Commit Graph

628 Commits

Author SHA1 Message Date
Ted Kremenek d727220d1a Micro-optimization when checking for panic functions.
llvm-svn: 51214
2008-05-17 00:42:01 +00:00
Ted Kremenek c8081b4e16 Fix 80 col violation.
llvm-svn: 51213
2008-05-17 00:40:45 +00:00
Ted Kremenek 0e76583574 Added panic function _XCAssertionFailureHandler.
llvm-svn: 51212
2008-05-17 00:33:23 +00:00
Eli Friedman d5a4838e3d Backout of codegen-based fix to PR2334; this has been fixed differently
at the Sema layer.

llvm-svn: 51203
2008-05-16 20:38:39 +00:00
Eli Friedman 928ab4d546 Sema-based fix for PR2334. The issue is that even if the two sides of
the condidtional have compatible types, they are not necessarily the 
same type.  Therefore, we cast to the composite type.  As a hack, for 
the moment we assume that the composite type is the type of the 
left-hand expression; this isn't correct, but it's good enough for most 
purposes.

llvm-svn: 51202
2008-05-16 20:37:07 +00:00
Nate Begeman 9800faa578 Fix some prototypes, and implement some builtins until we have our header files completed.
llvm-svn: 51199
2008-05-16 18:59:42 +00:00
Ted Kremenek c812b23ce8 Cache leaks by the allocation site, not the leak location.
llvm-svn: 51198
2008-05-16 18:33:44 +00:00
Ted Kremenek 590abd363e Partitioned BugTypeCachedLocation::isCached() into two methods: one that accepts and ExplodedNode, and the other that accepts a ProgramPoint. The default behavior is to cache bug reports by the
location they occur (the end node).  Subclasses can override this behavior by providing a different ProgramPoint.

llvm-svn: 51197
2008-05-16 18:33:14 +00:00
Eli Friedman 823622105e Review nit.
llvm-svn: 51196
2008-05-16 17:54:49 +00:00
Eli Friedman a959a59ac6 Clean up ownership per review comment.
llvm-svn: 51195
2008-05-16 17:51:27 +00:00
Eli Friedman cb92a3f03b Patch for PR2334, and a similar ObjC bug.
llvm-svn: 51193
2008-05-16 17:37:11 +00:00
Ted Kremenek 92137a3d8d Added CFGBlock::hasBinaryBranchTerminator().
llvm-svn: 51190
2008-05-16 16:06:00 +00:00
Eli Friedman db421caaa3 Minor cleanup to isBuiltinConstantExpr.
llvm-svn: 51188
2008-05-16 13:28:37 +00:00
Ted Kremenek dd547b1ce9 Fixed another regression introduced by r51113 caused by some refactoring
in Sema::CheckFunctionCall:

  http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080512/005706.html
  
The bug was that the logic from the helper methods used by CheckFunctionCall
were being inverted (a subtle bug).  This would cause the parser to discard
any valid AST nodes involving several builtins (see patch).

This removes the last regression failure I'm seeing in the test suite: Analysis-Apple/NoReturn.

llvm-svn: 51168
2008-05-15 22:24:49 +00:00
Ted Kremenek 98b730d5bb Removed bogus "return true" in Expr::isConstantExpr that returned true for all
expressions. This appears to be a regression introduced in r51113 that caused
many test cases to fail (there is still a test case in the Analysis directory
that is failing):

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080512/005706.html

llvm-svn: 51164
2008-05-15 21:49:04 +00:00
Steve Naroff ad91868aa6 Fix rewriter bug <rdar://problem/5929344> clang ObjC rewriter: "extern int __CFConstantStringClassReference[];" should be extern "C".
Have clang predefine OBJC_NEW_PROPERTIES (which is what gcc does).

llvm-svn: 51163
2008-05-15 21:12:10 +00:00
Argyrios Kyrtzidis 212f91107a Comments fix.
llvm-svn: 51151
2008-05-15 17:26:35 +00:00
Nate Begeman 6c59132241 Handle a couple missing builtins that will go away eventually when the various
intrin.h files are finished

llvm-svn: 51137
2008-05-15 07:38:03 +00:00
Eli Friedman f0d0e9e174 Use double-underscores in front of all non-keywords to protect against
#define pollution.

llvm-svn: 51128
2008-05-14 20:32:22 +00:00
Eli Friedman e94e0f66cd Make header use the new __builtin_shufflevector builtin.
llvm-svn: 51117
2008-05-14 20:11:29 +00:00
Eli Friedman a1b4ed8003 Implementation of __builtin_shufflevector, a portable builtin capable of
expressing the full flexibility of the LLVM shufflevector instruction.  
The expected immediate usage is in *mmintrin.h, so that they don't 
depend on the mess of gcc-inherited (and not completely implemented)
shuffle builtins.

llvm-svn: 51113
2008-05-14 19:38:39 +00:00
Argyrios Kyrtzidis 3722daf62d Change CRLF line endings to LF.
llvm-svn: 51103
2008-05-14 10:49:47 +00:00
Eli Friedman 7e452e59e4 An array of VLAs is a VLA. Shouldn't make any significant difference at
the moment, but it what you'd expect in the AST from reading the 
standard, and it should make VLA codegen a bit more strightforward.

llvm-svn: 51086
2008-05-14 00:40:18 +00:00
Eli Friedman 9fd8b68568 Add codegen support for block-level compound literals.
llvm-svn: 51081
2008-05-13 23:18:27 +00:00
Eli Friedman dd7406e65c Add support for init lists for complex variables.
llvm-svn: 51080
2008-05-13 23:11:35 +00:00
Nate Begeman d386215916 Remove AST dependency on VMCore by switching ExtVectorElementExpr off Constant.
llvm-svn: 51068
2008-05-13 21:03:02 +00:00
Eli Friedman 58639e584c Both operands to && have to be scalars, not just one.
llvm-svn: 51065
2008-05-13 20:16:47 +00:00
Eli Friedman 1a5754a26a Detabify.
llvm-svn: 51042
2008-05-13 14:40:48 +00:00
Steve Naroff a98fe19c7e Fix <rdar://problem/5924576> clang -fsyntax-only generates "redefinition" errors when parsing AppKit that gcc does not.
Teach Sema::MergeVarDecl() about __private_extern__.

llvm-svn: 51005
2008-05-12 22:36:43 +00:00
Steve Naroff bf1516c618 Fix <rdar://problem/5928590> clang -fsyntax-only: "incompatible operand types ('int' and 'void')" on input that 'gcc -fsyntax-only' eats
llvm-svn: 51002
2008-05-12 21:44:38 +00:00
Ted Kremenek 2abde809ce Unbreak build.
llvm-svn: 50980
2008-05-12 17:42:30 +00:00
Ted Kremenek a0055a8ef5 Support StringLiteralVal when comparing LVal types.
llvm-svn: 50979
2008-05-12 17:41:30 +00:00
Ted Kremenek 8322da5fa3 Grammar cleanup in comment.
Remove redundant assignment.

llvm-svn: 50978
2008-05-12 17:40:56 +00:00
Ted Kremenek 92f78f4c04 When reading in the DeclCtx during deserialization, register the DeclCtx of the
ScopedDecl with the backpatcher, and *not* a local variable on the stack. The
value of DeclCtx gets filled in *later* by the backpatcher.

This fixes: http://llvm.org/bugs/show_bug.cgi?id=2308

llvm-svn: 50976
2008-05-12 17:29:34 +00:00
Eli Friedman 6a7087e455 Emit basic block for switch body; fixes PR2307.
llvm-svn: 50968
2008-05-12 16:08:04 +00:00
Eli Friedman 6e31321043 Don't try to take the address of a bitfield; fixes PR2310.
llvm-svn: 50966
2008-05-12 15:06:05 +00:00
Nuno Lopes de9746cd45 fix free/delete mismatch problem in add/mergeProperties (found by valgrind)
llvm-svn: 50945
2008-05-10 10:31:54 +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
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 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
Ted Kremenek 712c91f8a9 Add attribute "format" support for typedefs of function pointers.
llvm-svn: 50906
2008-05-09 17:36:24 +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
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
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
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
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
Ted Kremenek aec1811c6c Don't report leaks for autoreleased objects.
llvm-svn: 50777
2008-05-06 23:07:13 +00:00
Ted Kremenek 767d0742c7 More comments.
"#if 0" out some assumptions when auto-generating method summaries.

llvm-svn: 50772
2008-05-06 21:26:51 +00:00
Devang Patel 243d5cd283 Fix PR2101 - Codegen crash during bitfield initialization.
llvm-svn: 50769
2008-05-06 19:57:59 +00:00
Ted Kremenek 10427bdbb9 Experiment with not converting bug names to lower case.
llvm-svn: 50753
2008-05-06 18:11:36 +00:00
Ted Kremenek 8bcc1bd3d5 More refactorings in GeneratePathDiagnostic: use ExecutionContinues to display
"Execution continues..." message, which does a better job at handling corner cases.

llvm-svn: 50751
2008-05-06 18:11:09 +00:00
Fariborz Jahanian 09367d68ff Patch to refactor setter/getter names of property attributes into Selector
(was IdentifierInfo * before). This will make method declartations whole
lot easier.

llvm-svn: 50747
2008-05-06 18:09:04 +00:00
Ted Kremenek cb2e636606 Generate "stop" summaries for selectors involving receivers whose type is not NSxxxx.
llvm-svn: 50721
2008-05-06 15:44:25 +00:00
Ted Kremenek 68f463b88e Use strncmp correctly.
llvm-svn: 50715
2008-05-06 06:17:42 +00:00
Ted Kremenek 5f478e9a0a Make string comparison legible and remove buffer overrun introduced by typo.
llvm-svn: 50714
2008-05-06 06:09:09 +00:00
Ted Kremenek 2f08fedec1 String comparison cleanups.
Added test case.

llvm-svn: 50711
2008-05-06 04:28:05 +00:00
Ted Kremenek 041d02201f Fix logic error in string processing.
llvm-svn: 50710
2008-05-06 04:21:38 +00:00
Ted Kremenek c9f4948bba Remove assertion.
llvm-svn: 50709
2008-05-06 04:21:10 +00:00
Ted Kremenek 015c3561ad Use EvalSummary to process message expressions, thereby unifying the checker
logic for function calls and message expressions.

Use the following heuristic to infer "allocating" instance methods:

  [ClassName classWithXXX]  allocates an object
  
Update testcase to reflect this heuristic.

llvm-svn: 50708
2008-05-06 04:20:12 +00:00
Ted Kremenek 821537ecdb Added receiver effects to EvalSummary.
llvm-svn: 50700
2008-05-06 02:41:27 +00:00
Ted Kremenek b0862dca6c Expand summaries to include "Receiver" effects.
llvm-svn: 50697
2008-05-06 02:26:56 +00:00
Chris Lattner dbcc2ca6b2 simplify some builder calls.
llvm-svn: 50694
2008-05-06 00:56:42 +00:00
Chris Lattner 222c6123df remove a stray printout
llvm-svn: 50691
2008-05-06 00:44:00 +00:00
Ted Kremenek be7c56ed78 Added initialization code to generate initial set of ObjC method summaries (non-instance methods).
llvm-svn: 50690
2008-05-06 00:38:54 +00:00
Ted Kremenek 0806f910d4 Added code to generate initial set of summaries for instance methods.
llvm-svn: 50689
2008-05-06 00:30:21 +00:00
Steve Naroff 125d73dc84 Several fixes to SemaInit.cpp. It's still not enabled (since it fails a few tests). Expect to enable it very soon.
llvm-svn: 50688
2008-05-06 00:23:44 +00:00
Ted Kremenek 3d1e972275 Add summary generation for "initXXX" methods.
llvm-svn: 50684
2008-05-05 23:55:01 +00:00
Ted Kremenek 046845e842 Make CF retain diagnostics more succinct.
In a leak's "name", indicate GC or non-GC bugs.

llvm-svn: 50680
2008-05-05 23:16:31 +00:00
Ted Kremenek f15cd14a3d Emit dead store warnings for ++ and -- operators.
llvm-svn: 50679
2008-05-05 23:12:21 +00:00
Chris Lattner 4dd2710222 Fix rdar://5905347 a crash on invalid builtin, due to the
params not getting installed for builtins when synthesized.

llvm-svn: 50676
2008-05-05 22:18:14 +00:00
Ted Kremenek 00daccdd2a Initial work on refactoring the CFRefCount checker so that it is more
generic and handles reference counts for NSObjects.

llvm-svn: 50674
2008-05-05 22:11:16 +00:00
Chris Lattner 00e2607de2 Add support for -Wimplicit-function-declaration, rdar://5907433
llvm-svn: 50672
2008-05-05 21:18:06 +00:00
Chris Lattner ca2b318233 Fix typo, improve comment.
llvm-svn: 50666
2008-05-05 20:09:27 +00:00
Chris Lattner db65ff7223 Fix a few more bugs in preprocessor expressions w.r.t. ?:. Now I
think it is really right. :)  This fixes PR2284.

llvm-svn: 50665
2008-05-05 20:07:41 +00:00
Fariborz Jahanian 8d91686b0d percolate @optional/@required protocols down to ASTs for
properties declared in the protocol.

llvm-svn: 50662
2008-05-05 18:51:55 +00:00
Ted Kremenek 627c3074dd Improve leak diagnostics to not report a leak on the same line where
the object was last used.  This can be confusing to users.

For example:

 // 'y' is leaked
x = foo(y);

instead:

x = foo(y);
  // 'y' is leaked

llvm-svn: 50661
2008-05-05 18:50:19 +00:00