summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/NestedNameSpecifier.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-25 00:36:19 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-25 00:36:19 +0000
commita9d87bc6ac7d705916c6be494ebdb205b6f24d29 (patch)
tree8be118d6f0c61e6dc9150bdf5cd6ad153aca0116 /clang/lib/AST/NestedNameSpecifier.cpp
parent49709e75bb6235f8999df63242389ed4d3a3457f (diff)
downloadbcm5719-llvm-a9d87bc6ac7d705916c6be494ebdb205b6f24d29.tar.gz
bcm5719-llvm-a9d87bc6ac7d705916c6be494ebdb205b6f24d29.zip
Update UsingDecl, UnresolvedUsingTypenameDecl, and
UnresolvedUsingValueDecl to use NestedNameSpecifierLoc rather than the extremely-lossy NestedNameSpecifier/SourceRange pair it used to use, improving source-location information. Various infrastructure updates to support NestedNameSpecifierLoc: - AST/PCH (de-)serialization - Recursive AST visitor - libclang traversal (including the first tests of this functionality) llvm-svn: 126459
Diffstat (limited to 'clang/lib/AST/NestedNameSpecifier.cpp')
-rw-r--r--clang/lib/AST/NestedNameSpecifier.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/clang/lib/AST/NestedNameSpecifier.cpp b/clang/lib/AST/NestedNameSpecifier.cpp
index da12aa77dd1..0689ae1c883 100644
--- a/clang/lib/AST/NestedNameSpecifier.cpp
+++ b/clang/lib/AST/NestedNameSpecifier.cpp
@@ -320,7 +320,7 @@ namespace {
}
}
-SourceRange NestedNameSpecifierLoc::getSourceRange() {
+SourceRange NestedNameSpecifierLoc::getSourceRange() const {
NestedNameSpecifierLoc First = *this;
while (NestedNameSpecifierLoc Prefix= First.getPrefix())
First = Prefix;
@@ -329,7 +329,7 @@ SourceRange NestedNameSpecifierLoc::getSourceRange() {
getLocalSourceRange().getEnd());
}
-SourceRange NestedNameSpecifierLoc::getLocalSourceRange() {
+SourceRange NestedNameSpecifierLoc::getLocalSourceRange() const {
unsigned Offset = getDataLength(Qualifier->getPrefix());
switch (Qualifier->getKind()) {
case NestedNameSpecifier::Global:
@@ -354,3 +354,14 @@ SourceRange NestedNameSpecifierLoc::getLocalSourceRange() {
return SourceRange();
}
+
+TypeLoc NestedNameSpecifierLoc::getTypeLoc() const {
+ assert((Qualifier->getKind() == NestedNameSpecifier::TypeSpec ||
+ Qualifier->getKind() == NestedNameSpecifier::TypeSpecWithTemplate) &&
+ "Nested-name-specifier location is not a type");
+
+ // The "void*" that points at the TypeLoc data.
+ unsigned Offset = getDataLength(Qualifier->getPrefix());
+ void *TypeData = LoadPointer(Data, Offset);
+ return TypeLoc(Qualifier->getAsType(), TypeData);
+}
OpenPOWER on IntegriCloud