llvm.org GIT mirror llvm / f73f809
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 Reid Kleckner 7 years ago
2 changed file(s) with 4 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
1111
1212 #include "llvm/ADT/SmallVector.h"
1313 #include "llvm/ADT/StringRef.h"
14 #include "llvm/ADT/StringSet.h"
1514 #include "llvm/Option/OptSpecifier.h"
1615 #include "llvm/Option/Option.h"
17 #include "llvm/Support/Allocator.h"
16 #include
1817 #include
1918 #include
2019
298297 /// This is mutable since we treat the ArgList as being the list
299298 /// of Args, and allow routines to add new strings (to have a
300299 /// convenient place to store the memory) via MakeIndex.
301 mutable StringSet> SynthesizedStrings;
300 mutable std::list> SynthesizedStrings;
302301
303302 /// The number of original input argument strings.
304303 unsigned NumInputArgStrings;
322322 unsigned InputArgList::MakeIndex(StringRef String0) const {
323323 unsigned Index = ArgStrings.size();
324324
325 // If necessary, make a copy so we can null terminate it.
326 std::string NullTerminated;
327 if (String0.back() != '\0') {
328 NullTerminated.append(String0.data(), String0.size());
329 NullTerminated.push_back('\0');
330 String0 = StringRef(&NullTerminated[0], NullTerminated.size());
331 }
332
333325 // Tuck away so we have a reliable const char *.
334 String0 = SynthesizedStrings.GetOrCreateValue(String0).getKey();
335 assert(String0.back() == '\0');
336 ArgStrings.push_back(String0.data());
326 SynthesizedStrings.push_back(String0);
327 ArgStrings.push_back(SynthesizedStrings.back().c_str());
337328
338329 return Index;
339330 }