Commit Graph

5216 Commits

Author SHA1 Message Date
Ted Kremenek aa4cfc2604 analyzer: Introduce a new class, ValueManager, that serves as an aggregate
"manager of symbolic values", wrapping BasicValueFactory, SymbolManager, and
MemRegionManager. While these individual managers nicely separate functionality
in the analyzer, constructing symbolic values can sometimes be cumbersome
because it requires using multiple managers at once. The goal of this class is
to create some factory methods to create SVals that require the use of these
different managers, thus (hopefully) simplifying the analyzer API for clients.

llvm-svn: 68709
2009-04-09 16:13:17 +00:00
Zhongxing Xu 7e9c193398 stop using loc::SymbolVal and clean up code with new API.
llvm-svn: 68703
2009-04-09 07:39:46 +00:00
Zhongxing Xu 48abb5d91f clean up code with new API.
llvm-svn: 68701
2009-04-09 07:04:45 +00:00
Zhongxing Xu 783cd82487 clean up code with new API.
llvm-svn: 68700
2009-04-09 07:01:16 +00:00
Zhongxing Xu 726876b385 clean up code with new API.
llvm-svn: 68699
2009-04-09 06:56:25 +00:00
Zhongxing Xu 2945210d71 clean up code with new API.
llvm-svn: 68698
2009-04-09 06:53:24 +00:00
Zhongxing Xu c48eb32872 stop using loc::SymbolVal.
llvm-svn: 68697
2009-04-09 06:49:52 +00:00
Zhongxing Xu 22f72485ed stop using loc::SymbolVal.
llvm-svn: 68696
2009-04-09 06:43:44 +00:00
Zhongxing Xu 0c87a4e79b stop using loc::SymbolVal.
llvm-svn: 68695
2009-04-09 06:41:51 +00:00
Zhongxing Xu 4a8f0cf874 clean up code with new API.
llvm-svn: 68694
2009-04-09 06:35:30 +00:00
Zhongxing Xu b74817f387 clean up code with new API.
llvm-svn: 68693
2009-04-09 06:32:20 +00:00
Zhongxing Xu 9410d7ee97 Add a new method because sometimes the type of the conjured symbol is not the
type of the expression where we create the symbol.

llvm-svn: 68692
2009-04-09 06:30:17 +00:00
Zhongxing Xu 40934cfa9b make a conjured symbol as the original code.
llvm-svn: 68691
2009-04-09 06:18:05 +00:00
Zhongxing Xu d3b33ba406 clean up code with new API.
llvm-svn: 68687
2009-04-09 06:03:54 +00:00
Ted Kremenek 2f3b0dbff4 Fix a null pointer dereference error due to state caching in a loop involving
sending a message to a nil receiver.

llvm-svn: 68686
2009-04-09 06:02:06 +00:00
Zhongxing Xu cb5d3ced70 Create a symbolic region instead of a loc::SymbolVal. This is a continued step
to eliminate the use of loc::SymbolVal.

llvm-svn: 68685
2009-04-09 05:57:11 +00:00
Ted Kremenek f9f9420303 GRExprEngine: Don't try to reason about the size of 'void' for the return type
of messages sent to nil.

llvm-svn: 68683
2009-04-09 05:45:56 +00:00
Ted Kremenek 042befd6d6 Another ParentMap bug: only the right side of a comma expression is consumed.
llvm-svn: 68680
2009-04-09 05:34:31 +00:00
Ted Kremenek c3f7c85129 Fix another regression introduced by changes to the analyzer's reasoning about
nil receivers in message expressions.

llvm-svn: 68672
2009-04-09 04:06:51 +00:00
Ted Kremenek d937ed386e Refactor/cleanup reasoning of nil receivers in message expressions.
llvm-svn: 68661
2009-04-09 00:00:02 +00:00
Daniel Dunbar d067f7fbef Driver: Split out CPP specific options for clang so that we don't end
up adding them twice when running with -no-integrated-cpp or
-save-temps.
 - <rdar://problem/6766636> -save-temps falls over with prefix headers

llvm-svn: 68660
2009-04-08 23:54:23 +00:00
Steve Naroff b47acdb2e5 Fix <rdar://problem/6770998> make cast of super illegal (again:-)
llvm-svn: 68659
2009-04-08 23:52:26 +00:00
Anders Carlsson 479e6fc7a7 Use the new EmitCallArgs function. No indented functionality change.
llvm-svn: 68652
2009-04-08 23:13:16 +00:00
Fariborz Jahanian 9c9f742ee2 Added a FIXME.
llvm-svn: 68646
2009-04-08 21:54:52 +00:00
Chris Lattner e01d82b81f finish the implementation of -imacros. The driver still needs to be hooked up.
llvm-svn: 68640
2009-04-08 20:53:24 +00:00
Anders Carlsson 60ce3fe140 Add code for emitting call arguments (not used yet).
llvm-svn: 68639
2009-04-08 20:47:54 +00:00
Anders Carlsson 03a409feda We weren't generating correct code for calls to variadic member functions.
llvm-svn: 68635
2009-04-08 20:31:57 +00:00
Daniel Dunbar 17b36271e7 Fix buffer overrun when laying out synthesized ivars.
llvm-svn: 68634
2009-04-08 20:18:15 +00:00
Fariborz Jahanian fc58ca4af6 Fixed a problem using property syntax on a 'super'
used as receiver.

llvm-svn: 68631
2009-04-08 19:50:10 +00:00
Devang Patel 2ac33a08d5 Use presumed location to get line number info.
llvm-svn: 68630
2009-04-08 19:47:04 +00:00
Ted Kremenek 5451c60f5a Enhance analyzer reasoning about sending messages to nil. A nil receiver returns 0 for scalars of size <= sizeof(void*).
llvm-svn: 68629
2009-04-08 18:51:08 +00:00
Ted Kremenek d43aaad1b1 Fix bug in ParentMap::isConsumedExpr. A BinaryOperator always "consumes" the
value of its subexpressions unless it is a comma (in which case it doesn't
consume the left subexpression).

llvm-svn: 68628
2009-04-08 18:49:36 +00:00
Chris Lattner 58a1eb0ba0 reject the #__include_macros directive unless it comes from the
predefines buffer.

llvm-svn: 68627
2009-04-08 18:46:40 +00:00
Chris Lattner 14a7f39733 Add initial support for -imacros. Right now it has the same semantics as
-include, but that will be fixed soon.

llvm-svn: 68625
2009-04-08 18:24:34 +00:00
Daniel Dunbar 17ddaa677e More fixes to builtin preprocessor defines.
- Add -static-define option driver can use when __STATIC__ should be
   defined (instead of __DYNAMIC__).

 - Don't set __OPTIMIZE_SIZE__ on Os, __OPTIMIZE_SIZE__ is tied to Oz.

 - Set __NO_INLINE__ following GCC 4.2.

 - Set __GNU_GNU_INLINE__ or __GNU_STDC_INLINE__ following GCC 4.2.

 - Set __EXCEPTIONS for Objective-C NonFragile ABI.

 - Set __STRICT_ANSI__ for standard conforming modes.

 - I added a clang style test case in utils for this, but its not
   particularly portable and I don't think it belongs in the test
   suite.

llvm-svn: 68621
2009-04-08 18:03:55 +00:00
Steve Naroff ea4c780da1 Sema::CheckConditionalOperands(): Soften pointer/integer mismatch from error->warning.
Fixes <rdar://problem/6762239> [sema] gcc incompatibility; error on incompatible operand types in ?:.

llvm-svn: 68617
2009-04-08 17:05:15 +00:00
Daniel Dunbar d92123fd2a Make sure value is initialized when built w/o asserts.
llvm-svn: 68615
2009-04-08 16:23:09 +00:00
Douglas Gregor b53c0c29c0 -Wmissing-prototypes shouldn't complain about main() missing a prototype.
Fixes <rdar://problem/6759522>

llvm-svn: 68611
2009-04-08 15:21:36 +00:00
Daniel Dunbar ad0f62b203 Darwin ld: Unconditionally add -lstdc++ if we are pretending to be
g++.

llvm-svn: 68601
2009-04-08 06:06:21 +00:00
Daniel Dunbar 3b358a3d83 Make debug info work when using -save-temps.
- This is pretty ugly, but the most obvious solution. Chime in if you
   have a nicer one.

 - The problem is that with -save-temps, clang-cc has no idea what the
   name of the original input file is. However, the user expects to be
   able to set breakpoints based on the input file name.

 - We support this by providing a new option -main-file-name (similar
   to -dumpbase used by gcc) which allows the driver to pass in the
   original file name.

 - <rdar://problem/6753383> building with clang using --save-temps
   gets the compile unit name from the .i file...

llvm-svn: 68595
2009-04-08 05:11:16 +00:00
Anders Carlsson 80f97ab08f Add a destination type argument to EmitConstantExpr. This will be used for when the destination has a reference type. (No functionality change yet)
llvm-svn: 68593
2009-04-08 04:48:15 +00:00
Daniel Dunbar 8f28d01126 Implementation definition of interfaces with __objc_exception attribute.
- Complete <rdar://problem/6635883> Support __objc_exception__
   attribute

llvm-svn: 68591
2009-04-08 04:21:03 +00:00
Sanjiv Gupta 562d68e8db Pointer width on targets like PIC16 is 16-bit, while the valid index size to GEP is only 32 or 64. So promote index to 32 in such cases.
llvm-svn: 68590
2009-04-08 04:16:39 +00:00
Chris Lattner 8bc98d9bed remove fixme!
llvm-svn: 68589
2009-04-08 03:47:39 +00:00
Chris Lattner 9591bbc4f6 improve compatibility with VC+, patch by John Thompson!
llvm-svn: 68586
2009-04-08 03:33:43 +00:00
Ted Kremenek 605fee8445 New static analyzer check by Nikita Zhuk!
"The attached patch generates warnings of cases where an ObjC message is sent to
a nil object and the size of return type of that message is larger than the size
of void pointer. This may result in undefined return values as described in PR
2718.  The patch also includes test cases."

llvm-svn: 68585
2009-04-08 03:07:17 +00:00
Daniel Dunbar ab7b2f5623 Set __PIC__ (more) correctly.
- Add -pic-level clang-cc option to specify the value for the define,
   updated driver to pass this.

 - Added __pic__

 - Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).

llvm-svn: 68584
2009-04-08 03:03:23 +00:00
Anders Carlsson a60cbcdfe6 Don't assume that a block always has a FunctionProtoType. Fixes rdar://6768379.
llvm-svn: 68583
2009-04-08 02:55:55 +00:00
Mike Stump 9d54bd77c0 Add basic support for arm static analysis checking. Radar 6699395
llvm-svn: 68582
2009-04-08 02:07:04 +00:00
Daniel Dunbar d4510f2223 Driver: Fix forwarding of -fpascal-strings.
llvm-svn: 68570
2009-04-07 23:51:44 +00:00