[libclang] Add Logger::operator<< overloads for CXCursor and FileEntry.

llvm-svn: 176680
This commit is contained in:
Argyrios Kyrtzidis 2013-03-08 02:32:26 +00:00
parent e7838a4c53
commit ba4b5f8646
3 changed files with 18 additions and 0 deletions

View File

@ -6397,6 +6397,18 @@ Logger &cxindex::Logger::operator<<(CXTranslationUnit TU) {
return *this;
}
Logger &cxindex::Logger::operator<<(const FileEntry *FE) {
*this << FE->getName();
return *this;
}
Logger &cxindex::Logger::operator<<(CXCursor cursor) {
CXString cursorName = clang_getCursorDisplayName(cursor);
*this << cursorName << "@" << clang_getCursorLocation(cursor);
clang_disposeString(cursorName);
return *this;
}
Logger &cxindex::Logger::operator<<(CXSourceLocation Loc) {
CXFile File;
unsigned Line, Column;

View File

@ -367,6 +367,9 @@ void clang_findReferencesInFile(CXCursor cursor, CXFile file,
return;
}
if (Log)
*Log << cursor << " @" << static_cast<const FileEntry *>(file);
ASTUnit *CXXUnit = cxcursor::getCursorASTUnit(cursor);
if (!CXXUnit)
return;

View File

@ -23,6 +23,7 @@ class format_object_base;
}
namespace clang {
class FileEntry;
namespace cxindex {
@ -64,6 +65,8 @@ public:
~Logger();
Logger &operator<<(CXTranslationUnit);
Logger &operator<<(const FileEntry *FE);
Logger &operator<<(CXCursor cursor);
Logger &operator<<(CXSourceLocation);
Logger &operator<<(CXSourceRange);
Logger &operator<<(CXString);