diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-10-10 13:27:25 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-10-10 13:27:25 +0000 |
commit | fc51490baf1d6ad5796d8cb8bb0792de13ce8fce (patch) | |
tree | bae0cfa9002258ffad07524d654245ed3b918cb1 /clang/unittests/Driver | |
parent | c616a7236c83994cacdbc13e37269bbc9598093d (diff) | |
download | bcm5719-llvm-fc51490baf1d6ad5796d8cb8bb0792de13ce8fce.tar.gz bcm5719-llvm-fc51490baf1d6ad5796d8cb8bb0792de13ce8fce.zip |
Lift VFS from clang to llvm (NFC)
This patch moves the virtual file system form clang to llvm so it can be
used by more projects.
Concretely the patch:
- Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support.
- Moves the corresponding unit test from clang to llvm.
- Moves the vfs namespace from clang::vfs to llvm::vfs.
- Formats the lines affected by this change, mostly this is the result of
the added llvm namespace.
RFC on the mailing list:
http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html
Differential revision: https://reviews.llvm.org/D52783
llvm-svn: 344140
Diffstat (limited to 'clang/unittests/Driver')
-rw-r--r-- | clang/unittests/Driver/DistroTest.cpp | 24 | ||||
-rw-r--r-- | clang/unittests/Driver/ToolChainTest.cpp | 14 |
2 files changed, 19 insertions, 19 deletions
diff --git a/clang/unittests/Driver/DistroTest.cpp b/clang/unittests/Driver/DistroTest.cpp index e3686e49806..5a23392e8cd 100644 --- a/clang/unittests/Driver/DistroTest.cpp +++ b/clang/unittests/Driver/DistroTest.cpp @@ -12,7 +12,7 @@ //===----------------------------------------------------------------------===// #include "clang/Driver/Distro.h" -#include "clang/Basic/VirtualFileSystem.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/raw_ostream.h" #include "gtest/gtest.h" using namespace clang; @@ -25,7 +25,7 @@ namespace { // accidentally result in incorrect distribution guess. TEST(DistroTest, DetectUbuntu) { - vfs::InMemoryFileSystem UbuntuTrustyFileSystem; + llvm::vfs::InMemoryFileSystem UbuntuTrustyFileSystem; // Ubuntu uses Debian Sid version. UbuntuTrustyFileSystem.addFile("/etc/debian_version", 0, llvm::MemoryBuffer::getMemBuffer("jessie/sid\n")); @@ -52,7 +52,7 @@ TEST(DistroTest, DetectUbuntu) { ASSERT_FALSE(UbuntuTrusty.IsOpenSUSE()); ASSERT_FALSE(UbuntuTrusty.IsDebian()); - vfs::InMemoryFileSystem UbuntuYakketyFileSystem; + llvm::vfs::InMemoryFileSystem UbuntuYakketyFileSystem; UbuntuYakketyFileSystem.addFile("/etc/debian_version", 0, llvm::MemoryBuffer::getMemBuffer("stretch/sid\n")); UbuntuYakketyFileSystem.addFile("/etc/lsb-release", 0, @@ -83,7 +83,7 @@ TEST(DistroTest, DetectUbuntu) { } TEST(DistroTest, DetectRedhat) { - vfs::InMemoryFileSystem Fedora25FileSystem; + llvm::vfs::InMemoryFileSystem Fedora25FileSystem; Fedora25FileSystem.addFile("/etc/system-release-cpe", 0, llvm::MemoryBuffer::getMemBuffer("cpe:/o:fedoraproject:fedora:25\n")); // Both files are symlinks to fedora-release. @@ -115,7 +115,7 @@ TEST(DistroTest, DetectRedhat) { ASSERT_FALSE(Fedora25.IsOpenSUSE()); ASSERT_FALSE(Fedora25.IsDebian()); - vfs::InMemoryFileSystem CentOS7FileSystem; + llvm::vfs::InMemoryFileSystem CentOS7FileSystem; CentOS7FileSystem.addFile("/etc/system-release-cpe", 0, llvm::MemoryBuffer::getMemBuffer("cpe:/o:centos:centos:7\n")); // Both files are symlinks to centos-release. @@ -153,7 +153,7 @@ TEST(DistroTest, DetectRedhat) { } TEST(DistroTest, DetectOpenSUSE) { - vfs::InMemoryFileSystem OpenSUSELeap421FileSystem; + llvm::vfs::InMemoryFileSystem OpenSUSELeap421FileSystem; OpenSUSELeap421FileSystem.addFile("/etc/SuSE-release", 0, llvm::MemoryBuffer::getMemBuffer("openSUSE 42.1 (x86_64)\n" "VERSION = 42.1\n" @@ -178,7 +178,7 @@ TEST(DistroTest, DetectOpenSUSE) { ASSERT_TRUE(OpenSUSELeap421.IsOpenSUSE()); ASSERT_FALSE(OpenSUSELeap421.IsDebian()); - vfs::InMemoryFileSystem OpenSUSE132FileSystem; + llvm::vfs::InMemoryFileSystem OpenSUSE132FileSystem; OpenSUSE132FileSystem.addFile("/etc/SuSE-release", 0, llvm::MemoryBuffer::getMemBuffer("openSUSE 13.2 (x86_64)\n" "VERSION = 13.2\n" @@ -203,7 +203,7 @@ TEST(DistroTest, DetectOpenSUSE) { ASSERT_TRUE(OpenSUSE132.IsOpenSUSE()); ASSERT_FALSE(OpenSUSE132.IsDebian()); - vfs::InMemoryFileSystem SLES10FileSystem; + llvm::vfs::InMemoryFileSystem SLES10FileSystem; SLES10FileSystem.addFile("/etc/SuSE-release", 0, llvm::MemoryBuffer::getMemBuffer("SUSE Linux Enterprise Server 10 (x86_64)\n" "VERSION = 10\n" @@ -221,7 +221,7 @@ TEST(DistroTest, DetectOpenSUSE) { } TEST(DistroTest, DetectDebian) { - vfs::InMemoryFileSystem DebianJessieFileSystem; + llvm::vfs::InMemoryFileSystem DebianJessieFileSystem; DebianJessieFileSystem.addFile("/etc/debian_version", 0, llvm::MemoryBuffer::getMemBuffer("8.6\n")); DebianJessieFileSystem.addFile("/etc/os-release", 0, @@ -241,7 +241,7 @@ TEST(DistroTest, DetectDebian) { ASSERT_FALSE(DebianJessie.IsOpenSUSE()); ASSERT_TRUE(DebianJessie.IsDebian()); - vfs::InMemoryFileSystem DebianStretchSidFileSystem; + llvm::vfs::InMemoryFileSystem DebianStretchSidFileSystem; DebianStretchSidFileSystem.addFile("/etc/debian_version", 0, llvm::MemoryBuffer::getMemBuffer("stretch/sid\n")); DebianStretchSidFileSystem.addFile("/etc/os-release", 0, @@ -261,7 +261,7 @@ TEST(DistroTest, DetectDebian) { } TEST(DistroTest, DetectExherbo) { - vfs::InMemoryFileSystem ExherboFileSystem; + llvm::vfs::InMemoryFileSystem ExherboFileSystem; ExherboFileSystem.addFile("/etc/exherbo-release", 0, // (ASCII art) llvm::MemoryBuffer::getMemBuffer("")); ExherboFileSystem.addFile("/etc/os-release", 0, @@ -282,7 +282,7 @@ TEST(DistroTest, DetectExherbo) { } TEST(DistroTest, DetectArchLinux) { - vfs::InMemoryFileSystem ArchLinuxFileSystem; + llvm::vfs::InMemoryFileSystem ArchLinuxFileSystem; ArchLinuxFileSystem.addFile("/etc/arch-release", 0, // (empty) llvm::MemoryBuffer::getMemBuffer("")); ArchLinuxFileSystem.addFile("/etc/os-release", 0, diff --git a/clang/unittests/Driver/ToolChainTest.cpp b/clang/unittests/Driver/ToolChainTest.cpp index 0d4c545bd79..f1181072a7e 100644 --- a/clang/unittests/Driver/ToolChainTest.cpp +++ b/clang/unittests/Driver/ToolChainTest.cpp @@ -15,11 +15,11 @@ #include "clang/Basic/DiagnosticIDs.h" #include "clang/Basic/DiagnosticOptions.h" #include "clang/Basic/LLVM.h" -#include "clang/Basic/VirtualFileSystem.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Driver.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/Support/raw_ostream.h" #include "gtest/gtest.h" using namespace clang; @@ -33,8 +33,8 @@ TEST(ToolChainTest, VFSGCCInstallation) { IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); struct TestDiagnosticConsumer : public DiagnosticConsumer {}; DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer); - IntrusiveRefCntPtr<vfs::InMemoryFileSystem> InMemoryFileSystem( - new vfs::InMemoryFileSystem); + IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem( + new llvm::vfs::InMemoryFileSystem); Driver TheDriver("/bin/clang", "arm-linux-gnueabihf", Diags, InMemoryFileSystem); @@ -87,8 +87,8 @@ TEST(ToolChainTest, VFSGCCInstallationRelativeDir) { IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); struct TestDiagnosticConsumer : public DiagnosticConsumer {}; DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer); - IntrusiveRefCntPtr<vfs::InMemoryFileSystem> InMemoryFileSystem( - new vfs::InMemoryFileSystem); + IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem( + new llvm::vfs::InMemoryFileSystem); Driver TheDriver("/home/test/bin/clang", "arm-linux-gnueabi", Diags, InMemoryFileSystem); @@ -127,8 +127,8 @@ TEST(ToolChainTest, DefaultDriverMode) { IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs()); struct TestDiagnosticConsumer : public DiagnosticConsumer {}; DiagnosticsEngine Diags(DiagID, &*DiagOpts, new TestDiagnosticConsumer); - IntrusiveRefCntPtr<vfs::InMemoryFileSystem> InMemoryFileSystem( - new vfs::InMemoryFileSystem); + IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem( + new llvm::vfs::InMemoryFileSystem); Driver CCDriver("/home/test/bin/clang", "arm-linux-gnueabi", Diags, InMemoryFileSystem); |