Neil pointed out that clang doesn't generate ranges from diagnostics
related to pp-expressions.  Doing so is pretty simple and this
patch implements it, yielding nice diagnostics like:

t.c:2:7: error: division by zero in preprocessor expression
#if 1 / (0 + 0)
    ~ ^ ~~~~~~~
t.c:5:14: error: expected ')' in preprocessor expression
#if (412 + 42
     ~~~~~~~~^
t.c:5:5: error: to match this '('
#if (412 + 42
    ^
t.c:10:10: warning: left side of operator converted from negative value to unsigned: -42 to 18446744073709551574
#if (-42 + 0U) / -2
     ~~~ ^ ~~
t.c:10:16: warning: right side of operator converted from negative value to unsigned: -2 to 18446744073709551614
#if (-42 + 0U) / -2
    ~~~~~~~~~~ ^ ~~
5 diagnostics generated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50638 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 9240a0a..8907327 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -124,6 +124,26 @@
   Diags.Report(getFullLoc(Loc), DiagID, &Msg, 1);
 }
 
+void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
+                        const std::string &Msg,
+                        const SourceRange &R1, const SourceRange &R2) {
+  SourceRange R[] = {R1, R2};
+  Diags.Report(getFullLoc(Loc), DiagID, &Msg, 1, R, 2);
+}
+
+
+void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
+                        const SourceRange &R) {
+  Diags.Report(getFullLoc(Loc), DiagID, 0, 0, &R, 1);
+}
+
+void Preprocessor::Diag(SourceLocation Loc, unsigned DiagID,
+                        const SourceRange &R1, const SourceRange &R2) {
+  SourceRange R[] = {R1, R2};
+  Diags.Report(getFullLoc(Loc), DiagID, 0, 0, R, 2);
+}
+
+
 void Preprocessor::DumpToken(const Token &Tok, bool DumpFlags) const {
   llvm::cerr << tok::getTokenName(Tok.getKind()) << " '"
              << getSpelling(Tok) << "'";