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

Chandler Carruth chandlerc at gmail.com
Sat Oct 15 16:54:09 PDT 2011


Author: chandlerc
Date: Sat Oct 15 18:54:09 2011
New Revision: 142088

URL: http://llvm.org/viewvc/llvm-project?rev=142088&view=rev
Log:
Clean up the names of all the TextDiagnostic methods (and even a static
function) to agree with the coding conventions, and in one case have
a bit more information in it.

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

Modified: cfe/trunk/include/clang/Frontend/TextDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnostic.h?rev=142088&r1=142087&r2=142088&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/TextDiagnostic.h (original)
+++ cfe/trunk/include/clang/Frontend/TextDiagnostic.h Sat Oct 15 18:54:09 2011
@@ -85,10 +85,10 @@
   /// \brief Get the last diagnostic level.
   DiagnosticsEngine::Level getLastLevel() const { return LastLevel; }
 
-  void Emit(SourceLocation Loc, DiagnosticsEngine::Level Level,
-            StringRef Message, ArrayRef<CharSourceRange> Ranges,
-            ArrayRef<FixItHint> FixItHints,
-            bool LastCaretDiagnosticWasNote = false);
+  void emitDiagnostic(SourceLocation Loc, DiagnosticsEngine::Level Level,
+                      StringRef Message, ArrayRef<CharSourceRange> Ranges,
+                      ArrayRef<FixItHint> FixItHints,
+                      bool LastCaretDiagnosticWasNote = false);
 
   /// \brief Print the diagonstic level to a raw_ostream.
   ///
@@ -126,28 +126,28 @@
 private:
   void emitIncludeStack(SourceLocation Loc, DiagnosticsEngine::Level Level);
   void emitIncludeStackRecursively(SourceLocation Loc);
-  void EmitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
+  void emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
                          DiagnosticsEngine::Level Level,
                          ArrayRef<CharSourceRange> Ranges);
-  void EmitCaret(SourceLocation Loc,
+  void emitCaret(SourceLocation Loc,
                  SmallVectorImpl<CharSourceRange>& Ranges,
                  ArrayRef<FixItHint> Hints,
                  unsigned &MacroDepth,
                  unsigned OnMacroInst = 0);
-  void EmitSnippetAndCaret(SourceLocation Loc,
+  void emitSnippetAndCaret(SourceLocation Loc,
                            SmallVectorImpl<CharSourceRange>& Ranges,
                            ArrayRef<FixItHint> Hints);
 
-  void HighlightRange(const CharSourceRange &R,
+  void highlightRange(const CharSourceRange &R,
                       unsigned LineNo, FileID FID,
                       const std::string &SourceLine,
                       std::string &CaretLine);
-  std::string BuildFixItInsertionLine(unsigned LineNo,
+  std::string buildFixItInsertionLine(unsigned LineNo,
                                       const char *LineStart,
                                       const char *LineEnd,
                                       ArrayRef<FixItHint> Hints);
-  void ExpandTabs(std::string &SourceLine, std::string &CaretLine);
-  void EmitParseableFixits(ArrayRef<FixItHint> Hints);
+  void expandTabs(std::string &SourceLine, std::string &CaretLine);
+  void emitParseableFixits(ArrayRef<FixItHint> Hints);
 };
 
 } // end namespace clang

Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=142088&r1=142087&r2=142088&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Sat Oct 15 18:54:09 2011
@@ -38,7 +38,7 @@
 
 /// \brief When the source code line we want to print is too long for
 /// the terminal, select the "interesting" region.
-static void SelectInterestingSourceRegion(std::string &SourceLine,
+static void selectInterestingSourceRegion(std::string &SourceLine,
                                           std::string &CaretLine,
                                           std::string &FixItInsertionLine,
                                           unsigned EndOfCaretToken,
@@ -228,7 +228,7 @@
 /// presumed location for the top of any macro backtrace when present.
 static PresumedLoc getDiagnosticPresumedLoc(const SourceManager &SM,
                                             SourceLocation Loc) {
-  // This is a condensed form of the algorithm used by EmitCaretDiagnostic to
+  // This is a condensed form of the algorithm used by emitCaretDiagnostic to
   // walk to the top of the macro call stack.
   while (Loc.isMacroID()) {
     Loc = skipToMacroArgExpansion(SM, Loc);
@@ -404,10 +404,12 @@
     this->LastIncludeLoc = SourceLocation();
     }
 
-void TextDiagnostic::Emit(SourceLocation Loc, DiagnosticsEngine::Level Level,
-                          StringRef Message, ArrayRef<CharSourceRange> Ranges,
-                          ArrayRef<FixItHint> FixItHints,
-                          bool LastCaretDiagnosticWasNote) {
+void TextDiagnostic::emitDiagnostic(SourceLocation Loc,
+                                    DiagnosticsEngine::Level Level,
+                                    StringRef Message,
+                                    ArrayRef<CharSourceRange> Ranges,
+                                    ArrayRef<FixItHint> FixItHints,
+                                    bool LastCaretDiagnosticWasNote) {
   PresumedLoc PLoc = getDiagnosticPresumedLoc(SM, Loc);
 
   // First, if this diagnostic is not in the main file, print out the
@@ -417,7 +419,7 @@
   uint64_t StartOfLocationInfo = OS.tell();
 
   // Next emit the location of this particular diagnostic.
-  EmitDiagnosticLoc(Loc, PLoc, Level, Ranges);
+  emitDiagnosticLoc(Loc, PLoc, Level, Ranges);
 
   if (DiagOpts.ShowColors)
     OS.resetColor();
@@ -447,7 +449,7 @@
         MutableRanges.push_back(I->RemoveRange);
 
     unsigned MacroDepth = 0;
-    EmitCaret(Loc, MutableRanges, FixItHints, MacroDepth);
+    emitCaret(Loc, MutableRanges, FixItHints, MacroDepth);
   }
 
   LastLoc = Loc;
@@ -559,7 +561,7 @@
 /// This includes extracting as much location information as is present for
 /// the diagnostic and printing it, as well as any include stack or source
 /// ranges necessary.
-void TextDiagnostic::EmitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
+void TextDiagnostic::emitDiagnosticLoc(SourceLocation Loc, PresumedLoc PLoc,
                                        DiagnosticsEngine::Level Level,
                                        ArrayRef<CharSourceRange> Ranges) {
   if (PLoc.isInvalid()) {
@@ -675,7 +677,7 @@
 /// \param Hints The FixIt hints active for this diagnostic.
 /// \param MacroSkipEnd The depth to stop skipping macro expansions.
 /// \param OnMacroInst The current depth of the macro expansion stack.
-void TextDiagnostic::EmitCaret(SourceLocation Loc,
+void TextDiagnostic::emitCaret(SourceLocation Loc,
                                SmallVectorImpl<CharSourceRange>& Ranges,
                                ArrayRef<FixItHint> Hints,
                                unsigned &MacroDepth,
@@ -687,7 +689,7 @@
   if (Loc.isFileID()) {
     assert(MacroDepth == 0 && "We shouldn't hit a leaf node twice!");
     MacroDepth = OnMacroInst;
-    EmitSnippetAndCaret(Loc, Ranges, Hints);
+    emitSnippetAndCaret(Loc, Ranges, Hints);
     return;
   }
   // Otherwise recurse through each macro expansion layer.
@@ -699,7 +701,7 @@
   SourceLocation OneLevelUp = getImmediateMacroCallerLoc(SM, Loc);
 
   // FIXME: Map ranges?
-  EmitCaret(OneLevelUp, Ranges, Hints, MacroDepth, OnMacroInst + 1);
+  emitCaret(OneLevelUp, Ranges, Hints, MacroDepth, OnMacroInst + 1);
 
   // Map the location.
   Loc = getImmediateMacroCalleeLoc(SM, Loc);
@@ -748,7 +750,7 @@
     }
     OS << "note: expanded from:\n";
 
-    EmitSnippetAndCaret(Loc, Ranges, ArrayRef<FixItHint>());
+    emitSnippetAndCaret(Loc, Ranges, ArrayRef<FixItHint>());
     return;
   }
 
@@ -767,7 +769,7 @@
 /// \param Loc The location for the caret.
 /// \param Ranges The underlined ranges for this code snippet.
 /// \param Hints The FixIt hints active for this diagnostic.
-void TextDiagnostic::EmitSnippetAndCaret(
+void TextDiagnostic::emitSnippetAndCaret(
     SourceLocation Loc,
     SmallVectorImpl<CharSourceRange>& Ranges,
     ArrayRef<FixItHint> Hints) {
@@ -817,7 +819,7 @@
   for (SmallVectorImpl<CharSourceRange>::iterator I = Ranges.begin(),
                                                   E = Ranges.end();
        I != E; ++I)
-    HighlightRange(*I, LineNo, FID, SourceLine, CaretLine);
+    highlightRange(*I, LineNo, FID, SourceLine, CaretLine);
 
   // Next, insert the caret itself.
   if (ColNo-1 < CaretLine.size())
@@ -825,7 +827,7 @@
   else
     CaretLine.push_back('^');
 
-  ExpandTabs(SourceLine, CaretLine);
+  expandTabs(SourceLine, CaretLine);
 
   // If we are in -fdiagnostics-print-source-range-info mode, we are trying
   // to produce easily machine parsable output.  Add a space before the
@@ -836,7 +838,7 @@
     CaretLine = ' ' + CaretLine;
   }
 
-  std::string FixItInsertionLine = BuildFixItInsertionLine(LineNo,
+  std::string FixItInsertionLine = buildFixItInsertionLine(LineNo,
                                                            LineStart, LineEnd,
                                                            Hints);
 
@@ -844,7 +846,7 @@
   // "interesting" source region within that line.
   unsigned Columns = DiagOpts.MessageLength;
   if (Columns && SourceLine.size() > Columns)
-    SelectInterestingSourceRegion(SourceLine, CaretLine, FixItInsertionLine,
+    selectInterestingSourceRegion(SourceLine, CaretLine, FixItInsertionLine,
                                   CaretEndColNo, Columns);
 
   // Finally, remove any blank spaces from the end of CaretLine.
@@ -872,11 +874,11 @@
   }
 
   // Print out any parseable fixit information requested by the options.
-  EmitParseableFixits(Hints);
+  emitParseableFixits(Hints);
 }
 
 /// \brief Highlight a SourceRange (with ~'s) for any characters on LineNo.
-void TextDiagnostic::HighlightRange(const CharSourceRange &R,
+void TextDiagnostic::highlightRange(const CharSourceRange &R,
                                     unsigned LineNo, FileID FID,
                                     const std::string &SourceLine,
                                     std::string &CaretLine) {
@@ -953,7 +955,7 @@
     CaretLine[i] = '~';
 }
 
-std::string TextDiagnostic::BuildFixItInsertionLine(unsigned LineNo,
+std::string TextDiagnostic::buildFixItInsertionLine(unsigned LineNo,
                                                     const char *LineStart,
                                                     const char *LineEnd,
                                                     ArrayRef<FixItHint> Hints) {
@@ -1027,7 +1029,7 @@
   return FixItInsertionLine;
 }
 
-void TextDiagnostic::ExpandTabs(std::string &SourceLine,
+void TextDiagnostic::expandTabs(std::string &SourceLine,
                                 std::string &CaretLine) {
   // Scan the source line, looking for tabs.  If we find any, manually expand
   // them to spaces and update the CaretLine to match.
@@ -1052,7 +1054,7 @@
   }
 }
 
-void TextDiagnostic::EmitParseableFixits(ArrayRef<FixItHint> Hints) {
+void TextDiagnostic::emitParseableFixits(ArrayRef<FixItHint> Hints) {
   if (!DiagOpts.ShowParseableFixits)
     return;
 

Modified: cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp?rev=142088&r1=142087&r2=142088&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp Sat Oct 15 18:54:09 2011
@@ -162,10 +162,10 @@
   TextDiagnostic TextDiag(OS, SM, *LangOpts, *DiagOpts,
                           LastLoc, LastIncludeLoc, LastLevel);
 
-  TextDiag.Emit(Info.getLocation(), Level, DiagMessageStream.str(),
-                Info.getRanges(),
-                llvm::makeArrayRef(Info.getFixItHints(),
-                                   Info.getNumFixItHints()));
+  TextDiag.emitDiagnostic(Info.getLocation(), Level, DiagMessageStream.str(),
+                          Info.getRanges(),
+                          llvm::makeArrayRef(Info.getFixItHints(),
+                                             Info.getNumFixItHints()));
 
   // Cache the LastLoc from the TextDiagnostic printing.
   // FIXME: Rather than this, we should persist a TextDiagnostic object across





More information about the cfe-commits mailing list