Commit Graph

95 Commits

Author SHA1 Message Date
Ted Kremenek 467297ab48 TranslationUnit now owns IdentifierTable, TargetInfo, and Selectors objects
when it is constructed via deserialization.  This is done by recording a flag
indicating that this is the case, and it deletes these objects by getting
the references stored in the ASTContext object.  This fixes some memory
leaks that occurs when we deserialize translation units from bitcode files.

The rationale between having TranslationUnit sometimes own these objects and
sometimes not is that a TranslationUnit object can be constructed from
state generated by the parser (Preprocessor; semantic analyzer, etc.), and thus
in these cases won't own the IdentifierTable or Selectors, etc.  During
deserialization, there is no Preprocessor, so somebody needs to own these
objects in order for them to be properly reclaimed.

llvm-svn: 50149
2008-04-23 16:25:39 +00:00
Fariborz Jahanian 6efdf1ddab Patch to build AST for property implementation declarations and
to print declaration from its AST.

llvm-svn: 50117
2008-04-23 00:06:01 +00:00
Chris Lattner bec41348e2 "This patch renames
DeclContext *CtxDecl -> DeclContext *DeclCtx
DeclContext *CD -> DeclContext *DC

It makes the code more consistent."

Patch by Zhongxing Xu!

llvm-svn: 50105
2008-04-22 18:39:57 +00:00
Fariborz Jahanian a591a12ea5 Allow property in base class to be implemented in a
derived class.

llvm-svn: 50074
2008-04-21 23:57:08 +00:00
Fariborz Jahanian a054e99fa8 Continuation of work on ObjC2's properties.
Added iterators, methods to find property and categories.
Use them in doing semantic analysis on property implementation
declarations. Fixed typos.

llvm-svn: 50050
2008-04-21 19:04:53 +00:00
Douglas Gregor 89f238cbe1 Clean up handling of function redeclarations
llvm-svn: 50021
2008-04-21 02:02:58 +00:00
Nate Begeman ce4d7fce6b OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.
llvm-svn: 49942
2008-04-18 23:10:10 +00:00
Fariborz Jahanian 8e36cddde0 Added property decl support for protocols.
Added assertion if unexpected property decls are found where they don't belong.
Consolidated property decl. printing by using a helper function.

llvm-svn: 49862
2008-04-17 18:25:18 +00:00
Argyrios Kyrtzidis c3b69ae815 Addition of TranslationUnitDecl to the AST:
-Added TranslationUnitDecl class to serve as top declaration context
-ASTContext gets a TUDecl member and a getTranslationUnitDecl() function
-All ScopedDecls get the TUDecl as DeclContext when declared at global scope

llvm-svn: 49855
2008-04-17 14:40:12 +00:00
Fariborz Jahanian 549e83caa0 New AST class for property implementation declarations.
llvm-svn: 49821
2008-04-16 22:00:24 +00:00
Fariborz Jahanian d634dfae0f Fixed a comment.
llvm-svn: 49819
2008-04-16 21:11:25 +00:00
Ted Kremenek c1f9a28e4d Added CFGBlock::getTerminatorCondition() to get the Expr* of the condition a block's terminator.
Refactored LiveVariables to use getTerminatorCondition() in VisitTerminator().

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

llvm-svn: 49818
2008-04-16 21:10:48 +00:00
Fariborz Jahanian 9d981eb9ae This patch adds support for declaraing properties in categories,
just as they are declared in objc classes.

llvm-svn: 49817
2008-04-16 21:08:45 +00:00
Ted Kremenek b65a67d7b6 Remove uses of "Selector&" and "const Selector&", since Selector is just an
immutable smart pointer (we don't need to pass references, just pass Selector).

llvm-svn: 49773
2008-04-16 04:30:16 +00:00
Steve Naroff 08899ff85d Remove FileVarDecl and BlockVarDecl. They are replaced by VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl().
This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it).

llvm-svn: 49748
2008-04-15 22:42:06 +00:00
Fariborz Jahanian 0152a1a5db New AST representation for each objc2's property declaration.
llvm-svn: 49699
2008-04-14 23:36:35 +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 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
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
Fariborz Jahanian 4572b45574 AST generation for objc2's property declarations.
llvm-svn: 49565
2008-04-11 23:40:25 +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
Sam Bishop ef8b94ae84 Invoke destructors in Decl::Destroy().
llvm-svn: 49547
2008-04-11 18:04:39 +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 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
Sam Bishop 506215c708 Changed the Decl::Kind enum of the ObjCPropertyDecl class, so that it follows
the pattern of the other Decl classes.

llvm-svn: 49399
2008-04-08 20:49:25 +00:00
Chris Lattner 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
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
Chris Lattner 4ba0cef93b random whitespace fixes.
llvm-svn: 49328
2008-04-07 07:01:58 +00:00
Chris Lattner fa00732562 fix a bug I introduced in my previous checkin.
llvm-svn: 49327
2008-04-07 06:58:21 +00:00
Chris Lattner e6b27c6ecd simplify array compatibility testing.
llvm-svn: 49326
2008-04-07 06:56:55 +00:00
Chris Lattner 7460fd297d simplify reference handling.
llvm-svn: 49325
2008-04-07 06:52:53 +00:00
Chris Lattner 49af6a4beb move some code around, no other change.
llvm-svn: 49324
2008-04-07 06:51:04 +00:00
Chris Lattner ec646834e7 simplify compatibility testing for tag types.
llvm-svn: 49323
2008-04-07 06:49:41 +00:00
Chris Lattner 3c7961597f merge compatibility testing of qualified/unqualified interfaces together
and fix a bug.

llvm-svn: 49322
2008-04-07 06:38:24 +00:00
Chris Lattner 64bf6ba308 Fix a really bad bug where type uniquing would merge a<x> with b<x> as the same
type, because it did not include a/b in the hash.

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

llvm-svn: 49320
2008-04-07 06:06:56 +00:00
Chris Lattner 7bbd3d75ef Remove a dead check for compatible builtin types
llvm-svn: 49319
2008-04-07 05:55:38 +00:00
Chris Lattner 90bef90ad4 futher simplify compatibility testing of objc interface types.
llvm-svn: 49318
2008-04-07 05:53:18 +00:00
Chris Lattner 9555466f7e ocuvector and vector should be compatible. Fix ASQual compatibility.
llvm-svn: 49316
2008-04-07 05:43:21 +00:00
Chris Lattner aee96c3a90 Fix comment typo, do reference eval at the correct type.
llvm-svn: 49315
2008-04-07 05:37:56 +00:00
Chris Lattner f8a6b4d4fc simplify vector type compatibility testing.
llvm-svn: 49314
2008-04-07 05:36:14 +00:00
Chris Lattner 2a3569b5d9 move ObjCQualifiedIdTypesAreCompatible out of ASTContext into Sema.
While it is similar to the other compatibility predicates in ASTContext,
it is not used by them and is different.

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

llvm-svn: 49313
2008-04-07 05:30:13 +00:00
Chris Lattner ae947fe3f9 Replace an O(n^2) algorithm in areCompatObjCQualInterfaces with
an O(n) algorithm by taking advantage of the fact that the
protocol qualifier list is already guaranteed sorted.

llvm-svn: 49312
2008-04-07 05:05:41 +00:00
Chris Lattner e0ea37ace7 move sorting of qualifying protocols from the parser into
sema.  This allows clients of the parser to have the unmolested 
list if desired, and guarantees that noone can create an
ObjCQualifiedInterfaceType with an unsorted list.

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

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

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

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

llvm-svn: 49305
2008-04-07 04:07:56 +00:00