Commit Graph

219 Commits

Author SHA1 Message Date
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
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 f1e4ec2898 remove a use of getCanonicalType.
llvm-svn: 49294
2008-04-06 23:09:52 +00:00
Chris Lattner 76a00cf3ff Start switching clients over from CT.getCanonicalType() to Context.getCanonicalType(CT) for PR2189.
While I'm at it, clean up a bit of maxIntegerType.

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

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

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

llvm-svn: 49287
2008-04-06 22:04:54 +00:00
Chris Lattner 3fb61c1fbb add a helper EnumType object for asking about tagtypes for enums.
llvm-svn: 49286
2008-04-06 21:58:47 +00:00
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 157dd0811e fix a number of const qualification bugs.
llvm-svn: 49257
2008-04-06 04:11:27 +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
Seo Sanghyeon 055c94f2f8 PR1963: Address of function is a constant expression
llvm-svn: 49212
2008-04-04 09:45:30 +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
Sam Bishop 2f8a31ca92 trivial whitespace fix
llvm-svn: 49160
2008-04-03 14:20:28 +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
Chris Lattner efdc7685d4 qualifier comparisons should be done on canonical types.
llvm-svn: 49137
2008-04-03 05:07:04 +00:00
Sam Bishop ca6226628e Call "delete" on the body of FunctionDecls.
llvm-svn: 49135
2008-04-03 05:01:04 +00:00
Chris Lattner db5f1fa3d8 add a common base class "PointerLikeType" for PointerType and ReferenceType,
allowing them to be treated the same in some contexts.  A suggestion for a
better name is welcome :)

llvm-svn: 49100
2008-04-02 17:35:06 +00:00
Chris Lattner 53be405c3a Add a citation.
llvm-svn: 49080
2008-04-02 06:06:35 +00:00
Chris Lattner a21ad8058a Fix several bugs in array -> pointer decomposition.
First, we got several CVR propagation cases wrong, which Eli pointed
out in PR2039.

Second, we didn't propagate address space qualifiers correctly, leading
to incorrect lowering of code in CodeGen/address-space.c.

Third, we didn't uniformly propagate the specifier in the array to the
pointer ("int[restrict 4]" -> "int *restrict").

This adds an ASTContext::getArrayDecayedType member that handles the 
non-trivial logic for this seemingly simple operation.

llvm-svn: 49078
2008-04-02 05:18:44 +00:00
Chris Lattner 800817bf6d remove blank line.
llvm-svn: 49075
2008-04-02 05:09:38 +00:00
Chris Lattner 091718d300 print cvr qualifiers on simplified typedefs
llvm-svn: 49074
2008-04-02 05:06:23 +00:00
Steve Naroff 257520b1b4 Fairly large "cleaup" related to changing ObjCCompatibleAliasDecl superclass (to inherit from NamedDecl, instead of ScopedDecl).
- Added a DenseMap to associate an IdentifierInfo with the ObjCCompatibleAliasDecl.
- Renamed LookupScopedDecl->LookupDecl and changed it's return type to Decl. Also added lookup for ObjCCompatibleAliasDecl's.
- Removed Sema::LookupInterfaceDecl(). Converted clients to used LookupDecl().
- Some minor indentation changes.

Will deal with ObjCInterfaceDecl and getObjCInterfaceDecl() in a separate commit...

llvm-svn: 49058
2008-04-01 23:04:06 +00:00
Chris Lattner 595cf9ff81 Update to match simplified llvm MemoryBuffer interfaces for files.
llvm-svn: 49042
2008-04-01 18:04:30 +00:00
Chris Lattner 59a2594f3f rename Decl::CompatibleAlias -> ObjCCompatibleAlias.
Fix objc ivar lookup.  Ivar lookup should occur between lookup
of method-local values and lookup of globals.  Emulate this with
some logic in the handling of Sema::ActOnIdentifierExpr.

Two todo's left:
 1) sema shouldn't turn a bare reference to an ivar into "self->ivar"
    in the AST.  This is a hack.
 2) The new ScopedDecl::isDefinedOutsideFunctionOrMethod method does
    not correctly handle typedefs and enum constants yet.

llvm-svn: 48972
2008-03-31 00:36:02 +00:00
Ted Kremenek fff4fc7e6d Bug fix in CFG construction: VisitCompoundStmt should return the last created block.
llvm-svn: 48460
2008-03-17 17:19:44 +00:00
Chris Lattner ed0e16404c clean up property memory allocation to move it into the ast classes
like the rest of the classes.

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

llvm-svn: 48433
2008-03-16 21:23:50 +00:00
Chris Lattner 219b3e9c6c add the last two Create methods for decls, woo!
llvm-svn: 48432
2008-03-16 21:17:37 +00:00
Chris Lattner 36ac1cae1f add two more Create methods.
llvm-svn: 48428
2008-03-16 20:53:07 +00:00
Chris Lattner d77aff8232 simplify the way ObjCCategoryDecl's get their referenced protocols list
specified.  Previously, the ctor would allocate memory for the list and then
it would get filled in later.  Move the allocation+filling in to be more 
consistent with other stuff, e.g. the addMethods method.

llvm-svn: 48427
2008-03-16 20:47:45 +00:00
Chris Lattner 1dd77af9ce Add create methods for ObjCCategoryDecl, ObjCForwardProtocolDecl, ObjCClassDecl.
llvm-svn: 48426
2008-03-16 20:34:23 +00:00
Chris Lattner acc04a9261 minor cleanups, make getNumInstanceMethods always return unsigned.
llvm-svn: 48423
2008-03-16 20:19:15 +00:00
Chris Lattner f87ca0a7d1 Give ObjCProtocolDecl a Create method.
llvm-svn: 48410
2008-03-16 01:23:04 +00:00
Chris Lattner 96c501ef7e Add create methods for ObjCIvarDecl and ObjCInterfaceDecl
llvm-svn: 48408
2008-03-16 01:15:50 +00:00
Chris Lattner c557947488 remove some dead arguments to ObjCMethodDecl.
llvm-svn: 48406
2008-03-16 00:58:16 +00:00
Chris Lattner 8d8829e225 Give ObjCMethodDecl a Create method.
llvm-svn: 48405
2008-03-16 00:49:28 +00:00
Chris Lattner 893751970a Split objc decl implementation out into DeclObjC.cpp
llvm-svn: 48404
2008-03-16 00:19:01 +00:00
Chris Lattner ee1284a6e2 switch the rest of the C decl classes to do their
allocation through ASTContext.

llvm-svn: 48403
2008-03-16 00:16:02 +00:00
Chris Lattner 7a51313d8a Make a major restructuring of the clang tree: introduce a top-level
lib dir and move all the libraries into it.  This follows the main
llvm tree, and allows the libraries to be built in parallel.  The
top level now enforces that all the libs are built before Driver,
but we don't care what order the libs are built in.  This speeds
up parallel builds, particularly incremental ones.

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