[llvm] r186329 - Revert "[Option] Store arg strings in a set backed by a BumpPtrAllocator"

Reid Kleckner reid at kleckner.net
Mon Jul 15 09:40:52 PDT 2013


Author: rnk
Date: Mon Jul 15 11:40:52 2013
New Revision: 186329

URL: http://llvm.org/viewvc/llvm-project?rev=186329&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/Option/ArgList.h
    llvm/trunk/lib/Option/ArgList.cpp

Modified: llvm/trunk/include/llvm/Option/ArgList.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Option/ArgList.h?rev=186329&r1=186328&r2=186329&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Option/ArgList.h (original)
+++ llvm/trunk/include/llvm/Option/ArgList.h Mon Jul 15 11:40:52 2013
@@ -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 <list>
 #include <string>
 #include <vector>
 
@@ -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<BumpPtrAllocator> SynthesizedStrings;
+  mutable std::list<std::string> SynthesizedStrings;
 
   /// The number of original input argument strings.
   unsigned NumInputArgStrings;

Modified: llvm/trunk/lib/Option/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Option/ArgList.cpp?rev=186329&r1=186328&r2=186329&view=diff
==============================================================================
--- llvm/trunk/lib/Option/ArgList.cpp (original)
+++ llvm/trunk/lib/Option/ArgList.cpp Mon Jul 15 11:40:52 2013
@@ -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;
 }





More information about the llvm-commits mailing list