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

Chris Lattner sabre at nondot.org
Sun Apr 19 00:44:19 PDT 2009


Author: lattner
Date: Sun Apr 19 02:44:08 2009
New Revision: 69525

URL: http://llvm.org/viewvc/llvm-project?rev=69525&view=rev
Log:
implement compiler support for -fno-diagnostics-fixit-info,
rdar://6805442

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

Modified: cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h?rev=69525&r1=69524&r2=69525&view=diff

==============================================================================
--- cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h (original)
+++ cfe/trunk/include/clang/Frontend/TextDiagnosticPrinter.h Sun Apr 19 02:44:08 2009
@@ -38,17 +38,20 @@
   bool ShowLocation;
   bool PrintRangeInfo;
   bool PrintDiagnosticOption;
+  bool PrintFixItInfo;
 public:
   TextDiagnosticPrinter(llvm::raw_ostream &os,
                         bool showColumn = true,
                         bool caretDiagnistics = true, bool showLocation = true,
                         bool printRangeInfo = true,
-                        bool printDiagnosticOption = true)
+                        bool printDiagnosticOption = true,
+                        bool printFixItInfo = true)
     : OS(os), LangOpts(0),
       LastCaretDiagnosticWasNote(false), ShowColumn(showColumn), 
       CaretDiagnostics(caretDiagnistics), ShowLocation(showLocation),
       PrintRangeInfo(printRangeInfo),
-      PrintDiagnosticOption(printDiagnosticOption) {}
+      PrintDiagnosticOption(printDiagnosticOption),
+      PrintFixItInfo(printFixItInfo) {}
 
   void setLangOptions(const LangOptions *LO) {
     LangOpts = LO;

Modified: cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp?rev=69525&r1=69524&r2=69525&view=diff

==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp Sun Apr 19 02:44:08 2009
@@ -207,10 +207,9 @@
   OS << SourceLine << '\n';
   OS << CaretLine << '\n';
 
-  if (NumHints) {
+  if (NumHints && PrintFixItInfo) {
     std::string InsertionLine;
-    for (const CodeModificationHint *Hint = Hints, 
-                                *LastHint = Hints + NumHints;
+    for (const CodeModificationHint *Hint = Hints, *LastHint = Hints + NumHints;
          Hint != LastHint; ++Hint) {
       if (Hint->InsertionLoc.isValid()) {
         // We have an insertion hint. Determine whether the inserted

Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=69525&r1=69524&r2=69525&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Sun Apr 19 02:44:08 2009
@@ -300,6 +300,11 @@
                                   " diagnostics"));
 
 static llvm::cl::opt<bool>
+NoDiagnosticsFixIt("fno-diagnostics-fixit-info",
+                   llvm::cl::desc("Do not include fixit information in"
+                                  " diagnostics"));
+
+static llvm::cl::opt<bool>
 PrintSourceRangeInfo("fprint-source-range-info",
                     llvm::cl::desc("Print source range spans in numeric form"));
 
@@ -1873,7 +1878,8 @@
                                            !NoCaretDiagnostics,
                                            !NoShowLocation,
                                            PrintSourceRangeInfo,
-                                           PrintDiagnosticOption));
+                                           PrintDiagnosticOption,
+                                           !NoDiagnosticsFixIt));
   }
   
   virtual void setLangOptions(const LangOptions *LO) {
@@ -2329,7 +2335,8 @@
                                                !NoCaretDiagnostics,
                                                !NoShowLocation,
                                                PrintSourceRangeInfo,
-                                               PrintDiagnosticOption));
+                                               PrintDiagnosticOption,
+                                               !NoDiagnosticsFixIt));
   } else {
     DiagClient.reset(CreateHTMLDiagnosticClient(HTMLDiag));
   }





More information about the cfe-commits mailing list