aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/SourceLocation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Basic/SourceLocation.cpp')
-rw-r--r--clang/lib/Basic/SourceLocation.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/Basic/SourceLocation.cpp b/clang/lib/Basic/SourceLocation.cpp
index 6e5e55f..931ea22 100644
--- a/clang/lib/Basic/SourceLocation.cpp
+++ b/clang/lib/Basic/SourceLocation.cpp
@@ -270,3 +270,30 @@ StringRef FullSourceLoc::getBufferData(bool *Invalid) const {
std::pair<FileID, unsigned> FullSourceLoc::getDecomposedLoc() const {
return SrcMgr->getDecomposedLoc(*this);
}
+
+//===----------------------------------------------------------------------===//
+// FullSourceRange
+//===----------------------------------------------------------------------===//
+
+void FullSourceRange::print(raw_ostream &OS) const {
+
+ OS << '<';
+ PresumedLoc PrintedLoc = PrintDifference(OS, B.getManager(), B, {});
+ if (B != E) {
+ OS << ", ";
+ PrintDifference(OS, E.getManager(), E, PrintedLoc);
+ }
+ OS << '>';
+}
+
+LLVM_DUMP_METHOD std::string FullSourceRange::printToString() const {
+ std::string S;
+ llvm::raw_string_ostream OS(S);
+ print(OS);
+ return OS.str();
+}
+
+LLVM_DUMP_METHOD void FullSourceRange::dump() const {
+ this->print(llvm::errs());
+ llvm::errs() << '\n';
+}