[PATCH] D50662: Add dump() method for SourceRange

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 13 13:27:18 PDT 2018


steveire created this revision.
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

https://reviews.llvm.org/D50662

Files:
  include/clang/Basic/SourceLocation.h
  lib/Basic/SourceLocation.cpp


Index: lib/Basic/SourceLocation.cpp
===================================================================
--- lib/Basic/SourceLocation.cpp
+++ lib/Basic/SourceLocation.cpp
@@ -80,6 +80,14 @@
   llvm::errs() << '\n';
 }
 
+LLVM_DUMP_METHOD void SourceRange::dump(const SourceManager &SM) const {
+  llvm::errs() << '[';
+  B.print(llvm::errs(), SM);
+  llvm::errs() << ",\n ";
+  E.print(llvm::errs(), SM);
+  llvm::errs() << "]\n";
+}
+
 //===----------------------------------------------------------------------===//
 // FullSourceLoc
 //===----------------------------------------------------------------------===//
Index: include/clang/Basic/SourceLocation.h
===================================================================
--- include/clang/Basic/SourceLocation.h
+++ include/clang/Basic/SourceLocation.h
@@ -220,6 +220,8 @@
   bool operator!=(const SourceRange &X) const {
     return B != X.B || E != X.E;
   }
+
+  void dump(const SourceManager &SM) const;
 };
 
 /// Represents a character-granular source range.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50662.160435.patch
Type: text/x-patch
Size: 1023 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180813/effeaf5b/attachment.bin>


More information about the cfe-commits mailing list