forked from qt-creator/qt-creator
Clang: Cleanup more PrintTo functions
Change-Id: If1389462479ae10b067904f05cf785c3d8fb9638 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -403,29 +403,31 @@ bool operator!=(const Cursor &first, const Cursor &second)
|
||||
return !(first == second);
|
||||
}
|
||||
|
||||
void PrintTo(CXCursorKind cursorKind, ::std::ostream *os)
|
||||
std::ostream &operator<<(std::ostream &os, CXCursorKind cursorKind)
|
||||
{
|
||||
ClangString cursorKindSpelling(clang_getCursorKindSpelling(cursorKind));
|
||||
*os << cursorKindSpelling.cString();
|
||||
return os << cursorKindSpelling.cString();
|
||||
}
|
||||
|
||||
void PrintTo(const Cursor &cursor, ::std::ostream*os)
|
||||
std::ostream &operator<<(std::ostream &os, const Cursor &cursor)
|
||||
{
|
||||
if (cursor.isValid()) {
|
||||
ClangString cursorKindSpelling(clang_getCursorKindSpelling(cursor.kind()));
|
||||
*os << cursorKindSpelling.cString() << " ";
|
||||
os << cursorKindSpelling << " ";
|
||||
|
||||
auto identifier = cursor.displayName();
|
||||
if (identifier.hasContent()) {
|
||||
*os << "\""
|
||||
<< identifier
|
||||
<< "\": ";
|
||||
os << "\""
|
||||
<< identifier
|
||||
<< "\": ";
|
||||
}
|
||||
|
||||
PrintTo(cursor.sourceLocation(), os);
|
||||
os << cursor.sourceLocation();
|
||||
} else {
|
||||
*os << "Invalid cursor!";
|
||||
os << "Invalid cursor!";
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
||||
Reference in New Issue
Block a user