aboutsummaryrefslogtreecommitdiff
path: root/lib/Index
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-10-18 01:05:36 +0000
committerJohn McCall <rjmccall@apple.com>2009-10-18 01:05:36 +0000
commit51bd803fbdade51d674598ed45da3d54190a656c (patch)
tree6a0f7a2881033be64625cb432e7b7e96eb0729fa /lib/Index
parenta47dd191719e88e41ce82555685869d2054178e1 (diff)
Clone the full Type hierarchy into the TypeLoc hierarchy. Normalize
TypeLoc class names to be $(Type classname)Loc. Rewrite the visitor. Provide skeleton implementations for all the new TypeLocs. Handle all cases in PCH. Handle a few more cases when inserting location information in SemaType. It should be extremely straightforward to add new location information to existing TypeLoc objects now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84386 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index')
-rw-r--r--lib/Index/ASTLocation.cpp2
-rw-r--r--lib/Index/ASTVisitor.h8
-rw-r--r--lib/Index/DeclReferenceMap.cpp8
-rw-r--r--lib/Index/ResolveLocation.cpp20
4 files changed, 19 insertions, 19 deletions
diff --git a/lib/Index/ASTLocation.cpp b/lib/Index/ASTLocation.cpp
index 6294d699a8..c24f3bf5b3 100644
--- a/lib/Index/ASTLocation.cpp
+++ b/lib/Index/ASTLocation.cpp
@@ -101,7 +101,7 @@ void ASTLocation::print(llvm::raw_ostream &OS) const {
break;
case N_Type: {
- QualType T = AsTypeLoc().getSourceType();
+ QualType T = AsTypeLoc().getType();
OS << "[Type: " << T->getTypeClassName() << " " << T.getAsString();
}
}
diff --git a/lib/Index/ASTVisitor.h b/lib/Index/ASTVisitor.h
index e18aa57b4d..0ae78fb74f 100644
--- a/lib/Index/ASTVisitor.h
+++ b/lib/Index/ASTVisitor.h
@@ -123,14 +123,14 @@ public:
BaseTypeLocVisitor::Visit(TL);
}
- void VisitArrayLoc(ArrayLoc TL) {
- BaseTypeLocVisitor::VisitArrayLoc(TL);
+ void VisitArrayLoc(ArrayTypeLoc TL) {
+ BaseTypeLocVisitor::VisitArrayTypeLoc(TL);
if (TL.getSizeExpr())
Visit(TL.getSizeExpr());
}
- void VisitFunctionLoc(FunctionLoc TL) {
- BaseTypeLocVisitor::VisitFunctionLoc(TL);
+ void VisitFunctionTypeLoc(FunctionTypeLoc TL) {
+ BaseTypeLocVisitor::VisitFunctionTypeLoc(TL);
for (unsigned i = 0; i != TL.getNumArgs(); ++i)
Visit(TL.getArg(i));
}
diff --git a/lib/Index/DeclReferenceMap.cpp b/lib/Index/DeclReferenceMap.cpp
index 0e48a369d5..366cf1b108 100644
--- a/lib/Index/DeclReferenceMap.cpp
+++ b/lib/Index/DeclReferenceMap.cpp
@@ -31,8 +31,8 @@ public:
void VisitMemberExpr(MemberExpr *Node);
void VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node);
- void VisitTypedefLoc(TypedefLoc TL);
- void VisitObjCInterfaceLoc(ObjCInterfaceLoc TL);
+ void VisitTypedefTypeLoc(TypedefTypeLoc TL);
+ void VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL);
};
} // anonymous namespace
@@ -55,12 +55,12 @@ void RefMapper::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
Map.insert(std::make_pair(Node->getDecl(), ASTLocation(CurrentDecl, Node)));
}
-void RefMapper::VisitTypedefLoc(TypedefLoc TL) {
+void RefMapper::VisitTypedefTypeLoc(TypedefTypeLoc TL) {
NamedDecl *ND = TL.getTypedefDecl();
Map.insert(std::make_pair(ND, ASTLocation(CurrentDecl, ND, TL.getNameLoc())));
}
-void RefMapper::VisitObjCInterfaceLoc(ObjCInterfaceLoc TL) {
+void RefMapper::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {
NamedDecl *ND = TL.getIFaceDecl();
Map.insert(std::make_pair(ND, ASTLocation(CurrentDecl, ND, TL.getNameLoc())));
}
diff --git a/lib/Index/ResolveLocation.cpp b/lib/Index/ResolveLocation.cpp
index 229669dc33..b94d48e33d 100644
--- a/lib/Index/ResolveLocation.cpp
+++ b/lib/Index/ResolveLocation.cpp
@@ -120,11 +120,11 @@ public:
TypeLocResolver(ASTContext &ctx, SourceLocation loc, Decl *pd)
: LocResolverBase(ctx, loc), ParentDecl(pd) { }
- ASTLocation VisitTypedefLoc(TypedefLoc TL);
- ASTLocation VisitFunctionLoc(FunctionLoc TL);
- ASTLocation VisitArrayLoc(ArrayLoc TL);
- ASTLocation VisitObjCInterfaceLoc(ObjCInterfaceLoc TL);
- ASTLocation VisitObjCProtocolListLoc(ObjCProtocolListLoc TL);
+ ASTLocation VisitTypedefTypeLoc(TypedefTypeLoc TL);
+ ASTLocation VisitFunctionTypeLoc(FunctionTypeLoc TL);
+ ASTLocation VisitArrayTypeLoc(ArrayTypeLoc TL);
+ ASTLocation VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL);
+ ASTLocation VisitObjCProtocolListTypeLoc(ObjCProtocolListTypeLoc TL);
ASTLocation VisitTypeLoc(TypeLoc TL);
};
@@ -349,7 +349,7 @@ ASTLocation DeclLocResolver::VisitDecl(Decl *D) {
return ASTLocation(D);
}
-ASTLocation TypeLocResolver::VisitTypedefLoc(TypedefLoc TL) {
+ASTLocation TypeLocResolver::VisitTypedefTypeLoc(TypedefTypeLoc TL) {
assert(ContainsLocation(TL) &&
"Should visit only after verifying that loc is in range");
if (ContainsLocation(TL.getNameLoc()))
@@ -357,7 +357,7 @@ ASTLocation TypeLocResolver::VisitTypedefLoc(TypedefLoc TL) {
return ASTLocation(ParentDecl, TL);
}
-ASTLocation TypeLocResolver::VisitFunctionLoc(FunctionLoc TL) {
+ASTLocation TypeLocResolver::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
assert(ContainsLocation(TL) &&
"Should visit only after verifying that loc is in range");
@@ -373,7 +373,7 @@ ASTLocation TypeLocResolver::VisitFunctionLoc(FunctionLoc TL) {
return ASTLocation(ParentDecl, TL);
}
-ASTLocation TypeLocResolver::VisitArrayLoc(ArrayLoc TL) {
+ASTLocation TypeLocResolver::VisitArrayTypeLoc(ArrayTypeLoc TL) {
assert(ContainsLocation(TL) &&
"Should visit only after verifying that loc is in range");
@@ -384,7 +384,7 @@ ASTLocation TypeLocResolver::VisitArrayLoc(ArrayLoc TL) {
return ASTLocation(ParentDecl, TL);
}
-ASTLocation TypeLocResolver::VisitObjCInterfaceLoc(ObjCInterfaceLoc TL) {
+ASTLocation TypeLocResolver::VisitObjCInterfaceTypeLoc(ObjCInterfaceTypeLoc TL) {
assert(ContainsLocation(TL) &&
"Should visit only after verifying that loc is in range");
if (ContainsLocation(TL.getNameLoc()))
@@ -392,7 +392,7 @@ ASTLocation TypeLocResolver::VisitObjCInterfaceLoc(ObjCInterfaceLoc TL) {
return ASTLocation(ParentDecl, TL);
}
-ASTLocation TypeLocResolver::VisitObjCProtocolListLoc(ObjCProtocolListLoc TL) {
+ASTLocation TypeLocResolver::VisitObjCProtocolListTypeLoc(ObjCProtocolListTypeLoc TL) {
assert(ContainsLocation(TL) &&
"Should visit only after verifying that loc is in range");