diff options
author | dim <dim@FreeBSD.org> | 2010-09-16 21:14:28 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2010-09-16 21:14:28 +0000 |
commit | fc84956ac8b7cd244ef30e7a4d4d38a58dec5904 (patch) | |
tree | fd60562fa69b344a835f86fd68c85f16cbe0b77c /tools/CIndex/CIndexInclusionStack.cpp | |
parent | f1752835b9d5f0da31f34b18c9f1eb8dcb799ba8 (diff) | |
download | FreeBSD-src-fc84956ac8b7cd244ef30e7a4d4d38a58dec5904.zip FreeBSD-src-fc84956ac8b7cd244ef30e7a4d4d38a58dec5904.tar.gz |
Make vendor/clang/dist exactly the same as upstream's r108428. Some
files and directories were already added/removed in the upstream
repository, but were not added/removed here, when the previous snapshot
was imported.
Note: I did not import the file test/Lexer/conflict-marker.c, because it
contains merge conflict markers on purpose, which upsets our pre-commit
hooks.
Approved by: rpaulo (mentor)
Diffstat (limited to 'tools/CIndex/CIndexInclusionStack.cpp')
-rw-r--r-- | tools/CIndex/CIndexInclusionStack.cpp | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/tools/CIndex/CIndexInclusionStack.cpp b/tools/CIndex/CIndexInclusionStack.cpp deleted file mode 100644 index e863239..0000000 --- a/tools/CIndex/CIndexInclusionStack.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===- CIndexInclusionStack.cpp - Clang-C Source Indexing Library ---------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines a callback mechanism for clients to get the inclusion -// stack from a translation unit. -// -//===----------------------------------------------------------------------===// - -#include "CIndexer.h" -#include "CXSourceLocation.h" -#include "clang/AST/DeclVisitor.h" -#include "clang/Frontend/ASTUnit.h" -#include "llvm/ADT/SmallString.h" -#include "llvm/Support/raw_ostream.h" -using namespace clang; - -extern "C" { -void clang_getInclusions(CXTranslationUnit TU, CXInclusionVisitor CB, - CXClientData clientData) { - - ASTUnit *CXXUnit = static_cast<ASTUnit *>(TU); - SourceManager &SM = CXXUnit->getSourceManager(); - ASTContext &Ctx = CXXUnit->getASTContext(); - - llvm::SmallVector<CXSourceLocation, 10> InclusionStack; - unsigned i = SM.sloc_loaded_entry_size(); - unsigned n = SM.sloc_entry_size(); - - // In the case where all the SLocEntries are in an external source, traverse - // those SLocEntries as well. This is the case where we are looking - // at the inclusion stack of an AST/PCH file. - if (i >= n) - i = 0; - - for ( ; i < n ; ++i) { - - const SrcMgr::SLocEntry &SL = SM.getSLocEntry(i); - - if (!SL.isFile()) - continue; - - const SrcMgr::FileInfo &FI = SL.getFile(); - if (!FI.getContentCache()->Entry) - continue; - - // Build the inclusion stack. - SourceLocation L = FI.getIncludeLoc(); - InclusionStack.clear(); - while (L.isValid()) { - PresumedLoc PLoc = SM.getPresumedLoc(L); - InclusionStack.push_back(cxloc::translateSourceLocation(Ctx, L)); - L = PLoc.getIncludeLoc(); - } - - // Callback to the client. - // FIXME: We should have a function to construct CXFiles. - CB((CXFile) FI.getContentCache()->Entry, - InclusionStack.data(), InclusionStack.size(), clientData); - } -} -} // end extern C |