r176680 - [libclang] Add Logger::operator<< overloads for CXCursor and FileEntry.
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Mar 7 18:32:26 PST 2013
Author: akirtzidis
Date: Thu Mar 7 20:32:26 2013
New Revision: 176680
URL: http://llvm.org/viewvc/llvm-project?rev=176680&view=rev
Log:
[libclang] Add Logger::operator<< overloads for CXCursor and FileEntry.
Modified:
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CIndexHigh.cpp
cfe/trunk/tools/libclang/CLog.h
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=176680&r1=176679&r2=176680&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Mar 7 20:32:26 2013
@@ -6397,6 +6397,18 @@ Logger &cxindex::Logger::operator<<(CXTr
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;
Modified: cfe/trunk/tools/libclang/CIndexHigh.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexHigh.cpp?rev=176680&r1=176679&r2=176680&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexHigh.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexHigh.cpp Thu Mar 7 20:32:26 2013
@@ -367,6 +367,9 @@ void clang_findReferencesInFile(CXCursor
return;
}
+ if (Log)
+ *Log << cursor << " @" << static_cast<const FileEntry *>(file);
+
ASTUnit *CXXUnit = cxcursor::getCursorASTUnit(cursor);
if (!CXXUnit)
return;
Modified: cfe/trunk/tools/libclang/CLog.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CLog.h?rev=176680&r1=176679&r2=176680&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CLog.h (original)
+++ cfe/trunk/tools/libclang/CLog.h Thu Mar 7 20:32:26 2013
@@ -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);
More information about the cfe-commits
mailing list