Commit Graph

410 Commits

Author SHA1 Message Date
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
Douglas Gregor 89f238cbe1 Clean up handling of function redeclarations
llvm-svn: 50021
2008-04-21 02:02:58 +00:00
Ted Kremenek 5fa90e49a9 Fix improper dereference of end() iterator. Patch by Argiris Kirtzidis!
llvm-svn: 50012
2008-04-20 23:54:24 +00:00
Nate Begeman 1c906206b8 Fix PR2236
Add test
Implement feedback from Chris re: PR1998

llvm-svn: 50001
2008-04-20 20:38:08 +00:00
Chris Lattner 14cd1ee95f Two improvements to initializer parsing:
1. If we hit a semantic error, try harder to recover to emit
   diagnostics for later initializer errors (PR2241).
2. Don't leak parsed initializers on an error.

llvm-svn: 49998
2008-04-20 19:07:56 +00:00
Chris Lattner 4885b97664 for exponent-related errors, emit the diagnostic on the 'e' or 'p'.
llvm-svn: 49997
2008-04-20 18:47:55 +00:00
Chris Lattner 48a9b9beeb when emitting diagnostics about some character in a numeric
literal, indicate what character the error is about or where
it would be.  For example:

pr2241.c:1:17: error: exponent has no digits
float f[] = { 1e  , 1ee0 };
                ^

llvm-svn: 49996
2008-04-20 18:41:46 +00:00
Nate Begeman 8e8d498d34 Only generate code for static functions and global variables that are actually used.
Warn about unused static functions and variables.
This fixes PR1998.

llvm-svn: 49987
2008-04-20 06:29:50 +00:00
Chris Lattner 2cc4e23252 Restructure and simplify Sema::ObjCQualifiedIdTypesAreCompatible,
deleting dead code, making other code more obvious, and fixing a
bug.  This fixes these (bogus) warnings in release mode:

SemaExprObjC.cpp:383: warning: 'RHSProtoE' may be used uninitialized in this function
SemaExprObjC.cpp:383: warning: 'RHSProtoI' may be used uninitialized in this function

llvm-svn: 49984
2008-04-20 02:09:31 +00:00
Chris Lattner ff2367c0c9 implement a fixme, add support for ++/-- on long double.
llvm-svn: 49980
2008-04-20 00:50:39 +00:00
Chris Lattner 1886e71e47 use simplified ConstantFP:get method.
llvm-svn: 49979
2008-04-20 00:45:53 +00:00
Chris Lattner 1e517a78a8 replace form feeds with an <hr> tag.
llvm-svn: 49975
2008-04-19 23:56:30 +00:00
Chris Lattner ba1f37bfdf simplify ownership of the predefines buffer.
llvm-svn: 49973
2008-04-19 23:09:31 +00:00