summaryrefslogtreecommitdiffstats
path: root/tools/libclang/CIndexInclusionStack.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
committerdim <dim@FreeBSD.org>2011-02-20 13:06:31 +0000
commit39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (patch)
treea9243275843fbeaa590afc07ee888e006b8d54ea /tools/libclang/CIndexInclusionStack.cpp
parent69b4eca4a4255ba43baa5c1d9bbdec3ec17f479e (diff)
downloadFreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.zip
FreeBSD-src-39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df.tar.gz
Vendor import of clang trunk r126079:
http://llvm.org/svn/llvm-project/cfe/trunk@126079
Diffstat (limited to 'tools/libclang/CIndexInclusionStack.cpp')
-rw-r--r--tools/libclang/CIndexInclusionStack.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/libclang/CIndexInclusionStack.cpp b/tools/libclang/CIndexInclusionStack.cpp
index e863239..e0f4d42 100644
--- a/tools/libclang/CIndexInclusionStack.cpp
+++ b/tools/libclang/CIndexInclusionStack.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "CIndexer.h"
+#include "CXTranslationUnit.h"
#include "CXSourceLocation.h"
#include "clang/AST/DeclVisitor.h"
#include "clang/Frontend/ASTUnit.h"
@@ -24,7 +25,7 @@ extern "C" {
void clang_getInclusions(CXTranslationUnit TU, CXInclusionVisitor CB,
CXClientData clientData) {
- ASTUnit *CXXUnit = static_cast<ASTUnit *>(TU);
+ ASTUnit *CXXUnit = static_cast<ASTUnit *>(TU->TUData);
SourceManager &SM = CXXUnit->getSourceManager();
ASTContext &Ctx = CXXUnit->getASTContext();
@@ -55,7 +56,7 @@ void clang_getInclusions(CXTranslationUnit TU, CXInclusionVisitor CB,
while (L.isValid()) {
PresumedLoc PLoc = SM.getPresumedLoc(L);
InclusionStack.push_back(cxloc::translateSourceLocation(Ctx, L));
- L = PLoc.getIncludeLoc();
+ L = PLoc.isValid()? PLoc.getIncludeLoc() : SourceLocation();
}
// Callback to the client.
OpenPOWER on IntegriCloud