Commit Graph

4640 Commits

Author SHA1 Message Date
Ted Kremenek 751d4d2d60 Added driver option "-checker-opt-analyze-headers" to force the static
analyzer to analyze functions declared in header files.

llvm-svn: 49675
2008-04-14 18:40:58 +00:00
Ted Kremenek 87bfc03f4a Don't flag dead stores that occur in macros.
llvm-svn: 49672
2008-04-14 18:28:25 +00:00
Ted Kremenek bae225d57a Have BugReporter::EmitWarning use the PathDiagnosticClient if it is available.
llvm-svn: 49668
2008-04-14 18:06:42 +00:00
Chris Lattner d80edddccd move a ton of code out of line, from RewriteRope.h -> RewriteRope.cpp
llvm-svn: 49664
2008-04-14 17:54:23 +00:00
Ted Kremenek 75ff623e2e 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.

llvm-svn: 49662
2008-04-14 17:52:13 +00:00
Ted Kremenek 12e721a728 Treat calls to unresolved functions in the CF-ref count checker as calls
to functions with NULL summaries.

llvm-svn: 49660
2008-04-14 17:45:13 +00:00
Ted Kremenek 69a4df4cb7 Updated test cases so that they do not emit warnings for dead stores.
llvm-svn: 49659
2008-04-14 17:40:10 +00:00
Ted Kremenek 7e15130dc9 Hooked up the dead-store checker to the BugReporter interface. Now dead-store
warnings are emitted as part of the warnings registered by GRSimpleVals.

llvm-svn: 49658
2008-04-14 17:39:48 +00:00
Ted Kremenek cad92f2447 Added version of "getClient()" for class Diagnostic that returns a non-const
reference to the DiagnosticClient.  This is useful for DiagnosticClients
that have internal state when processing diagnostics.

llvm-svn: 49656
2008-04-14 17:37:31 +00:00
Chris Lattner 04df1bb8b5 remove ifdefs
llvm-svn: 49651
2008-04-14 17:12:49 +00:00
Ted Kremenek 16a8a3be41 Added test case to dead stores checker.
llvm-svn: 49647
2008-04-14 15:56:17 +00:00
Sam Bishop cb1a37b145 Handle -D and -U options in order, so that they can cancel each other out when
intermixed.

llvm-svn: 49645
2008-04-14 14:41:57 +00:00
Chris Lattner 3374b039d9 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.

llvm-svn: 49635
2008-04-14 07:17:29 +00:00
Nate Begeman 91f40e3680 Enable clang to codegen emmintrin.h until we have our own emmintrin.h
llvm-svn: 49633
2008-04-14 04:49:57 +00:00
Nate Begeman 5eee93328e Fix typo
llvm-svn: 49632
2008-04-14 02:26:39 +00:00
Douglas Gregor 2daae31e9a Argiris Kirtzidis's fix for handling empty IdDeclInfo's in IdentifierResolver::AddDecl
llvm-svn: 49631
2008-04-14 00:26:07 +00:00
Douglas Gregor 423984d33b Make Parser::getAccessSpecifierIfPresent const, since it does not modify the state
llvm-svn: 49629
2008-04-14 00:13:42 +00:00
Argyrios Kyrtzidis 25f54c72ac Move IdDeclInfoMap class in an anonymous namespace. Suggestion by Chris Lattner.
llvm-svn: 49628
2008-04-14 00:09:21 +00:00
Douglas Gregor 556877c1e6 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).

llvm-svn: 49623
2008-04-13 21:30:24 +00:00
Douglas Gregor 83a586ec19 Introduce support for finding class and enum names via ordinary name lookup in C++
llvm-svn: 49621
2008-04-13 21:07:44 +00:00
Chris Lattner f8f945499c Fix PR2220, making diagnostics for unexpected tokens in pp expressions
more nice.

llvm-svn: 49619
2008-04-13 20:38:43 +00:00
Chris Lattner d71f83a8cb this started failing because a GEP was constant folded,
improve the robustness of the test.

llvm-svn: 49618
2008-04-13 19:54:28 +00:00
Douglas Gregor b77653430f Test commit: fix a typo
llvm-svn: 49615
2008-04-13 19:35:01 +00:00
Chris Lattner 861a226586 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!

llvm-svn: 49613
2008-04-13 18:59:07 +00:00
Chris Lattner cc0ef63a13 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).

llvm-svn: 49609
2008-04-13 08:52:45 +00:00
Chris Lattner cdefa7a6fc split node splitting from interior node restructuring.
llvm-svn: 49608
2008-04-13 08:22:30 +00:00
Chris Lattner 61705c1a6e update to follow mainline llvm API change.
llvm-svn: 49607
2008-04-13 07:32:11 +00:00
Sam Bishop fcd78b02c2 Use static_cast<> instead of cast<> in Decl::Destroy(). Suggestion by Argiris
Kirtzidis!

llvm-svn: 49603
2008-04-13 04:32:18 +00:00
Chris Lattner b0d3844fb8 Default argument cleanups and minor improvements, patch by
Doug Gregor!

llvm-svn: 49598
2008-04-12 23:52:44 +00:00
Chris Lattner 8fc77b7945 final cleanup, the code is now in a reviewable state.
llvm-svn: 49592
2008-04-12 22:04:18 +00:00
Chris Lattner cbb6bad435 move the DeltaTree implementation out of line, remove debugging printfs etc.
llvm-svn: 49591
2008-04-12 22:00:40 +00:00
Chris Lattner 0c8d17fc43 remove ifdefs
llvm-svn: 49587
2008-04-12 20:34:05 +00:00
Chris Lattner d154731131 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.

llvm-svn: 49586
2008-04-12 20:28:24 +00:00
Argyrios Kyrtzidis 740525a6b7 Use std::list's push_back instead of resize to add an element.
llvm-svn: 49582
2008-04-12 12:38:58 +00:00
Chris Lattner 8f96d04ceb don't diagnose empty source files, thanks Neil!
llvm-svn: 49575
2008-04-12 05:54:25 +00:00
Argyrios Kyrtzidis dfd52220d7 Fixed comments.
Moved IdDeclInfo class to anonymous namespace.
Replaced array with a std::vector.

llvm-svn: 49570
2008-04-12 01:50:47 +00:00
Argyrios Kyrtzidis b8a4920d62 Added PushOnScopeChains method to Sema, that adds a decl to both the IdResolver and the Scope.
llvm-svn: 49567
2008-04-12 00:47:19 +00:00
Fariborz Jahanian 4572b45574 AST generation for objc2's property declarations.
llvm-svn: 49565
2008-04-11 23:40:25 +00:00
Ted Kremenek 8784a7c006 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).

llvm-svn: 49564
2008-04-11 22:25:11 +00:00
Ted Kremenek bc888b47b9 Added "EvalEndPath" to GRTransferFuncs: the default implementation does not
change the state (and thus the GREndPathNodeBuilder automatically contructs a
node).

llvm-svn: 49563
2008-04-11 22:07:59 +00:00
Ted Kremenek 811c2b4edb Added "GREndPathNodeBuilder", a new node builder that will be used for
evaluating transfer functions at the end-of-path.

llvm-svn: 49561
2008-04-11 22:03:04 +00:00
Ted Kremenek 0a86fdb1ff Added FIXME
llvm-svn: 49558
2008-04-11 20:51:02 +00:00
Ted Kremenek 831f327568 Fix regression introduced by my last commit.
llvm-svn: 49556
2008-04-11 20:23:24 +00:00
Ted Kremenek a7c44113bc 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.

llvm-svn: 49555
2008-04-11 20:11:19 +00:00
Steve Naroff 5a4611cdda Add class and super class location info to ObjCInterfaceDecl...
llvm-svn: 49553
2008-04-11 19:35:35 +00:00
Ted Kremenek 988990f842 Use RangedBugReport to report better ranges for reference count errors.
llvm-svn: 49552
2008-04-11 18:40:51 +00:00
Ted Kremenek 6e38ffa517 Added "RangedBugReport".
llvm-svn: 49551
2008-04-11 18:40:29 +00:00
Ted Kremenek 2cf508c880 Update Xcode project with missing files.
llvm-svn: 49550
2008-04-11 18:30:21 +00:00
Sam Bishop ef8b94ae84 Invoke destructors in Decl::Destroy().
llvm-svn: 49547
2008-04-11 18:04:39 +00:00
Fariborz Jahanian 963767476c Minor changes per Chris L's review.
llvm-svn: 49539
2008-04-11 16:55:42 +00:00
Chris Lattner 9b7206eb4f don't read off the front of the buffer. Thanks to Sam for pointing this out.
llvm-svn: 49535
2008-04-11 16:20:41 +00:00
Sam Bishop 703ae9624b Stub out and start using a Decl::Destroy() method.
llvm-svn: 49532
2008-04-11 15:01:25 +00:00
Sam Bishop 4c088b766d Use the ASTContext allocator when creating deserialized Decl objects.
llvm-svn: 49530
2008-04-11 14:49:10 +00:00
Chris Lattner 9950c80c83 two new files for previous patch, by Argiris Kirtzidis
llvm-svn: 49521
2008-04-11 07:06:57 +00:00
Chris Lattner c5c95b52a8 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!

llvm-svn: 49520
2008-04-11 07:00:53 +00:00
Chris Lattner 47fb9efa5d Fix rdar://5843510 don't assert and die when an invalid output
file is specified, print a happy little error message.

llvm-svn: 49518
2008-04-11 06:14:11 +00:00
Ted Kremenek 4b77209694 Fixed some logic errors in the CF ref count checker; we now can detect simple
use-after-release errors.  Added test case.

llvm-svn: 49509
2008-04-10 23:44:06 +00:00
Fariborz Jahanian de615836f3 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.

llvm-svn: 49506
2008-04-10 23:32:45 +00:00
Ted Kremenek 3c03d52d6e Simplify CF ref. count checker state machine.
llvm-svn: 49505
2008-04-10 23:09:18 +00:00
Ted Kremenek 22bd628056 Fix some bonehead bugs in summary generation in CFRefCount.
llvm-svn: 49503
2008-04-10 22:58:08 +00:00
Ted Kremenek 969bb805f9 Used --checker-simple.
llvm-svn: 49501
2008-04-10 22:17:23 +00:00
Ted Kremenek 4a78c3ae11 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.

llvm-svn: 49500
2008-04-10 22:16:52 +00:00
Chris Lattner 5c7fce453d reduce the amount of 'C++ magic' this code depends on :)
llvm-svn: 49489
2008-04-10 16:37:40 +00:00
Ted Kremenek ea1bc3bec6 CFRefCount analysis now properly calls "EmitWarnings" after analyzing a function.
llvm-svn: 49488
2008-04-10 16:21:09 +00:00
Ted Kremenek 42d9db75f0 When not emitting path diagnostics in BugReporter::EmitWarning(), use the
BugReport-specific SourceRanges (when available).

llvm-svn: 49486
2008-04-10 16:12:38 +00:00
Ted Kremenek 83744ddbd9 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.

llvm-svn: 49485
2008-04-10 16:05:13 +00:00
Chris Lattner a12405b0ef 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.

llvm-svn: 49468
2008-04-10 06:46:29 +00:00
Chris Lattner 32295d344a Simplify lifetime of location object.
llvm-svn: 49467
2008-04-10 06:15:14 +00:00
Eric Christopher 67d650508a Fix typo.
llvm-svn: 49464
2008-04-10 05:23:15 +00:00
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 1d511d3bae Add SemaDeclCXX.cpp to Xcode project.
llvm-svn: 49428
2008-04-09 15:50:11 +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 d4db4fa359 For -emit-html, use the Rewriter to expand tabs.
llvm-svn: 49409
2008-04-08 23:25:54 +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 5d1647daf9 Add HTMLRewrite.h to Xcode project.
llvm-svn: 49405
2008-04-08 22:31:28 +00:00
Ted Kremenek b1f773ca98 When substituting tabs during HTMLification, only add "&nbsp;" when we are
"escaping" spaces.

llvm-svn: 49404
2008-04-08 22:28:15 +00:00
Ted Kremenek d8256ed2fe Improve range highlighting in HTMLDiagnostic to correctly highlight ranges
that span multiple lines by inserting multiple "</span>" and "<span>" tags.

llvm-svn: 49403
2008-04-08 21:29:14 +00:00
Ted Kremenek dbd1c183b0 Make SourceManager::getFullFilePos() public.
llvm-svn: 49402
2008-04-08 21:26:35 +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
Ted Kremenek ba0e4237aa Set the location of ccc-analyzer to be the same directory as where scan-build
is located.

llvm-svn: 49397
2008-04-08 20:22:12 +00:00
Chris Lattner 4fdfbf7b89 silence some warnings when assertions are disabled.
llvm-svn: 49372
2008-04-08 05:52:18 +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
Chris Lattner 2163265b53 Fix rdar://5846705: "clang -E foo.c -o foo.i" should remove foo.i on error.
llvm-svn: 49368
2008-04-08 04:16:20 +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 a378fe0a2e Left-justify text in report table.
llvm-svn: 49358
2008-04-07 23:50:07 +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
Ted Kremenek c0f15487c6 Fix analyzer breakage introduced by r49213: http://llvm.org/viewvc/llvm-project?rev=49213&view=rev
The problem is that some clients of gcc lookout at the stdout output of gcc;
this requires that all the analyzer diagnostics go to stderr to avoid polluting
stdout.

llvm-svn: 49355
2008-04-07 23:27:54 +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 fde0761735 improve comments.
llvm-svn: 49311
2008-04-07 04:58:07 +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 513494b32b add an example.
llvm-svn: 49309
2008-04-07 04:47:29 +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 56a7bf5a7e remove the old non-parallel test system. 'make' in clang/test now runs
the tests in parallel.

llvm-svn: 49290
2008-04-06 22:32:01 +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 53adca6610 don't dereference hte end iterator when inserting at end of buffer.
Patch by Cédric Venet!

llvm-svn: 49259
2008-04-06 04:36:15 +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 4dbab8a49d Avoid implicitly including any header files (requested by ckane).
llvm-svn: 49241
2008-04-04 22:58:22 +00:00
Steve Naroff af91b9ae13 Rewrite @package (an ObjC 2.0 idiom).
llvm-svn: 49238
2008-04-04 22:34:24 +00:00
Steve Naroff eae91700de Fix MS-specific bug in RewriteTest::RewriteObjCMethodDecl().
llvm-svn: 49237
2008-04-04 22:23:44 +00:00
Steve Naroff e421e97f1b Add BugReporter.cpp to VC++ project file.
llvm-svn: 49233
2008-04-04 21:24:02 +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
Steve Naroff 8164ca61b1 Add DeclBase.h to Xcode project.
llvm-svn: 49223
2008-04-04 18:04:30 +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 50ad37b6d9 add an isAnyComplexType() method, which returns true for both
integer and FP complexes.

llvm-svn: 49219
2008-04-04 16:51:46 +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 b7bf0f3e1e - ccc: print generated command line to stdout instead of stderr
- ccc: quote shell metacharacters in command line to ease copy-and-paste

llvm-svn: 49213
2008-04-04 11:02:21 +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
Ted Kremenek bf191c76bd Remove bogus check to prune out analyzing files.
llvm-svn: 49191
2008-04-03 21:29:11 +00:00
Ted Kremenek 4c32d1fcce More reliably remove '\n' from queries of the location of ccc-analyzer
llvm-svn: 49189
2008-04-03 21:17:14 +00:00
Ted Kremenek 0dcd309044 Use full path to ccc-analyzer.
llvm-svn: 49187
2008-04-03 20:08:18 +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 d068813464 Make typedefs public.
llvm-svn: 49185
2008-04-03 19:52:45 +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 c2546d6518 Mark nodes as sinks that GRAuditor says should be marked as sinks.
llvm-svn: 49179
2008-04-03 17:56:48 +00:00
Ted Kremenek b5c8225320 Use logical line number for BUGLINE.
llvm-svn: 49178
2008-04-03 17:55:57 +00:00
Ted Kremenek 406192d163 Added "getLogicalLineNumber" and "getLogicalColumnNumber" to FullSourceLoc.
llvm-svn: 49177
2008-04-03 17:55:15 +00:00
Sam Bishop 30d70968fd Remove handling of impossible "-?" option.
llvm-svn: 49161
2008-04-03 14:29:47 +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 4d26d194e4 Don't run the analyzer on files whose language is "unknown"
llvm-svn: 49152
2008-04-03 07:14:59 +00:00
Ted Kremenek b73d6dda84 Added guard for printing out PathDiagnostics whose last element ends with
a piece with a SourceLocation that does not have a FileID.

llvm-svn: 49151
2008-04-03 07:13:10 +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
Ted Kremenek ffc1147323 Remove impossible "-?" option.
llvm-svn: 49149
2008-04-03 07:11:44 +00:00
Ted Kremenek 78e30c17bc Added "isFileID()" to FullSourceLoc.
llvm-svn: 49148
2008-04-03 07:11:38 +00:00
Ted Kremenek d4bee176b6 CSS/HTML generation tweaks for index.html: Remove special "classes" for <td>
elements in table so that sorttable can sort them.

llvm-svn: 49145
2008-04-03 05:50:51 +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
Sam Bishop 5981404289 Temporarily make the Decl virtual destructor public, so that calls to "delete"
can be tested on derived classes.

llvm-svn: 49141
2008-04-03 05:29:20 +00:00