[llvm-commits] [llvm] r155014 - /llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp

Jim Grosbach grosbach at apple.com
Wed Apr 18 10:46:41 PDT 2012


Author: grosbach
Date: Wed Apr 18 12:46:41 2012
New Revision: 155014

URL: http://llvm.org/viewvc/llvm-project?rev=155014&view=rev
Log:
TableGen use PrintWarning rather than fprintf(stderr,...) for warnings.

That way we get source line number information from the diagnostics.

Modified:
    llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp

Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=155014&r1=155013&r2=155014&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Wed Apr 18 12:46:41 2012
@@ -17,6 +17,7 @@
 #include "llvm/TableGen/Record.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <algorithm>
@@ -2483,10 +2484,9 @@
     // If we decided that this is a store from the pattern, then the .td file
     // entry is redundant.
     if (MayStore)
-      fprintf(stderr,
-              "Warning: mayStore flag explicitly set on instruction '%s'"
-              " but flag already inferred from pattern.\n",
-              Inst.TheDef->getName().c_str());
+      PrintWarning(Inst.TheDef->getLoc(),
+                   Twine("Warning: mayStore flag explicitly set on ") +
+                   "instruction, but flag already inferred from pattern.\n");
     MayStore = true;
   }
 
@@ -2494,24 +2494,25 @@
     // If we decided that this is a load from the pattern, then the .td file
     // entry is redundant.
     if (MayLoad)
-      fprintf(stderr,
-              "Warning: mayLoad flag explicitly set on instruction '%s'"
-              " but flag already inferred from pattern.\n",
-              Inst.TheDef->getName().c_str());
+      PrintWarning(Inst.TheDef->getLoc(),
+                   Twine("Warning: mayLoad flag explicitly set on ") +
+                   "instruction, but flag already inferred from pattern.\n");
     MayLoad = true;
   }
 
   if (Inst.neverHasSideEffects) {
     if (HadPattern)
-      fprintf(stderr, "Warning: neverHasSideEffects set on instruction '%s' "
-              "which already has a pattern\n", Inst.TheDef->getName().c_str());
+      PrintWarning(Inst.TheDef->getLoc(),
+                   Twine("Warning: neverHasSideEffects flag explicitly set on ") +
+                   "instruction, but flag already inferred from pattern.\n");
     HasSideEffects = false;
   }
 
   if (Inst.hasSideEffects) {
     if (HasSideEffects)
-      fprintf(stderr, "Warning: hasSideEffects set on instruction '%s' "
-              "which already inferred this.\n", Inst.TheDef->getName().c_str());
+      PrintWarning(Inst.TheDef->getLoc(),
+                   Twine("Warning: hasSideEffects flag explicitly set on ") +
+                   "instruction, but flag already inferred from pattern.\n");
     HasSideEffects = true;
   }
 





More information about the llvm-commits mailing list