Commit Graph

14794 Commits

Author SHA1 Message Date
Duncan Sands 49c29ee43f Disambiguate an if statement.
llvm-svn: 76547
2009-07-21 07:56:29 +00:00
Argyrios Kyrtzidis 8274ad5281 Remove the ASTContext parameter from Entity::getPrintableName().
llvm-svn: 76546
2009-07-21 07:52:21 +00:00
Argyrios Kyrtzidis 11982922be Add an assert for safety check.
llvm-svn: 76539
2009-07-21 06:48:06 +00:00
Argyrios Kyrtzidis 1a176f0b96 Fix a crash that occurs in this C++ case:
struct foo {
  static bool value;
};
bool (foo::value); // crash because of parens

llvm-svn: 76538
2009-07-21 06:43:26 +00:00
Owen Anderson f319a7d6e7 Update for LLVM API change.
llvm-svn: 76534
2009-07-21 02:57:15 +00:00
Argyrios Kyrtzidis 3b4e2a7621 Keep only canonical Decls in Entities.
llvm-svn: 76532
2009-07-21 02:10:32 +00:00
Mike Stump 3557ea840b Wire up CFG improvements for __builtin_choose_expr.
llvm-svn: 76531
2009-07-21 01:46:17 +00:00
Mike Stump 8d50b6aeff Wire up CFG improvements for do { } while () when the condition is known.
llvm-svn: 76530
2009-07-21 01:27:50 +00:00
Mike Stump 014b3eabd1 Wire up for statement CFG improvements for conditionals that are known.
llvm-svn: 76529
2009-07-21 01:12:51 +00:00
Mike Stump 23a443bea7 Wire up CFG improvements for while when the condition is known.
llvm-svn: 76522
2009-07-21 00:38:52 +00:00
Argyrios Kyrtzidis d0a31d2c5a Remove a file from the test directory that was added by mistake.
llvm-svn: 76518
2009-07-21 00:17:57 +00:00
Ted Kremenek fe12f88924 RegionStore:
-refactor logic for retrieving bindings from VarDecls into
 RegionStoreManager::RetrieveVar()
- improve RegionStoreManager::CastRetrievedVal() and SimpleSValuate::EvalCastNL
  to better handle casts of values of the same canonical type as well as
  casts of LocAsInteger values.

llvm-svn: 76516
2009-07-21 00:12:07 +00:00
Argyrios Kyrtzidis 05ac8276cf Change the semantics for Entity.
Entity can now refer to declarations that are not visible outside the translation unit.
It is a wrapper of a pointer union, it's either a Decl* for declarations that don't
"cross" translation units, or an EntityImpl* which is associated with the specific "visible" Decl.

Included is a test case for handling fields across translation units.

llvm-svn: 76515
2009-07-21 00:07:06 +00:00
Ryan Flynn ed73cac647 define __STDC_VERSION__ processor token for c94
llvm-svn: 76514
2009-07-21 00:07:02 +00:00
Argyrios Kyrtzidis 851b208a20 Use temporary output to avoid running index-test with the same commands multiple times.
llvm-svn: 76513
2009-07-21 00:06:46 +00:00
Argyrios Kyrtzidis a8cf0beeef Implement the virtual getNextRedeclaration() for ObjCMethodDecl.
If it's in an ObjCContainerDecl, its "redeclaration" is the method definition in the corresponding ObjCImplDecl.
If it's in an ObjCImplDecl, its "redeclaration" is the method in the interface.

llvm-svn: 76512
2009-07-21 00:06:36 +00:00
Argyrios Kyrtzidis 60e9b7cf58 Add an assertion for the return value of Decl::getNextRedeclaration().
llvm-svn: 76511
2009-07-21 00:06:27 +00:00
Argyrios Kyrtzidis 1559d67b7a Remove the ObjCCategoryImpls vector from Sema class.
Use ObjCInterfaceDecl::getCategoryClassMethod() and ObjCInterfaceDecl::getCategoryInstanceMethod() for the same functionality.

llvm-svn: 76510
2009-07-21 00:06:20 +00:00
Argyrios Kyrtzidis 43cee935ae Remove Sema::LookupObjCImplementation and replace it with just calling ObjCInterfaceDecl::getImplementation().
llvm-svn: 76509
2009-07-21 00:06:04 +00:00
Argyrios Kyrtzidis 6d9fab7619 - Introduce ASTContext::getObjCImplementation() and ASTContext::setObjCImplementation() which use a DenseMap to associate
an interface/category with its implementation (if one exists).

- Introduce ObjCInterfaceDecl::get/setImplementation() and ObjCCategoryDecl::get/setImplementation() that use the above methods.

- Add a compiler error for when a category is reimplemented.

llvm-svn: 76508
2009-07-21 00:05:53 +00:00
Argyrios Kyrtzidis b78139f74d Handle references from ObjCIvarRefExprs.
llvm-svn: 76507
2009-07-21 00:05:38 +00:00
Argyrios Kyrtzidis 153d418def Add '\n' to the end of error message.
llvm-svn: 76506
2009-07-21 00:05:10 +00:00
Mike Stump 0d76d075e4 Add yet more analysis for CFGs involving conditionals that are actually constant.
llvm-svn: 76500
2009-07-20 23:24:15 +00:00
Fariborz Jahanian 83381cc9a6 Move EmitCtorPrologue to CGCXX. Add an assert and FIXMEs.
llvm-svn: 76498
2009-07-20 23:18:55 +00:00
Ted Kremenek 834e2f69da Enhanced IsReinterpreted() (RegionStore.cpp) to reason about higher-order
pointers.

Enhanced RegionStoreManager::Retrieve() to handle automatic casts when the
loaded value is different from the requested value. This should be refined over
time, but essentially we should always symbolicate locations as locations, and
convert them to non-locations on demand.

These changes now cause 'misc-ps.m' to pass again.

llvm-svn: 76497
2009-07-20 22:58:02 +00:00
Fariborz Jahanian c0656de03d Improve message for bad destructor decl. Per Doug's comment.
llvm-svn: 76494
2009-07-20 22:41:12 +00:00
Fariborz Jahanian 127059c7ec Early ir-gen for constructor prologue. This is on going.
llvm-svn: 76493
2009-07-20 22:35:22 +00:00
Douglas Gregor d12df6b160 Reuse VarDecl::Init to store the default argument of a ParmVarDecl,
reducing the size of ParmVarDecl by one pointer. Also means that we'll 
properly (de-)serialize default arguments in C++ PCH files.

llvm-svn: 76487
2009-07-20 22:03:28 +00:00
Ted Kremenek 2f730c8aed This test now passes with RegionStore.
llvm-svn: 76484
2009-07-20 21:44:10 +00:00
Ted Kremenek 77f7fc5e85 Enhance GRExprEngine::EvalBind to handle some implicit casts from nonlocs to
locs and vis versa.

llvm-svn: 76483
2009-07-20 21:43:20 +00:00
Ted Kremenek aadd463e0e Enhance SimpleSValuator to handle nonloc::LocAsInteger -> location casts.
llvm-svn: 76481
2009-07-20 21:39:27 +00:00
Mike Stump 17051250ad Remove an apparently unused forward class decl.
llvm-svn: 76476
2009-07-20 21:23:55 +00:00
Mike Stump 94e12450aa Remove an apparently unused header.
llvm-svn: 76473
2009-07-20 21:17:53 +00:00
Ted Kremenek bf04f98c1f Add XFAILED test.
llvm-svn: 76469
2009-07-20 21:00:55 +00:00
Ted Kremenek a1f9c7fb3b Add FIXME.
llvm-svn: 76466
2009-07-20 20:38:59 +00:00
Douglas Gregor 959cc7aaaa When a field is variable-sized or is an array with a negative size,
don't replace the type of the field with 'int', from Enea Zaffanella!

llvm-svn: 76454
2009-07-20 18:55:14 +00:00
Ted Kremenek 619eece347 Update DataflowSolver to handle the case where a successor/predecessor block
could be NULL. This allows the solver to handle optimized CFGs where branches
can be determined during CFG-construction to be infeasible.

llvm-svn: 76452
2009-07-20 18:52:34 +00:00
Douglas Gregor 47d2859b3e Improve GCC compatibility by allowing static tentative definitions of
incomplete type (with a warning), from Enea Zaffanella!

llvm-svn: 76451
2009-07-20 18:46:59 +00:00
Ted Kremenek af9f362840 Enhance GRBranchNodeBuilderImpl (part of GRCoreEngine) to understand the case
where the true or false CFGBlock* for a branch could be NULL. This will handle
the case where we can determine during CFG construction that a branch is
infeasible.

llvm-svn: 76450
2009-07-20 18:44:36 +00:00
Steve Naroff accc488785 5 cleanups to ObjCObjectPointerType work:
- Remove Sema::CheckPointeeTypesForAssignment(), a temporary API I added to ease migration to ObjCObjectPointerType. Convert Sema::CheckAssignmentConstraints() to no longer depend on the temporary API.
- Sema::ConvertDeclSpecToType(): Replace a couple FIXME's with an important comment/example.
- Sema::GetTypeForDeclarator(): Get the protocol's from the interface, NOT the declspec (to support the following C typedef idiom: "typedef C<P> T; T *obj").
- Sema::ObjCQualifiedIdTypesAreCompatible(): Removed some dead code.
- ASTContext::getObjCEncodingForTypeImpl(): Some minor cleanups.

llvm-svn: 76443
2009-07-20 17:56:53 +00:00
Fariborz Jahanian 4041dfc360 Issue a more descriptive diagnostics when mis-declaring
a destructor.

llvm-svn: 76436
2009-07-20 17:43:15 +00:00
Zhongxing Xu 34e0370502 The children statements might be NULL. Check for this case in
isContainedInStatement().

llvm-svn: 76408
2009-07-20 08:28:49 +00:00
Ted Kremenek 7d3a334298 Implement FIXME in pretty-printing for StringRegions.
llvm-svn: 76381
2009-07-19 20:38:24 +00:00
Ted Kremenek 291e8f770e Improve debug pretty-printing for ObjCIVarRegions.
llvm-svn: 76380
2009-07-19 20:36:24 +00:00
Chris Lattner 9662cd3227 enhance the goto checker to reject jumps across __block variable definitions.
llvm-svn: 76376
2009-07-19 20:17:11 +00:00
Daniel Dunbar ea3060a9e5 Catch another trivial case where we can avoid emitting a separate return blcok.
llvm-svn: 76365
2009-07-19 08:24:34 +00:00
Daniel Dunbar c3ab4c6c98 Detect when the current generation point is unreachable after emitting
expressions.
 - This generally catches the important case of noreturn functions.

 - With the last two changes, we are down to 152 unreachable blocks emitted on
   403.gcc, vs the 1805 we started with.

llvm-svn: 76364
2009-07-19 08:23:12 +00:00
Daniel Dunbar 669521c97c Fix thinko.
llvm-svn: 76362
2009-07-19 07:03:11 +00:00
Daniel Dunbar b6adc43f6e Avoid generation of dead code in a few more situations.
- Emit variable declarations as "simple", we want to avoid forcing the creation
   of a dummy basic block, but still need to make the variable available for
   later use.

 - With that, we can now skip IRgen for other unreachable statements (which
   don't define a label).

 - Anders, I added two fixmes on calls to EmitVLASize, can you check them?

llvm-svn: 76361
2009-07-19 06:58:07 +00:00
Daniel Dunbar 461ea7f005 Add include needed for MSVC.
llvm-svn: 76359
2009-07-19 02:17:34 +00:00
Daniel Dunbar 09fd05082d Update CMake
llvm-svn: 76351
2009-07-19 00:40:45 +00:00
Anders Carlsson 6d9f6f326d Handle layout of non-virtual base classes.
llvm-svn: 76348
2009-07-19 00:18:47 +00:00
Anders Carlsson 118ce16bf5 Refactor field layout into a separate function.
llvm-svn: 76343
2009-07-18 21:48:39 +00:00
Anders Carlsson 27b50135ee Rename NextOffset to DataSize, which better matches the Itanium C++ ABI
llvm-svn: 76339
2009-07-18 21:26:44 +00:00
Anders Carlsson a4267a654b Migrate over to the record layout builder.
llvm-svn: 76338
2009-07-18 21:19:52 +00:00
Argyrios Kyrtzidis c7082933e6 Re-enable 'test/SemaTemplate/temp_class_spec_neg.cpp', after commenting out the cause of the crash.
llvm-svn: 76337
2009-07-18 21:18:10 +00:00
Argyrios Kyrtzidis d6bf03c272 Introduce ASTLocation::getReferencedDecl(), for getting the declaration that the ASTLocation references.
llvm-svn: 76336
2009-07-18 21:17:58 +00:00
Argyrios Kyrtzidis fb63b0a317 Handle invalid ASTLocations instead of asserting.
llvm-svn: 76335
2009-07-18 21:17:43 +00:00
Anders Carlsson 4f51628b02 More layout builder work.
llvm-svn: 76333
2009-07-18 20:50:59 +00:00
Anders Carlsson 7947433411 Add a new ASTRecordLayoutBuilder class. Not used yet.
llvm-svn: 76330
2009-07-18 20:20:21 +00:00
Daniel Dunbar f1dc291655 Disable this test for now, it has been crashing on linux for weeks.
llvm-svn: 76328
2009-07-18 19:55:20 +00:00
Anders Carlsson 15b73deeea Revert r75641.
llvm-svn: 76327
2009-07-18 19:43:29 +00:00
Steve Naroff 4105f3eaf9 Fix typo from r76321.
llvm-svn: 76322
2009-07-18 15:38:31 +00:00
Steve Naroff c277ad10f0 Remove ObjCQualifiedInterfaceType:-)
llvm-svn: 76321
2009-07-18 15:33:26 +00:00
Sebastian Redl c88ab62c87 Fix RUN line to not litter the test directory.
llvm-svn: 76320
2009-07-18 15:13:36 +00:00
Sebastian Redl 3a0ae12162 Rename file in preparation of properly implementing C-style casts in C++.
llvm-svn: 76318
2009-07-18 15:08:18 +00:00
Sebastian Redl e644e19671 Enhance testing of overriding exception specs for inaccessible base exceptions.
llvm-svn: 76317
2009-07-18 14:32:15 +00:00
Zhongxing Xu 3f51f41779 Fix a comment.
llvm-svn: 76303
2009-07-18 09:26:51 +00:00
Argyrios Kyrtzidis fd16798b1f Fix a comment.
llvm-svn: 76299
2009-07-18 08:50:48 +00:00
Argyrios Kyrtzidis 05898da9cb Introduce a redecl_iterator in Decl class, so that we can do a "iterate over all declarations of the same decl" without knowing the exact type.
llvm-svn: 76298
2009-07-18 08:50:35 +00:00
Argyrios Kyrtzidis fad334ce5b Introduce the Redeclarable template class, which serves as a base type defining the common interface for Decls that can be redeclared.
Make FunctionDecl and VarDecl use it.

llvm-svn: 76297
2009-07-18 08:50:13 +00:00
Argyrios Kyrtzidis 194a9d8e73 Remove StmtLocResolver::VisitObjCIvarRefExpr, it was only there to avoid returning an implicit 'self' instead of the ivar.
Since implicit 'self' no longer has a source location, it's not needed. (plus we also want to check for a 'self' that is visible in source code)

llvm-svn: 76296
2009-07-18 08:49:56 +00:00
Argyrios Kyrtzidis e1a8c62ce7 Don't add a SourceLocation for 'self' if it does not actually appears in the source code.
llvm-svn: 76295
2009-07-18 08:49:37 +00:00
Zhongxing Xu 4b9f2d082a Replace stmt visitors with the fall back method.
llvm-svn: 76294
2009-07-18 08:49:07 +00:00
Ted Kremenek e9812bdac5 Fix crash in StoreManager::NewCastRegion() when handling casts from 'id' (or whatever) to a BlockPointerType.
llvm-svn: 76288
2009-07-18 06:27:51 +00:00
Ted Kremenek 2c8a159b7d Return CodeTextRegions for BlockPointerTypes in addition to FunctionPointerTypes.
llvm-svn: 76287
2009-07-18 06:27:01 +00:00
Ted Kremenek 6ab0a74a25 Add test case for bug fix in r76262.
llvm-svn: 76283
2009-07-18 05:02:33 +00:00
Ted Kremenek 0747de6aaa Fix some fallout from CFGBuilder restructuring: all expressions that we explicitly handle have the possibility to be block-level expressions.
llvm-svn: 76277
2009-07-18 00:47:21 +00:00
Argyrios Kyrtzidis 91ff94d6d9 Remove getFirstDeclaration/getLatestDeclaration from FunctionDecl and VarDecl.
Their usefulness is questionable since redecl_iterator was introduced.

llvm-svn: 76275
2009-07-18 00:34:35 +00:00
Argyrios Kyrtzidis 6b7e376160 Remove ASTContext::getCanonicalDecl() and use Decl::getCanonicalDecl in its place.
llvm-svn: 76274
2009-07-18 00:34:25 +00:00
Argyrios Kyrtzidis 5614aef776 Move the functionality of ASTContext::getCanonicalDecl(), into a virtual method Decl::getCanonicalDecl().
llvm-svn: 76273
2009-07-18 00:34:07 +00:00
Argyrios Kyrtzidis e842bd16ce Resolve a location that is inside an ObjCMethodDecl.
llvm-svn: 76272
2009-07-18 00:33:52 +00:00
Argyrios Kyrtzidis 38d83defbe Make ASTLocation accept a Stmt that is inside an ObjCMethodDecl.
llvm-svn: 76271
2009-07-18 00:33:46 +00:00
Argyrios Kyrtzidis 340f8af489 Search through all Decls that are DeclContexts.
llvm-svn: 76270
2009-07-18 00:33:40 +00:00
Argyrios Kyrtzidis 02675dc49d Set ObjCMethodDecl's EndLoc to the '}' when it's a definition.
llvm-svn: 76269
2009-07-18 00:33:33 +00:00
Argyrios Kyrtzidis ea72f422ef Location should be passed to setLocEnd() not to setAtEndLoc() which belongs to ObjCContainerDecl.
llvm-svn: 76268
2009-07-18 00:33:23 +00:00
Argyrios Kyrtzidis ce55b2e543 Add getSourceRange() methods for ObjC Decls.
llvm-svn: 76267
2009-07-18 00:33:08 +00:00
Chris Lattner f56501ce48 fix objc codegen to not have its own list of things that eventually get into llvm.used, just
populate CGM's list directly.

llvm-svn: 76266
2009-07-17 23:57:13 +00:00
Chris Lattner be35620902 This takes a long time to crash, just disable it for now.
llvm-svn: 76263
2009-07-17 23:48:38 +00:00
Ted Kremenek fc311292da Fix caching bug revealed by analyzing ClamAV using RegionStore.
llvm-svn: 76262
2009-07-17 23:48:26 +00:00
Ted Kremenek fe9b768aaa Fix possible null dereference in CFG construction.
llvm-svn: 76261
2009-07-17 22:57:50 +00:00
Ted Kremenek c3fd33014c Remove bogus check.
llvm-svn: 76259
2009-07-17 22:45:54 +00:00
Ted Kremenek 1d67c22949 Add error message when clang-cc cannot be found.
llvm-svn: 76256
2009-07-17 22:38:26 +00:00
Ted Kremenek 93668002c4 Restructure CFG builder to have just one visitor path instead of two. The result
is an algorithm that is much easier to understand and slightly more efficient.
Thanks to Mike Stump for our discussions on the CFGBuilder and his comments that
helped prompt this long needed cleanup.

llvm-svn: 76250
2009-07-17 22:18:43 +00:00
Ted Kremenek 2182259f36 Move WalkAST logic for 'ChooseExpr' to 'VisitChooseExpr'.
llvm-svn: 76205
2009-07-17 18:20:32 +00:00
Ted Kremenek 51d40b07a0 Move WalkAST logic for 'ConditionalOperator' into 'VisitConditionalOperator'.
llvm-svn: 76202
2009-07-17 18:15:54 +00:00
Daniel Dunbar c3ccd180e7 Fix indentation / trailing white space.
llvm-svn: 76200
2009-07-17 18:10:27 +00:00
Ted Kremenek 0bcdc981ef Remove stale comments.
llvm-svn: 76196
2009-07-17 18:04:55 +00:00
Ted Kremenek 8a286fbdb9 Per offline discussion with Steve Naroff, add back Type::getAsXXXType() methods
until Doug Gregor's Type smart pointer code lands (or more discussion occurs).
These methods just call the new Type::getAs<XXX> methods, so we still have
reduced implementation redundancy. Having explicit getAsXXXType() methods makes
it easier to set breakpoints in the debugger.

llvm-svn: 76193
2009-07-17 17:50:17 +00:00
Chris Lattner c960b3e80c clean up this code, add the fixme back.
llvm-svn: 76180
2009-07-17 15:50:19 +00:00
Chris Lattner 5230191e37 objc methods can't be an operand to callexpr.
llvm-svn: 76179
2009-07-17 15:46:27 +00:00
Zhongxing Xu 9d05213899 Rename Entity::getName() to Entity::getPrintableName() to make its purpose
more obvious.

llvm-svn: 76167
2009-07-17 07:49:44 +00:00
Zhongxing Xu 3436f58e40 As suggested by Argyrios, revert r76159 and make "FindImmediateParent"
a public static method of ASTLocation.

llvm-svn: 76166
2009-07-17 07:36:20 +00:00
Zhongxing Xu 3c8fa978ad Refactor code into a new CallExpr::getDirectCallee() method. Simplify some
code with the new method.

llvm-svn: 76164
2009-07-17 07:29:51 +00:00
Zhongxing Xu 2391d265ed CallGraph: add a bunch of stmt visitors.
llvm-svn: 76161
2009-07-17 07:05:19 +00:00
Zhongxing Xu d25ea831b2 Relax the assertion in ASTLocation's ctor: if the decl is not the immediate
parent of the stmt, find the immediate parent for the stmt.

This is because sometimes we cannot get the immediate decl of the stmt when
creating the ASTLocation. We can only get a parent of the stmt.

llvm-svn: 76159
2009-07-17 06:58:08 +00:00
Zhongxing Xu 6c1b35a0ef CallGraph:
- add IfStmt visitor.
 - print information only when a function has callee. Otherwise its ASTContext
   map is NULL.

llvm-svn: 76156
2009-07-17 05:49:16 +00:00
Mike Stump 31feda5585 Fixup indentation of rest of switch statement to match llvm coding
conventions.  Also reflowed comments and removed spaces at end of
lines and fixed up 80 col violations.

llvm-svn: 76140
2009-07-17 01:31:16 +00:00
Ted Kremenek b825c0ddc5 Replaced Type::getAsLValueReferenceType(), Type::getAsRValueReferenceType(), Type::getAsMemberPointerType(), Type::getAsTagType(), and Type::getAsRecordType() with their Type::getAs<XXX> equivalents.
llvm-svn: 76139
2009-07-17 01:20:38 +00:00
Argyrios Kyrtzidis 95d401de9d If we are not doing a Debug build, no need for the debugging print methods.
llvm-svn: 76138
2009-07-17 01:20:03 +00:00
Argyrios Kyrtzidis c6756ab0ae ObjCCategoryImplDecl and ObjCImplementation do not derive directly from DeclContext but from a new abstract ObjCImplDecl.
Reflect this change on the "DeclContext hierarchy".

llvm-svn: 76137
2009-07-17 01:19:49 +00:00
Argyrios Kyrtzidis bffa89f42c Check whether the IdentifierInfo is null, before using it.
llvm-svn: 76136
2009-07-17 01:19:03 +00:00
Mike Stump 48871a2880 Make noreturn functions alter the CFG.
llvm-svn: 76133
2009-07-17 01:04:31 +00:00
Ted Kremenek 3d486f08cb Replace Type::getAsReferenceType() with Type::getAs<ReferenceType>().
llvm-svn: 76132
2009-07-17 01:01:15 +00:00
Ted Kremenek 7c701e7d86 Update cf_returns_retained/ns_returns_retained examples to use __has_feature.
llvm-svn: 76130
2009-07-17 00:25:49 +00:00
Ted Kremenek e5a068fcb3 Update test case to use '__has_feature' macro.
llvm-svn: 76129
2009-07-17 00:19:33 +00:00
Daniel Dunbar a3f41f4bba Some more ?: for Obj-C tests.
llvm-svn: 76125
2009-07-16 23:34:22 +00:00
Daniel Dunbar 54c596465d Fix unused variable warnings (with -Asserts)
llvm-svn: 76112
2009-07-16 22:10:11 +00:00
Fariborz Jahanian c3443a3bf3 ir-gen for --/++ operators of objc object pointers
in 32bit abi.

llvm-svn: 76109
2009-07-16 22:04:59 +00:00
Daniel Dunbar 0418a5f11e Add more testing of ?: for Obj-C object types.
llvm-svn: 76108
2009-07-16 21:55:48 +00:00
Daniel Dunbar 54091b82b5 [llvm up] Add support for '#' component of QA_OVERRIDE_GCC3_OPTIONS.
- This silences the output about how command line arguments are being changed.

llvm-svn: 76107
2009-07-16 21:32:51 +00:00
Daniel Dunbar dde5c8d522 Add extra print for --time-tests output.
llvm-svn: 76104
2009-07-16 21:18:21 +00:00
Anton Korobeynikov b5b703b2f7 Hook in s390x stuff into clang
llvm-svn: 76099
2009-07-16 20:09:57 +00:00
Ted Kremenek e3fb4b6524 Add member template 'Type::getAs<T>', which converts a Type* to a respective T*.
This method is intended to eventually replace the individual
Type::getAsXXXType<> methods.

The motivation behind this change is twofold:

1) Reduce redundant implementations of Type::getAsXXXType() methods. Most of
them are basically copy-and-paste.

2) By centralizing the implementation of the getAs<Type> logic we can more
smoothly move over to Doug Gregor's proposed canonical type smart pointer
scheme.

Along with this patch:

a) Removed 'Type::getAsPointerType()'; now clients use getAs<PointerType>.
b) Removed 'Type::getAsBlockPointerTypE()'; now clients use getAs<BlockPointerType>.

llvm-svn: 76098
2009-07-16 19:58:26 +00:00
Ted Kremenek 6796fbd2e8 Move the source-level CFG from libAST to libAnalysis.
llvm-svn: 76092
2009-07-16 18:13:04 +00:00
Ted Kremenek afe797d7b3 Add 'clang-wpa' to the CMake-based build.
llvm-svn: 76091
2009-07-16 18:10:20 +00:00
Owen Anderson a296c03430 Update for LLVM API change.
llvm-svn: 76090
2009-07-16 18:09:38 +00:00
Fariborz Jahanian ca75db7c02 Diagnose ++/-- op on objc pointers in
nonfragile abi, instead of crashing.

llvm-svn: 76088
2009-07-16 17:59:14 +00:00
Chris Lattner aa64ca28cb use CreateRuntimeVariable to get __CFConstantStringClassReference
instead of doing it manually (which might end up getting auto-renamed),
fixing a FIXME. rdar://7065446

llvm-svn: 76079
2009-07-16 16:48:25 +00:00
Steve Naroff fac5bc9264 Cleanup a couple loops and improve a comment (based on feedback from Fariborz).
llvm-svn: 76078
2009-07-16 16:21:02 +00:00
Steve Naroff 79d1215d83 Remove ASTContext::isObjCObjectPointerType().
Convert all clients to use the new predicate on Type.

llvm-svn: 76076
2009-07-16 15:41:00 +00:00
Chris Lattner 3afa3e1d91 codegen string literals using private linkage now like llvm-gcc, eliminating
some target hooks.

llvm-svn: 75895
2009-07-16 05:03:48 +00:00
Daniel Dunbar 84a56054cd Unbreak build?
llvm-svn: 75887
2009-07-16 02:02:48 +00:00
Ted Kremenek 942c0e5243 Update CMake file.
llvm-svn: 75885
2009-07-16 01:43:33 +00:00
Ted Kremenek c7b1dade86 Move RegionStoreManager over to using new
ValueManager::makeArrayIndex()/convertArrayIndex() methods.  This
handles yet another crash case when reasoning about array indices of
different bitwidth and signedness.

llvm-svn: 75884
2009-07-16 01:33:37 +00:00
Ted Kremenek f267a15c8d Two changes:
(1) Moved the SValuator object from GRExprEngine to ValueManager.  This
   allows ValueManager to use the SValuator when creating SVals.

(2) Added ValueManager::makeArrayIndex() and
    ValueManager::convertToArrayIndex(), two SVal creation methods
    that will help RegionStoreManager always have a consistent set of
    SVals with the same integer size and type when reasoning about
    array indices.

llvm-svn: 75882
2009-07-16 01:32:00 +00:00
Fariborz Jahanian 41136eec6b Generate error on declaration containing 'static' and '__attribute__((weak))'
Patch by Ryan Flynn

llvm-svn: 75879
2009-07-16 01:12:24 +00:00
Zhongxing Xu cd64aaa4a9 update makefile.
llvm-svn: 75878
2009-07-16 01:05:34 +00:00
Zhongxing Xu bd8549169a add copyright comments.
llvm-svn: 75877
2009-07-16 01:03:49 +00:00
Devang Patel 894caff444 Enable. Now the LLVM dwarfwriter does not print extra '1' prefix in symbol names (rev. 75875)
llvm-svn: 75876
2009-07-16 01:02:47 +00:00
Zhongxing Xu 17c9e7cb5c Add a primitive clang whole primitive analyzer tool.
llvm-svn: 75874
2009-07-16 01:00:25 +00:00
Zhongxing Xu bc6eb71f31 Commit the initial implementation of call graph building.
llvm-svn: 75873
2009-07-16 00:54:12 +00:00
Steve Naroff a057ba905b Avoid crashing for the enclosed test case.
This is fallout from the recent ObjCObjectPointerType rework. I'll work on fixing this tomorrow.

llvm-svn: 75870
2009-07-16 00:25:06 +00:00
Owen Anderson 9f98d37612 Update for LLVM API change.
llvm-svn: 75869
2009-07-16 00:14:12 +00:00
Ted Kremenek ccc22924b0 Use utility method to create 0-index into ElementRegion.
llvm-svn: 75865
2009-07-16 00:00:11 +00:00
Fariborz Jahanian 30324d68b1 Fixed a stinko which caused an ast-print test failure.
llvm-svn: 75861
2009-07-15 23:39:31 +00:00
Ted Kremenek d4adebbbd6 Handle some more fallout with the conversion of using PointerType for
Objective-C pointers to using ObjCObjectPointerType.

Now the checking for 'attribute ((nonnull))' in Sema doesn't emit an error when
trying to apply that attribute to a parameter that is an Objective-C pointer
(this is a regression).

To prevent this regression from occuring in the future, the 'nonnull.c' test was
moved to test/SemaObjC and renamed 'nonnull.m'. I also enhanced the tests to
show that function calls involved a NULL Objective-C pointer constant does not
trigger a warning. This is consistent with GCC, but should likely be fixed.

llvm-svn: 75856
2009-07-15 23:23:54 +00:00
Fariborz Jahanian 24d2383a19 #ifdef'ed out -ast-print of destructors which caused
a test failure, until figuring out what caused the failure.

llvm-svn: 75855
2009-07-15 23:22:45 +00:00
Fariborz Jahanian 16094c2467 Added ASTs to destructor decl AST for default destruction of object's
base/members.

llvm-svn: 75849
2009-07-15 22:34:08 +00:00
Ted Kremenek f3e1e4d9a1 Fix <rdar://problem/7062158> by having BasicStoreManager model values for 'static' global variables.
llvm-svn: 75844
2009-07-15 22:09:25 +00:00
Ted Kremenek 3e808edac9 Lexically order files in CMakeLists.txt files.
llvm-svn: 75832
2009-07-15 21:08:41 +00:00
Daniel Dunbar ee71c25eee Reapply r75764: [llvm up] Switch to using the new TargetRegistry
llvm-svn: 75821
2009-07-15 20:25:38 +00:00
Steve Naroff 7183eefdfa Remove cast from test case (cast was incorrectly added as part of http://llvm.org/viewvc/llvm-project?view=rev&revision=75314).
Add new warnings that are being produced.

llvm-svn: 75816
2009-07-15 19:44:23 +00:00
Steve Naroff da44a40b64 Remove default argument, since it isn't being used (suggested by Fariborz).
llvm-svn: 75815
2009-07-15 19:34:04 +00:00
Argyrios Kyrtzidis 4b415acff6 Revert r75764 "[llvm up] Switch to using the new TargetRegistry" to fix build.
llvm-svn: 75814
2009-07-15 18:59:48 +00:00
Argyrios Kyrtzidis ed53caebda Add comments to indicate why RUN lines are below the source code.
llvm-svn: 75813
2009-07-15 18:59:40 +00:00
Steve Naroff 8206de760b Add a "t".
llvm-svn: 75810
2009-07-15 18:50:21 +00:00
Steve Naroff 1329fa0ed9 Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective).
This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-).

This patch also adds Type::isObjCBuiltinType().

This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small.

llvm-svn: 75808
2009-07-15 18:40:39 +00:00
Dan Gohman 74e3eb49ea Update for raw_fd_ostream API changes. raw_fd_ostream now has a
Force flag to control whether the case of opening an existing
file is considered an error.

llvm-svn: 75802
2009-07-15 17:32:18 +00:00
Daniel Dunbar 3d038dd33d [llvm up] Switch to using the new TargetRegistry.
llvm-svn: 75764
2009-07-15 09:43:46 +00:00
Zhongxing Xu 69cc15e97f Delete extra whitespaces.
llvm-svn: 75761
2009-07-15 09:04:01 +00:00
Zhongxing Xu a5da8d25b7 rewrite the logic to make it follow the comments more closely.
llvm-svn: 75750
2009-07-15 06:21:18 +00:00
Ted Kremenek 4802955b84 Enhance RegionStore's reasoning about Objective-C ivars. More testing to follow.
llvm-svn: 75748
2009-07-15 06:09:28 +00:00
Zhongxing Xu b5bf7ee393 Use utility method.
llvm-svn: 75745
2009-07-15 05:09:24 +00:00
Zhongxing Xu 12b1d137c2 Add getName() method to Entity.
llvm-svn: 75740
2009-07-15 04:39:21 +00:00
Ted Kremenek 57fa7e3cc8 Relax assertion.
llvm-svn: 75738
2009-07-15 04:23:32 +00:00
Ted Kremenek e6fea68c46 More test cases revealed that the logic in StoreManager::InvalidateRegion() needs more finesse when handling the invalidation of pointers. Pointers that were invalidated as integers could later cause problems for clients using them as pointers. It is easier for us to model a symbolic value as a pointer rather than modeling a non-symbolic value as a pointer.
This patch causes:
- StoreManager::InvalidateRegion() to not used the casted type of a region if
  it would cause a pointer type to be invalidated as a non-pointer type.
- Pushes RegionStore::RetrieveElement() further by handling retrievals from
  symbolic arrays that have been invalidated.  This uses the new SymbolDerived
  construct that was recently introduced.
  
The result is that the failing test in misc-ps-region-store-x86_64.m now passes.
Both misc-ps-region-store-x86_64.m and misc-ps-region-store-i386.m contain a
test case that motivated this change.

llvm-svn: 75730
2009-07-15 02:31:43 +00:00
Ted Kremenek c6c2157836 Introduced the notion of a "derived symbol" using the class SymbolDerived.
SymbolDerived allows us to model symbolic values that are related to other
symbols via a region hierarchy. For example, SymbolDerived can be used to model
individual values of a symbolic array.

llvm-svn: 75728
2009-07-15 02:27:32 +00:00
Ted Kremenek e5d2f79876 Handle cast of 'ObjCObjectRegion' in StoreManager::InvalidateRegion.
llvm-svn: 75713
2009-07-14 23:52:07 +00:00
Fariborz Jahanian dfbd05d8aa Added a FIXME and prevent crash when listing
a dependent type in the ctor initializer-list.

llvm-svn: 75712
2009-07-14 23:41:35 +00:00
Ted Kremenek 9a797db199 Split out 'test2' into an i386 and x86_64 file, illustrating how the
test behavior differs between architectures.  When this is no longer
the case, these tests will be merged.

llvm-svn: 75708
2009-07-14 23:17:22 +00:00
Owen Anderson 170229f68d Update for LLVM API change, and contextify a bunch of related stuff.
llvm-svn: 75705
2009-07-14 23:10:40 +00:00
Ted Kremenek eea582f04f This test currently only passes for 32-bit archs.
llvm-svn: 75698
2009-07-14 22:58:18 +00:00
Fariborz Jahanian 5da7ecb245 Fixed a bug in building ctor-initializer AST.
llvm-svn: 75692
2009-07-14 22:40:50 +00:00
Eli Friedman bb0d9a5129 Remove -ftraditional option, which gcc doesn't actually support. Make
using -traditional and -traditional-cpp with clang an error because 
it's unsupported in clang and causes a significant change in the 
semantics of the language.

llvm-svn: 75690
2009-07-14 21:58:17 +00:00
Devang Patel 9be7b20401 Revert 75648 for now. It is causing test failures.
llvm-svn: 75684
2009-07-14 21:31:22 +00:00
Ted Kremenek 0c37d19fea Enhance RegionStoreManager to handle 'Retrieve's from SymbolicRegions. We do this by silently wrapping the region with an ElementRegion. This fixes the failures in misc-ps-region-store.m.
llvm-svn: 75679
2009-07-14 20:48:22 +00:00
Chris Lattner 156817705e fix fallout of the LLVM codegen switching to formatted_raw_ostream.
llvm-svn: 75675
2009-07-14 20:39:15 +00:00
Ted Kremenek e2fb3ce385 Tweak pretty-printing of CompoundVal to make it more useful for debugging.
llvm-svn: 75672
2009-07-14 20:21:36 +00:00
Fariborz Jahanian 06b2374504 Build AST for default ctor-initializer when constructor has
out of line definition.

llvm-svn: 75668
2009-07-14 20:06:22 +00:00
Fariborz Jahanian c75e143709 Support data members of array type in default
ctor-initializer AST build.

llvm-svn: 75662
2009-07-14 18:56:31 +00:00
Fariborz Jahanian 6dc0284cff Moved a FIXME to where it was meant to be.
llvm-svn: 75651
2009-07-14 18:29:14 +00:00
Steve Naroff 6b712a7ba1 Introduce Type::isAnyPointerType() and convert all clients (suggested by Chris).
I don't love the name, however it simplifies the code and is a worthwhile change. If/when we come up with a better name, we can do a search/replace.

llvm-svn: 75650
2009-07-14 18:25:06 +00:00
Fariborz Jahanian 49c81799b0 Patch to build AST for ctor's initializer list according to
semantics of order of construction [class.init].

llvm-svn: 75649
2009-07-14 18:24:21 +00:00
Chris Lattner ff1ee0d7c9 [llvm up] adjust to match mainline.
llvm-svn: 75647
2009-07-14 18:18:16 +00:00
Anders Carlsson 466fd0a16d Rename RecordLayout.h to ASTRecordLayout.h
llvm-svn: 75641
2009-07-14 17:29:11 +00:00
Daniel Dunbar 88719a1dd6 Revert r75614 which depend on r75610 (for LLVM), which was reverted.
--- Reverse-merging r75614 into '.':
U    lib/CodeGen/CGDebugInfo.cpp

llvm-svn: 75639
2009-07-14 16:40:28 +00:00
Steve Naroff 5ec6ff7678 Add a "TypeSpecStartLoc" to FieldDecl. Patch contributed by Enea Zaffanella.
Note: One day, it might be useful to consider adding this info to DeclGroup (as the comments in FunctionDecl/VarDecl suggest). For now, I think this works fine. I considered moving this to ValueDecl (a common ancestor of FunctionDecl/VarDecl/FieldDecl), however this would add overhead to EnumConstantDecl (which would burn memory and isn't necessary).
llvm-svn: 75635
2009-07-14 14:58:18 +00:00
Alisdair Meredith ed28f6e433 Fix the build
llvm-svn: 75627
2009-07-14 08:10:06 +00:00
Alisdair Meredith a9ad47d94c Basic support for C++0x unicode types. Support for literals will follow in an incremental patch
llvm-svn: 75622
2009-07-14 06:30:34 +00:00
Chris Lattner 74d3c61532 use new name for method.
llvm-svn: 75614
2009-07-14 06:16:43 +00:00
Argyrios Kyrtzidis 9cbe886cff Move the RUN lines on the same file but below the code, as suggested by Sebastian.
llvm-svn: 75608
2009-07-14 05:34:59 +00:00
Argyrios Kyrtzidis b0c86d4fe8 In Stmt::printPretty(), pass the SourceManager to dump().
llvm-svn: 75606
2009-07-14 03:20:38 +00:00
Argyrios Kyrtzidis 12563b8111 Handle redeclarations properly at the index-test tool.
llvm-svn: 75605
2009-07-14 03:20:31 +00:00
Argyrios Kyrtzidis 1506d9bc25 Introduce redecl_iterator, used for iterating over the redeclarations of a FunctionDecl or VarDecl.
It iterates over all the redeclarations, regardless of the starting point. For example:

1) int f();
2) int f();
3) int f();

if you have the (2) FunctionDecl and call redecls_begin/redecls_end to iterate, you'll get this sequence:
(2)
(1)
(3)

The motivation to introduce this was that, previously, if (3) was a function definition,
and you called getBody() at (2), it would not return it, since getBody() iterated over the previous declarations only,
so it would only check (2) and (1).

llvm-svn: 75604
2009-07-14 03:20:21 +00:00
Argyrios Kyrtzidis 0736c5ca3b Introduce FunctionDecl::getLatestDeclaration() and VarDecl::getLatestDeclaration().
For multiple redeclarations they return the last one.

Also, add some non const versions of methods.

llvm-svn: 75603
2009-07-14 03:20:08 +00:00
Argyrios Kyrtzidis ef17c07bf6 Introduce FunctionDecl::getFirstDeclaration() and VarDecl::getFirstDeclaration().
For multiple redeclarations they return the first one.

llvm-svn: 75602
2009-07-14 03:19:57 +00:00
Argyrios Kyrtzidis d49e8dd759 Add a C++ indexing test case, where we show the references of overloaded '+' plus signs.
Ok, this is a bit out of place since C++ support is way way off, but it was just too cool to not show it off :-)

llvm-svn: 75601
2009-07-14 03:19:46 +00:00
Argyrios Kyrtzidis ef1c1e572c For C++ overloaded operator calls, set the source location of the DeclRefExpr to the location of the operator.
llvm-svn: 75600
2009-07-14 03:19:38 +00:00
Argyrios Kyrtzidis e6cd787ee1 For index-test, if the ASTLocation points at a CallExpr, get a Decl out of it.
llvm-svn: 75599
2009-07-14 03:19:30 +00:00
Argyrios Kyrtzidis eeaaead736 Read/write a CXXOperatorCallExpr from/to PCH files.
llvm-svn: 75598
2009-07-14 03:19:21 +00:00
Argyrios Kyrtzidis 11a846ab53 Fixes for a couple of things:
- Declaration context of ParmVarDecls (that we got from the Declarator) was not their containing function.
- C++ out-of-line method definitions didn't get an access specifier.

Both were exposed by a crash when emitting a C++ method to a PCH file (assert at Decl::CheckAccessDeclContext()).

llvm-svn: 75597
2009-07-14 03:18:53 +00:00
Argyrios Kyrtzidis 2f0eff102c Handle struct fields through the index-test tool.
llvm-svn: 75596
2009-07-14 03:18:40 +00:00
Argyrios Kyrtzidis 558449bf79 Move the test input source code to a separate file.
That way we can freely add new RUN lines without having to correct the line part in all the -point-at options.

llvm-svn: 75595
2009-07-14 03:18:25 +00:00
Argyrios Kyrtzidis 307b0717f7 In ResolveLocationInAST, handle locations that are inside TagDecl definitions.
llvm-svn: 75594
2009-07-14 03:18:17 +00:00
Argyrios Kyrtzidis a28d145cbb In DeclReferenceMap, map FieldDecls to the MemberExprs that reference them.
llvm-svn: 75593
2009-07-14 03:18:09 +00:00
Argyrios Kyrtzidis 664b690107 Read/write TagDecl's RBraceLoc from/to PCH files.
llvm-svn: 75592
2009-07-14 03:18:02 +00:00
Argyrios Kyrtzidis 23e1f1d6be Pass the right brace SourceLocation from the Parser to the TagDecls.
llvm-svn: 75591
2009-07-14 03:17:52 +00:00
Argyrios Kyrtzidis 575fa05991 Add the SourceLocation for the right brace in TagDecl.
llvm-svn: 75590
2009-07-14 03:17:17 +00:00
Devang Patel d6c256696b Use LLVM mangler to get mangled name for debug info entry.
llvm-svn: 75589
2009-07-14 02:47:58 +00:00
Daniel Dunbar f5c79709bc Update debug info generation for ObjCObjectPointer changes.
- Previously this would crash on recursive types, and it was also incorrectly
   stripping off a level of indirection.
 - I'm not 100% convinced this is all correct, but it should be a monotonic
   improvment.

llvm-svn: 75582
2009-07-14 01:20:56 +00:00
Zhongxing Xu 170e816eff Instead of recovering from a wrong invalidation, this patch aims to
invalidate the region correctly. It uses the cast-to type to invalidate 
the region when available. To avoid invalid cast-to type like 'void*' or 'id',
region store now only records non-generic casts of regions.

llvm-svn: 75580
2009-07-14 01:12:46 +00:00
Devang Patel caadf8c9dc I just revertd llvm patch.
XFAIL this for now until I prepare clang specific patch.

llvm-svn: 75575
2009-07-14 00:56:16 +00:00
Ted Kremenek c057f417d8 Add basic checking for passing NULL to CFRetain/CFRelease, since those functions
are not explicitly marked as not accepting NULL pointers. This check illustrates
how we need more refactoring in the custom-check logic.

llvm-svn: 75570
2009-07-14 00:43:42 +00:00
Owen Anderson 2571eb6453 Update for API change.
llvm-svn: 75569
2009-07-14 00:38:16 +00:00
Ted Kremenek a6904ff7f9 Tidy pretty-printing for SVals, using 'dump()' instead of 'printStdErr()', and implementing operator<< support for llvm::raw_ostream.
llvm-svn: 75560
2009-07-13 23:53:06 +00:00
Ted Kremenek c8d6746c39 When pretty-printing symbolic regions, use '{' ... '}' to indicate the symbol used for the region (makes it easier to read for nested regions).
llvm-svn: 75550
2009-07-13 23:38:57 +00:00
Fariborz Jahanian 44e56ca949 Fixes a minor bug in pretty printing of ctor defs.
llvm-svn: 75549
2009-07-13 23:31:10 +00:00
Ted Kremenek eabdd984b1 Change pretty-printing API for SymExprs and MemRegions to use a naming convention and style similar to other elements in Clang.
llvm-svn: 75548
2009-07-13 23:31:04 +00:00
Ted Kremenek b63f71528e Enhance SimpleSValuator::EvalBinOpNN to recognize the trivial case
where we are comparing a symbolic value against itself, regardless of
the nature of that symbolic value.

This enhancement identified a case where RegionStoreManager is not
correctly symbolicating the values of the pointees of parameters.  The
failing test is now in 'test/Analysis/misc-ps-region-store.m', with
that test file now (temporarily) marked XFAIL.

llvm-svn: 75521
2009-07-13 21:55:12 +00:00
Daniel Dunbar 9ab53d2b17 Explicitly initialize the options array, MinGW's gcc 4.3.5 appears to have a bug
in array value-initialization.

llvm-svn: 75518
2009-07-13 21:50:47 +00:00
Daniel Dunbar 48b4d1e27e There is no need to value initialize this array.
llvm-svn: 75517
2009-07-13 21:48:50 +00:00
Steve Naroff a63372da72 Remove superfluous call to getAsPointerType()...
llvm-svn: 75509
2009-07-13 21:32:29 +00:00
Daniel Dunbar 047f00ca4a Make stdin for test scripts empty, so that tests don't accidentally hang waiting
for stdin.

llvm-svn: 75506
2009-07-13 21:24:28 +00:00
Steve Naroff aacd4cce73 Sema::CheckAdditionOperands(): Use Type::getPointeeType() and remove PTy and OPT variables.
llvm-svn: 75505
2009-07-13 21:20:41 +00:00
Devang Patel 450f266095 New testcase for rev 75503.
llvm-svn: 75504
2009-07-13 21:20:20 +00:00
Chris Lattner d1d820ed51 add netbsd support, patch by Krister Kalfridsson!
llvm-svn: 75492
2009-07-13 20:29:08 +00:00
Fariborz Jahanian 494720b7f7 Added pretty-printing support for constructor definition.
llvm-svn: 75487
2009-07-13 20:18:13 +00:00
Steve Naroff 2efbbe3531 - Improve comment for Type::getPointeeType().
- Remove a couple redundant casts/returns.
- Fix 80 column violations for all getAsStringInternal() methods.

llvm-svn: 75485
2009-07-13 19:06:52 +00:00
Steve Naroff 4eed7a16d6 Fix 5 issues from Chris's feedback on http://llvm.org/viewvc/llvm-project?view=rev&revision=75314.
Still more to come...just wanted to get the no-brainers out of the way.

llvm-svn: 75477
2009-07-13 17:19:15 +00:00
Devang Patel 9c3a0188cd Update debug info type cache after fwd decl is replaced by real decl.
llvm-svn: 75473
2009-07-13 17:03:14 +00:00
Devang Patel 290b052d43 Fix comment.
llvm-svn: 75471
2009-07-13 16:15:54 +00:00
Owen Anderson ae86c19e68 Update for LLVM API change.
llvm-svn: 75446
2009-07-13 04:10:07 +00:00
Chris Lattner e7cabb94a3 minor cleanups, reduce nesting of if's with early return.
llvm-svn: 75442
2009-07-13 00:10:46 +00:00
Daniel Dunbar 2e5be09280 Match declaration to definition.
llvm-svn: 75441
2009-07-12 23:52:11 +00:00
Daniel Dunbar 593c36c1c8 Match declaration to definition.
llvm-svn: 75439
2009-07-12 22:53:49 +00:00
Chris Lattner c9f6c334f0 fix file headers.
llvm-svn: 75437
2009-07-12 22:33:12 +00:00
Chris Lattner 000628da61 fix typo in file headers.
llvm-svn: 75436
2009-07-12 22:31:02 +00:00
Chris Lattner c638161d38 improve comments.
llvm-svn: 75435
2009-07-12 22:29:59 +00:00
Chris Lattner 7bad9ef8ae document the diagnostics pragmas, patch by Louis Gerbarg!
llvm-svn: 75432
2009-07-12 21:22:10 +00:00
Chris Lattner fb42a1820f add push/pop semantics for diagnostics. Patch by Louis Gerbarg!
llvm-svn: 75431
2009-07-12 21:18:45 +00:00
Daniel Dunbar d37908f149 Revert to using shell to find files instead of 'find', that wasn't portable.
- I think I did this commit sequence before. :)

llvm-svn: 75420
2009-07-12 19:00:20 +00:00
Daniel Dunbar 0f4736424e Stop looking for tests in the Output/ directory.
llvm-svn: 75404
2009-07-11 23:43:59 +00:00
Daniel Dunbar 619bf84ad4 The -disable-free hack didn't work...
llvm-svn: 75401
2009-07-11 23:05:12 +00:00
Daniel Dunbar 024c68b734 Force NeXT runtime for this test.
llvm-svn: 75400
2009-07-11 23:04:43 +00:00
Daniel Dunbar df1cff7356 Remove excessive use of Carbon.h / Cocoa.h in clang tests.
- These kinds of "shotgun" tests are very slow, and do not belong in the
   regression suite. If these kinds of tests are regarded to have value, they
   should be added to the LLVM test-suite.

 - I would actually like to remove all of these tests, but I left Sema/carbon.c
   and SemaObjC/cocoa.m...

llvm-svn: 75399
2009-07-11 23:03:07 +00:00
Daniel Dunbar 5ae1e029f4 Add --time-tests option to test runner, for profiling 'make test'.
llvm-svn: 75396
2009-07-11 22:46:27 +00:00
Daniel Dunbar 09bb21f80c Fix comment, and reduce computational expense of this test.
- I don't see any need for it to be this expensive.

llvm-svn: 75395
2009-07-11 22:44:48 +00:00
Daniel Dunbar cfd6800c76 Add -disable-free to this test in the hopes if having it pass on Linux for now.
llvm-svn: 75390
2009-07-11 22:00:53 +00:00
Daniel Dunbar 7e5f052772 Fix type conversion of ObjCObjectPointerType.
- Previous code was based on a misunderstanding (on my part) of the type
   representation.

llvm-svn: 75385
2009-07-11 21:12:14 +00:00
Daniel Dunbar 9d82da40ec Generate correct prototype for objc_enumerationMutation.
- This was a latent bug exposed by the recent objc type changes.

llvm-svn: 75383
2009-07-11 20:32:50 +00:00
Daniel Dunbar 631a57e30f Fix test case to match intent.
llvm-svn: 75381
2009-07-11 20:17:35 +00:00
Nuno Lopes 14ea24e422 restore proper valgrind support.
disclaim: I know nothing about Python, so apologies in advance if I break something

llvm-svn: 75368
2009-07-11 18:34:43 +00:00
Alisdair Meredith f6eb60a851 Fix breakage on Windows, cannot redeclare loop variable i in the immediate scope of loop. Rename variable to j.
llvm-svn: 75365
2009-07-11 14:32:10 +00:00
Ted Kremenek da03e8443e Handle insidious corner case exposed by RegionStoreManager when handling void* values that are bound
to symbolic regions and then treated like integers.

llvm-svn: 75356
2009-07-11 04:38:49 +00:00
Zhongxing Xu e00c981feb remove duplicated test cast.
llvm-svn: 75329
2009-07-11 02:33:35 +00:00
Anders Carlsson 0d14291fbf Fix a test.
llvm-svn: 75327
2009-07-11 01:00:52 +00:00
Ted Kremenek f6f0461a38 Restructure RegionStoreManager::EvalBinOp() as a switch dispatch over different
MemRegion kinds. This allows the compiler to identify what MemRegions we don't
handle for pointer arithmetic.

llvm-svn: 75326
2009-07-11 00:58:27 +00:00
Eli Friedman 55179ca5aa Fix typo (found by gcc warning).
llvm-svn: 75325
2009-07-11 00:57:02 +00:00
Anders Carlsson 43171d6aeb Add another test.
llvm-svn: 75324
2009-07-11 00:55:33 +00:00
Anders Carlsson ae01993a12 Implement more of C++0x 'auto'. A variable with an auto type specifier must have an initializer. Also, move some tests around to match the C++0x draft better.
llvm-svn: 75322
2009-07-11 00:34:39 +00:00
Ted Kremenek f514592197 Fix warning when compiling with optimizations:
warning: ‘OPT’ may be used uninitialized in this function

Now OPT is initialized to NULL. I'm not certain if this is the correct fix;
others please review.

llvm-svn: 75321
2009-07-11 00:21:48 +00:00
Ted Kremenek 156700fd14 This test passes with RegionStoreManager.
llvm-svn: 75318
2009-07-11 00:07:06 +00:00
Ted Kremenek 74a7b9188a This test now passes with RegionStoreManager.
llvm-svn: 75316
2009-07-11 00:03:23 +00:00
Anders Carlsson 9890fb5bf6 Remove some unused code from an experiment that I didn't like.
llvm-svn: 75315
2009-07-10 23:48:10 +00:00
Steve Naroff 7cae42b07a This patch includes a conceptually simple, but very intrusive/pervasive change.
The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches.

This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic.

By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. 

Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks.

llvm-svn: 75314
2009-07-10 23:34:53 +00:00
Ted Kremenek 94575aacc1 Restructure RegionStoreManager::getSizeInElements() to use a switch statement
over the types of MemRegions. This allows the compiler to warn us which regions
are not handled, and also is a little faster.

llvm-svn: 75304
2009-07-10 22:30:06 +00:00
Eli Friedman fd9b1094b8 Fix silly mistake I made applying patch to fix test.
llvm-svn: 75303
2009-07-10 22:27:56 +00:00
Ted Kremenek e057d4e5a9 Rename test file.
llvm-svn: 75297
2009-07-10 21:48:43 +00:00
Ted Kremenek 3fcf628b40 RegionStoreManager also passes this test file.
llvm-svn: 75296
2009-07-10 21:48:10 +00:00
Ted Kremenek 488495e491 RegionStoreManager now correctly passes this test file.
llvm-svn: 75295
2009-07-10 21:45:10 +00:00
Ted Kremenek 6cb2a34e3c Test case in test/Analysis/xfail_regionstore_wine_crash.c no longer fails, so
move this case to 'test/Analysis/misc-ps.m' to test with both BasicStoreManager
and RegionStoreManager.

llvm-svn: 75294
2009-07-10 21:43:30 +00:00
Anders Carlsson 7ca3f6feea Fix type of 'this' and add a decltype test.
llvm-svn: 75291
2009-07-10 21:35:09 +00:00
Ted Kremenek bf73ad47a8 Revert r75281 and simply remove the assertion in NewCastRegion that
CodeTextRegions can only be casted to FunctionPointer or BlockPointerTypes. This
simply isn't true. We can handle bogus operations on CodeTextRegions (e.g, an
array access) elsewhere.

llvm-svn: 75285
2009-07-10 21:24:45 +00:00
Ted Kremenek 6c94771a0b Fix crash in StoreManager::NewCastRegion regarding handling casts to void*,
void**, void***, etc.  Such casts should just pass the region through.

llvm-svn: 75281
2009-07-10 21:11:16 +00:00
Eli Friedman 837f574ee9 Use /usr/bin/env trick to find python. Patch by Krister Walfridsson.
llvm-svn: 75271
2009-07-10 20:15:12 +00:00
Fariborz Jahanian 3554b5a37c Patch to build list of inherited virtual base classes
in their order of construction for each class and use it 
to to check on propery order of base class construction 
under -Wreorder option.

llvm-svn: 75270
2009-07-10 20:13:23 +00:00
Eli Friedman 7d369cd2a6 Misc fixes to fix tests on OpenBSD, per email to cfe-commits. Patches
by Jonathan Gray and Krister Walfridsson.

llvm-svn: 75268
2009-07-10 20:10:06 +00:00
Anders Carlsson ea1cfb415b Fix a problem that Eli noticed, and that Doug helped me fix.
llvm-svn: 75265
2009-07-10 19:20:26 +00:00
Ted Kremenek da98f732cb Rename potentially ambiguous member template 'getRegion' to 'getSubRegion' to hopefully resolve template lookup ambiguities on some compilers.
llvm-svn: 75253
2009-07-10 16:51:45 +00:00
Chris Lattner 53ea7db5e3 linkify
llvm-svn: 75225
2009-07-10 05:07:59 +00:00
Argyrios Kyrtzidis bff082aec9 Add documentation for the Index library to clang's web page.
llvm-svn: 75222
2009-07-10 03:41:36 +00:00
Argyrios Kyrtzidis 6dd7181ed4 Simplify a bit by using functions instead of checking enum values. No functionality change.
llvm-svn: 75221
2009-07-10 03:41:26 +00:00
Ted Kremenek f66557978e Switch BasicStoreManager to use the new CastRegion implementation by default,
and replace the 'clang-cc' option '-analyzer-store=basic-new-cast' with
'-analyzer-store=basic-old-cast'. We'll keep the old CastRegion implementation
around for a little while for regression testing.

llvm-svn: 75209
2009-07-10 00:41:58 +00:00
Fariborz Jahanian 5582f231f2 don't crash if class is using itself as its super class.
llvm-svn: 75178
2009-07-09 22:08:26 +00:00
Anders Carlsson cf1441ab20 Fix another decltype crash.
llvm-svn: 75175
2009-07-09 22:00:53 +00:00
Fariborz Jahanian 341583c3ac Sema check on out of order object initialization of
class object's base and members under -Wreorder flag.

llvm-svn: 75168
2009-07-09 19:59:47 +00:00
Anders Carlsson 17973e684d Use getDeclName in DefineImplicitOverloadedAssign as well.
llvm-svn: 75152
2009-07-09 17:47:25 +00:00
Douglas Gregor b05ce0f395 Another little test for C++ [over.over]
llvm-svn: 75151
2009-07-09 17:44:05 +00:00
Anders Carlsson 52b9180587 Pass the DeclName to the diagnostic builder so that member names will be quoted correctly.
llvm-svn: 75150
2009-07-09 17:37:12 +00:00
Ted Kremenek 7127801201 Update checker build.
llvm-svn: 75147
2009-07-09 17:20:25 +00:00
Douglas Gregor 6b6ba8bad8 Add test for C++ [over.over.]p1, the contexts in which one can take the address of an overloaded function.
llvm-svn: 75146
2009-07-09 17:16:51 +00:00
Zhongxing Xu 1796772267 Remove dead code.
llvm-svn: 75127
2009-07-09 09:17:11 +00:00
Anders Carlsson 03f89b1828 Store the isAddressOfOperand in the UnresolvedDeclRefExpr, so that we can pass it when instantiating the expr. Fixes another member pointer bug.
llvm-svn: 75075
2009-07-09 00:05:08 +00:00
Douglas Gregor b257e4fff8 Implement the simple form of overload resolution used when taking the
address of an overloaded function (which may involve both functions
and function templates). 

llvm-svn: 75069
2009-07-08 23:33:52 +00:00
Ted Kremenek 8ee3dd7cc5 Fix: <rdar://problem/7034511> ValueManager::makeIntVal(uint64_t X, QualType T) should return a 'Loc' when 'T' is a pointer
llvm-svn: 75062
2009-07-08 22:42:46 +00:00
Anders Carlsson 0b675f5ad5 It's not allowed to form member pointers to members that have reference type. Add a test for this and the rest of [dcl.mptr]p3.
llvm-svn: 75054
2009-07-08 21:45:58 +00:00
Douglas Gregor 79ca34de78 Bump the PCH version number
llvm-svn: 75049
2009-07-08 21:07:44 +00:00
Douglas Gregor 9b14658713 Implement template argument deduction when taking the address of a
function template. Most of the change here is in factoring out the
common bits used for template argument deduction from a function call
and when taking the address of a function template.

llvm-svn: 75044
2009-07-08 20:55:45 +00:00
Owen Anderson c9673d5bae Update for IRBuilder API change.
llvm-svn: 75041
2009-07-08 20:52:20 +00:00
Owen Anderson c10c8d3e2b Update for LLVM API change.
llvm-svn: 75028
2009-07-08 19:05:04 +00:00
Anders Carlsson 5b2095ce16 Implement code generation of ChooseExpr for aggregate types.
llvm-svn: 75021
2009-07-08 18:33:14 +00:00
Fariborz Jahanian 8e0d04249d Patch adds test to my previous patch for assigning to
gc'able structs in the Next runtime and adds missing
PCH info.

llvm-svn: 75014
2009-07-08 16:37:44 +00:00
Chris Lattner 26670dcba1 fix PR4513, a build problem with VC++, patch by James Abbatiello!
llvm-svn: 75013
2009-07-08 16:24:37 +00:00
Duncan Sands 9cb27e9c08 Correct FreeBSD target info, fixing PR4514.
Patch by Roman Divacky.

llvm-svn: 75003
2009-07-08 13:55:08 +00:00
Douglas Gregor be759256b9 Fix a corner case with argument-dependent lookup and overloaded function sets.
llvm-svn: 74999
2009-07-08 10:57:20 +00:00
Douglas Gregor ed3c80eb75 Update the C++ status table to better reflect our support for function overloading
llvm-svn: 74997
2009-07-08 10:03:09 +00:00
Douglas Gregor 197e5f7bb7 Improve argument-dependent lookup to find associated classes and
namespaces based on the template arguments of a class template
specialization type.

llvm-svn: 74993
2009-07-08 07:51:57 +00:00
Argyrios Kyrtzidis d8ffadcd82 Initialize the ConstantArraySizeAsWritten field of PrintingPolicy class.
It contained garbage since the constructor didn't initialize it and caused test/Sema/array-constraint.c to randomly fail.

llvm-svn: 74989
2009-07-08 02:17:42 +00:00
Owen Anderson 9f211fb4fa Update for LLVM API change.
llvm-svn: 74986
2009-07-08 01:29:18 +00:00
Fariborz Jahanian 5f21d2f69a Implemented memmove_collectable API for Next runtime
when struct variables with GC'able members are copied into.
Will provide a test case later.

llvm-svn: 74984
2009-07-08 01:18:33 +00:00
Chris Lattner 2a7deb64c0 reimplement vector comparisons as [fi]cmp+sext instead of using v[if]cmp.
Also, enable them in sema so that they are tested, and now that the x86 backend
has stablized.

llvm-svn: 74983
2009-07-08 01:08:03 +00:00
Douglas Gregor abd6813ff9 The canonical type of typeof or decltype with a dependent type is itself,
not Context.DependentTy. I'll let Anders check in the test case for this one...

llvm-svn: 74975
2009-07-08 00:03:05 +00:00
Douglas Gregor d3cb356d14 Overload resolution prefers non-templates to templates
llvm-svn: 74971
2009-07-07 23:38:56 +00:00
Douglas Gregor 9fc6097145 Template argument deduction from a call has improved a bit
llvm-svn: 74966
2009-07-07 23:12:18 +00:00
Douglas Gregor e81f3e71f8 Improve template argument deduction from a call. In particular,
implement C++ [temp.deduct.call]p3b3, which allows a template-id
parameter to match a derived class of the argument, while deducing
template arguments.

llvm-svn: 74965
2009-07-07 23:09:34 +00:00
Nate Begeman 425038cc6d Extra vector element initializers in OpenCL is an error, not a warning.
llvm-svn: 74951
2009-07-07 21:53:06 +00:00
Sebastian Redl 86be854fa8 Implement checking of exception spec compatibility for overriding virtual functions.
llvm-svn: 74943
2009-07-07 20:29:57 +00:00
Anders Carlsson 1f9648da17 Some (most) type trait expressions require that the argument passed in is a complete type.
llvm-svn: 74937
2009-07-07 19:06:02 +00:00
Fariborz Jahanian 385db80cc5 Diagnose, and not crash, when taking address of property expression.
llvm-svn: 74935
2009-07-07 18:50:52 +00:00
Chris Lattner de50a0c251 Convert the CharInfo table to be statically initialized, instead of dynamically initialized. Patch by Ryan Flynn!
llvm-svn: 74919
2009-07-07 17:09:54 +00:00
Douglas Gregor 2074977695 Tighten up the conditions under which we build an implicit function
declaration for a builtin.

llvm-svn: 74917
2009-07-07 17:00:05 +00:00
Douglas Gregor 27821cee82 Make ASTContext explicitly keep track of the declaration for the C
FILE type, rather than using name lookup to find FILE within the
translation unit. Within precompiled headers, FILE is treated as yet
another "special type" (like __builtin_va_list).

This change should provide a performance improvement (not verified),
since the lookup into the translation unit declaration 
forces the (otherwise unneeded) construction of a large hash table.
More importantly, with precompiled headers, the construction
of that table requires deserializing most of the top-level
declarations from the precompiled header, which are then unused.

Fixes PR 4509.

llvm-svn: 74911
2009-07-07 16:35:42 +00:00
Fariborz Jahanian 003a880c41 A few change per Doug's feedback.
- Fariborz

llvm-svn: 74909
2009-07-07 16:24:08 +00:00
Zhongxing Xu 6999b90146 Fix comment.
llvm-svn: 74896
2009-07-07 07:14:55 +00:00
Chris Lattner 5c34938aa4 fix an out-of-date comment.
llvm-svn: 74894
2009-07-07 05:05:42 +00:00
Sanjiv Gupta 30f95ec27d pic16 preproc defs.
llvm-svn: 74893
2009-07-07 04:42:23 +00:00
Zhongxing Xu cf67e61faa fix comment.
llvm-svn: 74890
2009-07-07 01:36:53 +00:00
Argyrios Kyrtzidis 3f50f7e853 Refactor DeclLocResolver/StmtLocResolver into a more functional style by removing the search state
and by having their Visit* methods return the ASTLocation directly.

llvm-svn: 74887
2009-07-07 00:53:31 +00:00
Douglas Gregor 0086a5a3bb Introduce the notion of "Relocatable" precompiled headers, which are built
with a particular system root directory and can be used with a different
system root directory when the headers it depends on have been installed.
Relocatable precompiled headers rewrite the file names of the headers used
when generating the PCH file into the corresponding file names of the 
headers available when using the PCH file.

Addresses <rdar://problem/7001604>.

llvm-svn: 74885
2009-07-07 00:12:59 +00:00
Ted Kremenek 97213bac53 NewCastRegion: Handle casts *from* pointers to incomplete structs to other types.
llvm-svn: 74884
2009-07-06 23:47:19 +00:00
Ted Kremenek 0ee2913215 Fix 80 col violation.
llvm-svn: 74877
2009-07-06 22:59:23 +00:00
Ted Kremenek 309d3c6db0 Restructure NewCastRegion to use a switch statement that dispatches off the
region type. This better shows the logic of the method and allows the compiler
to check if we didn't handle a specific region kind.

llvm-svn: 74876
2009-07-06 22:56:37 +00:00
Ted Kremenek f45778f425 Fix 80 col violation.
llvm-svn: 74875
2009-07-06 22:40:36 +00:00
Ted Kremenek bb5a62d46e NewCastRegion: Handle casts to any Objective-C pointer, not just qualified ids.
llvm-svn: 74874
2009-07-06 22:39:40 +00:00
Ted Kremenek 83b5ccbecf Implement FIXME.
llvm-svn: 74872
2009-07-06 22:34:50 +00:00
Ted Kremenek fdf5d802a8 Unbreak build by including header.
llvm-svn: 74870
2009-07-06 22:26:23 +00:00
Ted Kremenek c5ab3a0eab StoreManager::NewCastRegion:
- Refactor logic that creates ElementRegions into a help method 'MakeElementRegion'.
- Fix crash due to not handling StringRegions.  Casts of StringRegions now
  result in a new ElementRegion layered on the original StringRegion.

llvm-svn: 74867
2009-07-06 22:23:45 +00:00
Ted Kremenek eea8c29aa3 Make 'BasicStoreManager' + 'NewCastRegion' testable from the command line using '-analyzer-store=basic-new-cast'.
llvm-svn: 74865
2009-07-06 21:58:46 +00:00
Argyrios Kyrtzidis 26e8b9c9c1 Update CMake files.
llvm-svn: 74864
2009-07-06 21:38:29 +00:00
Argyrios Kyrtzidis 85b18aff24 Use the "ASTLocation nomenclature" (instead of the ASTNode one) in index-test.cpp.
llvm-svn: 74863
2009-07-06 21:35:26 +00:00
Argyrios Kyrtzidis b8020f0833 Some changes to ASTLocation's methods
-Change hasStmt() to isStmt()
-Add isDecl()
-Add getSourceRange()

llvm-svn: 74862
2009-07-06 21:35:20 +00:00
Argyrios Kyrtzidis b89c4cba7d Add some comments to the ASTLocation class.
llvm-svn: 74861
2009-07-06 21:35:09 +00:00
Argyrios Kyrtzidis f24249554b Move the 'ResolveLocationInAST' function from the Frontend library to the Index library.
Also, cut down its comments; more comments will be added to ASTLocation.

llvm-svn: 74860
2009-07-06 21:35:02 +00:00
Argyrios Kyrtzidis 63afa49add Move ASTLocation and DeclReferenceMap from the AST library to the Index library.
llvm-svn: 74859
2009-07-06 21:34:47 +00:00
Argyrios Kyrtzidis b0048027ba Rename 'ASTNode' -> 'ASTLocation'.
ASTLocation is a much better name for its intended purpose which to represent a "point" into the AST.

llvm-svn: 74858
2009-07-06 21:34:20 +00:00
Ted Kremenek 9848b557c8 NewCastRegion:
- Have test for 'CodeTextRegion' dominate other region tests.
- Use 'getAsRecordType' instead of isa<RecordType>

llvm-svn: 74853
2009-07-06 21:01:16 +00:00
Ted Kremenek 3ad4b3bca3 Fix loop so that 'continue' statements actually cause the loop to iterate.
llvm-svn: 74852
2009-07-06 20:53:52 +00:00
Ted Kremenek 9e010e11c3 Move the new 'CastRegion' implementation from RegionStoreManager to StoreManager
(its superclass). This will allow us to experiment with using the new CastRegion
with BasicStoreManager, and gradually phase out the old implementation.

llvm-svn: 74851
2009-07-06 20:21:51 +00:00
Douglas Gregor e64c196868 Fix a problem with false diagnostics when comparing distinct NULL pointer types, from David Majnemer
llvm-svn: 74850
2009-07-06 20:14:23 +00:00