diff options
Diffstat (limited to 'clang/unittests/Frontend/CodeGenActionTest.cpp')
-rw-r--r-- | clang/unittests/Frontend/CodeGenActionTest.cpp | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/clang/unittests/Frontend/CodeGenActionTest.cpp b/clang/unittests/Frontend/CodeGenActionTest.cpp index 90818b7..b2792c4 100644 --- a/clang/unittests/Frontend/CodeGenActionTest.cpp +++ b/clang/unittests/Frontend/CodeGenActionTest.cpp @@ -76,40 +76,4 @@ TEST(CodeGenTest, CodeGenFromIRMemBuffer) { bool Success = Compiler.ExecuteAction(Action); EXPECT_TRUE(Success); } - -TEST(CodeGenTest, DebugInfoCWDCodeGen) { - // Check that debug info is accessing the current working directory from the - // VFS instead of calling \p llvm::sys::fs::current_path() directly. - - auto Sept = llvm::sys::path::get_separator(); - auto VFS = std::make_unique<llvm::vfs::InMemoryFileSystem>(); - VFS->setCurrentWorkingDirectory( - std::string(llvm::formatv("{0}in-memory-fs-cwd", Sept))); - std::string TestPath = - std::string(llvm::formatv("{0}in-memory-fs-cwd{0}test.cpp", Sept)); - VFS->addFile(TestPath, 0, llvm::MemoryBuffer::getMemBuffer("int x;\n")); - - auto Invocation = std::make_shared<CompilerInvocation>(); - Invocation->getFrontendOpts().Inputs.push_back( - FrontendInputFile("test.cpp", Language::CXX)); - Invocation->getFrontendOpts().ProgramAction = EmitLLVM; - Invocation->getTargetOpts().Triple = "x86_64-unknown-linux-gnu"; - Invocation->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); - CompilerInstance Compiler(std::move(Invocation)); - - SmallString<256> IRBuffer; - Compiler.setOutputStream(std::make_unique<raw_svector_ostream>(IRBuffer)); - Compiler.createDiagnostics(*VFS); - Compiler.createFileManager(std::move(VFS)); - - EmitLLVMAction Action; - bool Success = Compiler.ExecuteAction(Action); - EXPECT_TRUE(Success); - - SmallString<128> RealCWD; - llvm::sys::fs::current_path(RealCWD); - EXPECT_TRUE(!RealCWD.empty()); - EXPECT_FALSE(IRBuffer.str().contains(RealCWD)); - EXPECT_TRUE(IRBuffer.str().contains("in-memory-fs-cwd")); -} } |