Skip to content

[libclc] Several little QOL improvements to libclc-remangler #13073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions libclc/utils/libclc-remangler/LibclcRemangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,12 +777,17 @@ class LibCLCRemangler : public ASTConsumer {

void Initialize(ASTContext &C) override {
ASTCtx = &C;
SMDiagnostic Err;
std::unique_ptr<MemoryBuffer> const Buff = ExitOnErr(
errorOrToExpected(MemoryBuffer::getFileOrSTDIN(InputIRFilename)));

SMDiagnostic Err;
std::unique_ptr<llvm::Module> const M =
ExitOnErr(Expected<std::unique_ptr<llvm::Module>>(
parseIR(Buff.get()->getMemBufferRef(), Err, LLVMCtx)));
parseIR(Buff.get()->getMemBufferRef(), Err, LLVMCtx);

if (!M) {
Err.print("libclc-remangler", errs());
exit(1);
}

handleModule(M.get());
}
Expand Down Expand Up @@ -840,7 +845,7 @@ class LibCLCRemangler : public ASTConsumer {
}

bool remangleFunction(Function &Func, llvm::Module *M) {
if (!Func.getName().startswith("_Z"))
if (!Func.getName().starts_with("_Z"))
return true;

std::string const MangledName = Func.getName().str();
Expand Down Expand Up @@ -958,7 +963,7 @@ int main(int argc, const char **argv) {

// Use a default Compilation DB instead of the build one, as it might contain
// toolchain specific options, not compatible with clang.
FixedCompilationDatabase Compilations("/", std::vector<std::string>());
FixedCompilationDatabase Compilations(".", std::vector<std::string>());
ClangTool Tool(Compilations, ExpectedParser->getSourcePathList());

LibCLCRemanglerActionFactory LRAF{};
Expand Down