aboutsummaryrefslogtreecommitdiff
path: root/lib/Index/ResolveLocation.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-11-04 07:28:41 +0000
committerJohn McCall <rjmccall@apple.com>2009-11-04 07:28:41 +0000
commit5ab75172051a6d2ea71a80a79e81c65519fd3462 (patch)
treee03271bc6d106935276fbc951192f7e85b3f1a5b /lib/Index/ResolveLocation.cpp
parentc86a6e988184867b09aa17a619402d0e81d0fda0 (diff)
Preserve type source information in sizeof/alignof expressions, and pass it
through to indexing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86018 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Index/ResolveLocation.cpp')
-rw-r--r--lib/Index/ResolveLocation.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/Index/ResolveLocation.cpp b/lib/Index/ResolveLocation.cpp
index ec8c1dcb38..73b584b520 100644
--- a/lib/Index/ResolveLocation.cpp
+++ b/lib/Index/ResolveLocation.cpp
@@ -92,6 +92,7 @@ public:
StmtLocResolver(ASTContext &ctx, SourceLocation loc, Decl *parent)
: LocResolverBase(ctx, loc), Parent(parent) {}
+ ASTLocation VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *Node);
ASTLocation VisitCXXOperatorCallExpr(CXXOperatorCallExpr *Node);
ASTLocation VisitDeclStmt(DeclStmt *Node);
ASTLocation VisitStmt(Stmt *Node);
@@ -136,6 +137,25 @@ public:
} // anonymous namespace
ASTLocation
+StmtLocResolver::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *Node) {
+ assert(ContainsLocation(Node) &&
+ "Should visit only after verifying that loc is in range");
+
+ if (Node->isArgumentType()) {
+ DeclaratorInfo *DInfo = Node->getArgumentTypeInfo();
+ if (ContainsLocation(DInfo))
+ return ResolveInDeclarator(Parent, Node, DInfo);
+ } else {
+ Expr *SubNode = Node->getArgumentExpr();
+ if (ContainsLocation(SubNode))
+ return Visit(SubNode);
+ }
+
+ return ASTLocation(Parent, Node);
+}
+
+
+ASTLocation
StmtLocResolver::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *Node) {
assert(ContainsLocation(Node) &&
"Should visit only after verifying that loc is in range");