Commit Graph

4868 Commits

Author SHA1 Message Date
Chris Lattner 14196c099f Implement -rewrite-macros, which is a crazy macro expander that expands
macros but doesn't expand #includes, remove comments, remove #defines
etc.

For example:

----
#include <stdio.h>

#define bbaa
#define funclike(x) x "a" x "b" x

bbaa  bbaa

#if 1 
funclike("gar")
foo /*blah*/  bar
bar
#endif

#if 0
funclike()
#endif
----


rewrites to:

----
#include <stdio.h>

#define bbaa
#define funclike(x) x "a" x "b" x 

/*bbaa  bbaa*/

#if 1
 "gar" "a" "gar" "b" "gar"/*funclike*//*("gar")*/
foo /*blah*/  bar
bar
#endif

#if 0
/*funclike()*/
#endif
----

llvm-svn: 50925
2008-05-10 00:02:33 +00:00
Ted Kremenek acdde6f099 Rename IsPointerType to LVal::IsLValType, and update CFRefCount::EvalSummary to use IsLValType when conjuring symbols for return values (this fixes a bug with an assertion firing in the analyzer when two qualified objective-c types were compared).
llvm-svn: 50924
2008-05-09 23:45:33 +00:00
Argyrios Kyrtzidis fa8e15bfa5 -Implement proper name lookup for namespaces.
-identifierResolver exposes an iterator interface to get all decls through the scope chain.
-The semantic staff (checking IdentifierNamespace and Doug's checking for shadowed tags were moved out of IdentifierResolver and back into Sema. IdentifierResolver just gives an iterator for all reachable decls of an identifier.

llvm-svn: 50923
2008-05-09 23:39:43 +00:00
Chris Lattner 664ef65981 make #if 0 code compile, even though it still isn't very useful.
llvm-svn: 50920
2008-05-09 22:43:24 +00:00
Mon P Wang b84407d6ec Added support to generate some atomic operators (add, sub, and, or etc..)
llvm-svn: 50919
2008-05-09 22:40:52 +00:00
Steve Naroff d30f8c5b54 Fix <rdar://problem/5924225> clang ObjC rewriter: objc_exception_throw declaration in preamble does not match objc/objc-exception.h.
llvm-svn: 50915
2008-05-09 21:17:56 +00:00
Steve Naroff 530c3f9403 DO NOT pre-defined __OBJC2__. The __OBJC2__ macro should only be defined when targeting the new, Apple 2.0 *runtime ABI*. It is not intended to be used to #ifdef ObjC 2.0 langauge features. This is unfortunate (given it's name). In a perfect world, this defined would be named __OBJC2_RUNTIME_ABI__. Oh well.
llvm-svn: 50913
2008-05-09 20:52:28 +00:00
Steve Naroff 0889b9bfac More VC++ project file updates.
llvm-svn: 50909
2008-05-09 19:10:27 +00:00
Ted Kremenek 82e8d07b02 Remove repeated word.
llvm-svn: 50907
2008-05-09 17:53:57 +00:00
Ted Kremenek 712c91f8a9 Add attribute "format" support for typedefs of function pointers.
llvm-svn: 50906
2008-05-09 17:36:24 +00:00
Ted Kremenek bbd4695a45 Grammar.
llvm-svn: 50905
2008-05-09 17:13:18 +00:00
Ted Kremenek 4d180b36f3 Added text on librewrite and libanalysis to the README.
llvm-svn: 50904
2008-05-09 17:12:45 +00:00
Nate Begeman 1d30431002 Handle all attributes on a parameter
llvm-svn: 50903
2008-05-09 16:56:01 +00:00
Nate Begeman f322eabbce Extend vector member references to include {.hi, .lo, .e, .o} which return a
vector of the same element type and half the width, with the high, low, even,
and odd elements respectively.

Allow member references to member references, so that .hi.hi gives you the high
quarter of a vector.  This is fairly convenient syntax for some insert/extract
operations.

Remove some unnecessary methods/types in the ExtVectorElementExpr class.

llvm-svn: 50892
2008-05-09 06:41:27 +00:00
Chris Lattner ba7a6c14ed set long/pointers to 64-bits on ppc64/x86-64
llvm-svn: 50891
2008-05-09 06:17:04 +00:00
Chris Lattner 5e2ef0c18a parameterize pointer size/align better without doing virtual method calls in normal case.
llvm-svn: 50890
2008-05-09 06:08:39 +00:00
Chris Lattner 55258cf278 simplify some code, don't assume that sizeof(long) < sizeof(long long).
llvm-svn: 50888
2008-05-09 05:59:00 +00:00
Chris Lattner 5a9aaaf687 parameterize long long.
llvm-svn: 50887
2008-05-09 05:50:02 +00:00
Chris Lattner 5dc7ff1cf3 correctly parameterize long, patch by Nate.
llvm-svn: 50886
2008-05-09 05:47:41 +00:00
Chris Lattner adb86418db Fix rdar://5921025 a crash on the included testcase.
llvm-svn: 50885
2008-05-09 05:34:49 +00:00
Chris Lattner 2fdcddd78d Don't call into objc front-end when not parsing objc code. This avoids
crashes because objc types aren't set up right.

llvm-svn: 50884
2008-05-09 05:28:21 +00:00
Steve Naroff 2e4e385a58 Make sure the prototype for objc_msgSend_fpret() returns a double.
llvm-svn: 50873
2008-05-08 22:02:18 +00:00
Nate Begeman c58373886d Add the non-immediate-shift vector builtins
llvm-svn: 50870
2008-05-08 21:51:12 +00:00
Ted Kremenek 0ae11a6f2e Added initial support for supporting __NSString__ in attribute "format".
Still need to iron out some of the semantics (fixmes are present).
This addresses <rdar://problem/5916348>

llvm-svn: 50866
2008-05-08 19:43:35 +00:00
Ted Kremenek 27a4ba66fd Updated Xcode project.
llvm-svn: 50864
2008-05-08 19:20:24 +00:00
Steve Naroff b1c02371cd Fix <rdar://problem/5879237> clang objc rewriter: ivars not accessible in structure generated for class
llvm-svn: 50862
2008-05-08 17:52:16 +00:00
Sanjiv Gupta 15cb669039 Added -g command line options to clang for generating source level debug information. This patch currently enables generation of line number debug information (stoppoints) and region begin/end debug information. The new files CGDebugInfo.h and CGDebugInfo.cpp implements the debug info manager class CGDebugInfo.
llvm-svn: 50848
2008-05-08 08:54:20 +00:00
Sanjiv Gupta cd13ef01a2 Remove the ending "." from clang options descriptions.
llvm-svn: 50847
2008-05-08 08:28:14 +00:00
Chris Lattner 3c04ff00c2 start implementation of a macro rewriter, this is currently just stubbed out.
llvm-svn: 50845
2008-05-08 06:52:13 +00:00
Chris Lattner b781dc79aa Add basic support for the pic-* target triples and add support for
targets that do not support recursion (and thus codegen stack variables
as globals).

Patch contributed by Alireza Moshtaghi!

llvm-svn: 50844
2008-05-08 05:58:21 +00:00
Chris Lattner d330036c06 The awesome GNU "comma elision extension" works with both the standard
__VA_ARGS__ syntax as well as with the amazingly awesome GNU "named 
variadic macro" extension.  Allow it with the GNU syntax as well.

llvm-svn: 50843
2008-05-08 05:10:33 +00:00
Chris Lattner 2b88c1e4c4 Fix rdar://5919567: assertion failure: split didn't occur before erase!
llvm-svn: 50839
2008-05-08 03:23:46 +00:00
Devang Patel ac25fc6f2e Begin handling union bitfields.
Note, this is just beginning.

llvm-svn: 50835
2008-05-07 22:28:29 +00:00
Steve Naroff 30ac2225ee Fix <rdar://problem/5887874> clang ObjC rewriter: Use a different name for 'offsetof' macro
llvm-svn: 50832
2008-05-07 21:23:49 +00:00
Ted Kremenek bcdb46830b Added support for "drain".
llvm-svn: 50831
2008-05-07 21:17:39 +00:00
Fariborz Jahanian 8983f17ba0 Synthesized getter/setter method declarations need not have
an implementation. This fixes couple of failing prperty tests
caused by my previous patch.

llvm-svn: 50830
2008-05-07 20:53:44 +00:00
Ted Kremenek f958ec50c0 Expand the CF retain checker to allow the Create/Get rule to apply to any
function that returns a CFxxxRef, not just functions whose name begins with
CF.  This implements <rdar://problem/5917879>.

Added test case for this feature.

Updated calls to CStrInCStrNoCase to swap their arguments, per compatibility
with strcasestr.

llvm-svn: 50829
2008-05-07 20:06:41 +00:00
Ted Kremenek fcf060fd2f Flip order of arguments to CStrInStrNoCase.
llvm-svn: 50824
2008-05-07 18:57:30 +00:00
Ted Kremenek b6cbf28d82 Use llvm::CStrInCStrNoCase instead of strcasestr, since the latter is not portable.
Correctly check if the result of CStrInCStrNoCase is NULL to generate summaries; before we were inverting the condition.

llvm-svn: 50822
2008-05-07 18:36:45 +00:00
Fariborz Jahanian ec6e4c8096 This patch introduces declaration of getter methods for ObjC2's
properties. Couple of property tests will fail with this patch.
Will fix them next.

llvm-svn: 50818
2008-05-07 17:43:59 +00:00
Ted Kremenek 89bd0fc27d copy-paste: NS types are not typedefs.
llvm-svn: 50817
2008-05-07 17:35:41 +00:00
Steve Naroff 456c0f6738 Fixup InitListExpr::child_begin/end. Thanks to Ted for catching the regression.
llvm-svn: 50816
2008-05-07 17:35:03 +00:00
Steve Naroff 6eda39c345 Fix off-by-one error.
llvm-svn: 50815
2008-05-07 16:50:14 +00:00
Ted Kremenek 7bf9dc773c Do not treat **instance** methods "copyWithZone:" and "mutableCopyWithZone:" from NSObject as allocators.
llvm-svn: 50802
2008-05-07 05:34:45 +00:00
Douglas Gregor caa8acebe7 Diagnose attempts to use C++ default arguments outside of a function declaration
llvm-svn: 50799
2008-05-07 04:49:29 +00:00
Ted Kremenek 9930bd8c4f Be less promiscuous with generating summaries for "new", "copy", "create".
llvm-svn: 50798
2008-05-07 04:25:59 +00:00
Ted Kremenek 08eb30f193 Added auto-summary generation for createXXX, copyXXX, newXXX methods.
llvm-svn: 50795
2008-05-07 03:45:05 +00:00
Steve Naroff cab93d58c3 Fix <rdar://problem/5908598> clang ObjC rewriter: typo in #pragma at end
llvm-svn: 50790
2008-05-07 00:06:16 +00:00
Ted Kremenek b95635e6ec Fix a few glitches in scan-build with automatically generating class names from bug types.
llvm-svn: 50784
2008-05-06 23:51:45 +00:00
Ted Kremenek e6d2419351 Improve HTMLDiagnostics by understanding the "Below" hint.
llvm-svn: 50783
2008-05-06 23:42:18 +00:00