mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-16 10:56:21 +00:00

To avoid using the AST when emitting diagnostics, split the "dontcall" attribute into "dontcall-warn" and "dontcall-error", and also add the frontend attribute value as the LLVM attribute value. This gives us all the information to report diagnostics we need from within the IR (aside from access to the original source). One downside is we directly use LLVM's demangler rather than using the existing Clang diagnostic pretty printing of symbols. Reviewed By: nickdesaulniers Differential Revision: https://reviews.llvm.org/D110364
23 lines
447 B
C
23 lines
447 B
C
// RUN: %clang_cc1 -O2 -verify -emit-codegen-only %s
|
|
|
|
__attribute__((error("oh no foo"))) void foo(void);
|
|
|
|
__attribute__((error("oh no bar"))) void bar(void);
|
|
|
|
int x(void) {
|
|
return 8 % 2 == 1;
|
|
}
|
|
void baz(void) {
|
|
foo(); // expected-error {{call to foo declared with 'error' attribute: oh no foo}}
|
|
if (x())
|
|
bar();
|
|
}
|
|
|
|
// FIXME: indirect call detection not yet supported.
|
|
void (*quux)(void);
|
|
|
|
void indirect(void) {
|
|
quux = foo;
|
|
quux();
|
|
}
|