Commit Graph

622 Commits

Author SHA1 Message Date
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
Ted Kremenek 3917b82e85 Improved leak diagnostics.
llvm-svn: 50657
2008-05-05 17:53:17 +00:00
Ted Kremenek 875db81301 Minor refactorings/cleanups in CF retain checker and added support for NSMakeCollectable.
Added test case for NSMakeCollectable.

llvm-svn: 50653
2008-05-05 16:51:50 +00:00
Ted Kremenek db04a9e967 When reporting branch conditions that evaluate to an uninitialized value,
highlight the most nested subexpression that appears most responsible (giving
the user better diagnostic feedback).

Updated test cases to illustrate this feature.

Implements: <rdar://problem/5880443>
llvm-svn: 50647
2008-05-05 15:56:53 +00:00
Chris Lattner 3565c8e343 Neil pointed out that clang doesn't generate ranges from diagnostics
related to pp-expressions.  Doing so is pretty simple and this
patch implements it, yielding nice diagnostics like:

t.c:2:7: error: division by zero in preprocessor expression
#if 1 / (0 + 0)
    ~ ^ ~~~~~~~
t.c:5:14: error: expected ')' in preprocessor expression
#if (412 + 42
     ~~~~~~~~^
t.c:5:5: error: to match this '('
#if (412 + 42
    ^
t.c:10:10: warning: left side of operator converted from negative value to unsigned: -42 to 18446744073709551574
#if (-42 + 0U) / -2
     ~~~ ^ ~~
t.c:10:16: warning: right side of operator converted from negative value to unsigned: -2 to 18446744073709551614
#if (-42 + 0U) / -2
    ~~~~~~~~~~ ^ ~~
5 diagnostics generated.

llvm-svn: 50638
2008-05-05 06:45:50 +00:00
Chris Lattner 3c57f7ebab fix a bug handling right associative operators that Neil noticed, hopefully
the final part of PR2279

llvm-svn: 50635
2008-05-05 04:10:51 +00:00
Chris Lattner ca671b0e51 ||/&& do not do UAC's either. This silences a bogus warning on #if -1 || 4U.
llvm-svn: 50632
2008-05-04 23:46:17 +00:00
Chris Lattner 4af72c76dd Neil points out that commas don't do UACs either.
llvm-svn: 50631
2008-05-04 23:38:48 +00:00
Chris Lattner d89e458ce0 Fix the rest of PR2279:
a) correct rejection of ',' in pp expressions.
b) the precedence of ',' was wrong w.r.t. ?:.

Thanks again to Neil for finding these and providing testcases.

llvm-svn: 50625
2008-05-04 18:36:18 +00:00
Chris Lattner a08f869c22 Fix PR2279 part C: shifts don't perform the UACs, thanks to Neil
for pointing this out.

llvm-svn: 50624
2008-05-04 18:25:32 +00:00
Chris Lattner 1e151816b2 use simplified API for making fp constants.
llvm-svn: 50623
2008-05-04 18:23:51 +00:00
Chris Lattner 0a9718eab0 fix a nasty bug that Neil identifier in pp-expr parsing (this is PR2279 part D).
llvm-svn: 50617
2008-05-04 07:15:21 +00:00
Chris Lattner 7b9293ba20 Simplify FunctionDecl::AddRedeclaration a bit by using std::swap.
Fix 'swapping' of attributes to not insert null values into the 
DeclAttrs map.

llvm-svn: 50612
2008-05-04 02:29:49 +00:00
Chris Lattner bc22b5b327 if a decl is both 'static' and weak or static and inline, its linkage
type should be internal, not weak/linkonce.

llvm-svn: 50611
2008-05-04 01:44:26 +00:00
Ted Kremenek a5e2df015a Rename member variable.
llvm-svn: 50597
2008-05-02 23:21:21 +00:00
Ted Kremenek 983be7cee6 Improved diagnostics for leaks: now we report which variable was leaked.
llvm-svn: 50588
2008-05-02 20:53:50 +00:00
Fariborz Jahanian 98a6c4fa77 This patch is about merging ObjC2's properties declared in class
protocols into class's property list and performing semantics
on them for while doing so.

llvm-svn: 50587
2008-05-02 19:17:30 +00:00
Ted Kremenek 3b33e2544a Fixed bug in ObjCIVarExpr: the child iterator now iterates over the Base expression.
llvm-svn: 50585
2008-05-02 18:40:22 +00:00
Ted Kremenek 789942cfda When running the reference count checker twice (GC and non-GC mode), only emit
basic warnings (dead stores, null dereferences) on the first pass.

llvm-svn: 50584
2008-05-02 18:01:49 +00:00
Ted Kremenek a06e7120bb Bug fix in StmtPrinter to handle pretty-printing ObjCMessageExprs involving variadic methods (also did some cosmetic cleanups in the printing output).
llvm-svn: 50583
2008-05-02 17:32:38 +00:00
Ted Kremenek bb7386aff5 Really noreturn on exceptions.
llvm-svn: 50579
2008-05-02 17:12:56 +00:00
Ted Kremenek 63d76df236 Fix copy-paste bug.
llvm-svn: 50557
2008-05-01 23:38:35 +00:00
Ted Kremenek 2722f36465 Remove no longer valid assertion.
llvm-svn: 50556
2008-05-01 23:28:56 +00:00
Ted Kremenek 1097b4c61f Added line number diagnostics to indicate the allocation site of the leaked object.
llvm-svn: 50553
2008-05-01 23:13:35 +00:00
Ted Kremenek fabfb4677d Do not highlight bogus ranges for leaks.
llvm-svn: 50549
2008-05-01 22:50:36 +00:00
Steve Naroff f8ecff2a94 Replace Sema::CheckInitializerListTypes() with a helper class (InitListChecker) that synthesizes implicit InitListExpr's when appropriate (see InitListExpr comments in Expr.h for more details). I also moved the code to SemaInit.cpp, to help reduce clutter in SemaDecl.cpp.
NOTE: This work is incomplete and still fails many tests (as a result, it isn't enabled yet). Nevertheless, I wanted to check it in so I can work on it from home.
llvm-svn: 50544
2008-05-01 22:18:59 +00:00
Argyrios Kyrtzidis 2be96ae68b Convert CRLF to LF.
llvm-svn: 50542
2008-05-01 21:44:34 +00:00
Ted Kremenek 8a56b06b5c Correctly invalidate reference count state when passing objects by reference in message expressions we don't understand.
llvm-svn: 50541
2008-05-01 21:31:50 +00:00
Argyrios Kyrtzidis 694dda1e4e Implicitly defined functions were getting the DeclContext of the function where they appeared, causing the bug: http://llvm.org/bugs/show_bug.cgi?id=2266.
Fix it by making implicitly defined functions get the DeclContext of translation unit.

llvm-svn: 50538
2008-05-01 21:04:16 +00:00
Ted Kremenek 7f824734e0 Added temporary fix for Obj-C exception handling in the static analyzer: treat these as panic functions.
llvm-svn: 50535
2008-05-01 18:33:28 +00:00
Ted Kremenek f0b0f2edfe Renamed static method.
llvm-svn: 50533
2008-05-01 18:31:44 +00:00
Fariborz Jahanian f303bdabdf Patch to match and issue diagnostics on property type mismatch.
llvm-svn: 50532
2008-05-01 18:05:01 +00:00
Ted Kremenek b99d01269a Added __assert_rtn to list of panic functions.
llvm-svn: 50530
2008-05-01 17:52:49 +00:00
Ted Kremenek b8861a6ccf Use pointer swizziling to unify in ObjCMessageExpr the receiver and classname "fields". This saves us a pointer.
Implemented serialization for ObjCMessageExpr.

llvm-svn: 50528
2008-05-01 17:26:20 +00:00
Ted Kremenek ed36e4b9a4 Added ziperr as a panic function. Eventually inter-procedural analysis
should catch this one easily.

llvm-svn: 50526
2008-05-01 15:55:59 +00:00
Ted Kremenek 9f696852c4 When processing "release", "retain", and "autorelease" messages return the
lval passed as an argument.

Fix: Inverted diagnostic messages.
llvm-svn: 50513
2008-05-01 04:02:04 +00:00
Ted Kremenek 4828aa3152 Added support for "autorelease" message in CF ref. count checker.
llvm-svn: 50512
2008-05-01 02:18:37 +00:00
Steve Naroff 20348b5653 Extend InitListExpr API/IMPL to support arbitrary add/remove (in support of the initializer rewrite I am doing).
llvm-svn: 50511
2008-05-01 02:04:18 +00:00
Fariborz Jahanian 7cf18862c2 More ObjC2 property semantics work. Work in progress.
llvm-svn: 50508
2008-05-01 00:03:38 +00:00
Ted Kremenek b0f87c48cb added preliminary diagnostics in scan-build results to denote whether
a CF memory leak occurred with GC enabled, etc.

llvm-svn: 50507
2008-04-30 23:47:44 +00:00
Ted Kremenek f20e2285c9 More cleanups with ObjCQualifiedIdType in the static analyzer.
llvm-svn: 50503
2008-04-30 22:48:21 +00:00
Ted Kremenek a16dacb6aa Add placeholder code in the static analyzer for MemberExprs involving struct temporaries.
llvm-svn: 50502
2008-04-30 22:17:15 +00:00
Ted Kremenek ca67cab1e8 Add workaround for __builtin_offsetof in the static analyzer.
llvm-svn: 50500
2008-04-30 21:45:55 +00:00
Ted Kremenek 99057462aa Provide SizeOfAlignTypeExpr workaround in the static analyzer for taking the sizeof of a ObjCInterfaceType.
llvm-svn: 50499
2008-04-30 21:31:12 +00:00
Ted Kremenek e0e8b535cf Support implicit casts from pointers to references.
llvm-svn: 50498
2008-04-30 21:10:19 +00:00
Ted Kremenek 84dea154fc When creating LVals for array entries, canonicalize entries with a 0 index.
llvm-svn: 50497
2008-04-30 21:05:35 +00:00
Ted Kremenek 20d8006e93 Teach more of the static analyzer about ObjCQualifiedIdType.
llvm-svn: 50494
2008-04-30 20:17:27 +00:00
Ted Kremenek 0940b99e3b Teach the static analysis engine about ObjCQualifiedIdType.
llvm-svn: 50493
2008-04-30 20:01:29 +00:00
Ted Kremenek 5ce35cc514 Add conjured symbols for decl initializations.
Add db_error as panic function.

llvm-svn: 50489
2008-04-30 17:54:04 +00:00
Ted Kremenek 39a736f723 Handle lval::ArrayOffset and lval::FieldOffset in EvalNE and EvalEQ.
llvm-svn: 50486
2008-04-30 16:07:22 +00:00
Chris Lattner dd477ce32b Verify the whole module after codegen to catch silly IR bugs.
llvm-svn: 50485
2008-04-30 16:05:42 +00:00
Chris Lattner e16406d2b1 fix 'var unused' warning.
llvm-svn: 50484
2008-04-30 16:04:01 +00:00
Ted Kremenek 5cc9e60a5f Invalidate old subexpression bindings when binding UnknownVal.
llvm-svn: 50466
2008-04-30 04:23:07 +00:00
Ted Kremenek 9700bd42f0 Simplify RemoveDeadBindings.
llvm-svn: 50458
2008-04-29 23:58:03 +00:00
Ted Kremenek 10246e8bfa Add lval::ArrayOffset, which represent the locations of entries in an array.
llvm-svn: 50453
2008-04-29 23:24:44 +00:00
Fariborz Jahanian 2dfcec129f Default visbility for instance variables is protected.
Patch by Emerson Murhpy-Hill.

llvm-svn: 50452
2008-04-29 23:03:51 +00:00
Ted Kremenek 0d2ccffa83 Added lval::FieldOffset, which represents symbolic lvalues for field offsets from other Lvalues.
This removes the failure in null-deref-ps.c (test suite).

llvm-svn: 50449
2008-04-29 22:17:41 +00:00
Ted Kremenek fa5a3d0fe7 Major rewrite/refactoring of static analysis engine. We now use
EvalStore/EvalLoad to handle all loads/stores from symbolic memory, allowing us
to do checks for null dereferences, etc., at any arbitrary load/store (these
were missed checks before). This also resulted in some major cleanups, some
conceptual, and others just in the structure of the code.

This temporarily introduces a regression in the test suite (null-deref-ps.c)
before I add a new LVal type for structure fields.

llvm-svn: 50443
2008-04-29 21:04:26 +00:00
Ted Kremenek a374ea9a35 Update typestate logic to support GC-mode.
llvm-svn: 50396
2008-04-29 05:44:10 +00:00
Ted Kremenek 4b7ca776cf Implement semantics of CFMakeCollectable for the CF-reference count checker.
llvm-svn: 50395
2008-04-29 05:33:51 +00:00
Ted Kremenek 4d1f422c6f Provide the option to run the CF-retain checker in GC enabled mode.
The transfer functions for the checker don't do anything special yet in GC mode.

llvm-svn: 50394
2008-04-29 05:13:59 +00:00
Ted Kremenek d796c18d7b Add -fobjc-gc and -fobjc-gc-only options to the driver.
Add corresponding enum in LangOptions.

llvm-svn: 50387
2008-04-29 04:37:03 +00:00
Ted Kremenek 6065ef6b9b Bug fix in CFG::getBlockEdgeImpl(): Use a BumpPtrAllocator to allocate
std::pair<CFGBlock*, CFGBlock*> that have an 8-byte alignment for use with
ProgramPoint. This fixes a bug reported by Argiris where using std::set<> on
Windows would result in a 4-byte alignment, not an 8-byte alignment.

Fixes: <rdar://problem/5892265>
llvm-svn: 50364
2008-04-28 18:00:46 +00:00
Argyrios Kyrtzidis 8eab584388 Call ExitScope before ActOnFinishNamespaceDef.
This is the same for functions and it's preferable to have the namespace as DeclContext during ActOnPopScope.

llvm-svn: 50322
2008-04-27 14:10:57 +00:00
Argyrios Kyrtzidis 081148986a Parsing of namespaces:
-NamespaceDecl for the AST
-Checks for name clashes between namespaces and tag/normal declarations.

This commit doesn't implement proper name lookup for namespaces.

llvm-svn: 50321
2008-04-27 13:50:30 +00:00
Argyrios Kyrtzidis ed1eec4812 Use PushOnScopeChains to introduce a decl into scope.
llvm-svn: 50320
2008-04-27 13:30:35 +00:00
Argyrios Kyrtzidis fa2d2f2886 Make assertions for all addresses passed to ProgramPoint that they have at least an 8-byte alignment.
llvm-svn: 50310
2008-04-26 15:19:51 +00:00
Ted Kremenek dd38e0bd0d Fix bug in BugReporter where we didn't handle emitting diagnostics for
empty CFGBlocks that only contained a terminator.

Added improved diagnostics for break and continue statements and default branches in switch statements.

This fixes <rdar://problem/5889244>.

llvm-svn: 50286
2008-04-25 19:01:27 +00:00
Chris Lattner 73669defed remove the 'unused static' diagnostic from codegen. This should be
reimplemented in Sema someday.  This is tracked in PR2236.  Until then
disabling it removes some bogus diagnostics (see 2236).

llvm-svn: 50263
2008-04-25 15:47:13 +00:00
Nuno Lopes 0276933b4b initial support for recognizing __transparent_union__ attributes
comments on the ML will follow

llvm-svn: 50262
2008-04-25 09:32:00 +00:00
Ted Kremenek 99131c9f5a Handle dereferences of function pointers (which return a handle to the function).
llvm-svn: 50246
2008-04-25 01:56:50 +00:00
Ted Kremenek 2e5092320e Don't abort on GetRVal when the LVal is a StringLiteralVal.
llvm-svn: 50245
2008-04-25 01:45:38 +00:00
Ted Kremenek 4dd412e022 Don't emit empty strings for path diagnostics when taking the default branch of a switch statement that has no label.
llvm-svn: 50242
2008-04-25 01:29:56 +00:00
Ted Kremenek ecbdf75049 Do a better job at computing dead symbols.
Implemented support for better localized leaks in the CF reference count checker.
Now leaks should be flagged close to where they occur.

This should implement the desired functionality in <rdar://problem/5879592>, although the diagnostics still need to be improved.

llvm-svn: 50241
2008-04-25 01:25:15 +00:00
Ted Kremenek b0daf2f6f5 Add preliminary support for flagging leaks around when they happen (doesn't work yet).
llvm-svn: 50237
2008-04-24 23:57:27 +00:00
Ted Kremenek ae8014cb7e More boilerplate for handling specialized-transfer function logic for dead symbols.
llvm-svn: 50233
2008-04-24 23:35:58 +00:00
Fariborz Jahanian 0a070ff570 Patch to diagnose inconsistancies between properties declared in current and
its super class. This patch is incomplete.

llvm-svn: 50228
2008-04-24 19:58:34 +00:00
Ted Kremenek 3812b7676c Added initial boilerplate in GRExprEngine to allow checker-specific transfer
function logic to act when symbols become dead.

llvm-svn: 50221
2008-04-24 18:31:42 +00:00
Ted Kremenek f7141597e8 CF reference count checker: handle variadic functions that allocate CF objects.
This fixes <rdar://problem/5886141>.

Part of this change resulted in creating sparser summaries.  I also added
some more comments and did some minor code cleanups.

llvm-svn: 50214
2008-04-24 17:22:33 +00:00
Ted Kremenek b44485b835 Have ValidateOutputConstraint return false instead of firing an assertion
when processing a constraint we don't understand.  This allows the frontend
to gracefully fail.

llvm-svn: 50213
2008-04-24 16:36:38 +00:00
Ted Kremenek 21bf6006b0 For case statements involving enums, BugReporter now generates PathDiagnostics
that say that we are jumping to "case a" instead of "case 0".

This is a feature implementation for <rdar://problem/5880430>.

llvm-svn: 50197
2008-04-23 23:35:07 +00:00
Ted Kremenek 05e6267466 Fix minor regression in bug report generation.
llvm-svn: 50195
2008-04-23 23:04:32 +00:00
Ted Kremenek f26bc55b9a When building PathDiagnostics for bug reports, generate a trimmed ExplodedGraph with a single path that BugReport objects can safely walk and introspect.
llvm-svn: 50194
2008-04-23 23:02:12 +00:00
Ted Kremenek dd43aeee54 Fixed: <rdar://problem/5881148>
Problem:

In the recently refactored VisitDeref (which processes dereferences), we
were incorrectly skipping the node just generated for the subexpression
of the dereference.  This was a horrible regression.

llvm-svn: 50176
2008-04-23 20:12:28 +00:00
Ted Kremenek 467297ab48 TranslationUnit now owns IdentifierTable, TargetInfo, and Selectors objects
when it is constructed via deserialization.  This is done by recording a flag
indicating that this is the case, and it deletes these objects by getting
the references stored in the ASTContext object.  This fixes some memory
leaks that occurs when we deserialize translation units from bitcode files.

The rationale between having TranslationUnit sometimes own these objects and
sometimes not is that a TranslationUnit object can be constructed from
state generated by the parser (Preprocessor; semantic analyzer, etc.), and thus
in these cases won't own the IdentifierTable or Selectors, etc.  During
deserialization, there is no Preprocessor, so somebody needs to own these
objects in order for them to be properly reclaimed.

llvm-svn: 50149
2008-04-23 16:25:39 +00:00
Ted Kremenek d2419a0730 Remove false path where the default branch in a switch statement would
always be taken even if it was not feasible.

llvm-svn: 50132
2008-04-23 05:03:18 +00:00
Chris Lattner 68a27fac9d fix a rewriter crash on zero length files.
llvm-svn: 50126
2008-04-23 03:21:50 +00:00
Ted Kremenek ef9af73887 Added panic function "assfail".
llvm-svn: 50119
2008-04-23 00:41:25 +00:00
Fariborz Jahanian 6efdf1ddab Patch to build AST for property implementation declarations and
to print declaration from its AST.

llvm-svn: 50117
2008-04-23 00:06:01 +00:00
Ted Kremenek 0224ac57e0 For default branches in switch statements with no default label, print out
the line we are going to.

llvm-svn: 50113
2008-04-22 22:29:46 +00:00
Ted Kremenek 3b42715930 Rewrote VisitDeclStmt to properly handle initializers that can do anything.
llvm-svn: 50112
2008-04-22 22:25:27 +00:00
Ted Kremenek c79c0591d6 Added lval type (and tracking) for StringLiterals.
llvm-svn: 50109
2008-04-22 21:39:21 +00:00
Ted Kremenek eccf3e5821 Added "nonlval::LValAsInteger" to represent abstract LVals casted to integers, allowing us to track lvals when they are casted back to pointers.
llvm-svn: 50108
2008-04-22 21:10:18 +00:00
Chris Lattner bec41348e2 "This patch renames
DeclContext *CtxDecl -> DeclContext *DeclCtx
DeclContext *CD -> DeclContext *DC

It makes the code more consistent."

Patch by Zhongxing Xu!

llvm-svn: 50105
2008-04-22 18:39:57 +00:00
Ted Kremenek 9718c9e8ee PathDiagnosticClients now retain ownership of passed PathDiagnostics, requiring
them to not be stack-allocated.

HTMLDiagnostics now batches PathDiagnostics before emitting HTML in its dtor.
This is a workaround for a problem when we trampled the Preprocessor state
when highlighting macros (sometimes resulting in an assertion failure).

llvm-svn: 50102
2008-04-22 16:15:03 +00:00
Argyrios Kyrtzidis 901a4e406b Use back() instead of end()-1
llvm-svn: 50098
2008-04-22 07:37:18 +00:00
Ted Kremenek 80f2c111bd Added panic function "dtrace_assfail".
llvm-svn: 50091
2008-04-22 06:09:33 +00:00
Ted Kremenek a2cca7dbdf Hardcode "Assert" as a no-return function (panic).
llvm-svn: 50089
2008-04-22 05:37:33 +00:00
Nate Begeman 2908fa0715 Add some basic ARM asm constraints
llvm-svn: 50085
2008-04-22 05:03:19 +00:00
Ted Kremenek da5cdda248 Added null-dereference check for ArraySubscriptExpr.
llvm-svn: 50083
2008-04-22 04:56:29 +00:00
Fariborz Jahanian a591a12ea5 Allow property in base class to be implemented in a
derived class.

llvm-svn: 50074
2008-04-21 23:57:08 +00:00
Ted Kremenek 38213f9573 Added support for detected bad dereferences involving MemberExprs, e.g. x->f where "x" is NULL.
llvm-svn: 50071
2008-04-21 23:43:38 +00:00
Fariborz Jahanian c6bec7b6dc More semantics checks of properties. Property implementation can implicitly use
ivar of same name. 
Better diagnostics to bring home this point.

llvm-svn: 50065
2008-04-21 21:57:36 +00:00
Fariborz Jahanian f2a7d7c949 Support for @dynamic AST build.
More property semantics checking.
First test case for ObjC2's property implementation.

llvm-svn: 50057
2008-04-21 21:05:54 +00:00
Chris Lattner 0dcd9aa8fd Fix pasto, thanks to Anders for pointing this out.
llvm-svn: 50055
2008-04-21 20:19:54 +00:00
Fariborz Jahanian a054e99fa8 Continuation of work on ObjC2's properties.
Added iterators, methods to find property and categories.
Use them in doing semantic analysis on property implementation
declarations. Fixed typos.

llvm-svn: 50050
2008-04-21 19:04:53 +00:00
Chris Lattner 17df24e736 add arm support
llvm-svn: 50049
2008-04-21 18:56:49 +00:00