Commit Graph

4904 Commits

Author SHA1 Message Date
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 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
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 c0656de03d Improve message for bad destructor decl. Per Doug's comment.
llvm-svn: 76494
2009-07-20 22:41:12 +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
Mike Stump 17051250ad Remove an apparently unused forward class decl.
llvm-svn: 76476
2009-07-20 21:23:55 +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
Fariborz Jahanian 4041dfc360 Issue a more descriptive diagnostics when mis-declaring
a destructor.

llvm-svn: 76436
2009-07-20 17:43:15 +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
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 d6bf03c272 Introduce ASTLocation::getReferencedDecl(), for getting the declaration that the ASTLocation references.
llvm-svn: 76336
2009-07-18 21:17:58 +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
Anders Carlsson 15b73deeea Revert r75641.
llvm-svn: 76327
2009-07-18 19:43:29 +00:00
Steve Naroff c277ad10f0 Remove ObjCQualifiedInterfaceType:-)
llvm-svn: 76321
2009-07-18 15:33:26 +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 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 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 ce55b2e543 Add getSourceRange() methods for ObjC Decls.
llvm-svn: 76267
2009-07-18 00:33:08 +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
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 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
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 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
Ted Kremenek 3d486f08cb Replace Type::getAsReferenceType() with Type::getAs<ReferenceType>().
llvm-svn: 76132
2009-07-17 01:01:15 +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
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
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 bc6eb71f31 Commit the initial implementation of call graph building.
llvm-svn: 75873
2009-07-16 00:54:12 +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
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
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