diff options
author | yronglin <yronglin777@gmail.com> | 2024-04-25 19:05:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-25 19:05:46 +0800 |
commit | 03b1a0c2a72dd24943642ef15e6c046d982643c2 (patch) | |
tree | 53177d4b3b8eed9344ac011bbd570e01d9bfc0a4 /clang/lib/Frontend/FrontendAction.cpp | |
parent | 2c5d7a888589a608a4cd6adc34f19a65dc4551af (diff) | |
download | llvm-03b1a0c2a72dd24943642ef15e6c046d982643c2.zip llvm-03b1a0c2a72dd24943642ef15e6c046d982643c2.tar.gz llvm-03b1a0c2a72dd24943642ef15e6c046d982643c2.tar.bz2 |
[Clang] Diagnose apply AST consume actions on LLVM IR (#88602)
Fixes https://github.com/llvm/llvm-project/issues/88522
This PR introduce a new diagnostic to report apply AST consume actions
on LLVM IR.
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index a2af738..9ae7664 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -757,8 +757,11 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, // IR files bypass the rest of initialization. if (Input.getKind().getLanguage() == Language::LLVM_IR) { - assert(hasIRSupport() && - "This action does not have IR file support!"); + if (!hasIRSupport()) { + CI.getDiagnostics().Report(diag::err_ast_action_on_llvm_ir) + << Input.getFile(); + return false; + } // Inform the diagnostic client we are processing a source file. CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), nullptr); |