Commit Graph

12864 Commits

Author SHA1 Message Date
Mike Stump 1b821b4fc5 Improve semantic checking for blocks. Radar 6441502
llvm-svn: 71145
2009-05-07 03:14:14 +00:00
Ted Kremenek 9abe474852 Add preliminary support for enhancing null-pointer dereference diagnostics.
llvm-svn: 71135
2009-05-07 00:45:33 +00:00
Ted Kremenek 75edb2e8a0 Bug fix: Not all ConstraintManagers always return a null state when setting
isFeasible to false. This is something we may wish to do further validation on.

llvm-svn: 71134
2009-05-07 00:45:08 +00:00
Sebastian Redl f08aa62c80 Back out r70506 (exception spec in AST) again. We won't have exception specs until we've had a lot more discussion.
llvm-svn: 71125
2009-05-06 23:27:55 +00:00
Daniel Dunbar f9d90275f9 Handle -march for the LLVM recognized cpu names.
- x86 target feature handling should not be feature complete, even if
   the code quality is lacking.

llvm-svn: 71123
2009-05-06 21:56:32 +00:00
Ted Kremenek bb8d546208 Refactor BugReporter interface to have a new 'BugReporterContext' and
'BugReporterVisitor'. This simplifies callbacks from BugReporter to BugReports
(via VisitNode). It also lays the foundation for arbitrary visitor "call backs"
that can be registered to a BugReporterContext as a PathDiagnostic is
constructed. These call backs can help operate as separate "experts" that can
work on constructed pieces of a PathDiagnostic for which they possess special
knowledge.

llvm-svn: 71121
2009-05-06 21:39:49 +00:00
Daniel Dunbar 908a66dc9b If stderr isn't a terminal, don't try to guess the terminal width or
look at COLUMNS.

llvm-svn: 71120
2009-05-06 21:28:42 +00:00
Daniel Dunbar bb36aed06b More x86 target feature support.
- Apologies for the extremely gross code duplication, I want to get
   this working and then decide how to get this information out of the
   back end.

 - This replaces -m[no-]sse4[12] by -m[no-]sse4, it appears gcc
   doesn't distinguish them?

 - -msse, etc. now properly disable/enable related features.

 - Don't always define __SSE3__...

 - The main missing functionality bit here is that we don't initialize
   the features based on the CPU for all -march options.

llvm-svn: 71117
2009-05-06 21:07:50 +00:00
Ted Kremenek 83ffab06ef Update checker build.
llvm-svn: 71112
2009-05-06 20:13:50 +00:00
Daniel Dunbar 16af476c42 Document environment variables we handle, and don't mention -pipe (it
isn't yet supported... lazy developers).

llvm-svn: 71109
2009-05-06 19:18:09 +00:00
Ted Kremenek 0626df4eeb Fix analyzer regression reported in PR 4164:
- Update the old StoreManager::CastRegion to strip off 'ElementRegions' when
  casting to void* (Zhongxing: please validate)
- Pass-by-reference argument invalidation logic in CFRefCount.cpp:
  - Strip ElementRegions when the ElementRegion is just a 'raw data' view
    on top of the underlying typed region.

llvm-svn: 71094
2009-05-06 18:19:24 +00:00
Chris Lattner 164ac10f82 More content.
llvm-svn: 71088
2009-05-06 17:22:08 +00:00
Zhongxing Xu ea8c48d5a1 Improve RegionStoreManager::getSizeInElements()
- add a static function getTypeWidth(), which computes the width of a type
   with the help of TargetInfo.
 - no-outofbounds.c now passes for region store.

llvm-svn: 71080
2009-05-06 11:51:48 +00:00
Zhongxing Xu bc3864829d add getTargetInfo() method to ASTContext.
llvm-svn: 71079
2009-05-06 11:48:29 +00:00
Zhongxing Xu c98868136f Add a GDM for recording the cast type of regions.
llvm-svn: 71076
2009-05-06 08:33:50 +00:00
Zhongxing Xu 24ed0b28a8 The super region of ElementRegion no longer needs to be TypedRegion. In the
future we would create ElementRegion directly on top of typeless regions.

llvm-svn: 71075
2009-05-06 08:15:46 +00:00
Zhongxing Xu 1813e23a52 Implement a heuristic type size comparison method for now.
llvm-svn: 71074
2009-05-06 08:08:27 +00:00
Chris Lattner 51f57a4195 adjust this to bourne shell syntax
llvm-svn: 71070
2009-05-06 06:00:28 +00:00
Daniel Dunbar e5ae096bf8 Tweak x86 -mcpu defaults.
- Default to yonah on Darwin (to get SSE3).

 - Default to Pentium4 (32-bit) and x86-64 (64-bit) on
   non-Darwin. Welcome to the 21st century.

llvm-svn: 71069
2009-05-06 04:58:14 +00:00
Anders Carlsson cd8db41c52 Add parsing of friend specifiers.
llvm-svn: 71067
2009-05-06 04:46:28 +00:00
Douglas Gregor 080fe61d64 Eliminate extra vertical space in Clang diagnostics
llvm-svn: 71066
2009-05-06 04:43:47 +00:00
Chris Lattner 37ac812f9c daniel is buggy :)
llvm-svn: 71065
2009-05-06 04:38:30 +00:00
Chris Lattner dbcc5ca57f Fix rdar://6860124 - invalid input constraint 'J' in asm
This recognizes all the target-independent constant constraints
that have target-specific meanings.

llvm-svn: 71064
2009-05-06 04:33:31 +00:00
Daniel Dunbar 67dba989bb Add missing include.
llvm-svn: 71063
2009-05-06 04:07:06 +00:00
Daniel Dunbar bc45101e09 Cleanup some FIXMEs.
llvm-svn: 71062
2009-05-06 03:48:17 +00:00
Daniel Dunbar 4dbaaa6f43 Improve handling of (X86) target features.
- This is a WIP...

 - This adds -march= handling to the driver, and fixes the defaulting
   of -mcpu on Darwin (which was using the wrong test).

Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
 -target-feature [+-]name

In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.

This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.

llvm-svn: 71061
2009-05-06 03:16:41 +00:00
Zhongxing Xu b2d4a52e3f remove commented code.
llvm-svn: 71060
2009-05-06 02:54:11 +00:00
Chris Lattner 2080787636 add some content
llvm-svn: 71059
2009-05-06 02:47:51 +00:00
Zhongxing Xu d5e09be293 Make StoreManager::CastRegion() virtual and implement a new CastRegion() for
RegionStore.

This CastRegion() performs casts according to the kind of the region being 
cast instead of the type that is cast to.

llvm-svn: 71058
2009-05-06 02:42:32 +00:00
Daniel Dunbar 5e051f9a86 Add --analyze-auto.
- Currently just an alias for --analyze, eventually we want to refit
   --analyze so that it is less automatic (i.e., does not force plist
   output and does not hard code the list of checks).

llvm-svn: 71056
2009-05-06 02:12:32 +00:00
Ted Kremenek 82f7cfa156 Update checker build.
llvm-svn: 71046
2009-05-06 00:14:14 +00:00
Daniel Dunbar 94fa27171b Override some pod2man defaults.
llvm-svn: 71045
2009-05-06 00:10:37 +00:00
Fariborz Jahanian a16904bc41 Fixes a bug for objc2's gc in the presense of type-casts.
llvm-svn: 71041
2009-05-05 23:28:21 +00:00
Ted Kremenek a8106efce9 BugReporter (extensive diagnostics): improve location context generation for the
start of 'do' and '@synchronized' statements.

llvm-svn: 71038
2009-05-05 23:13:38 +00:00
Ted Kremenek b3c657bbd4 source-level CFG: have the body for the @synchronized start with its own basic
block. This makes it a little easier for diagnostics generation.

llvm-svn: 71037
2009-05-05 23:11:51 +00:00
Ted Kremenek 98017051ae BugReporter (extensive diagnostics): Fix getEnclosingStmtLocation to reason
about Exprs that are not consumed and fix where the loop iteration diagnostic
goes.

llvm-svn: 71027
2009-05-05 22:19:17 +00:00
Ted Kremenek 90a6145ad1 Fix subtle bug in ParentMap::isConsumedExpr(): correctly ignore *parents* that
are ParenExpr or CastExprs.

llvm-svn: 71026
2009-05-05 22:16:12 +00:00
Chris Lattner c45529b17b Fix rdar://6849429 - -Wunused-value with deeply nested macro expansion generates untraceable warnings
The "instantiated from" messages coming from the caret diagnostics system are 
basically walking the macro expansion tree, emitting each level as it goes.  However, it was
skipping certain leaves in the tree by skipping up the entire instantiation arm every time
it went up one spelling arm.  This caused it to miss some things.  For example, in this
testcase:

#define M1(x) x
#define M2 1;

void foo() {
 M1(M2)
}

we now print:

/Users/sabre/Desktop/clang-unused-value-macro.c:6:2: warning: expression result unused

 M1(M2)
 ^~~~~~
/Users/sabre/Desktop/clang-unused-value-macro.c:6:5: note: instantiated from:

 M1(M2)
    ^~
/Users/sabre/Desktop/clang-unused-value-macro.c:3:12: note: instantiated from:

#define M2 1;
           ^

Previously we didn't print the last line, so we never emitted the caret pointing to the 1!

Incidentally, the spaces between the lines is really noisy, I think we should reconsider
this heuristic (which adds them when the printed code starts too close to the start of the
line).

The regression test can't use -verify, because -verify doesn't catch notes for macro
instantiation history.

llvm-svn: 71025
2009-05-05 22:03:18 +00:00
Chris Lattner 882abeb2f8 rename test
llvm-svn: 71024
2009-05-05 21:52:01 +00:00
Fariborz Jahanian f3648b8913 Patch to support Gnu runtime's typed selectors.
Patch by David Chisnall.

llvm-svn: 71023
2009-05-05 21:36:57 +00:00
Chris Lattner b732397343 257 -> FS
llvm-svn: 70996
2009-05-05 18:54:47 +00:00
Daniel Dunbar c4bb4274b6 Enable tight Objective-C interface layout unconditionally.
- I will remove the flag when I'm comfortable there is no fallout
   from this.

llvm-svn: 70993
2009-05-05 18:52:50 +00:00
Ted Kremenek 213ff5a98e Implement attribute 'ns_autorelease'.
llvm-svn: 70990
2009-05-05 18:44:20 +00:00
Fariborz Jahanian 3baaffba6b Issue a warning in odd case of instance method used
in a 'Class' receiver which is not a root instance
method.

llvm-svn: 70987
2009-05-05 18:34:37 +00:00
Chris Lattner eaefb3a8ca remove some incorrect and unimplemented atomic builtins (e.g.
__sync_umin_and_fetch), add some missing atomic builtins (e.g.
__sync_fetch_and_nand) and reorder the list to match the GCC
documentation.  The builtins still need work and codegen 
implementation, more patches coming.

llvm-svn: 70985
2009-05-05 17:48:42 +00:00
Ted Kremenek dad8889d62 Enhance ownership attribute tests with functions that use the attributes!
llvm-svn: 70984
2009-05-05 17:46:22 +00:00
Chris Lattner 36797ab251 When defining a function whose type has no prototype, make an effort
to go back and clean up existing uses of the bitcasted function.  This
is not just an optimization: it is required for correctness to get
always inline functions to work, see testcases in function-attributes.c.

llvm-svn: 70971
2009-05-05 06:16:31 +00:00
Chris Lattner 448a228521 fix some more cases where we'd emit a file with a line of 0 for implicit
types.  In this case, it was objc_selector and objc_class.  This fixes
rdar://6852754 - clang sometimes generates incorrect/unknown file/line info for DW_TAG__structure_type dies

llvm-svn: 70969
2009-05-05 05:16:17 +00:00
Chris Lattner f216fd96fe Do not generate bogus location info for DW_TAG_inheritance
DIEs.  We were generating a loc with line of 0 and a file.
These tags do not need locations at all, just remove it.
this fixes rdar://6852792 - Clang generates incorrect (and unnecessary) file and line info for DW_TAG_inheritance dies

llvm-svn: 70966
2009-05-05 05:05:36 +00:00
Chris Lattner 362d8ae328 Fix generated debug info for decls with no location (which include self/_cmd
in ObjC) to not emit file/line location information.  Previously
we would output a file with bogus line information.  This fixes:
rdar://6852814 - Clang generates incorrect file & line info for automatic/understood formal parameters for objc-programs

llvm-svn: 70965
2009-05-05 04:57:08 +00:00