-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[UBSan][BoundsSafety] Implement support for more expressive "trap reasons" #154618
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
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
5044fa0
[UBSan][BoundsSafety] Implement support for more expressive "trap rea…
delcypher edafb6c
Add `[[nodiscard]]` to `RuntimeTrapDiagnosticBuilder`
delcypher 9c7cf18
Remove unnecessary incldue
delcypher 9fcb7a7
Use modern header block for `DiagnosticTrap.h` and add a little bit of
delcypher e2449b7
Fix some formatting
delcypher 3aed658
Use %enum_select
delcypher eff527d
Use llvm::SmallString instead of llvm::SmallVector
delcypher 7e0cde9
Move `RuntimeTrapDiagnosticBuilder` to a safer API where the storage and
delcypher ac683d7
Fix `tools/clang/test/Misc/warning-flags.c` by teaching `diagtool` to
delcypher 6aa8296
Update clang/include/clang/Basic/Diagnostic.td
delcypher 5d819f2
Update clang/include/clang/Basic/DiagnosticTrap.h
delcypher c54409f
Update clang/lib/CodeGen/CGExprScalar.cpp
delcypher ad5cd32
Rename classes and move into CodeGen
delcypher 4d7acf8
Small clean ups
delcypher abfade4
Drop top-level comment in header
delcypher fc6b7cd
Add missing include to unbreak the build
delcypher 3a8b319
Add missing `isEmpty()` test to fix tests
delcypher 8973973
Fix inconsistent ordering
delcypher 4e3200f
Update clang/include/clang/Basic/Diagnostic.td
delcypher e5859be
Update clang/lib/CodeGen/TrapReasonBuilder.h
delcypher 58a897c
Update clang/lib/CodeGen/TrapReasonBuilder.h
delcypher 6c78086
Fix out-of-date comment
delcypher bc4842f
Make `-fsanitize-debug-trap-reasons=` a parameterized flag that takes
delcypher 85c4e42
Fix formatting
delcypher 783eca9
Fix typos in some test comments
delcypher cd62acd
Address some feedback for the release notes and also explain about
delcypher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,14 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| #ifndef LLVM_CLANG_BASIC_DIAGNOSTICTRAP_H | ||
| #define LLVM_CLANG_BASIC_DIAGNOSTICTRAP_H | ||
|
|
||
| #include "clang/Basic/Diagnostic.h" | ||
| #include "clang/Basic/DiagnosticTrapInterface.inc" | ||
|
|
||
| #endif |
This file contains hidden or 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,30 @@ | ||
| //==--- DiagnosticTrapKinds.td ------------------------ -------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // Trap Diagnostics | ||
| // | ||
| // These are diagnostics that are emitted into `TrapReason` objects using the | ||
| // `TrapReasonBuilder` class. These `TrapReason` objects are then encoded into | ||
| // debug info during codegen, rather than to the traditional diagnostic | ||
| // consumers like the terminal. Their primary purpose is to make debugging traps | ||
| // (e.g. `-fsanitize-trap=undefined`) easier by attaching a trap category and | ||
| // message to the trap instruction that tools like a debugger can show. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| let Component = "Trap" in { | ||
| let CategoryName = "Undefined Behavior Sanitizer" in { | ||
|
|
||
| def trap_ubsan_arith_overflow : Trap< | ||
| "%select{unsigned|signed}0 integer " | ||
| "%enum_select<UBSanArithKind>{" | ||
| "%Add{addition}|" | ||
| "%Sub{subtraction}|" | ||
| "%Mul{multiplication}" | ||
| "}1 overflow in %2">; | ||
|
|
||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.