Граф коммитов

10644 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 31593ac278 When processing "release", "retain", and "autorelease" messages return the
lval passed as an argument.

Fix: Inverted diagnostic messages.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 04:02:04 +00:00
Ted Kremenek 5934cee407 Added support for "autorelease" message in CF ref. count checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50512 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 02:18:37 +00:00
Steve Naroff c5ae899b4b Extend InitListExpr API/IMPL to support arbitrary add/remove (in support of the initializer rewrite I am doing).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50511 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 02:04:18 +00:00
Fariborz Jahanian 02edb98b45 More ObjC2 property semantics work. Work in progress.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01 00:03:38 +00:00
Ted Kremenek 072192bcbb added preliminary diagnostics in scan-build results to denote whether
a CF memory leak occurred with GC enabled, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 23:47:44 +00:00
Ted Kremenek c1ff3cd5fe More cleanups with ObjCQualifiedIdType in the static analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 22:48:21 +00:00
Ted Kremenek ee90dba352 Add placeholder code in the static analyzer for MemberExprs involving struct temporaries.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 22:17:15 +00:00
Ted Kremenek a084bb667d Add workaround for __builtin_offsetof in the static analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 21:45:55 +00:00
Ted Kremenek f342d1887c Provide SizeOfAlignTypeExpr workaround in the static analyzer for taking the sizeof of a ObjCInterfaceType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 21:31:12 +00:00
Ted Kremenek e8c2bde0d3 Support implicit casts from pointers to references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 21:10:19 +00:00
Ted Kremenek c52c89a5eb When creating LVals for array entries, canonicalize entries with a 0 index.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50497 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 21:05:35 +00:00
Ted Kremenek c0c3f5dbc9 Teach more of the static analyzer about ObjCQualifiedIdType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 20:17:27 +00:00
Ted Kremenek 036dce063a Teach the static analysis engine about ObjCQualifiedIdType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50493 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 20:01:29 +00:00
Ted Kremenek f47bb7851e Add conjured symbols for decl initializations.
Add db_error as panic function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50489 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 17:54:04 +00:00
Ted Kremenek c3b7f0ec5d Handle lval::ArrayOffset and lval::FieldOffset in EvalNE and EvalEQ.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 16:07:22 +00:00
Chris Lattner a1945fa74d Verify the whole module after codegen to catch silly IR bugs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50485 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 16:05:42 +00:00
Chris Lattner 2262494248 fix 'var unused' warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50484 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 16:04:01 +00:00
Ted Kremenek 436f2b9a79 Invalidate old subexpression bindings when binding UnknownVal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50466 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30 04:23:07 +00:00
Ted Kremenek ad87d25ef5 Simplify RemoveDeadBindings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50458 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 23:58:03 +00:00
Ted Kremenek 4d0348b6c7 Add lval::ArrayOffset, which represent the locations of entries in an array.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50453 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 23:24:44 +00:00
Fariborz Jahanian aa847fe3c8 Default visbility for instance variables is protected.
Patch by Emerson Murhpy-Hill.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50452 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 23:03:51 +00:00
Ted Kremenek 718c4f7b3f Added lval::FieldOffset, which represents symbolic lvalues for field offsets from other Lvalues.
This removes the failure in null-deref-ps.c (test suite).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50449 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 22:17:41 +00:00
Ted Kremenek 1b8bd4d71c 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 21:04:26 +00:00
Ted Kremenek 65c9165dad Update typestate logic to support GC-mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 05:44:10 +00:00
Ted Kremenek 377e2306a6 Implement semantics of CFMakeCollectable for the CF-reference count checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50395 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 05:33:51 +00:00
Ted Kremenek e5c30122ca 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 05:13:59 +00:00
Ted Kremenek 01d9dbf4ae Add -fobjc-gc and -fobjc-gc-only options to the driver.
Add corresponding enum in LangOptions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50387 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 04:37:03 +00:00
Ted Kremenek 274f4334f6 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>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-28 18:00:46 +00:00
Argyrios Kyrtzidis ff87144442 Call ExitScope before ActOnFinishNamespaceDef.
This is the same for functions and it's preferable to have the namespace as DeclContext during ActOnPopScope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50322 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 14:10:57 +00:00
Argyrios Kyrtzidis 2d1c5d313c 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 13:50:30 +00:00
Argyrios Kyrtzidis 642e38baae Use PushOnScopeChains to introduce a decl into scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50320 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-27 13:30:35 +00:00
Argyrios Kyrtzidis 6e5977f0a8 Make assertions for all addresses passed to ProgramPoint that they have at least an 8-byte alignment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-26 15:19:51 +00:00
Ted Kremenek 2673c9ff76 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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 19:01:27 +00:00
Chris Lattner 5827754da1 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 15:47:13 +00:00
Nuno Lopes 27ae6c6531 initial support for recognizing __transparent_union__ attributes
comments on the ML will follow

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 09:32:00 +00:00
Ted Kremenek 4b443a6142 Handle dereferences of function pointers (which return a handle to the function).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50246 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 01:56:50 +00:00
Ted Kremenek 2bfe9ea822 Don't abort on GetRVal when the LVal is a StringLiteralVal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50245 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 01:45:38 +00:00
Ted Kremenek 567839273d Don't emit empty strings for path diagnostics when taking the default branch of a switch statement that has no label.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 01:29:56 +00:00
Ted Kremenek 910e999c19 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 01:25:15 +00:00
Ted Kremenek 652adc6c5d Add preliminary support for flagging leaks around when they happen (doesn't work yet).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50237 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 23:57:27 +00:00
Ted Kremenek 846d4e923b More boilerplate for handling specialized-transfer function logic for dead symbols.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50233 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 23:35:58 +00:00
Fariborz Jahanian b5e0224173 Patch to diagnose inconsistancies between properties declared in current and
its super class. This patch is incomplete.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50228 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 19:58:34 +00:00
Ted Kremenek 77d7ef8d8a Added initial boilerplate in GRExprEngine to allow checker-specific transfer
function logic to act when symbols become dead.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50221 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 18:31:42 +00:00
Ted Kremenek 891d5ccc46 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50214 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 17:22:33 +00:00
Ted Kremenek 5ab201a324 Have ValidateOutputConstraint return false instead of firing an assertion
when processing a constraint we don't understand.  This allows the frontend
to gracefully fail.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50213 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 16:36:38 +00:00
Ted Kremenek 5a429954ae 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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50197 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 23:35:07 +00:00
Ted Kremenek 6aaca9cbf2 Fix minor regression in bug report generation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 23:04:32 +00:00
Ted Kremenek a43a1eb6e7 When building PathDiagnostics for bug reports, generate a trimmed ExplodedGraph with a single path that BugReport objects can safely walk and introspect.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50194 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 23:02:12 +00:00
Ted Kremenek 186350f192 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50176 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 20:12:28 +00:00
Ted Kremenek c1e9dea3d9 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50149 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 16:25:39 +00:00
Ted Kremenek 5014ab113e Remove false path where the default branch in a switch statement would
always be taken even if it was not feasible.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50132 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 05:03:18 +00:00
Chris Lattner c66d0aa934 fix a rewriter crash on zero length files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50126 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 03:21:50 +00:00
Ted Kremenek 688738fcf8 Added panic function "assfail".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50119 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 00:41:25 +00:00
Fariborz Jahanian 628b96f34e Patch to build AST for property implementation declarations and
to print declaration from its AST.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50117 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 00:06:01 +00:00
Ted Kremenek 8b90455743 For default branches in switch statements with no default label, print out
the line we are going to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50113 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 22:29:46 +00:00
Ted Kremenek 5b7dcce86c Rewrote VisitDeclStmt to properly handle initializers that can do anything.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50112 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 22:25:27 +00:00
Ted Kremenek a548846b47 Added lval type (and tracking) for StringLiterals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 21:39:21 +00:00
Ted Kremenek 0fe33bc94a Added "nonlval::LValAsInteger" to represent abstract LVals casted to integers, allowing us to track lvals when they are casted back to pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50108 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 21:10:18 +00:00
Chris Lattner 9fdf9c6d35 "This patch renames
DeclContext *CtxDecl -> DeclContext *DeclCtx
DeclContext *CD -> DeclContext *DC

It makes the code more consistent."

Patch by Zhongxing Xu!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 18:39:57 +00:00
Ted Kremenek 5585114307 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 16:15:03 +00:00
Argyrios Kyrtzidis 5fc073fe3b Use back() instead of end()-1
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 07:37:18 +00:00
Ted Kremenek 9a108ae69e Added panic function "dtrace_assfail".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50091 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 06:09:33 +00:00
Ted Kremenek 9a094cbf19 Hardcode "Assert" as a no-return function (panic).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 05:37:33 +00:00
Nate Begeman ad487f4ef2 Add some basic ARM asm constraints
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 05:03:19 +00:00
Ted Kremenek 540cbe2b60 Added null-dereference check for ArraySubscriptExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 04:56:29 +00:00
Fariborz Jahanian c70bee863b Allow property in base class to be implemented in a
derived class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50074 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 23:57:08 +00:00
Ted Kremenek 469ecbded3 Added support for detected bad dereferences involving MemberExprs, e.g. x->f where "x" is NULL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50071 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 23:43:38 +00:00
Fariborz Jahanian 6cdf16d61d More semantics checks of properties. Property implementation can implicitly use
ivar of same name. 
Better diagnostics to bring home this point.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50065 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 21:57:36 +00:00
Fariborz Jahanian c35b9e4e2e Support for @dynamic AST build.
More property semantics checking.
First test case for ObjC2's property implementation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 21:05:54 +00:00
Chris Lattner d0c33d3527 Fix pasto, thanks to Anders for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50055 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 20:19:54 +00:00
Fariborz Jahanian 559c0c4bbe 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 19:04:53 +00:00
Chris Lattner 393ff04a07 add arm support
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50049 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 18:56:49 +00:00
Douglas Gregor f009795057 Clean up handling of function redeclarations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50021 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 02:02:58 +00:00
Ted Kremenek 7b989570f0 Fix improper dereference of end() iterator. Patch by Argiris Kirtzidis!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 23:54:24 +00:00
Nate Begeman 1a1d92ac5e Fix PR2236
Add test
Implement feedback from Chris re: PR1998


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 20:38:08 +00:00
Chris Lattner 65bb89c382 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49998 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 19:07:56 +00:00
Chris Lattner 70f66ab053 for exponent-related errors, emit the diagnostic on the 'e' or 'p'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 18:47:55 +00:00
Chris Lattner 0b7f69d789 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 };
                ^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49996 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 18:41:46 +00:00
Nate Begeman 4c13b7a397 Only generate code for static functions and global variables that are actually used.
Warn about unused static functions and variables.
This fixes PR1998.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 06:29:50 +00:00
Chris Lattner b1698cf972 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




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49984 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 02:09:31 +00:00
Chris Lattner 25ddea7f78 implement a fixme, add support for ++/-- on long double.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49980 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 00:50:39 +00:00
Chris Lattner 59138ba7ce use simplified ConstantFP:get method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49979 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 00:45:53 +00:00
Chris Lattner f3d8d19caf replace form feeds with an <hr> tag.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49975 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 23:56:30 +00:00
Chris Lattner aa39197431 simplify ownership of the predefines buffer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 23:09:31 +00:00
Ted Kremenek 6bdafbfec5 Gracefully handle when the receiver of a message expression is not a pointer type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 19:12:50 +00:00
Nate Begeman 8bd4afeb87 Generate code for annotation attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 04:17:09 +00:00
Nate Begeman 532485cc6c Add support to module codegen for adding and emitting annotations
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49944 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 23:43:57 +00:00
Nate Begeman d6595fa87c Ignore qualifiers when attempting to match arguments to parameter types for
__builtin_overload



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 23:35:14 +00:00
Nate Begeman 213541a68a OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49942 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 23:10:10 +00:00
Ted Kremenek 2f0e89ea96 Another bug fix in emitting warnings without a path: construct a unit PathDiagnostic as we did
before.  This allows the HTMLDiagnostic object to retrieve the bug type, bug description, etc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 22:56:53 +00:00
Nuno Lopes 59b6d5ae1c fix __attribute__(format) for struct function pointer fields
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 22:43:39 +00:00
Ted Kremenek 27fd5863b9 Reenable using the PathDiagnosticClient for BugReports without paths.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49934 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 22:11:59 +00:00
Ted Kremenek 95cc1bae89 Generalize caching mechanism for bugs reports. Now individual BugTypes
can decide the policy on how to cache related bugs.  This allows us to
properly to handle warning about multiple leaks in the same location in the
ref count checker (not yet done).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49918 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 20:54:29 +00:00
Ted Kremenek b0533965f1 Fixed more caching bugs related to the one fixed in r49914. Silence
compiler warning introduced by a recent patch of mine.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 20:35:30 +00:00
Ted Kremenek eaa9edac11 Fixed elusive caching bug that led to false positives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49914 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 19:34:16 +00:00
Ted Kremenek cb61292aea Added "GetErrorNodes()" to BugType so that -trim-egraph can recognize errors
from registered BugTypes.  This helps with debugging.

Add detection of NULL values in ref count checker; this suppresses false positives.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49912 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 19:23:43 +00:00
Ted Kremenek 550a0f9493 Added "EvalAssume" virtual method to GRTransferFuncs; this is for evaluating
the checker-specific logic of symbolic assumptions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49910 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 17:20:23 +00:00
Nate Begeman 3d292065d8 Tabs -> spaces
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 17:17:24 +00:00
Ted Kremenek 4f28515992 Fixed bug in GREndPathNodeBuilder: only return a node if it wasn't in the node cache.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49907 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 16:30:14 +00:00
Nate Begeman d5e2d87d53 Initialize default double width and alignment
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 05:49:49 +00:00
Nate Begeman c8b1227fa8 Allow targets to override double size, alignment, and semantics, and tie this
information into the IR type codegen.  This allows a target to codegen the C
'double' type as either double or float.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 05:41:31 +00:00
Ted Kremenek fb58609c5b Provide a version of html::HighlightMacros that takes a Preprocessor&.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49896 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 05:34:33 +00:00
Ted Kremenek 79c140bbfc More grammar fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49895 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 05:32:44 +00:00
Ted Kremenek 5e770cae7d Fix plurality debacle.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49894 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 05:13:26 +00:00
Ted Kremenek 2cf943a6ac Added path diagnostics for reference counts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49892 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 04:55:01 +00:00
Chris Lattner 5c176f7a9b Make tab insertion really right: the number of spaces inserted
depends on the column number of the start of the tab.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49891 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 04:54:20 +00:00
Ted Kremenek 8dd564630c BugReport::VisitNode now takes BugReporter& instead of ASTContext&.
Shuffled around code in CFRefCount to better pair classes with implementation,
and started adding subclasses of RangedBugReport to handle better diagnostics
for reference count bugs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 03:39:05 +00:00
Ted Kremenek 38941b5b54 Use HTML5 doctype when generating HTML.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49888 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 03:37:38 +00:00
Ted Kremenek 329d2cc859 Added null check.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 02:24:50 +00:00
Ted Kremenek f501626052 Updated CSS colors. Patch by Cedric Venet!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49886 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 02:12:39 +00:00
Ted Kremenek 75840e1501 Simplified internal logic of BugReporter, consolidating EmitWarning and
EmitPathWarning into one method.  We now properly handle emitting warnings
without a PathDiagnosticClient when the warning does not involve a particular
statement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 01:56:37 +00:00
Fariborz Jahanian 5833b901d0 Fixed a bug in categories and properties.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49883 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 00:30:47 +00:00
Fariborz Jahanian f624f8186d Initial work for property implementation declarations.
Mostly semantic checking in this patch. This is on going
and incomplete.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49882 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 00:19:30 +00:00
Ted Kremenek bd7efa8ca2 Modified BugReport::getEndPath() to handle the case where end path is at
the exit block of the CFG.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49880 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 23:44:37 +00:00
Ted Kremenek 989d519636 Hook up reporting reference count memory leaks to the BugReporter mechanism.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49879 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 23:43:50 +00:00
Chris Lattner 9227c69534 Fix a problem noticed by Nuno, where we wouldn't escape characters in
macro expansions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49877 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 23:03:14 +00:00
Ted Kremenek 339b9c2775 class Preprocessor: Now owns the "predefines" char*; it deletes [] it in its dstor.
clang.cpp: InitializePreprocessor now makes a copy of the contents of PredefinesBuffer and
  passes it to the preprocessor object.
  
clang.cpp: DriverPreprocessorFactory now calls "InitializePreprocessor" instead of this being done in main().

html::HighlightMacros() now takes a PreprocessorFactory, allowing it to conjure up a new
Preprocessor to highlight macros.

class HTMLDiagnostics now takes a PreprocessorFactory* that it can use for html::HighlightMacros().
Updated clients of HTMLDiagnostics to use this new interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 22:31:54 +00:00
Chris Lattner dc5be47542 don't give macros a background
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49871 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 21:32:46 +00:00
Chris Lattner 8aa06aca8b Make sure popup is on top over other spans. wrap long line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49870 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 21:28:41 +00:00
Ted Kremenek ec6c574478 Added "PreprocessorFactory", an interface for lazily creating Preprocessor objects on-demand.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49868 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 21:23:07 +00:00
Ted Kremenek 07339a63b4 Add support in HTML macro expansion for hovering over a macro and automatically
expanding its definition.  This is a pure CSS solution.

Tested on IE7, Firefox 3b4, and Safari 3.1.

Patch by Cedric Venet!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49865 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 19:57:27 +00:00
Fariborz Jahanian 3dd4ba4068 Added property decl support for protocols.
Added assertion if unexpected property decls are found where they don't belong.
Consolidated property decl. printing by using a helper function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49862 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 18:25:18 +00:00
Ted Kremenek 4fd8897f81 Added transfer function support for ReturnStmt to support detecting leaks
involving objects that are returned but have an excessive reference count.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49861 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 18:12:53 +00:00
Argyrios Kyrtzidis ff898cd0b0 Use TranslationUnitDecl as DeclContext of builtin functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49856 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 14:47:13 +00:00
Argyrios Kyrtzidis ef17782010 Addition of TranslationUnitDecl to the AST:
-Added TranslationUnitDecl class to serve as top declaration context
-ASTContext gets a TUDecl member and a getTranslationUnitDecl() function
-All ScopedDecls get the TUDecl as DeclContext when declared at global scope


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49855 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 14:40:12 +00:00
Argyrios Kyrtzidis 5da6b2592f Fix MSVC compiler error: "initialization of 'VD' is skipped by 'case' label"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49853 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 13:52:22 +00:00
Chris Lattner 6f46be279f insert macro expansions into floating divs. For now, they are always displayed,
but we want some javascript or something toggle their display.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 00:40:45 +00:00
Chris Lattner 5deb96d065 correctly hilight multi-line macro definitions and other
preprocessor directives.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49828 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 23:21:17 +00:00
Chris Lattner 9402b57a0d Make HighlightRange correctly handle multi-line ranges. This causes us to
correctly handle multi-line comments.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49827 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 23:06:45 +00:00
Ted Kremenek 6b31e8ed11 Handle ReturnStmts by dispatching to "EvalReturn" in the transfer function object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49826 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 23:05:51 +00:00
Chris Lattner 5ef3e2c45f add a new HighlightRange API, it doesn't handle multiline ranges
yet, but it will soon...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 22:45:51 +00:00
Ted Kremenek db86371cb5 CF ref. count checker: Register memory leaks at the end of a path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49824 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 22:32:20 +00:00
Ted Kremenek 5eb1044ec1 Bug fix in GREndPathNodeBuilderImpl: Use the specified state to construct
a node, not the state of the predecessor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49823 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 22:30:40 +00:00
Fariborz Jahanian 61d46159af New AST class for property implementation declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 22:00:24 +00:00
Fariborz Jahanian d9a3c330b0 Fixed a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49819 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 21:11:25 +00:00
Ted Kremenek 411cdee0b4 Added CFGBlock::getTerminatorCondition() to get the Expr* of the condition a block's terminator.
Refactored LiveVariables to use getTerminatorCondition() in VisitTerminator().

Bug fix: CFG now computes Block-level expression numbers using information
from block terminators.  This fixes <rdar://problem/5868189>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 21:10:48 +00:00
Fariborz Jahanian 7e7e3872b5 This patch adds support for declaraing properties in categories,
just as they are declared in objc classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 21:08:45 +00:00
Chris Lattner 678c6358c8 reenable highlighting of (the first line of) comments
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49816 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 20:54:51 +00:00
Chris Lattner a745e8c528 switch from relexing with the preprocessor to do syntax highlighting to relexing
with the Lexer.  This is cheaper and gives us some advantages.  For now we start
highlighting preprocessor directives (which need improvement), and disable 
comments.  Comments to be restored later.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49815 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 20:51:51 +00:00
Ted Kremenek 1392261ff4 Small tweaks to EvalStore: pass an "RVal" instead of "LVal" for the TargetLV to
represent possible stores to "Unknown."


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 20:40:59 +00:00
Ted Kremenek 2798e17654 Add missing file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 18:39:25 +00:00
Ted Kremenek ec96a2d52d Hook up "EvalStore" from GRTransferFuncs to GRExprEngine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49804 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 18:39:06 +00:00
Ted Kremenek e38718e325 Take first step to migrating handling of "stores" to values from GRExprEngine
to the plug-in GRTransferFuncs object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49801 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 18:21:25 +00:00
Ted Kremenek 5cd24389af LiveVariables now updates the liveness state of block-level expressions that
are referenced by CFGBlock terminators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49798 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 17:07:59 +00:00
Ted Kremenek 33c6369f79 In ExplodedGraphImpl::Trim, prioritize for paths that don't span loops by using
two worklists: for nodes whose locations are block edges with loop terminators
and another for nodes with all other locations.  We only dequeue from the loop
worklist when the other is empty.  Exploration of the graph is still in
reverse-BFS.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 15:51:26 +00:00
Chris Lattner 74ea3e5c57 Take a stab at highlighting #defines and #includes. This doesn't work yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49781 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 06:53:09 +00:00
Chris Lattner c4586c234e Syntax highlight keywords. I assume someone else will pick less appaling colors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49780 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 06:35:07 +00:00
Chris Lattner c54d50a418 split syntax highlighting of macros from keywords and comments,
allowing us to use a cheaper means to highlight keywords and making
it so that comments won't foul up macro expansions.

Start highlighting macro expansions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 06:32:08 +00:00
Chris Lattner 3245a0a1c7 Add a mode of hackily syntax highlighting comments. This has a number of
problems, including the fact that it doesn't work well with multi-line 
comments due to Ted's crazy table.  However, that could be fixed, and it
does work with single-line ones :).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 06:11:58 +00:00
Chris Lattner 8570f0b0fd Switch AddLineNumbers to hack on a rewritebuffer instead of on a
rewriter, getting sourcelocations out of the picture.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49775 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:37:29 +00:00
Chris Lattner 735271479a In html::EscapeText, instead of going through the rewriter with
a SourceLocation to get a RewriteBuffer, poke the RewriteBuffer
with an offset directly.  THis is no faster, but results in 
cleaner code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49774 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:33:23 +00:00
Ted Kremenek 97b7f26a92 Remove uses of "Selector&" and "const Selector&", since Selector is just an
immutable smart pointer (we don't need to pass references, just pass Selector).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49773 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:30:16 +00:00
Ted Kremenek 9ed18e6c36 Implemented toll-free bridging support for CF Reference count checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49771 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:28:53 +00:00
Chris Lattner 57df3b9500 switch AddLineNumber to use a SmallString instead of sstream. This
speeds up -emit-html on ted's testcase by 29% (.138 -> 0.107s) in a
release build.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:11:35 +00:00
Ted Kremenek 2f868c0139 Simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49763 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 02:59:55 +00:00
Ted Kremenek 8534820eab Added initial boilerplate to support toll-free bridging in the ref-count checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49756 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 23:44:31 +00:00
Ted Kremenek e695e1cd7d Added some comments to GRExprEngine. Reorder some of the method definitions
to start logically organizing them.

Added initial plug-in transfer function support for Objective-C message expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49752 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 23:06:53 +00:00
Ted Kremenek 606ceeef82 Change "VisitBlockVarDecl" to "VisitVarDecl". UninitializedValues now works
as before r49748 (where BlockVarDecl was removed).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49749 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 23:02:18 +00:00
Steve Naroff 248a753f6b Remove FileVarDecl and BlockVarDecl. They are replaced by VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl().
This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 22:42:06 +00:00
Ted Kremenek 4b0f81323b For HTML diagnostics, output more information about a bug report.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49742 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 21:25:08 +00:00
Ted Kremenek 7deed0c65b Fix bug in terminator processing for uninitialized-values: simply ignore the terminator, don't reprocess it.
LiveVariables analysis now does a flow-insensitive analysis to determine what variables have their address taken; these variables are now always treated as being live.

The DataflowSolver now uses "SetTopValue()" when getting the initial value for the entry/exit block.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49734 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 18:35:30 +00:00
Argyrios Kyrtzidis afe10913bd Fix a compiler error on MSVC (variable name 'E' clash).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49727 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 16:30:10 +00:00
Chris Lattner b9b3094813 finish commenting RewriteRope
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49712 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 06:37:11 +00:00
Ted Kremenek 1d5d1da8c3 Improve dead store diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 05:31:00 +00:00
Ted Kremenek 37622081d8 Added initial support into the flow-sensitive dataflow solver to visit the Block-level expression
in a block's terminator.  This expression is visited within a block, but it is accessed by the
terminator.  This is important to observe because for live-variables analysis the block-level
expression is live between the terminator and where the expression occurs in the block.  So far
this hasn't been an issue to not observe this because the block-level expression used in the
terminator is always the last one in the block, and we have never queried the liveness information
about this point (but before the terminator).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 04:39:08 +00:00
Ted Kremenek 9d7af51f0f Bug fix in dead stores: don't always check the liveness of the first decl
in a DeclStmt.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 04:11:48 +00:00
Ted Kremenek dace4c9d65 ++/-- makes a variable live since it is used; thus the liveness state is
"Alive" as opposed to staying the same.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49707 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 04:08:54 +00:00
Ted Kremenek c8e00b2f4c Bug fix in LiveVariables: Operators ++/-- may kill a value, but the variable
is still live.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 03:47:30 +00:00
Chris Lattner 53f9e203c1 Fix a corner case that ted hit in -emit-html, rdar://5863212
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49703 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15 02:26:21 +00:00
Fariborz Jahanian 1de1e74541 New AST representation for each objc2's property declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49699 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 23:36:35 +00:00
Chris Lattner bf26856c21 simplify the implementation of the insert/split operation to return
the new RHS directly instead of indirecting through the 'InsertResult'
struct.  This eliminates InsertResult.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 22:10:58 +00:00
Chris Lattner 5618d88b93 Add a bunch of comments, move RewriteRope::MakeRopeString out of line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 21:41:00 +00:00
Ted Kremenek d0734e56d6 Fix regression in Diagnostic that caused it to not register the number
of errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49686 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 21:21:38 +00:00
Ted Kremenek 9fd87b1db4 Added "getCanonicalID()", "isFromSameFile", and "isFromMainFile" to compare
the files of different SourceLocations.  These methods correctly handle the
case where a file may have multiple FileIDs due to it being large enough
to be spread across several chunks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 21:04:18 +00:00
Chris Lattner 70778c8582 fix more uninit ivars, who wrote this junk? :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49679 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 20:07:03 +00:00
Chris Lattner b442e21970 Fix an assertion ted was hitting, due to an uninitialized variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49678 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 20:05:32 +00:00
Ted Kremenek 06bdb3a4fa Only increment the number of diagnostics when the DiagnosticClient used
is the one attached to the Diagnostic object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 19:56:12 +00:00
Ted Kremenek 1c86b156ff Don't flag dead stores that occur in macros.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 18:28:25 +00:00
Ted Kremenek 5fcca6881f Have BugReporter::EmitWarning use the PathDiagnosticClient if it is available.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 18:06:42 +00:00
Chris Lattner 5fd3e2673a move a ton of code out of line, from RewriteRope.h -> RewriteRope.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49664 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:54:23 +00:00
Ted Kremenek c967c9d901 Bug fix in dead-store checker when walking the Decls in a DeclStmt: don't
assume that DeclStmts only have VarDecls; they can have TypedefDecls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49662 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:52:13 +00:00
Ted Kremenek 7ded73c1cb Treat calls to unresolved functions in the CF-ref count checker as calls
to functions with NULL summaries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49660 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:45:13 +00:00
Ted Kremenek d2f642b56e Hooked up the dead-store checker to the BugReporter interface. Now dead-store
warnings are emitted as part of the warnings registered by GRSimpleVals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49658 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:39:48 +00:00
Chris Lattner e5cd857f7e remove ifdefs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49651 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 17:12:49 +00:00
Chris Lattner febe719596 Change the RewriteRope::Chunks data structure from an std::list into
a nice shiny B+ Tree variant.  This fixes the last of the known algorithmic
issues with the rewriter, allowing a significant speedup.  For example,
-emit-html on Ted's 500K .i file speeds up from 26.8s -> 0.64s in a 
debug build (41x!) and 5.475s -> 0.132s (41x!) in an optimized build.

This code is functional but needs to be cleaned up, ifdefs removed, better
commented, and moved to a .cpp file.  I plan to do this tomorrow.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 07:17:29 +00:00
Nate Begeman e7722103ab Enable clang to codegen emmintrin.h until we have our own emmintrin.h
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49633 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 04:49:57 +00:00
Nate Begeman 5253c7ff26 Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 02:26:39 +00:00
Douglas Gregor f8d9e76a58 Argiris Kirtzidis's fix for handling empty IdDeclInfo's in IdentifierResolver::AddDecl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49631 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 00:26:07 +00:00
Douglas Gregor 1b7f89846f Make Parser::getAccessSpecifierIfPresent const, since it does not modify the state
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 00:13:42 +00:00
Argyrios Kyrtzidis 7bc198fb47 Move IdDeclInfoMap class in an anonymous namespace. Suggestion by Chris Lattner.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49628 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-14 00:09:21 +00:00
Douglas Gregor e37ac4ff16 This patch adds very basic support for parsing and type-checking class
inheritance in C++. It'll parse the base-specifier list, e.g.,

 class D : public B1, virtual public B2 { };

and do some of the simpler semantic checks (B1 and B2 are classes;
they aren't unions or incomplete types, etc).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 21:30:24 +00:00
Douglas Gregor 2ce52f3fb9 Introduce support for finding class and enum names via ordinary name lookup in C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 21:07:44 +00:00
Chris Lattner d98d975ccd Fix PR2220, making diagnostics for unexpected tokens in pp expressions
more nice.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 20:38:43 +00:00
Chris Lattner 99dc914221 This patch is just the easy part of the class names patch, which
allows the parsing of "class" in addition to "struct" and "union" to
declare a record.  So this patch allows:

 class C { };
 class C c1;

But it does not contain the lookup bits, so this won't work yet:

 C c2;

Patch by Doug Gregor!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 18:59:07 +00:00
Chris Lattner 3b7ff0d143 Change the btree algorithm to split nodes bottom-up instead of top-down.
This results in an (IMO) simpler algorithm, results in fewer splits, and
is more amenable to delta handling (there is no reason to mutate the tree
at all when adding a delta to a position that already exists in the tree).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 08:52:45 +00:00
Chris Lattner b169e903c5 split node splitting from interior node restructuring.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 08:22:30 +00:00
Chris Lattner 50b3674167 update to follow mainline llvm API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 07:32:11 +00:00
Sam Bishop 1b30cb27f8 Use static_cast<> instead of cast<> in Decl::Destroy(). Suggestion by Argiris
Kirtzidis!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-13 04:32:18 +00:00
Chris Lattner 9e979557ee Default argument cleanups and minor improvements, patch by
Doug Gregor!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 23:52:44 +00:00
Chris Lattner 22cb282b29 final cleanup, the code is now in a reviewable state.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 22:04:18 +00:00
Chris Lattner 8100d74951 move the DeltaTree implementation out of line, remove debugging printfs etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 22:00:40 +00:00
Chris Lattner 77257889f5 remove ifdefs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49587 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 20:34:05 +00:00
Chris Lattner 5c9dc5ac75 Do an initial hack at replacing one of the incredibly inefficient
(but simple!) datastructures in the rewriter with a more complex but
more efficient one.

This replaces the Deltas vector with a specialized BTree that makes
delta lookups much more efficient.  This speeds up -emit-html on a 500K
.i file from 157.154 to 27.127 seconds on my machine (5.8x).

While this code is functional, it isn't very pretty, I have much 
refactoring planned for it, and will remove the USE_VECTOR ifdef.
Stay tuned.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49586 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 20:28:24 +00:00
Argyrios Kyrtzidis 72e62b0c60 Use std::list's push_back instead of resize to add an element.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49582 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 12:38:58 +00:00
Chris Lattner b25e5d79d9 don't diagnose empty source files, thanks Neil!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49575 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 05:54:25 +00:00
Argyrios Kyrtzidis 321f278db3 Fixed comments.
Moved IdDeclInfo class to anonymous namespace.
Replaced array with a std::vector.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49570 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 01:50:47 +00:00
Argyrios Kyrtzidis 87f3ff0c27 Added PushOnScopeChains method to Sema, that adds a decl to both the IdResolver and the Scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49567 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-12 00:47:19 +00:00
Fariborz Jahanian dae1a1a2aa AST generation for objc2's property declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49565 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 23:40:25 +00:00
Ted Kremenek e7bd9c20a9 Add some boilerplate to report memory leaks at the end of an analyzed function.
Still need some boilerplate in BugReporter to report bugs at the end
of a function (not associated with a particular statement).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49564 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 22:25:11 +00:00
Ted Kremenek 11062b1184 Added "GREndPathNodeBuilder", a new node builder that will be used for
evaluating transfer functions at the end-of-path.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 22:03:04 +00:00
Ted Kremenek b8873558cf Added FIXME
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49558 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 20:51:02 +00:00
Ted Kremenek f9561e51e8 Fix regression introduced by my last commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 20:23:24 +00:00
Ted Kremenek a0df99ff6f Changed behavior of how we handle "NULL" summaries: just call
GRSimpleVals::EvalCal(), and don't change reference counts.

Remove "getDoNothingSummary()", as a NULL summary does the same thing.

Added temporary hack for the "Get" rule for objects that return a pointer type:
treat them as non-owned CF objects.

Added test case to detect the release of a non-owned object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 20:11:19 +00:00
Steve Naroff d6a07aaf62 Add class and super class location info to ObjCInterfaceDecl...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 19:35:35 +00:00
Ted Kremenek bcf50ad8c7 Use RangedBugReport to report better ranges for reference count errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49552 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 18:40:51 +00:00
Ted Kremenek 5e55cda64f Added "RangedBugReport".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49551 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 18:40:29 +00:00
Sam Bishop 1bb19638f2 Invoke destructors in Decl::Destroy().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49547 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 18:04:39 +00:00
Fariborz Jahanian 45bc03f920 Minor changes per Chris L's review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49539 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 16:55:42 +00:00
Chris Lattner 8fa3078cfe don't read off the front of the buffer. Thanks to Sam for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 16:20:41 +00:00
Sam Bishop bb45c512e0 Stub out and start using a Decl::Destroy() method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 15:01:25 +00:00
Sam Bishop f3c63ae44e Use the ASTContext allocator when creating deserialized Decl objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49530 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 14:49:10 +00:00
Chris Lattner a2f42b1d18 two new files for previous patch, by Argiris Kirtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49521 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 07:06:57 +00:00
Chris Lattner 7f925cc107 Switch sema to maintaining its own scope chain information for variable
shadowing, instead of threading it through the AST.  This patch contributed
by Argiris Kirtzidis!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49520 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-11 07:00:53 +00:00
Ted Kremenek 940b1d85d3 Fixed some logic errors in the CF ref count checker; we now can detect simple
use-after-release errors.  Added test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 23:44:06 +00:00
Fariborz Jahanian 1d78cc4430 Patch for:
1) objc ivar processing is split out of ActOnField into its own ActOnIvar method.
2) the new objc ivar action takes visibility info directly, eliminating 
  AllVisibilities in ParseObjCClassInstanceVariables.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 23:32:45 +00:00
Ted Kremenek 61b9f870cc Simplify CF ref. count checker state machine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49505 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 23:09:18 +00:00
Ted Kremenek 3ea0b6a087 Fix some bonehead bugs in summary generation in CFRefCount.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 22:58:08 +00:00
Ted Kremenek d71ed26dd8 Refactored all logic to run the GRSimpleVals and CFRef checker into a common
code path in the clang driver.

Renamed options --grsimple to -checker-simple and -check-cfref to -checker-cfref.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 22:16:52 +00:00
Chris Lattner ebe457c344 reduce the amount of 'C++ magic' this code depends on :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49489 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 16:37:40 +00:00
Ted Kremenek f84afb77a0 CFRefCount analysis now properly calls "EmitWarnings" after analyzing a function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49488 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 16:21:09 +00:00
Ted Kremenek 4bb6ac2bb6 When not emitting path diagnostics in BugReporter::EmitWarning(), use the
BugReport-specific SourceRanges (when available).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 16:12:38 +00:00
Ted Kremenek 4d35dacf85 Fixed regressions in error reporting due to copy-paste errors (using the "begin"
iterator instead of "end") and not implementing "getDescription()" for Nil
argument checks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49485 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 16:05:13 +00:00
Chris Lattner e13594279a refactor Parser::ParseStructDeclaration to return a vector of uninterpreted
declarators.  This allows the clients (C structs, objc classes, objc 
properties, [future] C++ classes) etc, to do custom processing before invoking
an action.

This has two benefits in the short term:
1) objc ivar processing should be split out of ActOnField into its own ActOn method.
2) the new objc ivar action can take visibility info directly, eliminating 
   AllVisibilities in ParseObjCClassInstanceVariables.
3) objc properties can pass their own special sauce down to sema as well.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49468 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 06:46:29 +00:00
Chris Lattner 60b1e3ebe4 Simplify lifetime of location object.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49467 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 06:15:14 +00:00
Chris Lattner def026a193 typedef void T;
void f(T);

is only invalid in C++ mode, not C89 mode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49460 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 02:26:16 +00:00
Chris Lattner 8123a95c33 Several improvements from Doug Gregor related to default
argument handling.  I'll fix up the c89 (void) thing next.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 02:22:51 +00:00
Ted Kremenek 05cbe1a44e Hooked up initial reference-count checks to the BugReporter interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49455 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 23:49:11 +00:00
Ted Kremenek 50a6d0ce34 Major refactoring/cleanup of GRExprEngine, ExplodedGraph, and BugReporter.
Bugs are now reported using a combination of "BugType" (previously
BugDescription) and Bug "BugReport" objects, which are fed to BugReporter (which
generates PathDiagnostics). This provides a far more modular way of registering
bug types and plugging in diagnostics.

GRExprEngine now owns its copy of GRCoreEngine, and is not owned by the
ExplodedGraph.

ExplodedGraph is no longer templated on the "checker", but instead on the state
contained in the nodes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49453 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 21:41:14 +00:00
Ted Kremenek 2979ec73b4 The dtor CGObjCRuntime::~CGObjCRuntime() was implemented twice, once
in CGObjCGNU.cpp and once in CGObjCEtoile.cpp.  Moved its definition to
CGObjC.cpp.  This resolves a build error in Xcode, and also cleans things up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 15:51:31 +00:00
Ted Kremenek 70bcba6030 Micro-optimization: Don't use ostringstream when using a C-string literal
will work just fine.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49427 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 15:40:40 +00:00
Ted Kremenek fa34b33e43 Added some boilerplate for emitting warnings from the CF-reference count checker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49414 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 01:10:13 +00:00
Ted Kremenek 6837faa083 Added new "BugReporterHelper" class which is used by BugReporter to emit
checker-specific diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49412 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 00:20:43 +00:00
Ted Kremenek fa5be36172 Don't expand tabs in EscapeText, but rather expand them when writing out
the HTML file.  This should reduce the amount of memory pressure on the
rewriter for files that have a lot of tabs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 22:37:58 +00:00
Ted Kremenek 4ce32cb52b When substituting tabs during HTMLification, only add "&nbsp;" when we are
"escaping" spaces.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 22:28:15 +00:00
Sam Bishop 670aa9d763 Changed the Decl::Kind enum of the ObjCPropertyDecl class, so that it follows
the pattern of the other Decl classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49399 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 20:49:25 +00:00
Chris Lattner 3d1cee3698 Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49370 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 05:04:30 +00:00
Chris Lattner 0442108783 Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-08 04:40:51 +00:00
Ted Kremenek 356708cb33 Add ids for line numbers, allowing us to jump to arbitrary line numbers within
an HTMLified source file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 23:53:30 +00:00
Ted Kremenek 7e54eede40 Tweak message bubble color (gold)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 23:43:44 +00:00
Ted Kremenek 706e3cf2fa Improve BugReport diagnostics for loops and ? operator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49356 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 23:35:17 +00:00
Sam Bishop e2563ca02a Pass the ASTContext object around when deserializing Decl and Stmt objects, so
they can be created using the same allocator as in the "from source code" case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 21:55:54 +00:00
Steve Naroff d77bc28342 Have Parser::FuzzyParseMicrosoftAsmStatement() return the null statement (';').
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 21:06:54 +00:00
Chris Lattner 5426bf6456 random whitespace fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 07:01:58 +00:00
Chris Lattner 8c7bbb5347 fix a bug I introduced in my previous checkin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49327 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:58:21 +00:00
Chris Lattner acc9972da2 simplify array compatibility testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49326 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:56:55 +00:00
Chris Lattner 8f8fc7bdb6 simplify reference handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49325 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:52:53 +00:00
Chris Lattner 6ac46a4a52 move some code around, no other change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49324 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:51:04 +00:00
Chris Lattner 78eca286b0 simplify compatibility testing for tag types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49323 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:49:41 +00:00
Chris Lattner b0489814dc merge compatibility testing of qualified/unqualified interfaces together
and fix a bug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49322 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:38:24 +00:00
Chris Lattner 1ee0700c7d Fix a really bad bug where type uniquing would merge a<x> with b<x> as the same
type, because it did not include a/b in the hash.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:37:47 +00:00
Chris Lattner 42a997c93b MyOtherClass<MyProtocol>* is compatible with MyClass*
if MyClass is a superclass of MyOtherClass, there is no need for
an exact interface match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49320 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 06:06:56 +00:00
Chris Lattner 3cc4c0c305 Remove a dead check for compatible builtin types
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:55:38 +00:00
Chris Lattner 6e26f5db80 futher simplify compatibility testing of objc interface types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:53:18 +00:00
Chris Lattner a36a61f218 ocuvector and vector should be compatible. Fix ASQual compatibility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:43:21 +00:00
Chris Lattner f3692dc4a4 Fix comment typo, do reference eval at the correct type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49315 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:37:56 +00:00
Chris Lattner f62f9cd5a7 simplify vector type compatibility testing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49314 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:36:14 +00:00
Chris Lattner eca7be6b7e move ObjCQualifiedIdTypesAreCompatible out of ASTContext into Sema.
While it is similar to the other compatibility predicates in ASTContext,
it is not used by them and is different.

In addition, greatly simplify ObjCQualifiedIdTypesAreCompatible and
fix some canonical type bugs.  Also, simplify my Type::getAsObjC* methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:30:13 +00:00
Chris Lattner 821a01baa2 Replace an O(n^2) algorithm in areCompatObjCQualInterfaces with
an O(n) algorithm by taking advantage of the fact that the
protocol qualifier list is already guaranteed sorted.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 05:05:41 +00:00
Chris Lattner 88cb27a160 move sorting of qualifying protocols from the parser into
sema.  This allows clients of the parser to have the unmolested 
list if desired, and guarantees that noone can create an
ObjCQualifiedInterfaceType with an unsorted list.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:56:42 +00:00
Chris Lattner 065f0d7b00 eliminate getReferencedProtocols from
ObjCQualifiedIdType/ObjCQualifiedInterfaceType, adding an interator 
interface instead.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49308 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:44:08 +00:00
Chris Lattner 3b27546b42 make QualifiedInterfaceTypesAreCompatible a static function
and start simplifying it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:17:40 +00:00
Chris Lattner 53efc25179 This predicate is just a generic "issuperclass" predicate, move it to the
ObjCInterfaceType as a method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:13:03 +00:00
Chris Lattner c4e4059962 Simplify some objc compatibility testing, make interfaceTypesAreCompatible
a static function named isCompatibleInterfaceAssign.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 04:07:56 +00:00
Chris Lattner 439dbadead simplify the logic in ASTContext::objcTypesAreCompatible
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49302 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 01:30:37 +00:00
Chris Lattner 368eefa081 clean up some logic in objc type handling. Specifically, make it so that
there are QualType::getAsObjc* type methods, and make isa<ObjCInterfaceType>
return true for ObjCQualifiedInterfaceType's.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49300 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 00:27:04 +00:00
Chris Lattner 1361b11066 trivial changes to getFloatingTypeOfSizeWithinDomain, nothing significant.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 23:58:54 +00:00
Chris Lattner 7cfeb08f24 simplify max type computation by making it return an integer (like
getFloatingTypeOrder) instead of a type.  Fix a fixme.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 23:55:33 +00:00
Chris Lattner a75cea3f6b minor simplifications/cleanups to type comparisons.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49296 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 23:38:49 +00:00
Chris Lattner 8bcfc5bef4 remove the Decl::getCanonicalType() method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49295 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 23:10:54 +00:00
Chris Lattner d8bdba5d35 remove a use of getCanonicalType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49294 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 23:09:52 +00:00
Chris Lattner f52ab250ff Start switching clients over from CT.getCanonicalType() to Context.getCanonicalType(CT) for PR2189.
While I'm at it, clean up a bit of maxIntegerType.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49292 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 22:59:24 +00:00
Chris Lattner 77c9647cae introduce a new ASTContext::getCanonicalType method. This is the first
step towards fixing PR2189.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 22:41:35 +00:00
Chris Lattner 37c1b78a20 Use EnumType to simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 22:29:16 +00:00
Chris Lattner 7176331b0f make use of EnumType to simplify some code, eliminate warnings
when assertions are disabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 22:05:18 +00:00
Chris Lattner 2daa5df1b5 Make EnumType/RecordType classof predicates simpler and more efficient in
some cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49287 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 22:04:54 +00:00
Chris Lattner 5edb8bfe84 add a helper EnumType object for asking about tagtypes for enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 21:58:47 +00:00
Gabor Greif 984d0b414b tracking API changes arising from r49277
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 20:42:52 +00:00
Chris Lattner 3420766281 move a semantic check out of the parser into sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49273 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 07:49:57 +00:00
Chris Lattner f97409f352 now that identifier list parsing is split out, simplify handling of
normal typed argument lists.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49272 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 06:57:35 +00:00
Chris Lattner 3825c2eb00 reject 'int test(x, x) int x; {}'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 06:50:56 +00:00
Chris Lattner aaf9ddbeab reject 'typedef int y; int test(x, y)'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49270 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 06:47:48 +00:00
Chris Lattner 50c6477a06 simplify Parser::ParseFunctionDeclaratorIdentifierList
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 06:39:19 +00:00
Chris Lattner 66d2865075 split parsing of identifier lists in function declarators out into
their own method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49268 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 06:34:08 +00:00
Chris Lattner 3e3d310a8c minor simplification
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49267 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 06:03:03 +00:00
Chris Lattner 2a2819a0a8 finish up throw parsing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 06:02:23 +00:00
Chris Lattner ef4715c3fe split code for handling grouping parens in declarators from code that
handles function argument parens in declarators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 05:45:57 +00:00
Chris Lattner a711dd0131 another minor simplification
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 05:27:21 +00:00
Chris Lattner 5dcc6ce4a6 Use token lookahead to simplify some code that is rarely executed.
Since it is rare, the cost is not significant and we enjoy the 
simplification.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 05:26:30 +00:00
Chris Lattner 5619688510 Fix a bug I introduced in my const'ification patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 05:25:03 +00:00
Chris Lattner b048c98359 This patch contains these changes:
-Renamed ContextDecl -> DeclContext
-Removed DeclContext pointer from FieldDecl
-EnumDecl inherits from DeclContext, instead of TagDecl

Patch by Argiris Kirtzidis!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49261 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 04:47:34 +00:00
Chris Lattner 6ccb91abc3 fix css font name, patch by Cédric Venet
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49260 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 04:37:21 +00:00
Chris Lattner 3ae30f8781 templates can't be static.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 04:22:39 +00:00
Chris Lattner e0def7589a fix a number of const qualification bugs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 04:11:27 +00:00
Chris Lattner 5483bdf386 add a missing #include
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 04:02:29 +00:00
Chris Lattner d658b562e8 Fix handling of implicit int, resolving PR2012 and reverting (and
subsuming) my patch for PR1999.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-05 06:32:51 +00:00
Chris Lattner a798ebc826 Step #1 to fixing PR2012: c89 allows declspecs to be completely
missing from function definitions only.  If we see a function 
definiton with missing declspecs, just fudge in an int.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49250 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-05 05:52:15 +00:00
Steve Naroff 0c29b22f43 Support MS-specific integer suffixes (i8, i16, i32, i64, i128).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49229 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 21:02:54 +00:00
Chris Lattner f81557cb71 Fix PR2049, updating Eli's patch that fixes to mainline. This produces incorrect
code, but the codegen doesn't crash.  I'll file a bugzilla for the AST being wrong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49226 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 18:42:16 +00:00
Steve Naroff b6e64c57e4 Rename ScopedDecl::getContext() -> getContextDecl(). Two motivations:
#1: To be consistent with FieldDecl::getContextDecl(), which serves the same purpose.
#2: From my perspective, getContext() is too general (and used by several other classes for different purposes).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 18:15:49 +00:00
Chris Lattner 9b2dc28717 Since isComplexType() no longer returns true for _Complex integers, the code
generator needs to call isAnyComplexType().  This fixes PR1960.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49220 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 16:54:41 +00:00
Chris Lattner 72858c94f1 updates from David.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 15:59:59 +00:00
Chris Lattner be09ededdb various bug fixes, add to xcode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 15:47:22 +00:00
Chris Lattner 7ba9c60ddf initial checkin of Étoilé runtime support, patch by David Chisnall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 15:45:52 +00:00
Steve Naroff e2ef815de1 Add explicit support for diagnosing implicit function decls.
Without this, the diagnostic is very confusing. The diag is now consistent with gcc as well.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49214 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 14:32:09 +00:00
Seo Sanghyeon 63f067f5a7 PR1963: Address of function is a constant expression
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 09:45:30 +00:00
Torok Edwin 730f2c13e8 fix build error: add missing braces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49209 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 06:16:25 +00:00
Chris Lattner 0ed844b04e Introduce ContextDecl, patch by Argiris Kirtzidis!
-Added ContextDecl (no TranslationUnitDecl)
-ScopedDecl class has a ContextDecl member
-FieldDecl class has a ContextDecl member, so that a Field or a ObjCIvar can be traced back to their RecordDecl/ObjCInterfaceDecl easily
-FunctionDecl, ObjCMethodDecl, TagDecl, ObjCInterfaceDecl inherit from ContextDecl. With TagDecl as ContextDecl, enum constants have a EnumDecl as their context.
-Moved Decl class to a "DeclBase.h" along with ContextDecl class
-CurContext is handled by Sema




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49208 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 06:12:32 +00:00
Chris Lattner c8aa5f1f26 Codegen assignment to self correctly, patch by David Chisnall!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49201 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 04:07:35 +00:00
Nate Begeman 1330b0e6e4 Ignore qualifiers when checking vector operands, just like scalar operands.
This prevents things like 
a += b[0]; where a is a float4 and b is a float4 * (address_space 1)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49199 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-04 01:30:25 +00:00
Ted Kremenek 7956f754f8 Added investigate patch for an occasionally failing assertion (heisenbug?)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49193 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 21:44:24 +00:00
Nate Begeman dbebb73b86 Teach clang how to codegen punpcklbw and punpcklwd
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49186 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 19:58:06 +00:00
Ted Kremenek a2fdbf5245 Better range highlight for undefined-argument checks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 18:52:25 +00:00
Ted Kremenek a7bf7e79cc When reporting "bad receiver" warnings, highlight the receiver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49183 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 18:46:16 +00:00
Ted Kremenek de7161fa68 Use "getRanges" in default implementation of "getEndPath" to determine
the ranges of highlighted elements in the source code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49181 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 18:00:37 +00:00
Ted Kremenek f1ae705460 Hooked up GRSimpleAPICheck and the simple Objective-C Foundation checks to use
the new BugReporter interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 17:57:38 +00:00
Ted Kremenek 1758b07ef7 Added "getLogicalLineNumber" and "getLogicalColumnNumber" to FullSourceLoc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 17:55:15 +00:00
Sam Bishop 0f9c72f505 trivial whitespace fix
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49160 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 14:20:28 +00:00
Ted Kremenek 70d1722c90 Handle the case when getEndPath() returns NULL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49155 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 07:33:55 +00:00
Ted Kremenek 49cd6354d5 Some cleanups in EscapeText and AddLineNumbers. Still investigating performance
issues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 07:12:29 +00:00
Chris Lattner fce71b8ea5 Fix PR2081 (problems codegen'ing some recursive structures) patch
by Lauro Venancio!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49144 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 05:50:42 +00:00
Sam Bishop 71de20ef8b Created a destructor so that the top-level decls can be deleted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 05:35:20 +00:00
Ted Kremenek 1c1924525d Add back bug name to PathDiagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 05:23:19 +00:00
Chris Lattner bc896f58c7 Fix a bug where we didn't check the RHS for null, we checked
the LHS for null twice.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 05:07:25 +00:00
Chris Lattner 988ee6ef54 qualifier comparisons should be done on canonical types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 05:07:04 +00:00
Sam Bishop 8266d7f620 Call "delete" on the body of FunctionDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 05:01:04 +00:00
Ted Kremenek 94826a7910 When creating PathDiagnostics, created a trimmed graph first and report the
BFS path to the root.  This also avoids problems with loops in the ExplodedGraph.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 04:59:14 +00:00
Ted Kremenek 61f3e05805 Created new path-sensitive bug-reporting scheme based on the classes
"BugReporter" and "BugDescription".  BugDescription is used to describe
a bug and provide pieces of the PathDiagnostic, and BugReporter creates
the actual PathDiagnostic by crawling through the ExplodedGraph.

Migrated checks done by GRSimpleVals to be reported using the new BugReporter
mechanism.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49127 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 04:42:52 +00:00
Ted Kremenek 9e628a02f4 CSS tweaking on blue boxes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49121 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 22:50:50 +00:00
Ted Kremenek 07b39fc389 80 col violation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49120 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 22:08:09 +00:00
Ted Kremenek 87abc03d3d Added more PathDiagnostic rendering for terminators: switch, goto, loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49119 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 22:03:53 +00:00
Ted Kremenek f23621f1fc Blue diagnostic boxes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49117 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 21:14:04 +00:00
Ted Kremenek 718ceb13e0 Added path sequence numbers in HTML output of PathDiagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49116 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 21:04:20 +00:00
Steve Naroff 3110251f13 Change ObjCInterfaceDecl to inherit from NamedDecl (not TypeDecl). While ObjCInterfaceDecl is arguably a TypeDecl, it isn't a ScopedDecl. Since TypeDecl's are scoped, it makes sense to simply treat them as NamedDecl's. I could have fiddled a bit more with the hierarchy (in terms of creating a non-scoped TypeDecl), however this probably isn't worth the effort.
I also finished unifying access to scope decl change by converting Sema::getObjCInterfaceDecl() to use Sema::LookupDecl(). This is much cleaner now:-)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49107 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 18:30:49 +00:00
Ted Kremenek 3cc9fdc8c9 Shorted bug-description.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 18:02:54 +00:00
Chris Lattner 423a3c9c27 simplify some code by using PointerLikeType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49101 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 17:45:06 +00:00
Chris Lattner bdcd637c29 add a common base class "PointerLikeType" for PointerType and ReferenceType,
allowing them to be treated the same in some contexts.  A suggestion for a
better name is welcome :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49100 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 17:35:06 +00:00
Chris Lattner 987798ad1d properly handle array decay in objc message exprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 17:17:33 +00:00
Steve Naroff b327ce0295 Two changes to Sema::LookupDecl() interface.
(1) Remove IdLoc (it's never used). 
(2) Add a bool to enable/disable lazy builtin creaation (defaults to true).

This enables us to use LookupDecl() in Sema::isTypeName(), which is also part of this commit.

To make this work, I changed isTypeName() to be a non-const member function. I'm not happy with this, however I fiddled with making LookupDecl() and friends const and it got ugly pretty quickly. We can certainly add it back if/when someone has time to fiddle with it. For now, I thought this simplification was more important than retaining the const-ness. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49087 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 14:35:35 +00:00
Ted Kremenek dd5981177b Beginning of some cleanups; start generating path diagnostics using objects
that describe a bug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 07:05:46 +00:00
Chris Lattner d805bec0fb Various parts of the standard require something to be an "incomplete or
object type".  Add a predicate that checks exactly this, as it is equivalent
to checking ot see if the type is *not* a function type, which is faster
to check.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 06:59:01 +00:00
Chris Lattner 96b77fc05e 1) Enforce C99 6.7.3p2: "Types other than pointer types derived from
object or incomplete types shall not be restrict-qualified."

2) Warn about qualifiers on function types: C99 6.7.3p8: "If the 
specification of a function type includes any type qualifiers, the 
behavior is undefined."

3) Implement restrict on C++ references.

4) fix some locations for various C++ reference diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49081 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 06:50:17 +00:00
Chris Lattner d965455756 Add a citation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49080 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 06:06:35 +00:00
Chris Lattner e6327747b7 Fix several bugs in array -> pointer decomposition.
First, we got several CVR propagation cases wrong, which Eli pointed
out in PR2039.

Second, we didn't propagate address space qualifiers correctly, leading
to incorrect lowering of code in CodeGen/address-space.c.

Third, we didn't uniformly propagate the specifier in the array to the
pointer ("int[restrict 4]" -> "int *restrict").

This adds an ASTContext::getArrayDecayedType member that handles the 
non-trivial logic for this seemingly simple operation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49078 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 05:18:44 +00:00
Ted Kremenek 503d613235 Added initial hacked support for display path diagnostics with
GRSimpleVals warnings.  Cleaning up, but now we get multiple bubbles (branches are annotated).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49077 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 05:15:22 +00:00
Chris Lattner 8527f82594 remove blank line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 05:09:38 +00:00
Chris Lattner bad37858ae print cvr qualifiers on simplified typedefs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49074 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 05:06:23 +00:00
Chris Lattner f0467b39b5 rename some variables, fix 80 col violation. No
functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 04:24:33 +00:00
Chris Lattner fd89bc8250 Fix PR2017 and silence some bogus errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49068 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 01:05:10 +00:00
Steve Naroff c822ff47d2 Fix a comment typo and add a couple suggestions from Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49066 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-02 00:39:51 +00:00
Steve Naroff e8043c3917 Fairly large "cleaup" related to changing ObjCCompatibleAliasDecl superclass (to inherit from NamedDecl, instead of ScopedDecl).
- Added a DenseMap to associate an IdentifierInfo with the ObjCCompatibleAliasDecl.
- Renamed LookupScopedDecl->LookupDecl and changed it's return type to Decl. Also added lookup for ObjCCompatibleAliasDecl's.
- Removed Sema::LookupInterfaceDecl(). Converted clients to used LookupDecl().
- Some minor indentation changes.

Will deal with ObjCInterfaceDecl and getObjCInterfaceDecl() in a separate commit...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49058 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 23:04:06 +00:00
Ted Kremenek a6fb4e07ed Patch by Argiris Kirtzidis: Fix a dangling pointer error!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 22:35:58 +00:00
Chris Lattner 35de512b9c Update to match simplified llvm MemoryBuffer interfaces for files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49042 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 18:04:30 +00:00
Chris Lattner be2ab45def prune dead #includes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49033 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 06:08:11 +00:00
Chris Lattner 3c1f7b615c MemoryBuffer::getFile got smarter, obviating the need for readfilefast.
The new MemoryBuffer doesn't "leak" file descriptors and handles the
small file case efficiently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49032 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-01 06:06:37 +00:00
Ted Kremenek 8fb001684f Better handling for tabs with message bubbles.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 23:14:05 +00:00
Ted Kremenek 6bb205c469 Do not prepend the keyword "[CHECKER]" to checker messages when using
a PathDiagnosticClient.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48996 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 20:42:43 +00:00
Steve Naroff ff721524ec Hack ReadFileFast() to raise the threshold of memory mapped files (from 4->12 pages).
This is a temporary solution to avoid running out of file descriptors (which defaults to 256).

Need to benchmark to understand the speed benefit. If the benefit is small, the simple solution is to avoid memory mapping files. If the benefit is significant, more thought is necessary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48991 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 18:44:59 +00:00
Ted Kremenek 5297e5ffc5 Include ranges in GRSimpleVals diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48990 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 18:44:32 +00:00
Ted Kremenek 4dc41cc8de Inlined clang/Analysis/Analyses/GRSimpleVals.h into LocalCheckers.h and removed
GRSimpleVals.h

Added a PathDiagnosticClient option to the driver functions for the
CFRefCountChecker and the GRSimpleVals analysis. Both analyses now accept a "-o"
argument from the driver that specifies where HTML reports should be dumped.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48989 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 18:26:32 +00:00
Ted Kremenek 615f517709 Added variation of the "Report" method in the class Diagnostic that takes
an optional DiagnosticClient argument that differs from the client stored
internally in the Diagnostic object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48986 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 18:23:15 +00:00
Ted Kremenek 02737ed29d Added path-sensitive check for return statements that return the address
of a stack variable.  This is the path-sensitive version of a check that
is already done during semantic analysis.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48980 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 15:02:58 +00:00
Chris Lattner 8a934233d1 rename Decl::CompatibleAlias -> ObjCCompatibleAlias.
Fix objc ivar lookup.  Ivar lookup should occur between lookup
of method-local values and lookup of globals.  Emulate this with
some logic in the handling of Sema::ActOnIdentifierExpr.

Two todo's left:
 1) sema shouldn't turn a bare reference to an ivar into "self->ivar"
    in the AST.  This is a hack.
 2) The new ScopedDecl::isDefinedOutsideFunctionOrMethod method does
    not correctly handle typedefs and enum constants yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48972 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-31 00:36:02 +00:00
Chris Lattner ce5605ecf7 some cleanups on top of David's patch. There are still two
remaining open issues I've communicated to him:

1) self can be assigned to, and his patch didn't handle it correctly.
2) CollectObjCIvarTypes is N^2 (because each subclass reprocesses
   all parent class ivars) and flattens classes.  If A derives from B, 
   and both have an int, I'd expect to get { {i32}, i32}, not { i32, i32}.

David, please review.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-30 23:25:33 +00:00
Chris Lattner 391d77a263 Add initial support for objc codegen for methods, ivars, and the
etoile runtime, patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48969 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-30 23:03:07 +00:00
Steve Naroff 95110968dc Make sure Sema::ActOnClassMessage() correctly diagnoses "super".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 21:37:05 +00:00
Ted Kremenek 8730e130ab Added skeleton checking for NSString's method initWithFormat: (do not pass nil). This won't be useful in most cases right now
because the analyzer isn't tracking expected types for an object, and [NSString alloc] just runs "id".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-28 16:09:38 +00:00
Ted Kremenek 4ba6283f9c Expanded NSString checking to check for nil for a few more methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 22:05:32 +00:00
Ted Kremenek 9b3fdeaca3 Add line SourceLocation to NSString checks.
Added test case to test warning about passing 'nil' to NSString's compare: method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48896 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 21:23:57 +00:00
Ted Kremenek e5d5c204c7 Hooked up initial NSString interface checking to GRSimpleVals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48895 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 21:15:17 +00:00
Ted Kremenek 487f827a7f Minor CSS tweaking (smaller h1 tags).
Bug fix in EscapeText (for std::string) where spaces were not properly emitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 17:28:58 +00:00
Ted Kremenek 527556184b Add creation of BasicObjCFoundationChecks when running GRSimpleVals from the driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48886 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 17:17:22 +00:00
Ted Kremenek 053ef593fa Add html::EscapeText for std::string; use this function to escape text in message bubbles.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 17:15:29 +00:00
Ted Kremenek 2e93981a62 Added <h3> tag in HTML file output that contains the name of the source file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48869 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 07:35:49 +00:00
Ted Kremenek 99c6ad3f22 Added "GRAuditor" and "GRSimpleAPICheck" interface to allow simple stateless checkers to be injected into the analyzer.
Added "AnnotatedPath" class to record an annotated path that will be useful for inspecting paths.
Added some boilerplate code for simple checks of Apple's Foundation API.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48867 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 07:25:52 +00:00
Ted Kremenek 120187de4b PathDiagnosticPiece no longer contains a vector of strings; just one string.
PathDiagnostic no longer contains a diagnostic ID or diagnostic level.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48864 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 06:16:40 +00:00
Ted Kremenek d3abcdfa30 Added classes "PathDiagnosticPiece", "PathDiagnostic", and "PathDiagnosticClient", which encapsulate diagnostic reporting for paths.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48861 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-27 03:49:32 +00:00
Ted Kremenek a056b4f7f0 Bug fix: use GetRVal instead of GetLVal (were getting the value of a DeclRefExpr, not it's address).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48846 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 22:21:58 +00:00
Ted Kremenek 5af373a0c2 Bug fix in transfer function for ObjCMessageExpr: Visit the receiver expression as an ordinary expression, not using VisitLVal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48842 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 21:36:08 +00:00
Steve Naroff c5e2f34df1 Alloc redeclaration of typedefs within ExternCSystemHeaderDir's AND SystemHeaderDir's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 21:27:00 +00:00
Nuno Lopes 8c1a9a80ba allow the format attribute to be specified in function pointer prototypes
# this is my first commit here, so please be gentle :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 23:01:48 +00:00
Nate Begeman 8e7dafec4b Extend QualType::getAddressSpace to do the right thing for array types, and in
the future, RecordTypes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 18:36:32 +00:00
Ted Kremenek dbfe41acda GRSimple analysis now outputs additional diagnostic warnings about
passing an uninitialized value to a message expresion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 16:40:05 +00:00
Ted Kremenek b9308372e0 Tweak to transfer function for ObjCMessageExpr: handle both instance methods
and message expressions with a specified receiver.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48773 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 16:07:41 +00:00
Ted Kremenek 23a4f917cd Added logic to check for uninitialized values as the receivers for message expressions
and uninitialized values passed-by-value as arguments to message expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48760 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 02:10:28 +00:00
Ted Kremenek 55deb97341 Added initial transfer function support for ObjCMessageExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48757 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 00:34:37 +00:00
Ted Kremenek 9d4e659fce Minor CSS tweaking: use webkit style CSS properties for shadows/rounded edges
for message bubbles.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48754 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 23:38:32 +00:00
Chris Lattner ea301e15a6 Avoid overflowing buffer, patch by Algeris Kirtzidis!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48741 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 21:14:55 +00:00
Ted Kremenek 5fb5c6afbb Changed merge operation for uninitialized values analysis to "intersect" (previous union).
The effect is that if a variable is uninitialized along a branch (but initialized along another), at merge points it is considered uninitialized.  Previously we had the opposite behavior.  The new behavior is more conservative, and more in line with gcc's behavior.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-22 20:11:00 +00:00
Ted Kremenek 0e561a3e67 Rename "Nodify" to "MakeNode"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48659 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 21:30:14 +00:00
Sam Bishop 9a4939f7ed Plug a memory leak in the "this macro expands into a single trivially-
expanded token" case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48637 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 07:13:02 +00:00
Ted Kremenek fa59f1f053 LiveVariables analysis now uses intersect for the merge of block-level expression liveness information.
The rationale is that a block-level expression cannot be live in a parent block unless it is live in all of the successor blocks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48618 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-20 21:46:49 +00:00
Ted Kremenek 0f1b67bc25 Added HTML highlighting for ranges.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 23:55:53 +00:00
Steve Naroff 0d755ad7d8 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48571 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 23:46:26 +00:00
Steve Naroff 657aefe011 Fix http://llvm.org/bugs/show_bug.cgi?id=2161.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48568 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 23:07:49 +00:00
Ted Kremenek eeacc5203a Change colors of HTML message bubble.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48563 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 22:44:21 +00:00
Ted Kremenek db87ca09df More CSS enhancements to HTML code printing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48557 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 22:06:25 +00:00
Ted Kremenek e8e019ede1 Misc. cleanups to HTML printing: make code rendered using tables; add
better div positioning for messages.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 21:59:05 +00:00
Ted Kremenek 13e479b2b7 Initial experimentation with adding boxed "annotations" to HTMLized source.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48540 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 07:53:42 +00:00
Ted Kremenek ad0a203130 Moved generation of html header/footer with builtin CSS to the rewriter library.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48537 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 06:14:37 +00:00
Chris Lattner 572cf09ae8 simplify code by using the variadic StructType::get method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 05:24:56 +00:00
Chris Lattner 36b6a0a63e simplify the clang codegen by using the new Builder.CreateStructGEP method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 05:19:41 +00:00
Ted Kremenek d6c1360c2b More cleanups to the HTML rewriter (with line formatting), with better
pretty-printing of line numbers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 05:07:26 +00:00
Ted Kremenek f7768bc7a3 Change "style" to "class" in HTML output.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 01:44:27 +00:00
Ted Kremenek f830997de6 More cleanups to HTML rewriter API: remove the InsertTag method; was too complicated
and clients can achieve a cleaner design just by inserting tags directly.  Reserve
the "html" namespace for meta-level operations (e.g., escaping text, etc.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48524 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 01:30:02 +00:00
Ted Kremenek 1b3188cfc2 More HTML rewriter cleanups. Preliminary CSS support in code pretty-printing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48518 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 23:55:46 +00:00
Ted Kremenek b485cd1e0a Some cleanups to the HTMLRewrite API. Added support for printing out line
numbers (more work to be done on aesthetics).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48512 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 23:08:51 +00:00
Ted Kremenek c22efea6f9 Modified "InsertTag" (HTML rewriter) to have an optional "OutermostTag" flag to
indicate whether or not the new tag should be the outermost tag at the specified
location (in the case that other tags have been inserted at the same spot).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 21:26:34 +00:00
Ted Kremenek 6a34083e9f Added the beginning of a set of rewriter functions for pretty-printing source
code as HTML.  Added a new driver option "--emit-html" to dump the source
of the main input file as HTML.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48505 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 21:19:49 +00:00
Ted Kremenek 886c8db545 Added variant of "InsertText" in the Rewriter to support inserting text both
*before* and after a specific location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 21:17:59 +00:00
Ted Kremenek 88ad97f177 Bug fix in RewriteBuffer::getMappedOffset: potentially multiple deltas
need to be skipped over when AfterInserts == true, as multiple deltas
may share the same FileLoc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 21:00:57 +00:00
Chris Lattner f90a248578 move #include to the file that needs it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48485 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 05:59:11 +00:00
Ted Kremenek 58cda6ff1c Fix assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48470 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 22:18:22 +00:00
Ted Kremenek 14a1140c9f Fix integer overflow bug when processing switch statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48469 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 22:17:56 +00:00
Ted Kremenek 7ffa0aad4c Properly hook up inline asm transfer function logic to the main GRExprEngine logic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48468 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 21:31:48 +00:00
Ted Kremenek ef44bfb9d0 Added initial transfer function support for inline asm.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48466 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 21:11:24 +00:00
Nate Begeman 9c167115e9 Check in a couple fixes for vector extensions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 17:22:18 +00:00
Ted Kremenek a716d7a575 Bug fix in CFG construction: VisitCompoundStmt should return the last created block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48460 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 17:19:44 +00:00
Chris Lattner f4af515457 clean up property memory allocation to move it into the ast classes
like the rest of the classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48434 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-17 01:19:02 +00:00
Chris Lattner 55d13b4d55 make property addition work list all other "add" methods. Do
the allocation in the class, not in sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48433 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 21:23:50 +00:00
Chris Lattner f8d17a5916 add the last two Create methods for decls, woo!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48432 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 21:17:37 +00:00
Chris Lattner 75c9cae5f8 add two more Create methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48428 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 20:53:07 +00:00
Chris Lattner 68c82cf612 simplify the way ObjCCategoryDecl's get their referenced protocols list
specified.  Previously, the ctor would allocate memory for the list and then
it would get filled in later.  Move the allocation+filling in to be more 
consistent with other stuff, e.g. the addMethods method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48427 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 20:47:45 +00:00
Chris Lattner 61f9d41036 Add create methods for ObjCCategoryDecl, ObjCForwardProtocolDecl, ObjCClassDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48426 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 20:34:23 +00:00
Chris Lattner c858105d41 minor cleanups, make getNumInstanceMethods always return unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48423 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 20:19:15 +00:00
Chris Lattner 439e71f4be fix a crasher where an invalid program that multiply defined
a protocol could smash more references in than are allocated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48411 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 01:25:17 +00:00
Chris Lattner cca59d77c4 Give ObjCProtocolDecl a Create method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48410 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 01:23:04 +00:00
Chris Lattner f962808120 hoist a bunch of casting.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48409 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 01:16:52 +00:00
Chris Lattner 0e77ba0bf7 Add create methods for ObjCIvarDecl and ObjCInterfaceDecl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 01:15:50 +00:00
Chris Lattner 58cce3b0dc Make the parameter count of ObjCMethodDecl unsigned, you
can't have negative arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 01:07:14 +00:00
Chris Lattner b06fa3b869 remove some dead arguments to ObjCMethodDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 00:58:16 +00:00
Chris Lattner 6c4ae5de0c Give ObjCMethodDecl a Create method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 00:49:28 +00:00
Chris Lattner 1e03a561f4 Split objc decl implementation out into DeclObjC.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 00:19:01 +00:00
Chris Lattner 8e25d86818 switch the rest of the C decl classes to do their
allocation through ASTContext.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48403 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-16 00:16:02 +00:00
Chris Lattner bda0b626e7 Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it.  This follows the main
llvm tree, and allows the libraries to be built in parallel.  The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in.  This speeds
up parallel builds, particularly incremental ones.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-15 23:59:48 +00:00