[PATCH] D34936: [clangd] Add -ffreestanding on VFS tests.
Phabricator via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 3 07:46:22 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL307025: [clangd] Add -ffreestanding on VFS tests. (authored by ibiryukov).
Repository:
rL LLVM
https://reviews.llvm.org/D34936
Files:
clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
Index: clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
===================================================================
--- clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
@@ -164,6 +164,13 @@
class MockCompilationDatabase : public GlobalCompilationDatabase {
public:
+ MockCompilationDatabase(bool AddFreestandingFlag) {
+ // We have to add -ffreestanding to VFS-specific tests to avoid errors on
+ // implicit includes of stdc-predef.h.
+ if (AddFreestandingFlag)
+ ExtraClangFlags.push_back("-ffreestanding");
+ }
+
std::vector<tooling::CompileCommand>
getCompileCommands(PathRef File) override {
if (ExtraClangFlags.empty())
@@ -259,7 +266,7 @@
bool ExpectErrors = false) {
MockFSProvider FS;
ErrorCheckingDiagConsumer DiagConsumer;
- MockCompilationDatabase CDB;
+ MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
ClangdServer Server(CDB, DiagConsumer, FS,
/*RunSynchronously=*/false);
for (const auto &FileWithContents : ExtraFiles)
@@ -315,7 +322,7 @@
TEST_F(ClangdVFSTest, Reparse) {
MockFSProvider FS;
ErrorCheckingDiagConsumer DiagConsumer;
- MockCompilationDatabase CDB;
+ MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
ClangdServer Server(CDB, DiagConsumer, FS,
/*RunSynchronously=*/false);
@@ -350,7 +357,7 @@
TEST_F(ClangdVFSTest, ReparseOnHeaderChange) {
MockFSProvider FS;
ErrorCheckingDiagConsumer DiagConsumer;
- MockCompilationDatabase CDB;
+ MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
ClangdServer Server(CDB, DiagConsumer, FS,
/*RunSynchronously=*/false);
@@ -388,7 +395,7 @@
TEST_F(ClangdVFSTest, CheckVersions) {
MockFSProvider FS;
ErrorCheckingDiagConsumer DiagConsumer;
- MockCompilationDatabase CDB;
+ MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
ClangdServer Server(CDB, DiagConsumer, FS,
/*RunSynchronously=*/true);
@@ -414,8 +421,10 @@
// Checks that searches for GCC installation is done through vfs.
MockFSProvider FS;
ErrorCheckingDiagConsumer DiagConsumer;
- MockCompilationDatabase CDB;
- CDB.ExtraClangFlags = {"-xc++", "-target", "x86_64-linux-unknown", "-m64"};
+ MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
+ CDB.ExtraClangFlags.insert(
+ CDB.ExtraClangFlags.end(),
+ {"-xc++", "-target", "x86_64-linux-unknown", "-m64"});
ClangdServer Server(CDB, DiagConsumer, FS,
/*RunSynchronously=*/true);
@@ -472,7 +481,7 @@
TEST_F(ClangdCompletionTest, CheckContentsOverride) {
MockFSProvider FS;
ErrorCheckingDiagConsumer DiagConsumer;
- MockCompilationDatabase CDB;
+ MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
ClangdServer Server(CDB, DiagConsumer, FS,
/*RunSynchronously=*/false);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34936.105073.patch
Type: text/x-patch
Size: 2966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170703/1b666833/attachment.bin>
More information about the cfe-commits
mailing list