forked from qt-creator/qt-creator
Clang: Extend ClangTool and CommandLineBuilder
We now support source file and not only header files and the file path is now automatically added to the end. This removes quite some clutter. Change-Id: I74eabd262e6c7e5f4d523e3a3cd194bd3efe1ef3 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
committed by
Marco Bubke
parent
d6a6d356bb
commit
7fe65851d9
@@ -96,7 +96,7 @@ TEST_F(ClangQuerySlowTest, SourceRangeInUnsavedFileDeclarationRange)
|
||||
::ClangQuery query(filePathCache);
|
||||
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
|
||||
"#include \"unsaved.h\"",
|
||||
{"cc", toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(), "-std=c++14"});
|
||||
{"cc", "-std=c++14"});
|
||||
query.setQuery("functionDecl()");
|
||||
ClangBackEnd::V2::FileContainer unsavedFile{{TESTDATA_DIR, "unsaved.h"}, "void unsaved();", {}};
|
||||
query.addUnsavedFiles({unsavedFile});
|
||||
@@ -110,9 +110,7 @@ TEST_F(ClangQuerySlowTest, SourceRangeInUnsavedFileDeclarationRange)
|
||||
TEST_F(ClangQuerySlowTest, FileIsNotExistingButTheUnsavedDataIsParsed)
|
||||
{
|
||||
::ClangQuery query(filePathCache);
|
||||
query.addFile({TESTDATA_DIR "/foo.cpp"},
|
||||
"void f() {}",
|
||||
{"cc", toNativePath(TESTDATA_DIR "/foo.cpp").path(), "-std=c++14"});
|
||||
query.addFile({TESTDATA_DIR "/foo.cpp"}, "void f() {}", {"cc", "-std=c++14"});
|
||||
query.setQuery("functionDecl()");
|
||||
|
||||
query.findLocations();
|
||||
@@ -124,9 +122,7 @@ TEST_F(ClangQuerySlowTest, FileIsNotExistingButTheUnsavedDataIsParsed)
|
||||
TEST_F(ClangQuerySlowTest, DISABLED_SourceRangeInUnsavedFileDeclarationRangeOverride) // seems not to work in Clang
|
||||
{
|
||||
::ClangQuery query(filePathCache);
|
||||
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
|
||||
"void f() {}",
|
||||
{"cc", toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(), "-std=c++14"});
|
||||
query.addFile({TESTDATA_DIR "/query_simplefunction.cpp"}, "void f() {}", {"cc", "-std=c++14"});
|
||||
query.setQuery("functionDecl()");
|
||||
ClangBackEnd::V2::FileContainer unsavedFile{{TESTDATA_DIR "/query_simplefunction.cpp"},
|
||||
"void unsaved();",
|
||||
@@ -226,12 +222,10 @@ void ClangQuery::SetUp()
|
||||
simpleFunctionQuery.addFile({TESTDATA_DIR "/query_simplefunction.cpp"},
|
||||
"",
|
||||
{"cc",
|
||||
toNativePath(TESTDATA_DIR "/query_simplefunction.cpp").path(),
|
||||
"-std=c++14"});
|
||||
simpleClassQuery.addFile({TESTDATA_DIR "/query_simpleclass.cpp"},
|
||||
"",
|
||||
{"cc",
|
||||
toNativePath(TESTDATA_DIR "/query_simpleclass.cpp").path(),
|
||||
"-std=c++14"});
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user