]> granicus.if.org Git - clang/commitdiff
Add an accessor for all of the ranges in a diagnostic as an ArrayRef.
authorChandler Carruth <chandlerc@gmail.com>
Sat, 15 Oct 2011 10:48:13 +0000 (10:48 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 15 Oct 2011 10:48:13 +0000 (10:48 +0000)
This will simplify a number of calls in the diagnostic printing going
forward.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142062 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Diagnostic.h

index fefc44ce7bc6e1ce6b2c3343c54aac52423c76af..ae0f6ea0cf1a209f9cdf1cc9407dad8455bd0edd 100644 (file)
@@ -951,6 +951,11 @@ public:
     return DiagObj->DiagRanges[Idx];
   }
 
+  /// \brief Return an array reference for this diagnostic's ranges.
+  ArrayRef<CharSourceRange> getRanges() const {
+    return llvm::makeArrayRef(DiagObj->DiagRanges, DiagObj->NumDiagRanges);
+  }
+
   unsigned getNumFixItHints() const {
     return DiagObj->NumFixItHints;
   }