forked from OSchip/llvm-project
[libclang] When logging a CXTranslationUnit that came from an AST file, print out the filename.
llvm-svn: 176511
This commit is contained in:
parent
43c8df8153
commit
37f2ab4824
|
@ -485,6 +485,9 @@ public:
|
||||||
|
|
||||||
StringRef getMainFileName() const;
|
StringRef getMainFileName() const;
|
||||||
|
|
||||||
|
/// \brief If this ASTUnit came from an AST file, returns the filename for it.
|
||||||
|
StringRef getASTFileName() const;
|
||||||
|
|
||||||
typedef std::vector<Decl *>::iterator top_level_iterator;
|
typedef std::vector<Decl *>::iterator top_level_iterator;
|
||||||
|
|
||||||
top_level_iterator top_level_begin() {
|
top_level_iterator top_level_begin() {
|
||||||
|
|
|
@ -1711,6 +1711,15 @@ StringRef ASTUnit::getMainFileName() const {
|
||||||
return StringRef();
|
return StringRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringRef ASTUnit::getASTFileName() const {
|
||||||
|
if (!isMainFileAST())
|
||||||
|
return StringRef();
|
||||||
|
|
||||||
|
serialization::ModuleFile &
|
||||||
|
Mod = Reader->getModuleManager().getPrimaryModule();
|
||||||
|
return Mod.FileName;
|
||||||
|
}
|
||||||
|
|
||||||
ASTUnit *ASTUnit::create(CompilerInvocation *CI,
|
ASTUnit *ASTUnit::create(CompilerInvocation *CI,
|
||||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
|
IntrusiveRefCntPtr<DiagnosticsEngine> Diags,
|
||||||
bool CaptureDiagnostics,
|
bool CaptureDiagnostics,
|
||||||
|
|
|
@ -6387,6 +6387,8 @@ Logger &cxindex::Logger::operator<<(CXTranslationUnit TU) {
|
||||||
if (TU) {
|
if (TU) {
|
||||||
if (ASTUnit *Unit = cxtu::getASTUnit(TU)) {
|
if (ASTUnit *Unit = cxtu::getASTUnit(TU)) {
|
||||||
LogOS << '<' << Unit->getMainFileName() << '>';
|
LogOS << '<' << Unit->getMainFileName() << '>';
|
||||||
|
if (Unit->isMainFileAST())
|
||||||
|
LogOS << " (" << Unit->getASTFileName() << ')';
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue