[cfe-commits] r80932 - in /cfe/trunk: include/clang/Frontend/ASTUnit.h lib/Frontend/ASTUnit.cpp tools/CIndex/CIndex.cpp
Steve Naroff
snaroff at apple.com
Thu Sep 3 11:19:54 PDT 2009
Author: snaroff
Date: Thu Sep 3 13:19:54 2009
New Revision: 80932
URL: http://llvm.org/viewvc/llvm-project?rev=80932&view=rev
Log:
Add ASTUnit::getOriginalSourceFileName() and use in clang_getTranslationUnitSpelling().
Modified:
cfe/trunk/include/clang/Frontend/ASTUnit.h
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/tools/CIndex/CIndex.cpp
Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=80932&r1=80931&r2=80932&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/trunk/include/clang/Frontend/ASTUnit.h Thu Sep 3 13:19:54 2009
@@ -58,6 +58,8 @@
const Diagnostic &getDiagnostic() const { return *Diags.get(); }
Diagnostic &getDiagnostic() { return *Diags.get(); }
+
+ const std::string &getOriginalSourceFileName();
/// \brief Create a ASTUnit from a PCH file.
///
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=80932&r1=80931&r2=80932&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Thu Sep 3 13:19:54 2009
@@ -77,6 +77,9 @@
} // anonymous namespace
+const std::string &ASTUnit::getOriginalSourceFileName() {
+ return dyn_cast<PCHReader>(Ctx->getExternalSource())->getOriginalSourceFile();
+}
ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
FileManager &FileMgr,
Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=80932&r1=80931&r2=80932&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Thu Sep 3 13:19:54 2009
@@ -194,9 +194,8 @@
const char *clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit)
{
assert(CTUnit && "Passed null CXTranslationUnit");
- //ASTUnit *CXXUnit = static_cast<ASTUnit *>(CTUnit);
- //return CXXUnit->getOriginalSourceFileName().c_str();
- return "<unimplemented>";
+ ASTUnit *CXXUnit = static_cast<ASTUnit *>(CTUnit);
+ return CXXUnit->getOriginalSourceFileName().c_str();
}
void clang_loadTranslationUnit(CXTranslationUnit CTUnit,
More information about the cfe-commits
mailing list