Change Lexer::MeasureTokenLength to take a LangOptions reference.
This allows it to accurately measure tokens, so that we get:

t.cpp:8:13: error: unknown type name 'X'
static foo::X  P;
       ~~~~~^

instead of the woefully inferior:

t.cpp:8:13: error: unknown type name 'X'
static foo::X  P;
       ~~~~ ^

Most of this is just plumbing to push the reference around.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69099 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/HTMLDiagnostics.cpp b/lib/Frontend/HTMLDiagnostics.cpp
index 83c2ac5..752d41f 100644
--- a/lib/Frontend/HTMLDiagnostics.cpp
+++ b/lib/Frontend/HTMLDiagnostics.cpp
@@ -163,7 +163,7 @@
     return; // FIXME: Emit a warning?
   
   // Create a new rewriter to generate HTML.
-  Rewriter R(const_cast<SourceManager&>(SMgr));
+  Rewriter R(const_cast<SourceManager&>(SMgr), PP->getLangOptions());
   
   // Process the path.  
   unsigned n = D.size();
@@ -574,8 +574,8 @@
                                      SourceRange Range,
                                      const char *HighlightStart,
                                      const char *HighlightEnd) {
-  
-  SourceManager& SM = R.getSourceMgr();
+  SourceManager &SM = R.getSourceMgr();
+  const LangOptions &LangOpts = R.getLangOpts();
   
   SourceLocation InstantiationStart = SM.getInstantiationLoc(Range.getBegin());
   unsigned StartLineNo = SM.getInstantiationLineNumber(InstantiationStart);
@@ -596,7 +596,7 @@
 
   if (EndColNo) {
     // Add in the length of the token, so that we cover multi-char tokens.
-    EndColNo += Lexer::MeasureTokenLength(Range.getEnd(), SM) - 1;
+    EndColNo += Lexer::MeasureTokenLength(Range.getEnd(), SM, LangOpts)-1;
   }
   
   // Highlight the range.  Make the span tag the outermost tag for the