summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/ASTConsumer.cpp3
-rw-r--r--clang/lib/AST/ASTContext.cpp30
-rw-r--r--clang/lib/AST/ASTImporter.cpp14
-rw-r--r--clang/lib/AST/DeclObjC.cpp26
-rw-r--r--clang/lib/AST/DeclPrinter.cpp13
-rw-r--r--clang/lib/AST/Type.cpp11
6 files changed, 19 insertions, 78 deletions
diff --git a/clang/lib/AST/ASTConsumer.cpp b/clang/lib/AST/ASTConsumer.cpp
index 04a084a06a4..f37cbdea548 100644
--- a/clang/lib/AST/ASTConsumer.cpp
+++ b/clang/lib/AST/ASTConsumer.cpp
@@ -17,6 +17,3 @@ using namespace clang;
void ASTConsumer::HandleTopLevelDecl(DeclGroupRef D) {}
-void ASTConsumer::HandleInterestingDecl(DeclGroupRef D) {
- HandleTopLevelDecl(D);
-}
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 83cee5cc783..7d159269c1b 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -872,7 +872,7 @@ void ASTContext::ShallowCollectObjCIvars(const ObjCInterfaceDecl *OI,
/// CollectNonClassIvars -
/// This routine collects all other ivars which are not declared in the class.
/// This includes synthesized ivars (via @synthesize) and those in
-/// class's @implementation.
+// class's @implementation.
///
void ASTContext::CollectNonClassIvars(const ObjCInterfaceDecl *OI,
llvm::SmallVectorImpl<ObjCIvarDecl*> &Ivars) {
@@ -2212,24 +2212,18 @@ QualType ASTContext::getObjCObjectPointerType(QualType ObjectT) {
return QualType(QType, 0);
}
-QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
- const ObjCInterfaceDecl *PrevDecl) {
- assert(Decl && "Passed null for Decl param");
-
- if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
-
- if (PrevDecl) {
- assert(PrevDecl->TypeForDecl && "previous decl has no TypeForDecl");
- Decl->TypeForDecl = PrevDecl->TypeForDecl;
- return QualType(PrevDecl->TypeForDecl, 0);
- }
+/// getObjCInterfaceType - Return the unique reference to the type for the
+/// specified ObjC interface decl. The list of protocols is optional.
+QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl) {
+ if (Decl->TypeForDecl)
+ return QualType(Decl->TypeForDecl, 0);
- assert(!Decl->getPreviousDeclaration() &&
- "interface has previous declaration");
-
- Decl->TypeForDecl = new (*this, TypeAlignment) ObjCInterfaceType(Decl);
- Types.push_back(Decl->TypeForDecl);
- return QualType(Decl->TypeForDecl, 0);
+ // FIXME: redeclarations?
+ void *Mem = Allocate(sizeof(ObjCInterfaceType), TypeAlignment);
+ ObjCInterfaceType *T = new (Mem) ObjCInterfaceType(Decl);
+ Decl->TypeForDecl = T;
+ Types.push_back(T);
+ return QualType(T, 0);
}
/// getTypeOfExprType - Unlike many "get<Type>" functions, we can't unique
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index 6242d400419..5e8586f2a06 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -2467,18 +2467,6 @@ Decl *ASTNodeImporter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
}
Decl *ASTNodeImporter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
- // If this interface has a definition in the translation unit we're coming
- // from, but this particular declaration is not that definition, import the
- // definition and map to that.
- ObjCInterfaceDecl *Definition = D->getDefinition();
- if (Definition && Definition != D) {
- Decl *ImportedDef = Importer.Import(Definition);
- if (!ImportedDef)
- return 0;
-
- return Importer.Imported(D, ImportedDef);
- }
-
// Import the major distinguishing characteristics of an @interface.
DeclContext *DC, *LexicalDC;
DeclarationName Name;
@@ -2503,7 +2491,7 @@ Decl *ASTNodeImporter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
ToIface = ObjCInterfaceDecl::Create(Importer.getToContext(),
DC, Loc,
Name.getAsIdentifierInfo(),
- Importer.Import(D->getClassLoc()), 0,
+ Importer.Import(D->getClassLoc()),
D->isForwardDecl(),
D->isImplicitInterfaceDecl());
ToIface->setForwardDecl(D->isForwardDecl());
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index 0720b203d62..32f9433d9a8 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -45,14 +45,6 @@ void ObjCProtocolList::set(ObjCProtocolDecl* const* InList, unsigned Elts,
// ObjCInterfaceDecl
//===----------------------------------------------------------------------===//
-ObjCInterfaceDecl *ObjCInterfaceDecl::getDefinition() {
- for (redecl_iterator I = redecls_begin(), E = redecls_end(); I != E; ++I) {
- if (I->isDefinition())
- return *I;
- }
- return 0;
-}
-
/// getIvarDecl - This method looks up an ivar in this ContextDecl.
///
ObjCIvarDecl *
@@ -440,30 +432,18 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
SourceLocation atLoc,
IdentifierInfo *Id,
SourceLocation ClassLoc,
- ObjCInterfaceDecl *PrevDecl,
bool ForwardDecl, bool isInternal){
- ObjCInterfaceDecl *D = new (C) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc,
- PrevDecl, ForwardDecl,
- isInternal);
- C.getObjCInterfaceType(D, PrevDecl);
- return D;
-}
-
-ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C, EmptyShell) {
- return new (C) ObjCInterfaceDecl(0, SourceLocation(), 0, SourceLocation(),
- 0, false, false);
+ return new (C) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc, ForwardDecl,
+ isInternal);
}
ObjCInterfaceDecl::
ObjCInterfaceDecl(DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id,
- SourceLocation CLoc, ObjCInterfaceDecl *PrevDecl,
- bool FD, bool isInternal)
+ SourceLocation CLoc, bool FD, bool isInternal)
: ObjCContainerDecl(ObjCInterface, DC, atLoc, Id),
TypeForDecl(0), SuperClass(0),
CategoryList(0), ForwardDecl(FD), InternalInterface(isInternal),
ClassLoc(CLoc) {
- if (PrevDecl)
- setPreviousDeclaration(PrevDecl);
}
ObjCImplementationDecl *ObjCInterfaceDecl::getImplementation() const {
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index d3ebc8f508e..fae1e724a17 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -727,19 +727,12 @@ void DeclPrinter::VisitObjCImplementationDecl(ObjCImplementationDecl *OID) {
void DeclPrinter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
std::string I = OID->getNameAsString();
-
- if (OID->isForwardDecl()) {
- // These shouldn't be directly visited, but in case they are, write them
- // as an @class declaration.
- Out << "@class " << I;
- return;
- }
-
ObjCInterfaceDecl *SID = OID->getSuperClass();
- Out << "@interface " << I;
if (SID)
- Out << " : " << SID;
+ Out << "@interface " << I << " : " << SID;
+ else
+ Out << "@interface " << I;
// Protocols?
const ObjCList<ObjCProtocolDecl> &Protocols = OID->getReferencedProtocols();
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 4f884989ae2..31af6fb6619 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -360,17 +360,6 @@ const ObjCObjectPointerType *Type::getAsObjCInterfacePointerType() const {
return 0;
}
-ObjCInterfaceDecl *ObjCInterfaceType::getDecl() const {
- for (ObjCInterfaceDecl::redecl_iterator I = Decl->redecls_begin(),
- E = Decl->redecls_end();
- I != E; ++I) {
- if (I->isDefinition())
- return *I;
- }
- // If we can't find a definition, return whatever we have.
- return Decl;
-}
-
const CXXRecordDecl *Type::getCXXRecordDeclForPointerType() const {
if (const PointerType *PT = getAs<PointerType>())
if (const RecordType *RT = PT->getPointeeType()->getAs<RecordType>())
OpenPOWER on IntegriCloud