aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclPrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/DeclPrinter.cpp')
-rw-r--r--lib/AST/DeclPrinter.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index fae1e724a1..d3ebc8f508 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -727,12 +727,19 @@ 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 << "@interface " << I << " : " << SID;
- else
- Out << "@interface " << I;
+ Out << " : " << SID;
// Protocols?
const ObjCList<ObjCProtocolDecl> &Protocols = OID->getReferencedProtocols();