Commit Graph

32160 Commits

Author SHA1 Message Date
Chris Lattner 0e91b41902 typedef void T;
void f(T);

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

llvm-svn: 49460
2008-04-10 02:26:16 +00:00
Chris Lattner 58258246ec Several improvements from Doug Gregor related to default
argument handling.  I'll fix up the c89 (void) thing next.

llvm-svn: 49459
2008-04-10 02:22:51 +00:00
Ted Kremenek c8bef6a076 Hooked up initial reference-count checks to the BugReporter interface.
llvm-svn: 49455
2008-04-09 23:49:11 +00:00
Ted Kremenek 7acc3a36ef 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.

llvm-svn: 49453
2008-04-09 21:41:14 +00:00
Ted Kremenek 43e0633048 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.

llvm-svn: 49429
2008-04-09 15:51:31 +00:00
Ted Kremenek f17d5758fc Micro-optimization: Don't use ostringstream when using a C-string literal
will work just fine.

llvm-svn: 49427
2008-04-09 15:40:40 +00:00
Ted Kremenek ce8e881dc3 Added some boilerplate for emitting warnings from the CF-reference count checker.
llvm-svn: 49414
2008-04-09 01:10:13 +00:00
Ted Kremenek 3cef454e2e Added new "BugReporterHelper" class which is used by BugReporter to emit
checker-specific diagnostics.

llvm-svn: 49412
2008-04-09 00:20:43 +00:00
Ted Kremenek 5f7ece0bff 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.

llvm-svn: 49406
2008-04-08 22:37:58 +00:00
Ted Kremenek b1f773ca98 When substituting tabs during HTMLification, only add " " when we are
"escaping" spaces.

llvm-svn: 49404
2008-04-08 22:28:15 +00:00
Sam Bishop 506215c708 Changed the Decl::Kind enum of the ObjCPropertyDecl class, so that it follows
the pattern of the other Decl classes.

llvm-svn: 49399
2008-04-08 20:49:25 +00:00
Chris Lattner 199abbcb26 Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!

llvm-svn: 49370
2008-04-08 05:04:30 +00:00
Chris Lattner aa9c7aed0f Add support for C++ default arguments, and rework Parse-Sema
interaction for function parameters, fixing PR2046.

Patch by Doug Gregor!

llvm-svn: 49369
2008-04-08 04:40:51 +00:00
Ted Kremenek a9077ab6b7 Add ids for line numbers, allowing us to jump to arbitrary line numbers within
an HTMLified source file.

llvm-svn: 49359
2008-04-07 23:53:30 +00:00
Ted Kremenek bd1bd88423 Tweak message bubble color (gold)
llvm-svn: 49357
2008-04-07 23:43:44 +00:00
Ted Kremenek e73006ee45 Improve BugReport diagnostics for loops and ? operator.
llvm-svn: 49356
2008-04-07 23:35:17 +00:00
Sam Bishop e0680b7e7a 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.

llvm-svn: 49353
2008-04-07 21:55:54 +00:00
Steve Naroff fba3942438 Have Parser::FuzzyParseMicrosoftAsmStatement() return the null statement (';').
llvm-svn: 49349
2008-04-07 21:06:54 +00:00
Chris Lattner 4ba0cef93b random whitespace fixes.
llvm-svn: 49328
2008-04-07 07:01:58 +00:00
Chris Lattner fa00732562 fix a bug I introduced in my previous checkin.
llvm-svn: 49327
2008-04-07 06:58:21 +00:00
Chris Lattner e6b27c6ecd simplify array compatibility testing.
llvm-svn: 49326
2008-04-07 06:56:55 +00:00
Chris Lattner 7460fd297d simplify reference handling.
llvm-svn: 49325
2008-04-07 06:52:53 +00:00
Chris Lattner 49af6a4beb move some code around, no other change.
llvm-svn: 49324
2008-04-07 06:51:04 +00:00
Chris Lattner ec646834e7 simplify compatibility testing for tag types.
llvm-svn: 49323
2008-04-07 06:49:41 +00:00
Chris Lattner 3c7961597f merge compatibility testing of qualified/unqualified interfaces together
and fix a bug.

llvm-svn: 49322
2008-04-07 06:38:24 +00:00
Chris Lattner 64bf6ba308 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.

llvm-svn: 49321
2008-04-07 06:37:47 +00:00
Chris Lattner c9062d01d7 MyOtherClass<MyProtocol>* is compatible with MyClass*
if MyClass is a superclass of MyOtherClass, there is no need for
an exact interface match.

llvm-svn: 49320
2008-04-07 06:06:56 +00:00
Chris Lattner 7bbd3d75ef Remove a dead check for compatible builtin types
llvm-svn: 49319
2008-04-07 05:55:38 +00:00
Chris Lattner 90bef90ad4 futher simplify compatibility testing of objc interface types.
llvm-svn: 49318
2008-04-07 05:53:18 +00:00
Chris Lattner 9555466f7e ocuvector and vector should be compatible. Fix ASQual compatibility.
llvm-svn: 49316
2008-04-07 05:43:21 +00:00
Chris Lattner aee96c3a90 Fix comment typo, do reference eval at the correct type.
llvm-svn: 49315
2008-04-07 05:37:56 +00:00
Chris Lattner f8a6b4d4fc simplify vector type compatibility testing.
llvm-svn: 49314
2008-04-07 05:36:14 +00:00
Chris Lattner 2a3569b5d9 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.

llvm-svn: 49313
2008-04-07 05:30:13 +00:00
Chris Lattner ae947fe3f9 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.

llvm-svn: 49312
2008-04-07 05:05:41 +00:00
Chris Lattner e0ea37ace7 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.

llvm-svn: 49310
2008-04-07 04:56:42 +00:00
Chris Lattner bd7981a978 eliminate getReferencedProtocols from
ObjCQualifiedIdType/ObjCQualifiedInterfaceType, adding an interator 
interface instead.

llvm-svn: 49308
2008-04-07 04:44:08 +00:00
Chris Lattner f96084ee73 make QualifiedInterfaceTypesAreCompatible a static function
and start simplifying it.

llvm-svn: 49307
2008-04-07 04:17:40 +00:00
Chris Lattner ae1b6078e3 This predicate is just a generic "issuperclass" predicate, move it to the
ObjCInterfaceType as a method.

llvm-svn: 49306
2008-04-07 04:13:03 +00:00
Chris Lattner ddfdaf9a69 Simplify some objc compatibility testing, make interfaceTypesAreCompatible
a static function named isCompatibleInterfaceAssign.

llvm-svn: 49305
2008-04-07 04:07:56 +00:00
Chris Lattner f8c3e82897 simplify the logic in ASTContext::objcTypesAreCompatible
llvm-svn: 49302
2008-04-07 01:30:37 +00:00
Chris Lattner ba5862e74c 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.

llvm-svn: 49300
2008-04-07 00:27:04 +00:00
Chris Lattner b9dfb03ddb trivial changes to getFloatingTypeOfSizeWithinDomain, nothing significant.
llvm-svn: 49298
2008-04-06 23:58:54 +00:00
Chris Lattner d4bacd68bf simplify max type computation by making it return an integer (like
getFloatingTypeOrder) instead of a type.  Fix a fixme.

llvm-svn: 49297
2008-04-06 23:55:33 +00:00
Chris Lattner b90739d556 minor simplifications/cleanups to type comparisons.
llvm-svn: 49296
2008-04-06 23:38:49 +00:00
Chris Lattner fc4379f916 remove the Decl::getCanonicalType() method.
llvm-svn: 49295
2008-04-06 23:10:54 +00:00
Chris Lattner f1e4ec2898 remove a use of getCanonicalType.
llvm-svn: 49294
2008-04-06 23:09:52 +00:00
Chris Lattner 76a00cf3ff Start switching clients over from CT.getCanonicalType() to Context.getCanonicalType(CT) for PR2189.
While I'm at it, clean up a bit of maxIntegerType.

llvm-svn: 49292
2008-04-06 22:59:24 +00:00
Chris Lattner ed0d0795ff introduce a new ASTContext::getCanonicalType method. This is the first
step towards fixing PR2189.

llvm-svn: 49291
2008-04-06 22:41:35 +00:00
Chris Lattner 7d9b6a9d50 Use EnumType to simplify some code.
llvm-svn: 49289
2008-04-06 22:29:16 +00:00
Chris Lattner 8b23c25b21 make use of EnumType to simplify some code, eliminate warnings
when assertions are disabled.

llvm-svn: 49288
2008-04-06 22:05:18 +00:00
Chris Lattner e07e912f5e Make EnumType/RecordType classof predicates simpler and more efficient in
some cases.

llvm-svn: 49287
2008-04-06 22:04:54 +00:00
Chris Lattner 3fb61c1fbb add a helper EnumType object for asking about tagtypes for enums.
llvm-svn: 49286
2008-04-06 21:58:47 +00:00
Gabor Greif d36afd7d65 tracking API changes arising from r49277
llvm-svn: 49279
2008-04-06 20:42:52 +00:00
Chris Lattner 784903e4c1 move a semantic check out of the parser into sema.
llvm-svn: 49273
2008-04-06 07:49:57 +00:00
Chris Lattner 371ed4e7a9 now that identifier list parsing is split out, simplify handling of
normal typed argument lists.

llvm-svn: 49272
2008-04-06 06:57:35 +00:00
Chris Lattner 285a3e47be reject 'int test(x, x) int x; {}'
llvm-svn: 49271
2008-04-06 06:50:56 +00:00
Chris Lattner 67b450cb48 reject 'typedef int y; int test(x, y)'.
llvm-svn: 49270
2008-04-06 06:47:48 +00:00
Chris Lattner 9186f556cc simplify Parser::ParseFunctionDeclaratorIdentifierList
llvm-svn: 49269
2008-04-06 06:39:19 +00:00
Chris Lattner 6c940e6e6a split parsing of identifier lists in function declarators out into
their own method.

llvm-svn: 49268
2008-04-06 06:34:08 +00:00
Chris Lattner 69740a60b6 minor simplification
llvm-svn: 49267
2008-04-06 06:03:03 +00:00
Chris Lattner 65dd843cb4 finish up throw parsing.
llvm-svn: 49266
2008-04-06 06:02:23 +00:00
Chris Lattner c0a1c7d387 split code for handling grouping parens in declarators from code that
handles function argument parens in declarators.

llvm-svn: 49265
2008-04-06 05:45:57 +00:00
Chris Lattner c439f0de6d another minor simplification
llvm-svn: 49264
2008-04-06 05:27:21 +00:00
Chris Lattner 521ff2b430 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.

llvm-svn: 49263
2008-04-06 05:26:30 +00:00
Chris Lattner 713e6592be Fix a bug I introduced in my const'ification patch.
llvm-svn: 49262
2008-04-06 05:25:03 +00:00
Chris Lattner 0a5ff0d34a This patch contains these changes:
-Renamed ContextDecl -> DeclContext
-Removed DeclContext pointer from FieldDecl
-EnumDecl inherits from DeclContext, instead of TagDecl

Patch by Argiris Kirtzidis!

llvm-svn: 49261
2008-04-06 04:47:34 +00:00
Chris Lattner e8e1e1131d fix css font name, patch by Cédric Venet
llvm-svn: 49260
2008-04-06 04:37:21 +00:00
Chris Lattner 1e830c07a2 templates can't be static.
llvm-svn: 49258
2008-04-06 04:22:39 +00:00
Chris Lattner 157dd0811e fix a number of const qualification bugs.
llvm-svn: 49257
2008-04-06 04:11:27 +00:00
Chris Lattner c4f02b6bed add a missing #include
llvm-svn: 49256
2008-04-06 04:02:29 +00:00
Chris Lattner 9d51f2b9d4 Fix handling of implicit int, resolving PR2012 and reverting (and
subsuming) my patch for PR1999.

llvm-svn: 49251
2008-04-05 06:32:51 +00:00
Chris Lattner 94fc8063b4 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.

llvm-svn: 49250
2008-04-05 05:52:15 +00:00
Steve Naroff a1f414517c Support MS-specific integer suffixes (i8, i16, i32, i64, i128).
llvm-svn: 49229
2008-04-04 21:02:54 +00:00
Chris Lattner 579a05d767 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.

llvm-svn: 49226
2008-04-04 18:42:16 +00:00
Steve Naroff c7d38433cd 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).

llvm-svn: 49224
2008-04-04 18:15:49 +00:00
Chris Lattner f3bc75afcf Since isComplexType() no longer returns true for _Complex integers, the code
generator needs to call isAnyComplexType().  This fixes PR1960.

llvm-svn: 49220
2008-04-04 16:54:41 +00:00
Chris Lattner 019193acea updates from David.
llvm-svn: 49217
2008-04-04 15:59:59 +00:00
Chris Lattner 15c6b7c948 various bug fixes, add to xcode project.
llvm-svn: 49216
2008-04-04 15:47:22 +00:00
Chris Lattner 6175bbbee2 initial checkin of Étoilé runtime support, patch by David Chisnall
llvm-svn: 49215
2008-04-04 15:45:52 +00:00
Steve Naroff 3913ea4bfb Add explicit support for diagnosing implicit function decls.
Without this, the diagnostic is very confusing. The diag is now consistent with gcc as well.

llvm-svn: 49214
2008-04-04 14:32:09 +00:00
Seo Sanghyeon 055c94f2f8 PR1963: Address of function is a constant expression
llvm-svn: 49212
2008-04-04 09:45:30 +00:00
Torok Edwin 602647aa70 fix build error: add missing braces.
llvm-svn: 49209
2008-04-04 06:16:25 +00:00
Chris Lattner c5ffed4a66 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

llvm-svn: 49208
2008-04-04 06:12:32 +00:00
Chris Lattner 5506f8cf4c Codegen assignment to self correctly, patch by David Chisnall!
llvm-svn: 49201
2008-04-04 04:07:35 +00:00
Nate Begeman 002e4bd158 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)

llvm-svn: 49199
2008-04-04 01:30:25 +00:00
Ted Kremenek d1a2efadba Added investigate patch for an occasionally failing assertion (heisenbug?)
llvm-svn: 49193
2008-04-03 21:44:24 +00:00
Nate Begeman 11b6bb408e Teach clang how to codegen punpcklbw and punpcklwd
llvm-svn: 49186
2008-04-03 19:58:06 +00:00
Ted Kremenek 10569cdd87 Better range highlight for undefined-argument checks.
llvm-svn: 49184
2008-04-03 18:52:25 +00:00
Ted Kremenek 5f5592062b When reporting "bad receiver" warnings, highlight the receiver.
llvm-svn: 49183
2008-04-03 18:46:16 +00:00
Ted Kremenek 89575b7bcb Use "getRanges" in default implementation of "getEndPath" to determine
the ranges of highlighted elements in the source code.

llvm-svn: 49181
2008-04-03 18:00:37 +00:00
Ted Kremenek cb2dc8eca5 Hooked up GRSimpleAPICheck and the simple Objective-C Foundation checks to use
the new BugReporter interface.

llvm-svn: 49180
2008-04-03 17:57:38 +00:00
Ted Kremenek 406192d163 Added "getLogicalLineNumber" and "getLogicalColumnNumber" to FullSourceLoc.
llvm-svn: 49177
2008-04-03 17:55:15 +00:00
Sam Bishop 2f8a31ca92 trivial whitespace fix
llvm-svn: 49160
2008-04-03 14:20:28 +00:00
Ted Kremenek ca40664275 Handle the case when getEndPath() returns NULL.
llvm-svn: 49155
2008-04-03 07:33:55 +00:00
Ted Kremenek c599179267 Some cleanups in EscapeText and AddLineNumbers. Still investigating performance
issues.

llvm-svn: 49150
2008-04-03 07:12:29 +00:00
Chris Lattner e799eb5daa Fix PR2081 (problems codegen'ing some recursive structures) patch
by Lauro Venancio!

llvm-svn: 49144
2008-04-03 05:50:42 +00:00
Sam Bishop 2289459bf6 Created a destructor so that the top-level decls can be deleted.
llvm-svn: 49142
2008-04-03 05:35:20 +00:00
Ted Kremenek e4c029e7aa Add back bug name to PathDiagnostic.
llvm-svn: 49139
2008-04-03 05:23:19 +00:00
Chris Lattner 3a0702e631 Fix a bug where we didn't check the RHS for null, we checked
the LHS for null twice.

llvm-svn: 49138
2008-04-03 05:07:25 +00:00
Chris Lattner efdc7685d4 qualifier comparisons should be done on canonical types.
llvm-svn: 49137
2008-04-03 05:07:04 +00:00
Sam Bishop ca6226628e Call "delete" on the body of FunctionDecls.
llvm-svn: 49135
2008-04-03 05:01:04 +00:00
Ted Kremenek 4e9cc3f272 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.

llvm-svn: 49133
2008-04-03 04:59:14 +00:00
Ted Kremenek 505a36afc6 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.

llvm-svn: 49127
2008-04-03 04:42:52 +00:00
Ted Kremenek 84041843af CSS tweaking on blue boxes.
llvm-svn: 49121
2008-04-02 22:50:50 +00:00
Ted Kremenek 33d03a52f0 80 col violation
llvm-svn: 49120
2008-04-02 22:08:09 +00:00
Ted Kremenek 744fb6d9e7 Added more PathDiagnostic rendering for terminators: switch, goto, loops.
llvm-svn: 49119
2008-04-02 22:03:53 +00:00
Ted Kremenek ab2a52c4bf Blue diagnostic boxes.
llvm-svn: 49117
2008-04-02 21:14:04 +00:00
Ted Kremenek 258493c188 Added path sequence numbers in HTML output of PathDiagnostics.
llvm-svn: 49116
2008-04-02 21:04:20 +00:00
Steve Naroff 778927532d 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:-)

llvm-svn: 49107
2008-04-02 18:30:49 +00:00
Ted Kremenek 383bfd27d0 Shorted bug-description.
llvm-svn: 49102
2008-04-02 18:02:54 +00:00
Chris Lattner 182f660d8d simplify some code by using PointerLikeType.
llvm-svn: 49101
2008-04-02 17:45:06 +00:00
Chris Lattner db5f1fa3d8 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 :)

llvm-svn: 49100
2008-04-02 17:35:06 +00:00
Chris Lattner b1f7398b1c properly handle array decay in objc message exprs.
llvm-svn: 49098
2008-04-02 17:17:33 +00:00
Steve Naroff 2fc93f5c43 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. 

llvm-svn: 49087
2008-04-02 14:35:35 +00:00
Ted Kremenek d12d21c000 Beginning of some cleanups; start generating path diagnostics using objects
that describe a bug.

llvm-svn: 49086
2008-04-02 07:05:46 +00:00
Chris Lattner b3a176da9f 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.

llvm-svn: 49082
2008-04-02 06:59:01 +00:00
Chris Lattner daaa8ba77e 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.

llvm-svn: 49081
2008-04-02 06:50:17 +00:00
Chris Lattner 53be405c3a Add a citation.
llvm-svn: 49080
2008-04-02 06:06:35 +00:00
Chris Lattner a21ad8058a 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.

llvm-svn: 49078
2008-04-02 05:18:44 +00:00
Ted Kremenek 2c71d51513 Added initial hacked support for display path diagnostics with
GRSimpleVals warnings.  Cleaning up, but now we get multiple bubbles (branches are annotated).

llvm-svn: 49077
2008-04-02 05:15:22 +00:00
Chris Lattner 800817bf6d remove blank line.
llvm-svn: 49075
2008-04-02 05:09:38 +00:00
Chris Lattner 091718d300 print cvr qualifiers on simplified typedefs
llvm-svn: 49074
2008-04-02 05:06:23 +00:00
Chris Lattner 24d5bfe0b2 rename some variables, fix 80 col violation. No
functionality change.

llvm-svn: 49072
2008-04-02 04:24:33 +00:00
Chris Lattner 81cb9e8637 Fix PR2017 and silence some bogus errors.
llvm-svn: 49068
2008-04-02 01:05:10 +00:00
Steve Naroff 9b94b17806 Fix a comment typo and add a couple suggestions from Chris.
llvm-svn: 49066
2008-04-02 00:39:51 +00:00
Steve Naroff 257520b1b4 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...

llvm-svn: 49058
2008-04-01 23:04:06 +00:00
Ted Kremenek 94896e17bb Patch by Argiris Kirtzidis: Fix a dangling pointer error!
llvm-svn: 49057
2008-04-01 22:35:58 +00:00
Chris Lattner 595cf9ff81 Update to match simplified llvm MemoryBuffer interfaces for files.
llvm-svn: 49042
2008-04-01 18:04:30 +00:00
Chris Lattner 4f6002c79a prune dead #includes
llvm-svn: 49033
2008-04-01 06:08:11 +00:00
Chris Lattner 47448288ee MemoryBuffer::getFile got smarter, obviating the need for readfilefast.
The new MemoryBuffer doesn't "leak" file descriptors and handles the
small file case efficiently.

llvm-svn: 49032
2008-04-01 06:06:37 +00:00
Ted Kremenek 3bcfc6edc0 Better handling for tabs with message bubbles.
llvm-svn: 49001
2008-03-31 23:14:05 +00:00
Ted Kremenek e9f2a90d1f Do not prepend the keyword "[CHECKER]" to checker messages when using
a PathDiagnosticClient.

llvm-svn: 48996
2008-03-31 20:42:43 +00:00
Steve Naroff 93eea6e1a0 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.

llvm-svn: 48991
2008-03-31 18:44:59 +00:00
Ted Kremenek bb7f03f926 Include ranges in GRSimpleVals diagnostics.
llvm-svn: 48990
2008-03-31 18:44:32 +00:00
Ted Kremenek c27815ca82 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.

llvm-svn: 48989
2008-03-31 18:26:32 +00:00
Ted Kremenek 491dc9f4a0 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.

llvm-svn: 48986
2008-03-31 18:23:15 +00:00
Ted Kremenek f646774f32 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.

llvm-svn: 48980
2008-03-31 15:02:58 +00:00
Chris Lattner 59a2594f3f 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.

llvm-svn: 48972
2008-03-31 00:36:02 +00:00
Chris Lattner c00c35a857 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.

llvm-svn: 48970
2008-03-30 23:25:33 +00:00
Chris Lattner 4bd5596d08 Add initial support for objc codegen for methods, ivars, and the
etoile runtime, patch by David Chisnall!

llvm-svn: 48969
2008-03-30 23:03:07 +00:00
Steve Naroff 0de4199ca0 Make sure Sema::ActOnClassMessage() correctly diagnoses "super".
llvm-svn: 48924
2008-03-28 21:37:05 +00:00
Ted Kremenek c719424caa 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".

llvm-svn: 48917
2008-03-28 16:09:38 +00:00
Ted Kremenek 276278e5d2 Expanded NSString checking to check for nil for a few more methods.
llvm-svn: 48898
2008-03-27 22:05:32 +00:00
Ted Kremenek 2e4e7ccb22 Add line SourceLocation to NSString checks.
Added test case to test warning about passing 'nil' to NSString's compare: method.

llvm-svn: 48896
2008-03-27 21:23:57 +00:00
Ted Kremenek 27156c8c9f Hooked up initial NSString interface checking to GRSimpleVals.
llvm-svn: 48895
2008-03-27 21:15:17 +00:00
Ted Kremenek 64b95a024e Minor CSS tweaking (smaller h1 tags).
Bug fix in EscapeText (for std::string) where spaces were not properly emitted.

llvm-svn: 48889
2008-03-27 17:28:58 +00:00
Ted Kremenek a4d60b6de3 Add creation of BasicObjCFoundationChecks when running GRSimpleVals from the driver.
llvm-svn: 48886
2008-03-27 17:17:22 +00:00
Ted Kremenek 561dfe3153 Add html::EscapeText for std::string; use this function to escape text in message bubbles.
llvm-svn: 48884
2008-03-27 17:15:29 +00:00
Ted Kremenek 8cc4842a76 Added <h3> tag in HTML file output that contains the name of the source file.
llvm-svn: 48869
2008-03-27 07:35:49 +00:00
Ted Kremenek c04149299c 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.

llvm-svn: 48867
2008-03-27 07:25:52 +00:00
Ted Kremenek 710714c365 PathDiagnosticPiece no longer contains a vector of strings; just one string.
PathDiagnostic no longer contains a diagnostic ID or diagnostic level.

llvm-svn: 48864
2008-03-27 06:16:40 +00:00
Ted Kremenek 4fa20c9bba Added classes "PathDiagnosticPiece", "PathDiagnostic", and "PathDiagnosticClient", which encapsulate diagnostic reporting for paths.
llvm-svn: 48861
2008-03-27 03:49:32 +00:00
Ted Kremenek ea128437b3 Bug fix: use GetRVal instead of GetLVal (were getting the value of a DeclRefExpr, not it's address).
llvm-svn: 48846
2008-03-26 22:21:58 +00:00
Ted Kremenek cb047289a8 Bug fix in transfer function for ObjCMessageExpr: Visit the receiver expression as an ordinary expression, not using VisitLVal.
llvm-svn: 48842
2008-03-26 21:36:08 +00:00
Steve Naroff c06ee808d7 Alloc redeclaration of typedefs within ExternCSystemHeaderDir's AND SystemHeaderDir's.
llvm-svn: 48841
2008-03-26 21:27:00 +00:00
Nuno Lopes 623207d603 allow the format attribute to be specified in function pointer prototypes
# this is my first commit here, so please be gentle :)

llvm-svn: 48807
2008-03-25 23:01:48 +00:00
Nate Begeman c506c78117 Extend QualType::getAddressSpace to do the right thing for array types, and in
the future, RecordTypes.

llvm-svn: 48784
2008-03-25 18:36:32 +00:00
Ted Kremenek 4b55badc39 GRSimple analysis now outputs additional diagnostic warnings about
passing an uninitialized value to a message expresion.

llvm-svn: 48776
2008-03-25 16:40:05 +00:00
Ted Kremenek 3335120f69 Tweak to transfer function for ObjCMessageExpr: handle both instance methods
and message expressions with a specified receiver.

llvm-svn: 48773
2008-03-25 16:07:41 +00:00
Ted Kremenek 945a246ad8 Added logic to check for uninitialized values as the receivers for message expressions
and uninitialized values passed-by-value as arguments to message expressions.

llvm-svn: 48760
2008-03-25 02:10:28 +00:00
Ted Kremenek 64100da427 Added initial transfer function support for ObjCMessageExpr.
llvm-svn: 48757
2008-03-25 00:34:37 +00:00
Ted Kremenek b2f4d3138f Minor CSS tweaking: use webkit style CSS properties for shadows/rounded edges
for message bubbles.

llvm-svn: 48754
2008-03-24 23:38:32 +00:00
Chris Lattner 22fc992f59 Avoid overflowing buffer, patch by Algeris Kirtzidis!
llvm-svn: 48741
2008-03-24 21:14:55 +00:00
Ted Kremenek fb475ec504 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.

llvm-svn: 48689
2008-03-22 20:11:00 +00:00
Ted Kremenek 181f72369f Rename "Nodify" to "MakeNode"
llvm-svn: 48659
2008-03-21 21:30:14 +00:00
Sam Bishop 27654983dc Plug a memory leak in the "this macro expands into a single trivially-
expanded token" case.

llvm-svn: 48637
2008-03-21 07:13:02 +00:00
Ted Kremenek b7151c7ca8 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.

llvm-svn: 48618
2008-03-20 21:46:49 +00:00
Ted Kremenek bc24962566 Added HTML highlighting for ranges.
llvm-svn: 48572
2008-03-19 23:55:53 +00:00
Steve Naroff 157c403cb8 Fix typo.
llvm-svn: 48571
2008-03-19 23:46:26 +00:00
Steve Naroff c5f8120ad0 Fix http://llvm.org/bugs/show_bug.cgi?id=2161.
llvm-svn: 48568
2008-03-19 23:07:49 +00:00
Ted Kremenek 161d16e083 Change colors of HTML message bubble.
llvm-svn: 48563
2008-03-19 22:44:21 +00:00
Ted Kremenek 7ee6a1474f More CSS enhancements to HTML code printing.
llvm-svn: 48557
2008-03-19 22:06:25 +00:00
Ted Kremenek 1651b7cd2d Misc. cleanups to HTML printing: make code rendered using tables; add
better div positioning for messages.

llvm-svn: 48555
2008-03-19 21:59:05 +00:00
Ted Kremenek 216624ce58 Initial experimentation with adding boxed "annotations" to HTMLized source.
llvm-svn: 48540
2008-03-19 07:53:42 +00:00
Ted Kremenek 966da4acc3 Moved generation of html header/footer with builtin CSS to the rewriter library.
llvm-svn: 48537
2008-03-19 06:14:37 +00:00
Chris Lattner 554221e9fb simplify code by using the variadic StructType::get method.
llvm-svn: 48535
2008-03-19 05:24:56 +00:00
Chris Lattner 3e593cdb98 simplify the clang codegen by using the new Builder.CreateStructGEP method.
llvm-svn: 48534
2008-03-19 05:19:41 +00:00
Ted Kremenek 3f8392626b More cleanups to the HTML rewriter (with line formatting), with better
pretty-printing of line numbers.

llvm-svn: 48533
2008-03-19 05:07:26 +00:00
Ted Kremenek 54d62b6d64 Change "style" to "class" in HTML output.
llvm-svn: 48525
2008-03-19 01:44:27 +00:00
Ted Kremenek 5ddff02861 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.)

llvm-svn: 48524
2008-03-19 01:30:02 +00:00
Ted Kremenek 8800ae68a0 More HTML rewriter cleanups. Preliminary CSS support in code pretty-printing.
llvm-svn: 48518
2008-03-18 23:55:46 +00:00
Ted Kremenek 5792cebb08 Some cleanups to the HTMLRewrite API. Added support for printing out line
numbers (more work to be done on aesthetics).

llvm-svn: 48512
2008-03-18 23:08:51 +00:00
Ted Kremenek 1b580f98aa 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).

llvm-svn: 48506
2008-03-18 21:26:34 +00:00
Ted Kremenek 7dcc82220e 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.

llvm-svn: 48505
2008-03-18 21:19:49 +00:00
Ted Kremenek 45467ef372 Added variant of "InsertText" in the Rewriter to support inserting text both
*before* and after a specific location.

llvm-svn: 48504
2008-03-18 21:17:59 +00:00
Ted Kremenek af5b820af3 Bug fix in RewriteBuffer::getMappedOffset: potentially multiple deltas
need to be skipped over when AfterInserts == true, as multiple deltas
may share the same FileLoc.

llvm-svn: 48503
2008-03-18 21:00:57 +00:00
Chris Lattner 0725a3e055 move #include to the file that needs it.
llvm-svn: 48485
2008-03-18 05:59:11 +00:00
Ted Kremenek a9b30c0651 Fix assertion.
llvm-svn: 48470
2008-03-17 22:18:22 +00:00
Ted Kremenek 9eae403cde Fix integer overflow bug when processing switch statements.
llvm-svn: 48469
2008-03-17 22:17:56 +00:00
Ted Kremenek 58021a617b Properly hook up inline asm transfer function logic to the main GRExprEngine logic.
llvm-svn: 48468
2008-03-17 21:31:48 +00:00
Ted Kremenek 7c7a331f74 Added initial transfer function support for inline asm.
llvm-svn: 48466
2008-03-17 21:11:24 +00:00
Nate Begeman 0c185c45a9 Check in a couple fixes for vector extensions.
llvm-svn: 48461
2008-03-17 17:22:18 +00:00
Ted Kremenek fff4fc7e6d Bug fix in CFG construction: VisitCompoundStmt should return the last created block.
llvm-svn: 48460
2008-03-17 17:19:44 +00:00
Chris Lattner ed0e16404c clean up property memory allocation to move it into the ast classes
like the rest of the classes.

llvm-svn: 48434
2008-03-17 01:19:02 +00:00
Chris Lattner 41eec3d097 make property addition work list all other "add" methods. Do
the allocation in the class, not in sema.

llvm-svn: 48433
2008-03-16 21:23:50 +00:00
Chris Lattner 219b3e9c6c add the last two Create methods for decls, woo!
llvm-svn: 48432
2008-03-16 21:17:37 +00:00
Chris Lattner 36ac1cae1f add two more Create methods.
llvm-svn: 48428
2008-03-16 20:53:07 +00:00
Chris Lattner d77aff8232 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.

llvm-svn: 48427
2008-03-16 20:47:45 +00:00
Chris Lattner 1dd77af9ce Add create methods for ObjCCategoryDecl, ObjCForwardProtocolDecl, ObjCClassDecl.
llvm-svn: 48426
2008-03-16 20:34:23 +00:00
Chris Lattner acc04a9261 minor cleanups, make getNumInstanceMethods always return unsigned.
llvm-svn: 48423
2008-03-16 20:19:15 +00:00
Chris Lattner 5074f8f3ef fix a crasher where an invalid program that multiply defined
a protocol could smash more references in than are allocated.

llvm-svn: 48411
2008-03-16 01:25:17 +00:00
Chris Lattner f87ca0a7d1 Give ObjCProtocolDecl a Create method.
llvm-svn: 48410
2008-03-16 01:23:04 +00:00
Chris Lattner 2a52083efc hoist a bunch of casting.
llvm-svn: 48409
2008-03-16 01:16:52 +00:00
Chris Lattner 96c501ef7e Add create methods for ObjCIvarDecl and ObjCInterfaceDecl
llvm-svn: 48408
2008-03-16 01:15:50 +00:00
Chris Lattner 011b0f5c5a Make the parameter count of ObjCMethodDecl unsigned, you
can't have negative arguments.

llvm-svn: 48407
2008-03-16 01:07:14 +00:00
Chris Lattner c557947488 remove some dead arguments to ObjCMethodDecl.
llvm-svn: 48406
2008-03-16 00:58:16 +00:00
Chris Lattner 8d8829e225 Give ObjCMethodDecl a Create method.
llvm-svn: 48405
2008-03-16 00:49:28 +00:00
Chris Lattner 893751970a Split objc decl implementation out into DeclObjC.cpp
llvm-svn: 48404
2008-03-16 00:19:01 +00:00
Chris Lattner ee1284a6e2 switch the rest of the C decl classes to do their
allocation through ASTContext.

llvm-svn: 48403
2008-03-16 00:16:02 +00:00
Chris Lattner 7a51313d8a 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.

llvm-svn: 48402
2008-03-15 23:59:48 +00:00