diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-08 02:32:26 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-08 02:32:26 +0000 |
commit | b70e7a83ee55e463d52d175bd68dece2bfd084f4 (patch) | |
tree | 7d492303389dd0e924540d095aa58e8a176b52cd /tools | |
parent | 480760f8c7db7a1b77a73f4833bb99f657802775 (diff) |
[libclang] Add Logger::operator<< overloads for CXCursor and FileEntry.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176680 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libclang/CIndex.cpp | 12 | ||||
-rw-r--r-- | tools/libclang/CIndexHigh.cpp | 3 | ||||
-rw-r--r-- | tools/libclang/CLog.h | 3 |
3 files changed, 18 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 2cfaea442b..9e8b2f4588 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -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; diff --git a/tools/libclang/CIndexHigh.cpp b/tools/libclang/CIndexHigh.cpp index 77e71c3393..af386d2276 100644 --- a/tools/libclang/CIndexHigh.cpp +++ b/tools/libclang/CIndexHigh.cpp @@ -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; diff --git a/tools/libclang/CLog.h b/tools/libclang/CLog.h index 3ac40d56e7..57e01aeb68 100644 --- a/tools/libclang/CLog.h +++ b/tools/libclang/CLog.h @@ -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); |