[llvm] r185031 - Fix a crash bug in dumping options with groups

Reid Kleckner reid at kleckner.net
Wed Jun 26 15:43:37 PDT 2013


Author: rnk
Date: Wed Jun 26 17:43:37 2013
New Revision: 185031

URL: http://llvm.org/viewvc/llvm-project?rev=185031&view=rev
Log:
Fix a crash bug in dumping options with groups

Option groups don't have prefixes.  Option dumping is basically dead
code unless there is something wrong with the option table, so this
isn't an important crasher.

Modified:
    llvm/trunk/lib/Option/Option.cpp

Modified: llvm/trunk/lib/Option/Option.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/Option.cpp?rev=185031&r1=185030&r2=185031&view=diff
==============================================================================
--- llvm/trunk/lib/Option/Option.cpp (original)
+++ llvm/trunk/lib/Option/Option.cpp Wed Jun 26 17:43:37 2013
@@ -50,11 +50,13 @@ void Option::dump() const {
 #undef P
   }
 
-  llvm::errs() << " Prefixes:[";
-  for (const char * const *Pre = Info->Prefixes; *Pre != 0; ++Pre) {
-    llvm::errs() << '"' << *Pre << (*(Pre + 1) == 0 ? "\"" : "\", ");
+  if (Info->Prefixes) {
+    llvm::errs() << " Prefixes:[";
+    for (const char * const *Pre = Info->Prefixes; *Pre != 0; ++Pre) {
+      llvm::errs() << '"' << *Pre << (*(Pre + 1) == 0 ? "\"" : "\", ");
+    }
+    llvm::errs() << ']';
   }
-  llvm::errs() << ']';
 
   llvm::errs() << " Name:\"" << getName() << '"';
 





More information about the llvm-commits mailing list