forked from OSchip/llvm-project
parent
9aad25f193
commit
93cd99173f
|
@ -121,7 +121,7 @@ protected:
|
|||
bool ExpectErrors = false) {
|
||||
MockFSProvider FS;
|
||||
ErrorCheckingDiagConsumer DiagConsumer;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
ClangdServer Server(CDB, DiagConsumer, FS, getDefaultAsyncThreadsCount(),
|
||||
/*StorePreamblesInMemory=*/true,
|
||||
clangd::CodeCompleteOptions(),
|
||||
|
@ -186,7 +186,7 @@ int b = a;
|
|||
TEST_F(ClangdVFSTest, Reparse) {
|
||||
MockFSProvider FS;
|
||||
ErrorCheckingDiagConsumer DiagConsumer;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
ClangdServer Server(CDB, DiagConsumer, FS, getDefaultAsyncThreadsCount(),
|
||||
/*StorePreamblesInMemory=*/true,
|
||||
clangd::CodeCompleteOptions(),
|
||||
|
@ -232,7 +232,7 @@ int b = a;
|
|||
TEST_F(ClangdVFSTest, ReparseOnHeaderChange) {
|
||||
MockFSProvider FS;
|
||||
ErrorCheckingDiagConsumer DiagConsumer;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
|
||||
ClangdServer Server(CDB, DiagConsumer, FS, getDefaultAsyncThreadsCount(),
|
||||
/*StorePreamblesInMemory=*/true,
|
||||
|
@ -281,7 +281,7 @@ int b = a;
|
|||
TEST_F(ClangdVFSTest, CheckVersions) {
|
||||
MockFSProvider FS;
|
||||
ErrorCheckingDiagConsumer DiagConsumer;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
// Run ClangdServer synchronously.
|
||||
ClangdServer Server(CDB, DiagConsumer, FS,
|
||||
/*AsyncThreadsCount=*/0,
|
||||
|
@ -313,7 +313,7 @@ TEST_F(ClangdVFSTest, SearchLibDir) {
|
|||
// Checks that searches for GCC installation is done through vfs.
|
||||
MockFSProvider FS;
|
||||
ErrorCheckingDiagConsumer DiagConsumer;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
CDB.ExtraClangFlags.insert(CDB.ExtraClangFlags.end(),
|
||||
{"-xc++", "-target", "x86_64-linux-unknown",
|
||||
"-m64", "--gcc-toolchain=/randomusr",
|
||||
|
@ -369,7 +369,7 @@ std::string x;
|
|||
TEST_F(ClangdVFSTest, ForceReparseCompileCommand) {
|
||||
MockFSProvider FS;
|
||||
ErrorCheckingDiagConsumer DiagConsumer;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
ClangdServer Server(CDB, DiagConsumer, FS,
|
||||
/*AsyncThreadsCount=*/0,
|
||||
/*StorePreamblesInMemory=*/true,
|
||||
|
@ -512,7 +512,7 @@ int d;
|
|||
|
||||
TestDiagConsumer DiagConsumer;
|
||||
{
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
ClangdServer Server(CDB, DiagConsumer, FS, getDefaultAsyncThreadsCount(),
|
||||
/*StorePreamblesInMemory=*/true,
|
||||
clangd::CodeCompleteOptions(),
|
||||
|
@ -672,7 +672,7 @@ int d;
|
|||
TEST_F(ClangdVFSTest, CheckSourceHeaderSwitch) {
|
||||
MockFSProvider FS;
|
||||
ErrorCheckingDiagConsumer DiagConsumer;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
|
||||
ClangdServer Server(CDB, DiagConsumer, FS, getDefaultAsyncThreadsCount(),
|
||||
/*StorePreamblesInMemory=*/true,
|
||||
|
@ -801,7 +801,7 @@ int d;
|
|||
NoConcurrentAccessDiagConsumer DiagConsumer(
|
||||
std::move(StartSecondReparsePromise));
|
||||
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
ClangdServer Server(CDB, DiagConsumer, FS, 4, /*StorePreamblesInMemory=*/true,
|
||||
clangd::CodeCompleteOptions(),
|
||||
EmptyLogger::getInstance());
|
||||
|
|
|
@ -71,7 +71,7 @@ protected:
|
|||
TEST_F(ClangdCompletionTest, CheckContentsOverride) {
|
||||
MockFSProvider FS;
|
||||
IgnoreDiagnostics DiagConsumer;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
|
||||
ClangdServer Server(CDB, DiagConsumer, FS, getDefaultAsyncThreadsCount(),
|
||||
/*StorePreamblesInMemory=*/true,
|
||||
|
@ -129,7 +129,7 @@ int b = ;
|
|||
|
||||
TEST_F(ClangdCompletionTest, Limit) {
|
||||
MockFSProvider FS;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
CDB.ExtraClangFlags.push_back("-xc++");
|
||||
IgnoreDiagnostics DiagConsumer;
|
||||
clangd::CodeCompleteOptions Opts;
|
||||
|
@ -168,7 +168,7 @@ int main() { ClassWithMembers().{complete} }
|
|||
|
||||
TEST_F(ClangdCompletionTest, Filter) {
|
||||
MockFSProvider FS;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
CDB.ExtraClangFlags.push_back("-xc++");
|
||||
IgnoreDiagnostics DiagConsumer;
|
||||
clangd::CodeCompleteOptions Opts;
|
||||
|
@ -224,7 +224,7 @@ TEST_F(ClangdCompletionTest, Filter) {
|
|||
TEST_F(ClangdCompletionTest, CompletionOptions) {
|
||||
MockFSProvider FS;
|
||||
IgnoreDiagnostics DiagConsumer;
|
||||
MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
|
||||
MockCompilationDatabase CDB;
|
||||
CDB.ExtraClangFlags.push_back("-xc++");
|
||||
|
||||
auto FooCpp = getVirtualTestFilePath("foo.cpp");
|
||||
|
|
|
@ -143,6 +143,9 @@ MockFSProvider::getTaggedFileSystem(PathRef File) {
|
|||
return make_tagged(FS, Tag);
|
||||
}
|
||||
|
||||
MockCompilationDatabase::MockCompilationDatabase()
|
||||
: ExtraClangFlags({"-ffreestanding"}) {} // Avoid implicit stdc-predef.h.
|
||||
|
||||
llvm::Optional<tooling::CompileCommand>
|
||||
MockCompilationDatabase::getCompileCommand(PathRef File) const {
|
||||
if (ExtraClangFlags.empty())
|
||||
|
|
|
@ -37,12 +37,7 @@ public:
|
|||
// A Compilation database that returns a fixed set of compile flags.
|
||||
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");
|
||||
}
|
||||
MockCompilationDatabase();
|
||||
|
||||
llvm::Optional<tooling::CompileCommand>
|
||||
getCompileCommand(PathRef File) const override;
|
||||
|
|
Loading…
Reference in New Issue