Skip to content

Commit d8f6a6a

Browse files
authored
[LIBCLC] Use default compilation DB for ClangTool run (#9974)
Since 94f7c96 landed the `-fno-lifetime-dse` option is added to the compilation database, if using non-llvm based toolchains, this option is not compatible with clang and as tools invocation in libclc does not relay on the content of the DB, use the default, empty one. Also fix deprecated `makeArrayRef` warning. cc: [abagusetty](https://github.com/abagusetty)
1 parent 83555cd commit d8f6a6a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libclc/utils/libclc-remangler/LibclcRemangler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,7 @@ class Remangler {
449449
auto *FTD = FunctionTemplateDecl::Create(*AST, FD->getDeclContext(),
450450
SourceLocation(),
451451
DeclarationName(), TPL, FD);
452-
auto TAArr =
453-
makeArrayRef(TemplateArguments.begin(), TemplateArguments.size());
452+
auto TAArr = ArrayRef(TemplateArguments.begin(), TemplateArguments.size());
454453
auto *TAL = TemplateArgumentList::CreateCopy(*AST, TAArr);
455454
FDSpecialization->setTemplateParameterListsInfo(*AST, TPL);
456455
FDSpecialization->setFunctionTemplateSpecialization(
@@ -962,9 +961,10 @@ int main(int argc, const char **argv) {
962961
return 1;
963962
}
964963

965-
CommonOptionsParser &OptionsParser = ExpectedParser.get();
966-
ClangTool Tool(OptionsParser.getCompilations(),
967-
OptionsParser.getSourcePathList());
964+
// Use a default Compilation DB instead of the build one, as it might contain
965+
// toolchain specific options, not compatible with clang.
966+
FixedCompilationDatabase Compilations("/", std::vector<std::string>());
967+
ClangTool Tool(Compilations, ExpectedParser->getSourcePathList());
968968

969969
LibCLCRemanglerActionFactory LRAF{};
970970
std::unique_ptr<FrontendActionFactory> FrontendFactory;

0 commit comments

Comments
 (0)