[llvm-commits] [llvm] r69213 - /llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp

Chris Lattner sabre at nondot.org
Wed Apr 15 13:16:13 PDT 2009


Author: lattner
Date: Wed Apr 15 15:16:12 2009
New Revision: 69213

URL: http://llvm.org/viewvc/llvm-project?rev=69213&view=rev
Log:
use UppercaseString instead of EmitAllCaps

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

Modified: llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp?rev=69213&r1=69212&r2=69213&view=diff

==============================================================================
--- llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Wed Apr 15 15:16:12 2009
@@ -28,10 +28,9 @@
 //===----------------------------------------------------------------------===//
 
 typedef std::vector<Record*> RecordVector;
-typedef std::vector<Record*> SuperClassVector;
-typedef std::vector<RecordVal> RecordValVector;
 
 static const RecordVal* findRecordVal(const Record& R, const std::string &key) {  
+  typedef std::vector<RecordVal> RecordValVector;
   const RecordValVector &Vals = R.getValues();
   for (RecordValVector::const_iterator I=Vals.begin(), E=Vals.end(); I!=E; ++I)
     if ((*I).getName() == key)
@@ -40,11 +39,6 @@
   return 0;
 }
 
-static void EmitAllCaps(std::ostream& OS, const std::string &s) {
-  for (std::string::const_iterator I=s.begin(), E=s.end(); I!=E; ++I)
-    OS << char(toupper(*I));  
-}
-
 //===----------------------------------------------------------------------===//
 // Warning Tables (.inc file) generation.
 //===----------------------------------------------------------------------===//
@@ -68,15 +62,12 @@
   
   // Write the #if guard
   if (!Component.empty()) {
-    OS << "#ifdef ";
-    EmitAllCaps(OS, Component);
-    OS << "START\n__";
-    EmitAllCaps(OS, Component);
-    OS << "START = DIAG_START_";
-    EmitAllCaps(OS, Component);
-    OS << ",\n#undef ";
-    EmitAllCaps(OS, Component);
-    OS << "START\n#endif\n";
+    std::string ComponentName = UppercaseString(Component);
+    OS << "#ifdef " << ComponentName << "START\n";
+    OS << "__" << ComponentName << "START = DIAG_START_" << ComponentName
+       << ",\n";
+    OS << "#undef " << ComponentName << "START\n";
+    OS << "#endif\n";
   }
   
   for (RecordVector::const_iterator I=Diags.begin(), E=Diags.end(); I!=E; ++I) {





More information about the llvm-commits mailing list