Clang: Extract highlighting information

Prepare the move of the semantic highlighting to the clang back end. We
have it under tests too so it should be quite easy to make changes or
corrections.

Change-Id: I5706a8a06fde5a9ba2eba3a8ba62782102ac0bd3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Marco Bubke
2015-11-17 13:33:31 +01:00
parent 611d7db4de
commit bcd93b594e
35 changed files with 4292 additions and 19 deletions

View File

@@ -32,6 +32,8 @@
#include <sourcerangecontainer.h>
#include <ostream>
namespace ClangBackEnd {
SourceRange::SourceRange()
@@ -39,6 +41,11 @@ SourceRange::SourceRange()
{
}
SourceRange::SourceRange(const SourceLocation &start, const SourceLocation &end)
: cxSourceRange(clang_getRange(start, end))
{
}
bool SourceRange::isNull() const
{
return clang_Range_isNull(cxSourceRange);
@@ -65,10 +72,33 @@ SourceRangeContainer SourceRange::toSourceRangeContainer() const
end().toSourceLocationContainer());
}
ClangBackEnd::SourceRange::operator SourceRangeContainer() const
{
return toSourceRangeContainer();
}
ClangBackEnd::SourceRange::operator CXSourceRange() const
{
return cxSourceRange;
}
SourceRange::SourceRange(CXSourceRange cxSourceRange)
: cxSourceRange(cxSourceRange)
{
}
bool operator==(const SourceRange &first, const SourceRange &second)
{
return clang_equalRanges(first.cxSourceRange, second.cxSourceRange);
}
void PrintTo(const SourceRange &sourceRange, ::std::ostream* os)
{
*os << "[";
PrintTo(sourceRange.start(), os);
*os << ", ";
PrintTo(sourceRange.end(), os);
*os << "]";
}
} // namespace ClangBackEnd