diff options
| author | 2019-01-27 16:42:12 +0000 | |
|---|---|---|
| committer | 2019-01-27 16:42:12 +0000 | |
| commit | b773203fb58f3ef282fb69c832d8710cab5bc82d (patch) | |
| tree | e75913f147570fbd75169647b144df85b88a038c /gnu/llvm/tools/clang/unittests/Tooling/ToolingTest.cpp | |
| parent | tweak errno in previous (diff) | |
| download | wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip | |
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/tools/clang/unittests/Tooling/ToolingTest.cpp')
| -rw-r--r-- | gnu/llvm/tools/clang/unittests/Tooling/ToolingTest.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/gnu/llvm/tools/clang/unittests/Tooling/ToolingTest.cpp b/gnu/llvm/tools/clang/unittests/Tooling/ToolingTest.cpp index 891907a4d08..0a5150a31b7 100644 --- a/gnu/llvm/tools/clang/unittests/Tooling/ToolingTest.cpp +++ b/gnu/llvm/tools/clang/unittests/Tooling/ToolingTest.cpp @@ -17,7 +17,6 @@ #include "clang/Tooling/CompilationDatabase.h" #include "clang/Tooling/Tooling.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/Config/llvm-config.h" #include "llvm/Support/Path.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" @@ -216,7 +215,7 @@ struct VerifyEndCallback : public SourceFileCallbacks { bool Matched; }; -#if !defined(LLVM_ON_WIN32) +#if !defined(_WIN32) TEST(newFrontendActionFactory, InjectsSourceFileCallbacks) { VerifyEndCallback EndCallback; @@ -319,8 +318,8 @@ TEST(runToolOnCode, TestSkipFunctionBody) { TEST(runToolOnCodeWithArgs, TestNoDepFile) { llvm::SmallString<32> DepFilePath; - ASSERT_FALSE( - llvm::sys::fs::createTemporaryFile("depfile", "d", DepFilePath)); + ASSERT_FALSE(llvm::sys::fs::getPotentiallyUniqueTempFileName("depfile", "d", + DepFilePath)); std::vector<std::string> Args; Args.push_back("-MMD"); Args.push_back("-MT"); @@ -402,6 +401,24 @@ TEST(ClangToolTest, ArgumentAdjusters) { EXPECT_FALSE(Found); } +TEST(ClangToolTest, BaseVirtualFileSystemUsage) { + FixedCompilationDatabase Compilations("/", std::vector<std::string>()); + llvm::IntrusiveRefCntPtr<vfs::OverlayFileSystem> OverlayFileSystem( + new vfs::OverlayFileSystem(vfs::getRealFileSystem())); + llvm::IntrusiveRefCntPtr<vfs::InMemoryFileSystem> InMemoryFileSystem( + new vfs::InMemoryFileSystem); + OverlayFileSystem->pushOverlay(InMemoryFileSystem); + + InMemoryFileSystem->addFile( + "a.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int main() {}")); + + ClangTool Tool(Compilations, std::vector<std::string>(1, "a.cpp"), + std::make_shared<PCHContainerOperations>(), OverlayFileSystem); + std::unique_ptr<FrontendActionFactory> Action( + newFrontendActionFactory<SyntaxOnlyAction>()); + EXPECT_EQ(0, Tool.run(Action.get())); +} + // Check getClangStripDependencyFileAdjuster doesn't strip args after -MD/-MMD. TEST(ClangToolTest, StripDependencyFileAdjuster) { FixedCompilationDatabase Compilations("/", {"-MD", "-c", "-MMD", "-w"}); @@ -513,7 +530,7 @@ TEST(addTargetAndModeForProgramName, IgnoresExistingMode) { ArgsAlt); } -#ifndef LLVM_ON_WIN32 +#ifndef _WIN32 TEST(ClangToolTest, BuildASTs) { FixedCompilationDatabase Compilations("/", std::vector<std::string>()); |
