diff options
author | Thurston Dang <thurston@google.com> | 2025-06-06 14:59:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-06 14:59:32 -0700 |
commit | 428afa62b0aa1bb0ac344cbfc62429a60c42b265 (patch) | |
tree | 8ecd95edfec80811713ecd9dc8560d1e99c52d47 /clang/lib/CodeGen/CGCall.cpp | |
parent | a42bb8b57a6dcf298789ae88b36bbbba19e151fb (diff) | |
download | llvm-428afa62b0aa1bb0ac344cbfc62429a60c42b265.zip llvm-428afa62b0aa1bb0ac344cbfc62429a60c42b265.tar.gz llvm-428afa62b0aa1bb0ac344cbfc62429a60c42b265.tar.bz2 |
[ubsan] Add more -fsanitize-annotate-debug-info checks (#141997)
This extends https://github.com/llvm/llvm-project/pull/138577 to more UBSan checks, by changing SanitizerDebugLocation (formerly SanitizerScope) to add annotations if enabled for the specified ordinals.
Annotations will use the ordinal name if there is exactly one ordinal specified in the SanitizerDebugLocation; otherwise, it will use the handler name.
Updates the tests from https://github.com/llvm/llvm-project/pull/141814.
---------
Co-authored-by: Vitaly Buka <vitalybuka@google.com>
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 46a5d64..75df821e 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -4184,7 +4184,7 @@ void CodeGenFunction::EmitReturnValueCheck(llvm::Value *RV) { Handler = SanitizerHandler::NullabilityReturn; } - SanitizerScope SanScope(this); + SanitizerDebugLocation SanScope(this, {CheckKind}, Handler); // Make sure the "return" source location is valid. If we're checking a // nullability annotation, make sure the preconditions for the check are met. @@ -4569,7 +4569,7 @@ void CodeGenFunction::EmitNonNullArgCheck(RValue RV, QualType ArgType, Handler = SanitizerHandler::NullabilityArg; } - SanitizerScope SanScope(this); + SanitizerDebugLocation SanScope(this, {CheckKind}, Handler); llvm::Value *Cond = EmitNonNullRValueCheck(RV, ArgType); llvm::Constant *StaticData[] = { EmitCheckSourceLocation(ArgLoc), |