diff options
author | Serge Pavlov <sepavloff@gmail.com> | 2022-09-28 13:32:20 +0700 |
---|---|---|
committer | Serge Pavlov <sepavloff@gmail.com> | 2022-09-28 13:33:28 +0700 |
commit | 5ddde5f80ab69cc69f64f6fd0114fc7992a29c61 (patch) | |
tree | 205486cfb62858923383d22f37b60aaf7f982a94 /llvm/unittests/Support/CommandLineTest.cpp | |
parent | 0a14f73126173d6335c927dbfdb56e9189003ca5 (diff) | |
download | llvm-5ddde5f80ab69cc69f64f6fd0114fc7992a29c61.zip llvm-5ddde5f80ab69cc69f64f6fd0114fc7992a29c61.tar.gz llvm-5ddde5f80ab69cc69f64f6fd0114fc7992a29c61.tar.bz2 |
Revert "[Support] Class for response file expansion (NFC)"
This reverts commit 6e491c48d6b9cadcc5b77f730dd83a1448197329.
There are missed changes in flang.
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r-- | llvm/unittests/Support/CommandLineTest.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index 7af8c89..4fd037e 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -869,9 +869,10 @@ TEST(CommandLineTest, ResponseFiles) { // Expand response files. llvm::BumpPtrAllocator A; - llvm::cl::ExpansionContext ECtx(A, llvm::cl::TokenizeGNUCommandLine); - ECtx.setVFS(&FS).setCurrentDir(TestRoot).setRelativeNames(true); - ASSERT_TRUE(ECtx.expandResponseFiles(Argv)); + llvm::StringSaver Saver(A); + ASSERT_TRUE(llvm::cl::ExpandResponseFiles( + Saver, llvm::cl::TokenizeGNUCommandLine, Argv, false, true, false, + /*CurrentDir=*/StringRef(TestRoot), FS)); EXPECT_THAT(Argv, testing::Pointwise( StringEquality(), {"test/test", "-flag_1", "-option_1", "-option_2", @@ -926,14 +927,15 @@ TEST(CommandLineTest, RecursiveResponseFiles) { SmallVector<const char *, 4> Argv = {"test/test", SelfFileRef.c_str(), "-option_3"}; BumpPtrAllocator A; + StringSaver Saver(A); #ifdef _WIN32 cl::TokenizerCallback Tokenizer = cl::TokenizeWindowsCommandLine; #else cl::TokenizerCallback Tokenizer = cl::TokenizeGNUCommandLine; #endif - llvm::cl::ExpansionContext ECtx(A, Tokenizer); - ECtx.setVFS(&FS).setCurrentDir(TestRoot); - ASSERT_FALSE(ECtx.expandResponseFiles(Argv)); + ASSERT_FALSE( + cl::ExpandResponseFiles(Saver, Tokenizer, Argv, false, false, false, + /*CurrentDir=*/llvm::StringRef(TestRoot), FS)); EXPECT_THAT(Argv, testing::Pointwise(StringEquality(), @@ -969,9 +971,10 @@ TEST(CommandLineTest, ResponseFilesAtArguments) { Argv.push_back(ResponseFileRef.c_str()); BumpPtrAllocator A; - llvm::cl::ExpansionContext ECtx(A, cl::TokenizeGNUCommandLine); - ECtx.setVFS(&FS).setCurrentDir(TestRoot); - ASSERT_FALSE(ECtx.expandResponseFiles(Argv)); + StringSaver Saver(A); + ASSERT_FALSE(cl::ExpandResponseFiles(Saver, cl::TokenizeGNUCommandLine, Argv, + false, false, false, + /*CurrentDir=*/StringRef(TestRoot), FS)); // ASSERT instead of EXPECT to prevent potential out-of-bounds access. ASSERT_EQ(Argv.size(), 1 + NON_RSP_AT_ARGS + 2); @@ -1003,9 +1006,10 @@ TEST(CommandLineTest, ResponseFileRelativePath) { SmallVector<const char *, 2> Argv = {"test/test", "@dir/outer.rsp"}; BumpPtrAllocator A; - llvm::cl::ExpansionContext ECtx(A, cl::TokenizeGNUCommandLine); - ECtx.setVFS(&FS).setCurrentDir(TestRoot).setRelativeNames(true); - ASSERT_TRUE(ECtx.expandResponseFiles(Argv)); + StringSaver Saver(A); + ASSERT_TRUE(cl::ExpandResponseFiles(Saver, cl::TokenizeGNUCommandLine, Argv, + false, true, false, + /*CurrentDir=*/StringRef(TestRoot), FS)); EXPECT_THAT(Argv, testing::Pointwise(StringEquality(), {"test/test", "-flag"})); } @@ -1022,10 +1026,10 @@ TEST(CommandLineTest, ResponseFileEOLs) { MemoryBuffer::getMemBuffer("-Xclang -Wno-whatever\n input.cpp")); SmallVector<const char *, 2> Argv = {"clang", "@eols.rsp"}; BumpPtrAllocator A; - llvm::cl::ExpansionContext ECtx(A, cl::TokenizeWindowsCommandLine); - ECtx.setVFS(&FS).setCurrentDir(TestRoot).setMarkEOLs(true).setRelativeNames( - true); - ASSERT_TRUE(ECtx.expandResponseFiles(Argv)); + StringSaver Saver(A); + ASSERT_TRUE(cl::ExpandResponseFiles(Saver, cl::TokenizeWindowsCommandLine, + Argv, true, true, false, + /*CurrentDir=*/StringRef(TestRoot), FS)); const char *Expected[] = {"clang", "-Xclang", "-Wno-whatever", nullptr, "input.cpp"}; ASSERT_EQ(std::size(Expected), Argv.size()); @@ -1121,8 +1125,9 @@ TEST(CommandLineTest, ReadConfigFile) { EXPECT_NE(CurrDir.str(), TestDir.path()); llvm::BumpPtrAllocator A; - llvm::cl::ExpansionContext ECtx(A, cl::tokenizeConfigFile); - bool Result = ECtx.readConfigFile(ConfigFile.path(), Argv); + llvm::StringSaver Saver(A); + bool Result = llvm::cl::readConfigFile(ConfigFile.path(), Saver, Argv, + *llvm::vfs::getRealFileSystem()); EXPECT_TRUE(Result); EXPECT_EQ(Argv.size(), 13U); |