From 780d4ccf9ea016b86b76e8121b8450e3fa202843 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Wed, 26 Jun 2013 22:43:37 +0000 Subject: [PATCH] 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. llvm-svn: 185031 --- lib/Option/Option.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Option/Option.cpp b/lib/Option/Option.cpp index 0e2263475e0..f1b7941e498 100644 --- a/lib/Option/Option.cpp +++ b/lib/Option/Option.cpp @@ -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() << '"';