-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit an error instead of crashing on invalid use of __capability
Previously, attempting to generate code that contained __capability while using a target without support for CHERI would assert with `Assertion `llvm::isPowerOf2_32(Align) && "Alignment must be power of 2"' failed.` Fix this by emitting a more user-friendly error message instead of crashing when we encounter __capability but CHERI is not supported. Ideally we would not expose the keyword for non-CHERI but that is a rather more invasive change.
- Loading branch information
1 parent
6812917
commit 7092f79
Showing
3 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py | ||
/// Using __capability without the appropriate -march string previously | ||
/// crashed clang during codegen instead of emitting an error earlier. | ||
// RUN: %clang_cc1 -triple riscv64 -fsyntax-only %s -verify=no-cheri | ||
// RUN: %clang_cc1 -triple riscv64 -target-feature +xcheri -fsyntax-only %s -verify=cheri | ||
// cheri-no-diagnostics | ||
|
||
void *__capability foo; // no-cheri-error{{'__capability' attribute is not supported on targets missing CHERI; specify an appropriate -march= or -mcpu=}} |