Commit Graph

5418 Commits

Author SHA1 Message Date
Ted Kremenek 5e08668882 Updated checker build to checker-51
llvm-svn: 52949
2008-07-01 01:56:05 +00:00
Ted Kremenek bc6d850088 Temporarily treat "Autorelease" as "StopTracking". This is the original behavior.
llvm-svn: 52940
2008-07-01 00:01:02 +00:00
Chris Lattner 9a8d1d9e56 Make a few related changes:
1) add a new ASTContext::getFloatTypeSemantics method.
2) Use it from SemaExpr.cpp, CodeGenTypes.cpp and other places.
3) Change the TargetInfo.h get*Format methods to return their 
   fltSemantics byref instead of by pointer.
4) Change CodeGenFunction::EmitBuiltinExpr to allow builtins which
   sometimes expand specially and othertimes fall back to libm.
5) Add support for __builtin_nan("") to codegen, cases that don't pass
   in an empty string are currently lowered to libm calls.
6) Fix codegen of __builtin_infl.

llvm-svn: 52914
2008-06-30 18:32:54 +00:00
Ted Kremenek 51a685cf27 When inspecting the build command, strip off the preceding path to the build command.
llvm-svn: 52913
2008-06-30 18:18:16 +00:00
Ted Kremenek a0e071c861 Added "Autorelease" ArgEffect to better simulate "autorelease" messages. Right
now this does the same thing as "MayEscape", but more functionality will go in
here shortly.

llvm-svn: 52904
2008-06-30 16:57:41 +00:00
Ted Kremenek 54dd81ced9 Updated checker build to checker-48
llvm-svn: 52902
2008-06-30 16:30:52 +00:00
Ted Kremenek fec817aa12 Bug fix: when copying prefix files using 'cp', don't split file names by spaces.
llvm-svn: 52899
2008-06-30 16:12:30 +00:00
Chris Lattner d68c04f162 Fix a bug reported by Kelly Wilson, where we incorrectly
rejected FP immediates like 08.123

llvm-svn: 52890
2008-06-30 06:44:49 +00:00
Chris Lattner 6016a515e5 refactor some code out into a new method.
llvm-svn: 52889
2008-06-30 06:39:54 +00:00
Chris Lattner a7e619c17b make type attribute processing static instead of methods on Sema.
llvm-svn: 52881
2008-06-29 00:50:08 +00:00
Chris Lattner b632a6e534 make the rest of the decl attribute processing methods be
static functions instead of methods on sema.

llvm-svn: 52880
2008-06-29 00:43:07 +00:00
Chris Lattner a663a0a1b6 make most of Sema public. Sema is a class private to the Sema library
anyway, so there is no real loss here.  Start making attribute processing
methods static functions instead of methods on Sema.

llvm-svn: 52879
2008-06-29 00:28:59 +00:00
Chris Lattner 9e2aafea38 move a few methods, no other change.
llvm-svn: 52878
2008-06-29 00:23:49 +00:00
Chris Lattner c4ecec545e handle type attributes when converting types, not when processing decls.
llvm-svn: 52877
2008-06-29 00:19:33 +00:00
Chris Lattner 58418ffa32 Make ProcessDeclAttributes walk the declarator structure pulling
decl attributes out of the various places they can hide.  This makes
us correctly reject things like this:

t.c:2:22: error: mode attribute only supported for integer and floating-point types
  int **__attribute((mode(HI)))* i32;
                     ^

because you can't make a pointer be HImode.

llvm-svn: 52876
2008-06-29 00:16:31 +00:00
Chris Lattner 2727d1b221 move some code from all callers of ProcessDeclAttributes into
the implementation of ProcessDeclAttributes.

llvm-svn: 52875
2008-06-29 00:02:00 +00:00
Chris Lattner a574154106 more attribute refactoring/renaming, no functionality change.
llvm-svn: 52874
2008-06-28 23:58:55 +00:00
Chris Lattner 4627b74233 more minor tidiness.
llvm-svn: 52873
2008-06-28 23:50:44 +00:00
Chris Lattner ed9cbbc4f0 more cleanups, refactor HandleVectorTypeAttribute
to work list the rest of the attr handlers.  Also, rename
it to HandleVectorSizeAttribute to match its attr name.
No functionality change.

llvm-svn: 52872
2008-06-28 23:48:25 +00:00
Chris Lattner 4a927cba2e adjust the prototypes of a bunch of decl processing methods to take
the single attribute they look at by reference instead of by pointer.
This is a subtle indicator that they take the specified attribute, not
a whole list of them.

This also make HandleExtVectorTypeAttribute work the same way as the rest
of the attributes, adds some comments etc. No functionality change.

llvm-svn: 52871
2008-06-28 23:36:30 +00:00
Argyrios Kyrtzidis f4ebe9ea4f Handle unnamed bitfields when parsing C++ classes.
llvm-svn: 52855
2008-06-28 08:10:48 +00:00
Eli Friedman 4f89ccb1df Fix for PR2501; this patch makes usual arithmetic conversions for
integers which have the same width and different signedness work 
correctly. (The testcase in PR2501 uses a comparison between long and 
unsigned int).

llvm-svn: 52853
2008-06-28 06:23:08 +00:00
Argyrios Kyrtzidis 853fbea313 Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext.
llvm-svn: 52852
2008-06-28 06:07:14 +00:00
Ted Kremenek 62ea6e8b6a Updated checker build to checker-47.
llvm-svn: 52848
2008-06-28 00:13:07 +00:00
Chris Lattner e6c693d932 Fix a bug where we didn't promote 'const float' (or typedefs) to
double in some places.

llvm-svn: 52846
2008-06-27 22:48:56 +00:00
Chris Lattner acbc2d200d the 'mode' attribute is a decl attribute, not a type attribute. Move it to
SemaDeclAttr, and do some cleanups.

llvm-svn: 52844
2008-06-27 22:18:37 +00:00
Chris Lattner 0e7c7c9ee1 Nuno points out that my numbers were out of date
llvm-svn: 52840
2008-06-27 21:56:03 +00:00
Chris Lattner d9f8413402 making progress!
llvm-svn: 52833
2008-06-27 19:02:23 +00:00
Cedric Venet 3903908794 Add missing include file (due to a file splitting in llvm).
Add new file to Sema Project for VS.
this unbreak the build for VS2005 (with the associated patch on llvm).

llvm-svn: 52830
2008-06-27 17:53:02 +00:00
Ted Kremenek cf1ab19086 Added a simple static analysis check to look for improper uses of CFCreateNumber.
llvm-svn: 52799
2008-06-26 23:59:48 +00:00
Chris Lattner 2c6fcf5abb move decl attribute processing to a new SemaDeclAttr.cpp.
llvm-svn: 52792
2008-06-26 18:38:35 +00:00
Ted Kremenek a4c52a3366 Update Xcode project so that the clang target depends on LLVMAnalysis.a
llvm-svn: 52790
2008-06-26 17:53:57 +00:00
Chris Lattner d1224b2493 clang uses the llvm backend, so define __llvm__ like llvm-gcc.
Additionally, define __clang__ so clients can predicate based on
clang features.

llvm-svn: 52788
2008-06-26 17:26:01 +00:00
Cedric Venet 68cbee847e Another class -> struct in declaration to match definition.
llvm-svn: 52782
2008-06-26 12:50:52 +00:00
Matthijs Kooijman 0fb56e50b1 Make clang work on 32 bit powerpc linux.
Patch by Nick Lewycky!

llvm-svn: 52777
2008-06-26 08:39:30 +00:00
Matthijs Kooijman 70574af7d8 Link in LLVMAnalysis after LLVMCodeGen, since the latter depends on the former
since LLVM r52748.

llvm-svn: 52776
2008-06-26 08:37:29 +00:00
Chris Lattner cf31de3760 Make Declarator::getDeclSpec() return a const reference to avoid
cases where mutation can introduce bugs.  Propagate around 'const'.

llvm-svn: 52772
2008-06-26 06:49:43 +00:00
Chris Lattner 3e39fa365d add a comment about something that was surprising, at least to me.
llvm-svn: 52771
2008-06-26 06:39:41 +00:00
Chris Lattner 2239b7d3d2 rename some attr tests for consistency.
llvm-svn: 52770
2008-06-26 06:32:02 +00:00
Chris Lattner 4b413ea3bf fix a bug handling type attributes in the declspec. declspec processing
used to mutate the attribute list for declspecs when the type was 
converted, breaking the case where one declspec was shared by multiple
declarators.

This fixes rdar://6032532.

llvm-svn: 52769
2008-06-26 06:27:57 +00:00
Chris Lattner dd7c10227b another const correctness bug with declspec.
llvm-svn: 52768
2008-06-26 06:11:04 +00:00
Chris Lattner c8846a19d4 fix const correctness of accessor.
llvm-svn: 52767
2008-06-26 06:07:52 +00:00
Chris Lattner bf231a61fd refactor more objc codegen interfaces to pass around selectors so
we don't push strings into LLVM IR and then have to read them back out.

llvm-svn: 52765
2008-06-26 05:08:00 +00:00
Chris Lattner 882034dd99 indenting and other minor things.
llvm-svn: 52764
2008-06-26 04:52:29 +00:00
Chris Lattner da35bc8e53 refactor interface to GenerateClassStructure to avoid converting a
string to LLVM IR and then regenerating the string from IR.

llvm-svn: 52762
2008-06-26 04:47:04 +00:00
Chris Lattner d9b98863c4 remove the old getSelector implementation, which removes some
calls to getStringValue

llvm-svn: 52761
2008-06-26 04:44:19 +00:00
Chris Lattner 6cfec78e48 avoid a lot of unneeded selector processing work by passing around
selectors instead of Value*'s.

llvm-svn: 52760
2008-06-26 04:42:20 +00:00
Chris Lattner 9a05d04a0d use cheaper/simpler getselector call for @selector exprs.
llvm-svn: 52759
2008-06-26 04:38:58 +00:00
Chris Lattner 6d522c0133 start avoid doing lots of unneeded work handling selectors
llvm-svn: 52758
2008-06-26 04:37:12 +00:00
Chris Lattner 42587147d4 improve indentation, avoid thrashing on maps and recalculating strings as much.
llvm-svn: 52757
2008-06-26 04:24:57 +00:00
Chris Lattner 87ab27d42f give CreateObjCRuntime a full CGM so it can get whatever state it needs,
instead of passing in just a couple random things it currently 
happens to use.

llvm-svn: 52756
2008-06-26 04:19:03 +00:00
Chris Lattner 63dd337fc2 Fix 80 col violations, assert on assumptions.
llvm-svn: 52755
2008-06-26 04:10:42 +00:00
Chris Lattner 64d8d074a8 fix this testcase after Mon Ping's intrinsic rename.
llvm-svn: 52754
2008-06-26 04:06:27 +00:00
Chris Lattner d46944d639 a temporary minimal hack to get clang building after the getStringValue changes in llvm mainline.
llvm-svn: 52753
2008-06-26 04:05:20 +00:00
Ted Kremenek f7b72b6940 Updated latest checker build to checker-45.
llvm-svn: 52746
2008-06-26 00:04:08 +00:00
Ted Kremenek 3185c9c9cd CF ref checker:
Tracked objects now have their type information tracked with them.

Enhanced summaries for ObjC methods to include the type information of the receiver.

Used the enhanced summaries to support the idiom that NSWindow owns itself (it sends a release message to itself upon close).

Added some comments.

Did some cleanups with the checker logic using operator overloading (reduced redundant code which I was concerned about being the source of bugs).

llvm-svn: 52741
2008-06-25 21:21:56 +00:00
Ted Kremenek 0654d156b0 Add Profile method to QualType.
llvm-svn: 52735
2008-06-25 17:24:26 +00:00
Ted Kremenek c5d1e443ed Update VS project files.
llvm-svn: 52732
2008-06-25 17:14:52 +00:00
Ted Kremenek c9d1f45210 Update Xcode project.
llvm-svn: 52720
2008-06-25 15:15:35 +00:00
Argyrios Kyrtzidis 8a73d1f327 The assert at Sema::ObjCActOnStartOfMethodDef should check CurMethodDecl instead of CurFunctionDecl.
llvm-svn: 52719
2008-06-25 14:24:09 +00:00
Argyrios Kyrtzidis 90ba8b6de2 Set CXXClassVar to identifier namespace IDNS_Ordinary.
llvm-svn: 52718
2008-06-25 14:04:17 +00:00
Mon P Wang 28898b2888 Updated atomic intrinsic name from llvm r52706. Fixed dropped bit in shufps.
llvm-svn: 52707
2008-06-25 08:21:36 +00:00
Argyrios Kyrtzidis ac1b916441 'Educate' IdentifierResolver about the declaration context of CXXFieldDecls.
llvm-svn: 52698
2008-06-24 23:08:34 +00:00
Argyrios Kyrtzidis 1492538fd1 Set CXXMethod to identifier namespace IDNS_Ordinary.
llvm-svn: 52697
2008-06-24 22:56:42 +00:00
Argyrios Kyrtzidis a781452193 The only caller of this knows that the current token is l_brace, so this can be an assert; suggestion by Chris.
llvm-svn: 52696
2008-06-24 22:31:41 +00:00
Argyrios Kyrtzidis 7bbb20e338 Add parsing support for C++ classes.
Note that Parser::ParseCXXMemberSpecification is temporarily disabled until the Sema support is in place.
Once ParseCXXMemberSpecification is enabled, the Parser/cxx-class.cpp test will pass.

llvm-svn: 52694
2008-06-24 22:12:16 +00:00
Chris Lattner b1d329da07 "Support for Objective-C message sends which return structures. Also includes a small fix for constant string handling that should have been in the last patch (sorry!) and a hook for generating selectors (rest of this implementation to follow in the next patch)."
Patch by David Chisnall!

llvm-svn: 52681
2008-06-24 17:04:18 +00:00
Chris Lattner 6447ed3a1f "This is a small fix for a bug where static object instances were being incorrectly generated. The bug was caused by my inability to read the GNU libobjc source and is only apparent when JITing code (static compilation does not expose the bug due to the data layout of other globals)."
Patch by David Chisnall!

llvm-svn: 52680
2008-06-24 17:01:28 +00:00
Ted Kremenek 17ae57faa8 Update serialization for ObjCMessageExpr to handle additional bit-swizziling of receiver information.
llvm-svn: 52679
2008-06-24 17:00:08 +00:00
Ted Kremenek a3a37ae8c8 ObjCMessageExpr objects that represent messages to class methods now can contain the ObjCInterfaceDecl* of the target class if it was available when the ObjCMessageExpr object was constructed. The original interfaces of the class has been preserved (requiring no functionality changes from clients), but now a "getClasSInfo" method returns both the ObjCInterfaceDecl* and IdentifierInfo* of the target class.
llvm-svn: 52676
2008-06-24 15:50:53 +00:00
Argyrios Kyrtzidis f159b71bdf Move the namespace action declarations at the "C++ declarations" section.
llvm-svn: 52673
2008-06-24 11:23:36 +00:00
Cedric Venet 4bcc95de9b Test commit: changed the forward declaration of FieldDeclarator from class to struct to be coherent with its definition (DeclSpec.h)
llvm-svn: 52671
2008-06-24 09:09:38 +00:00
Ted Kremenek f8e0bbd6ad Fix comments: "class method" should be "instance method" and vis versa
llvm-svn: 52669
2008-06-24 04:44:10 +00:00
Ted Kremenek f890bfe0ff Remove unneeded method arguments.
llvm-svn: 52668
2008-06-24 03:56:45 +00:00
Ted Kremenek b1d1329ac7 Cache ObjC summaries by IdentifierInfo*, not by ObjCInterfaceDecl.
llvm-svn: 52667
2008-06-24 03:49:48 +00:00
Ted Kremenek 675a6e6dfa Patch by Anders Bergh:
'There's not much to say about this patch, it just adds the Arch Linux
gcc 4.3.1 header paths for i686 and amd64. The patch was generated
using "svn diff" with clang at revision 52660. The paths aren't
distribution-specific, so they should work for all Linux distributions
using the default(?) names like "i686-pc-linux-gnu".'

llvm-svn: 52665
2008-06-24 03:33:47 +00:00
Ted Kremenek 0cfc16100b Added ObjCSummaryCache, a new summary cache object to cache summaries for Objective-C methods. Instead of mapping from Selectors -> Summaries, we will now map from (ObjCInterfaceDecl*,Selectors) -> Summaries. This will allow more nuanced summary generation. This patch just swaps in the new data structure; the rest of the code works as before by allowing the ObjCInterfaceDecl* to be null.
llvm-svn: 52653
2008-06-23 23:30:29 +00:00
Ted Kremenek ea736c5d02 Rename summary methods for "instance methods" to "class methods" (the names got screwed up). No functionality change.
llvm-svn: 52650
2008-06-23 22:21:20 +00:00
Ted Kremenek 4c9e587db0 Updated latest checker build to checker-44.
llvm-svn: 52635
2008-06-23 18:32:25 +00:00
Ted Kremenek ab4a8b5213 The CF retain/release checker now assumes that allocations do not fail. Eventually we will add a flag to the driver to enable allocation failures (documented as a FIXME).
llvm-svn: 52632
2008-06-23 18:02:52 +00:00
Ted Kremenek 75c93eed9a Update VS project files. Patch by Cedric Venet!
llvm-svn: 52625
2008-06-23 16:18:59 +00:00
Chris Lattner 8a6274d745 add a new clang::APValue class at Eli's request. It is a discriminated
union between [potentially complex] APInt/APFloat.

llvm-svn: 52609
2008-06-22 05:45:53 +00:00
Chris Lattner 7fa2758b45 add a fixme back
llvm-svn: 52607
2008-06-21 22:44:51 +00:00
Chris Lattner 091f698d29 "this patch adds code generation hooks for Objective-C constant strings. It also modifies Sema so that Objective-C constant strings are treated as untyped objects if the interface for the constant string class can not be found. This is consistent with Apple GCC. I thought it was consistent with GNU GCC, since this was causing failures when trying to compile GNUstep with (GNU) GCC, but it appears that this is not the case when attempting to produce a simple test case to demonstrate it. Possibly there is a way of making the error go away, but I haven't found out what it is yet."
Patch by David Chisnall!

llvm-svn: 52599
2008-06-21 21:44:18 +00:00
Chris Lattner 0f2b471730 Implement printing for ObjCClassDecl's, patch by Jean-Daniel Dupas!
llvm-svn: 52598
2008-06-21 21:40:20 +00:00
Chris Lattner c4f38851e6 Don't add isa with @defs only to work around it in the code generator, patch
by David Chisnall. 

llvm-svn: 52597
2008-06-21 21:37:25 +00:00
Chris Lattner 5a92bab4f0 "This moves built-in Objective-C types up the scope chains to where they can be replaced by versions included from the runtime library's headers."
This makes it ok to use @"foo" without a declaration for NSConstantString.

Patch by David Chisnall!

llvm-svn: 52593
2008-06-21 20:20:39 +00:00
Chris Lattner 535b830449 add parser and sema support for the funny ObjC '@defs' thing.
Patch by David Chisnall!

llvm-svn: 52586
2008-06-21 19:39:06 +00:00
Chris Lattner 5d20a70d01 remove dead enums.
llvm-svn: 52581
2008-06-21 18:06:44 +00:00
Chris Lattner a9b3cae8fd Switch 'super' from being a weird cast thing to being a predefined expr node.
Patch by David Chisnall with objc rewriter and stmtdumper updates from me.

llvm-svn: 52580
2008-06-21 18:04:54 +00:00
Chris Lattner 552b52f49d "This maps the -pthread option to -lpthread - this isn't 100% correct,
since handling this correctly is quite complex, and on some platforms  
requires additional -D options and on some implies linking against a  
different libc, but this works better than just ignoring the option.

The other change passes the -x option across to clang, which allows  
compiling .c files as Objective-C and so on.  For some reason a lot of  
configure scripts seem to be under the misguided impression that this  
is a sensible thing to do."

Patch by David Chisnall!

llvm-svn: 52579
2008-06-21 17:46:11 +00:00
Ted Kremenek 68d2368064 Include stdint.h instead of stdio.h.
llvm-svn: 52578
2008-06-21 17:20:55 +00:00
Argyrios Kyrtzidis e6aff3db25 K&R-style functions not allowed in C++.
llvm-svn: 52575
2008-06-21 10:00:56 +00:00
Ted Kremenek 9f9aefdc89 Updated latest static analyzer builder to checker-43.
llvm-svn: 52569
2008-06-20 23:22:15 +00:00
Ted Kremenek 22cf89d9cd Test the dead-store checker using both -warn-dead-stores and -checker-simple.
llvm-svn: 52568
2008-06-20 23:14:52 +00:00
Ted Kremenek c9cea053ba When using the dead-stores checker with the BugReporter class, properly capture the diagnostic associated with a specific warning and emit it.
llvm-svn: 52565
2008-06-20 23:13:39 +00:00
Ted Kremenek ec93f25a9c Updated latest checker build.
llvm-svn: 52563
2008-06-20 21:56:47 +00:00
Ted Kremenek c64511152a Updated call to dead stores to use proper arguments.
llvm-svn: 52560
2008-06-20 21:55:29 +00:00
Ted Kremenek 837d967fe8 Updated latest static analyzer build to checker-41.
llvm-svn: 52559
2008-06-20 21:54:57 +00:00
Ted Kremenek b0ead8520c Updated Xcode project.
llvm-svn: 52556
2008-06-20 21:46:17 +00:00