Introduce ObjCInterfaceLoc which provides type source information for ObjC interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83097 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp
index fbd7caa..1337def 100644
--- a/lib/AST/TypeLoc.cpp
+++ b/lib/AST/TypeLoc.cpp
@@ -230,6 +230,24 @@
}
//===----------------------------------------------------------------------===//
+// ObjCInterfaceLoc Implementation
+//===----------------------------------------------------------------------===//
+
+namespace {
+
+class ObjCInterfaceLocChecker :
+ public TypeLocVisitor<ObjCInterfaceLocChecker, bool> {
+public:
+ bool VisitObjCInterfaceLoc(ObjCInterfaceLoc TyLoc) { return true; }
+};
+
+}
+
+bool ObjCInterfaceLoc::classof(const TypeLoc *TL) {
+ return ObjCInterfaceLocChecker().Visit(*TL);
+}
+
+//===----------------------------------------------------------------------===//
// ObjCProtocolListLoc Implementation
//===----------------------------------------------------------------------===//
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index 550f4db..9b28e8b 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -179,6 +179,9 @@
void TypeLocReader::VisitTypedefLoc(TypedefLoc TyLoc) {
TyLoc.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
}
+void TypeLocReader::VisitObjCInterfaceLoc(ObjCInterfaceLoc TyLoc) {
+ TyLoc.setNameLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
+}
void TypeLocReader::VisitObjCProtocolListLoc(ObjCProtocolListLoc TyLoc) {
TyLoc.setLAngleLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
TyLoc.setRAngleLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp
index 7a8f3e8..9573d43 100644
--- a/lib/Frontend/PCHWriterDecl.cpp
+++ b/lib/Frontend/PCHWriterDecl.cpp
@@ -177,6 +177,9 @@
void TypeLocWriter::VisitTypedefLoc(TypedefLoc TyLoc) {
Writer.AddSourceLocation(TyLoc.getNameLoc(), Record);
}
+void TypeLocWriter::VisitObjCInterfaceLoc(ObjCInterfaceLoc TyLoc) {
+ Writer.AddSourceLocation(TyLoc.getNameLoc(), Record);
+}
void TypeLocWriter::VisitObjCProtocolListLoc(ObjCProtocolListLoc TyLoc) {
Writer.AddSourceLocation(TyLoc.getLAngleLoc(), Record);
Writer.AddSourceLocation(TyLoc.getRAngleLoc(), Record);
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 89e9e49..333895b 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1299,6 +1299,9 @@
if (TypedefLoc *TL = dyn_cast<TypedefLoc>(&TSL)) {
TL->setNameLoc(DS.getTypeSpecTypeLoc());
+ } else if (ObjCInterfaceLoc *TL = dyn_cast<ObjCInterfaceLoc>(&TSL)) {
+ TL->setNameLoc(DS.getTypeSpecTypeLoc());
+
} else if (ObjCProtocolListLoc *PLL = dyn_cast<ObjCProtocolListLoc>(&TSL)) {
assert(PLL->getNumProtocols() == DS.getNumProtocolQualifiers());
PLL->setLAngleLoc(DS.getProtocolLAngleLoc());