[PATCH] D97764: [clang][patch] To solve PR26413, x86 interrupt routines may only call routines with no_saved_reg
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 2 05:42:55 PST 2021
aaron.ballman added inline comments.
================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:297-298
+def err_anyx86_interrupt_regsave : Error<
+ "interrupt service routine may only call routine"
+ " with attribute no_caller_saved_registers">;
def warn_arm_interrupt_calling_convention : Warning<
----------------
The diagnostic wording needs a bit more updating though, see below.
================
Comment at: clang/lib/Sema/SemaExpr.cpp:6566
+ ((!FDecl || !FDecl->hasAttr<AnyX86NoCallerSavedRegistersAttr>()))) {
+ Diag(Fn->getExprLoc(), diag::err_anyx86_interrupt_regsave);
+ }
----------------
I think we should pass in `FDecl` when emitting the diagnostic because it's possible that there are multiple function calls where only one is problematic. e.g.,
```
__attribute__((interrupt)) void fooA(void) {
fine(okay(12), bad(14)); // Would be nice to identify 'bad' as the issue
}
```
However, I'm not certain what to say when `FDecl` is null (I don't know what circumstances that happens).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97764/new/
https://reviews.llvm.org/D97764
More information about the cfe-commits
mailing list