From: Reid Kleckner Date: Mon, 15 Jul 2013 16:40:52 +0000 (+0000) Subject: Revert "[Option] Store arg strings in a set backed by a BumpPtrAllocator" X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f73f80975639a7413bee66391556f7ea51f83423;p=oota-llvm.git Revert "[Option] Store arg strings in a set backed by a BumpPtrAllocator" This broke clang's crash-report.c test, and I haven't been able to figure it out yet. This reverts commit r186319. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186329 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Option/ArgList.h b/include/llvm/Option/ArgList.h index 2f4d85295b2..06ba679c2b5 100644 --- a/include/llvm/Option/ArgList.h +++ b/include/llvm/Option/ArgList.h @@ -12,10 +12,9 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" -#include "llvm/ADT/StringSet.h" #include "llvm/Option/OptSpecifier.h" #include "llvm/Option/Option.h" -#include "llvm/Support/Allocator.h" +#include #include #include @@ -299,7 +298,7 @@ private: /// This is mutable since we treat the ArgList as being the list /// of Args, and allow routines to add new strings (to have a /// convenient place to store the memory) via MakeIndex. - mutable StringSet SynthesizedStrings; + mutable std::list SynthesizedStrings; /// The number of original input argument strings. unsigned NumInputArgStrings; diff --git a/lib/Option/ArgList.cpp b/lib/Option/ArgList.cpp index 18a7b5982be..15f7e8bf4b8 100644 --- a/lib/Option/ArgList.cpp +++ b/lib/Option/ArgList.cpp @@ -323,18 +323,9 @@ InputArgList::~InputArgList() { unsigned InputArgList::MakeIndex(StringRef String0) const { unsigned Index = ArgStrings.size(); - // If necessary, make a copy so we can null terminate it. - std::string NullTerminated; - if (String0.back() != '\0') { - NullTerminated.append(String0.data(), String0.size()); - NullTerminated.push_back('\0'); - String0 = StringRef(&NullTerminated[0], NullTerminated.size()); - } - // Tuck away so we have a reliable const char *. - String0 = SynthesizedStrings.GetOrCreateValue(String0).getKey(); - assert(String0.back() == '\0'); - ArgStrings.push_back(String0.data()); + SynthesizedStrings.push_back(String0); + ArgStrings.push_back(SynthesizedStrings.back().c_str()); return Index; }