[cfe-commits] r142071 - in /cfe/trunk: include/clang/Frontend/TextDiagnosticPrinter.h lib/Frontend/TextDiagnosticPrinter.cpp

Chandler Carruth chandlerc at gmail.com
Sat Oct 15 05:12:44 PDT 2011


Author: chandlerc
Date: Sat Oct 15 07:12:44 2011
New Revision: 142071

URL: http://llvm.org/viewvc/llvm-project?rev=142071&view=rev
Log:
Neither 'Warning' nor 'NonNote' was a good name for this location...
It's the last include-stack-root we tried to walk up. Use a better name
and better doxyments for it.

Modified:
    cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h
    cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp

Modified: cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h?rev=142071&r1=142070&r2=142071&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h (original)
+++ cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h Sat Oct 15 07:12:44 2011
@@ -28,7 +28,7 @@
   const DiagnosticOptions *DiagOpts;
 
   FullSourceLoc LastLoc;
-  FullSourceLoc LastNonNoteLoc;
+  FullSourceLoc LastIncludeLoc;
   unsigned LastCaretDiagnosticWasNote : 1;
   unsigned OwnsOutputStream : 1;
 

Modified: cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp?rev=142071&r1=142070&r2=142071&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp Sat Oct 15 07:12:44 2011
@@ -492,10 +492,11 @@
   /// a different source manager than SM.
   SourceLocation LastLoc;
 
-  /// \brief The location of the previous non-note diagnostic if known.
+  /// \brief The location of the last include whose stack was printed if known.
   ///
-  /// Same restriction as \see LastLoc but tracks the last non-note location.
-  SourceLocation LastNonNoteLoc;
+  /// Same restriction as \see LastLoc essentially, but tracking include stack
+  /// root locations rather than diagnostic locations.
+  SourceLocation LastIncludeLoc;
 
 public:
   TextDiagnostic(raw_ostream &OS,
@@ -503,20 +504,20 @@
                  const LangOptions &LangOpts,
                  const DiagnosticOptions &DiagOpts,
                  FullSourceLoc LastLoc = FullSourceLoc(),
-                 FullSourceLoc LastNonNoteLoc = FullSourceLoc())
+                 FullSourceLoc LastIncludeLoc = FullSourceLoc())
     : OS(OS), SM(SM), LangOpts(LangOpts), DiagOpts(DiagOpts),
-      LastLoc(LastLoc), LastNonNoteLoc(LastNonNoteLoc) {
+      LastLoc(LastLoc), LastIncludeLoc(LastIncludeLoc) {
     if (LastLoc.isValid() && &SM != &LastLoc.getManager())
       this->LastLoc = SourceLocation();
-    if (LastNonNoteLoc.isValid() && &SM != &LastNonNoteLoc.getManager())
-      this->LastNonNoteLoc = SourceLocation();
+    if (LastIncludeLoc.isValid() && &SM != &LastIncludeLoc.getManager())
+      this->LastIncludeLoc = SourceLocation();
   }
 
   /// \brief Get the last diagnostic location emitted.
   SourceLocation getLastLoc() const { return LastLoc; }
 
-  /// \brief Get the last non-note diagnostic location emitted.
-  SourceLocation getLastNonNoteLoc() const { return LastNonNoteLoc; }
+  /// \brief Get the last emitted include stack location.
+  SourceLocation getLastIncludeLoc() const { return LastIncludeLoc; }
 
   void Emit(SourceLocation Loc, DiagnosticsEngine::Level Level,
             StringRef Message, ArrayRef<CharSourceRange> Ranges,
@@ -795,9 +796,9 @@
   ///              location).
   void emitIncludeStack(SourceLocation Loc, DiagnosticsEngine::Level Level) {
     // Skip redundant include stacks altogether.
-    if (LastNonNoteLoc == Loc)
+    if (LastIncludeLoc == Loc)
       return;
-    LastNonNoteLoc = Loc;
+    LastIncludeLoc = Loc;
 
     if (!DiagOpts.ShowNoteIncludeStack && Level == DiagnosticsEngine::Note)
       return;
@@ -1278,7 +1279,7 @@
          "Unexpected diagnostic with no source manager");
   const SourceManager &SM = Info.getSourceManager();
   TextDiagnostic TextDiag(OS, SM, *LangOpts, *DiagOpts,
-                          LastLoc, LastNonNoteLoc);
+                          LastLoc, LastIncludeLoc);
 
   TextDiag.Emit(Info.getLocation(), Level, DiagMessageStream.str(),
                 Info.getRanges(),
@@ -1288,7 +1289,7 @@
 
   // Cache the LastLoc from the TextDiagnostic printing.
   LastLoc = FullSourceLoc(TextDiag.getLastLoc(), SM);
-  LastNonNoteLoc = FullSourceLoc(TextDiag.getLastNonNoteLoc(), SM);
+  LastIncludeLoc = FullSourceLoc(TextDiag.getLastIncludeLoc(), SM);
   LastCaretDiagnosticWasNote = (Level == DiagnosticsEngine::Note);
 
   OS.flush();





More information about the cfe-commits mailing list