From db7948499872e3ace0efaa793b15d2b4d547fc58 Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Fri, 15 Aug 2014 23:39:01 +0000 Subject: Revert "[Support] Promote cl::StringSaver to a separate utility" This reverts commit r215784 / 3f8a26f6fe16cc76c98ab21db2c600bd7defbbaa. LLD has 3 StringSaver's, one of which takes a lock when saving the string... Need to investigate more closely. llvm-svn: 215790 --- llvm/unittests/Support/CommandLineTest.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'llvm/unittests/Support/CommandLineTest.cpp') diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index ffabaca..e4a1b67 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -146,19 +146,26 @@ TEST(CommandLineTest, UseOptionCategory) { "Category."; } -typedef void ParserFunction(StringRef Source, StringSaver &Saver, +class StrDupSaver : public cl::StringSaver { + const char *SaveString(const char *Str) override { + return strdup(Str); + } +}; + +typedef void ParserFunction(StringRef Source, llvm::cl::StringSaver &Saver, SmallVectorImpl &NewArgv); void testCommandLineTokenizer(ParserFunction *parse, const char *Input, const char *const Output[], size_t OutputSize) { SmallVector Actual; - StringSaver Saver; + StrDupSaver Saver; parse(Input, Saver, Actual); EXPECT_EQ(OutputSize, Actual.size()); for (unsigned I = 0, E = Actual.size(); I != E; ++I) { if (I < OutputSize) EXPECT_STREQ(Output[I], Actual[I]); + free(const_cast(Actual[I])); } } -- cgit v1.1