Index: clang-query/tool/ClangQuery.cpp =================================================================== --- clang-query/tool/ClangQuery.cpp +++ clang-query/tool/ClangQuery.cpp @@ -100,8 +100,7 @@ ClangTool Tool(OptionsParser.getCompilations(), OptionsParser.getSourcePathList()); std::vector> ASTs; - if (Tool.buildASTs(ASTs) != 0) - return 1; + Tool.buildASTs(ASTs); QuerySession QS(ASTs); Index: test/clang-query/Inputs/database_template.json =================================================================== --- /dev/null +++ test/clang-query/Inputs/database_template.json @@ -0,0 +1,12 @@ +[ +{ + "directory": "test_dir/build", + "command": "clang -DAVAL=8 -o a.o test_dir/src/a.c", + "file": "test_dir/src/a.c" +}, +{ + "directory": "test_dir/build", + "command": "clang -o b.o test_dir/src/b.c", + "file": "test_dir/src/b.c" +} +] Index: test/clang-query/database-missing-entry.c =================================================================== --- /dev/null +++ test/clang-query/database-missing-entry.c @@ -0,0 +1,12 @@ +// RUN: rm -rf %t && mkdir -p %t/src %t/build +// RUN: sed 's|test_dir|%t|g' %S/Inputs/database_template.json > %t/build/compile_commands.json +// RUN: echo 'int A = AVAL;' > %t/src/a.c +// RUN: echo 'deliberate parsing error' > %t/src/b.c +// RUN: clang-query -p=%t/build -c "m integerLiteral()" %t/src/a.c %t/src/b.c %t/src/missing.c 2>&1 | FileCheck %s + +// Test that neither parse errors nor missing database entries prevent further processing. +// CHECK: deliberate parsing error +// CHECK: Skipping {{.*[/\\]}}missing.c. Compile command not found. +// CHECK-NOT-EXIST: Error while processing {{.*[/\\]}}missing.c. +// CHECK-NOT-EXIST: unable to handle compilation +// CHECK: a.c:1:9: note: "root" binds here