From 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 20 Feb 2011 13:06:31 +0000 Subject: Vendor import of clang trunk r126079: http://llvm.org/svn/llvm-project/cfe/trunk@126079 --- tools/libclang/CIndexInclusionStack.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools/libclang/CIndexInclusionStack.cpp') 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(TU); + ASTUnit *CXXUnit = static_cast(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. -- cgit v1.1