[clang] [Doc][NFC] Fix Sanitizer Ignore list example errors. (PR #143755)

2025-06-12 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/143755 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-06 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/141997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-04 Thread Thurston Dang via cfe-commits
@@ -6435,10 +6433,44 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo( #undef SANITIZER_CHECK }; + // Label doesn't require sanitization + + return Label; +} + +static std::string +SanitizerOrdinalToCheckLabel(SanitizerKind::SanitizerOrdinal Ordinal) { +

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-04 Thread Thurston Dang via cfe-commits
@@ -6435,10 +6433,44 @@ llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo( #undef SANITIZER_CHECK }; + // Label doesn't require sanitization + thurstond wrote: Removed https://github.com/llvm/llvm-project/pull/141997 _

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-04 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/141997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-04 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/141997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-04 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/141997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-04 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/141997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-03 Thread Thurston Dang via cfe-commits
@@ -1134,18 +1136,32 @@ void ScalarExprEmitter::EmitIntegerTruncationCheck(Value *Src, QualType SrcType, (!SrcSigned && DstSigned)) return; - CodeGenFunction::SanitizerScope SanScope(&CGF); - std::pair> - Check = - EmitIntegerTruncationCheckHelper(

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-03 Thread Thurston Dang via cfe-commits
@@ -1134,18 +1136,32 @@ void ScalarExprEmitter::EmitIntegerTruncationCheck(Value *Src, QualType SrcType, (!SrcSigned && DstSigned)) return; - CodeGenFunction::SanitizerScope SanScope(&CGF); - std::pair> - Check = - EmitIntegerTruncationCheckHelper(

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-03 Thread Thurston Dang via cfe-commits
@@ -1134,18 +1136,32 @@ void ScalarExprEmitter::EmitIntegerTruncationCheck(Value *Src, QualType SrcType, (!SrcSigned && DstSigned)) return; - CodeGenFunction::SanitizerScope SanScope(&CGF); - std::pair> - Check = - EmitIntegerTruncationCheckHelper(

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-03 Thread Thurston Dang via cfe-commits
@@ -2817,7 +2817,9 @@ void CodeGenFunction::EmitVTablePtrCheckForCall(const CXXRecordDecl *RD, RD = LeastDerivedClassWithSameLayout(RD); auto [Ordinal, _] = SanitizerInfoFromCFICheckKind(TCK); - ApplyDebugLocation ApplyTrapDI(*this, SanitizerAnnotateDebugInfo(Ordinal))

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-03 Thread Thurston Dang via cfe-commits
@@ -2817,7 +2817,9 @@ void CodeGenFunction::EmitVTablePtrCheckForCall(const CXXRecordDecl *RD, RD = LeastDerivedClassWithSameLayout(RD); auto [Ordinal, _] = SanitizerInfoFromCFICheckKind(TCK); - ApplyDebugLocation ApplyTrapDI(*this, SanitizerAnnotateDebugInfo(Ordinal))

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-03 Thread Thurston Dang via cfe-commits
@@ -2817,7 +2817,9 @@ void CodeGenFunction::EmitVTablePtrCheckForCall(const CXXRecordDecl *RD, RD = LeastDerivedClassWithSameLayout(RD); auto [Ordinal, _] = SanitizerInfoFromCFICheckKind(TCK); - ApplyDebugLocation ApplyTrapDI(*this, SanitizerAnnotateDebugInfo(Ordinal))

[clang] [NFC][CodeGen] Exctact SanitizerHandler into own header (PR #142527)

2025-06-02 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/142527 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
thurstond wrote: > How is this going to be useful? We should make some effort to try to > determine where the overhead comes from. I don't like that the specific > array_bounds inline function is going away _even though we have a specific > codepath for it_. I've now changed the annotations t

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
@@ -2755,9 +2757,18 @@ CodeGenFunction::CGCapturedStmtInfo::~CGCapturedStmtInfo() { } CodeGenFunction::SanitizerScope::SanitizerScope(CodeGenFunction *CGF) : CGF(CGF) { assert(!CGF->IsSanitizerScope); + assert(!ApplyTrapDI); thurstond wrote: Removed h

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
thurstond wrote: > @thurstond So there is a significant overlap here with what my GSoC student > (@anthonyhatran) is working on right now (CC @MiB137). The project was > proposed > [here](https://llvm.org/OpenProjects.html#clang-improve-trapping-ubsan-2025). > > During @anthonyhatran 's GSoC

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
@@ -2755,9 +2757,18 @@ CodeGenFunction::CGCapturedStmtInfo::~CGCapturedStmtInfo() { } CodeGenFunction::SanitizerScope::SanitizerScope(CodeGenFunction *CGF) : CGF(CGF) { assert(!CGF->IsSanitizerScope); + assert(!ApplyTrapDI); CGF->IsSanitizerScope = true; } +CodeGe

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
@@ -2756,10 +2758,23 @@ CodeGenFunction::SanitizerScope::SanitizerScope(CodeGenFunction *CGF) : CGF(CGF) { assert(!CGF->IsSanitizerScope); CGF->IsSanitizerScope = true; + + assert(!this->ApplyTrapDI); +} + +CodeGenFunction::SanitizerScope::SanitizerScope( +CodeGen

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
@@ -4734,7 +4770,16 @@ Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) { RHS = ConstrainShiftValue(Ops.LHS, RHS, "shl.mask"); else if ((SanitizeBase || SanitizeExponent) && isa(Ops.LHS->getType())) { -CodeGenFunction::SanitizerScope SanScope(&CGF);

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
@@ -2756,10 +2758,23 @@ CodeGenFunction::SanitizerScope::SanitizerScope(CodeGenFunction *CGF) : CGF(CGF) { assert(!CGF->IsSanitizerScope); CGF->IsSanitizerScope = true; + + assert(!this->ApplyTrapDI); +} + +CodeGenFunction::SanitizerScope::SanitizerScope( +CodeGen

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
@@ -4204,7 +4238,9 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, PtrTy->getPointerAddressSpace())) return Ptr; // The inbounds GEP of null is valid iff the index is zero. -CodeGenFunction::SanitizerScope SanScope(&CGF);

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
@@ -2756,10 +2758,23 @@ CodeGenFunction::SanitizerScope::SanitizerScope(CodeGenFunction *CGF) : CGF(CGF) { assert(!CGF->IsSanitizerScope); CGF->IsSanitizerScope = true; + + assert(!this->ApplyTrapDI); thurstond wrote: Fixed in https://github.com/llv

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
@@ -597,8 +597,15 @@ class CodeGenFunction : public CodeGenTypeCache { class SanitizerScope { CodeGenFunction *CGF; +// ApplyDebugLocation is undeclared: CGDebugInfo.h is not #included in this thurstond wrote: Fixed in https://github.com/llvm/llvm-

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/141997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-06-02 Thread Thurston Dang via cfe-commits
https://github.com/thurstond ready_for_review https://github.com/llvm/llvm-project/pull/141997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-05-30 Thread Thurston Dang via cfe-commits
https://github.com/thurstond converted_to_draft https://github.com/llvm/llvm-project/pull/141997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-05-30 Thread Thurston Dang via cfe-commits
@@ -1245,30 +1245,23 @@ void CodeGenFunction::EmitBoundsCheckImpl(const Expr *E, llvm::Value *Bound, } llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo( -SanitizerKind::SanitizerOrdinal CheckKindOrdinal) { - std::string Label; - switch (CheckKindOrdinal) {

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-05-30 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/141997 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Add more -fsanitize-annotate-debug-info checks (PR #141997)

2025-05-30 Thread Thurston Dang via cfe-commits
@@ -1245,30 +1245,23 @@ void CodeGenFunction::EmitBoundsCheckImpl(const Expr *E, llvm::Value *Bound, } llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo( -SanitizerKind::SanitizerOrdinal CheckKindOrdinal) { - std::string Label; - switch (CheckKindOrdinal) {

[clang] cb065a5 - [NFCI][ubsan] Add/update deprecation TODOs

2025-05-29 Thread Thurston Dang via cfe-commits
Author: Thurston Dang Date: 2025-05-29T18:13:47Z New Revision: cb065a578a9d152603c2ea66a616c1cbbc702d63 URL: https://github.com/llvm/llvm-project/commit/cb065a578a9d152603c2ea66a616c1cbbc702d63 DIFF: https://github.com/llvm/llvm-project/commit/cb065a578a9d152603c2ea66a616c1cbbc702d63.diff LOG:

[clang] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-debug-info (PR #141814)

2025-05-28 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/141814 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-debug-info (PR #141814)

2025-05-28 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/141814 >From 04f6229593a5891025d4ac240b3b5b15535a1e25 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 28 May 2025 17:55:46 + Subject: [PATCH 1/4] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-deb

[clang] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-debug-info (PR #141814)

2025-05-28 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/141814 >From 04f6229593a5891025d4ac240b3b5b15535a1e25 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 28 May 2025 17:55:46 + Subject: [PATCH 1/3] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-deb

[clang] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-debug-info (PR #141814)

2025-05-28 Thread Thurston Dang via cfe-commits
@@ -0,0 +1,74 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -emit-llvm -triple x86_64 -std=c17 -fsanitize=function %s -o - \ thurstond wrote: Done https://github.com/llvm/llvm-projec

[clang] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-debug-info (PR #141814)

2025-05-28 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/141814 >From 04f6229593a5891025d4ac240b3b5b15535a1e25 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 28 May 2025 17:55:46 + Subject: [PATCH 1/2] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-deb

[clang] [NFCI][ubsan] Precommit tests for -fsanitize-annotate-debug-info (PR #141814)

2025-05-28 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/141814 These tests will track progress on extending https://github.com/llvm/llvm-project/pull/139809 from CFI to more UBSan checks. >From 04f6229593a5891025d4ac240b3b5b15535a1e25 Mon Sep 17 00:00:00 2001 From: Thurst

[clang] [Clang] Add missing macro undefs in AttributeSpellingList emitter (PR #141090)

2025-05-22 Thread Thurston Dang via cfe-commits
thurstond wrote: > > Could you please merge this to bring the buildbots back to green? Thanks! > > Done! Thank you! https://github.com/llvm/llvm-project/pull/141090 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [Clang] Add missing macro undefs in AttributeSpellingList emitter (PR #141090)

2025-05-22 Thread Thurston Dang via cfe-commits
thurstond wrote: Could you please merge this to bring the buildbots back to green? Thanks! https://github.com/llvm/llvm-project/pull/141090 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-com

[clang] 57763b7 - Fix-forward excess ';' from 9459c8309c6768cf6aa7956885b2540e16582a93 (#134632)

2025-05-21 Thread Thurston Dang via cfe-commits
Author: Thurston Dang Date: 2025-05-21T17:05:58Z New Revision: 57763b7c6481daed40f412d4b302cc7479a9839e URL: https://github.com/llvm/llvm-project/commit/57763b7c6481daed40f412d4b302cc7479a9839e DIFF: https://github.com/llvm/llvm-project/commit/57763b7c6481daed40f412d4b302cc7479a9839e.diff LOG:

[clang] [NFC] Pre-commit UBSAN src:*=sanitize test (PR #140602)

2025-05-19 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/140602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DO not merge] demo test for https://github.com/llvm/llvm-project/pull/140529 (PR #140602)

2025-05-19 Thread Thurston Dang via cfe-commits
thurstond wrote: > The linked pull request (#140529) introduces a new feature rather than > correcting a bug. I would argue that since the `src:*=sanitize` syntax could reasonably be expected to work, but it did not work, then that is both a missing feature and a bug (not working as intended)

[clang] [DO not merge] demo test for https://github.com/llvm/llvm-project/pull/140529 (PR #140602)

2025-05-19 Thread Thurston Dang via cfe-commits
https://github.com/thurstond requested changes to this pull request. Per comment above https://github.com/llvm/llvm-project/pull/140602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [DO not merge] demo test for https://github.com/llvm/llvm-project/pull/140529 (PR #140602)

2025-05-19 Thread Thurston Dang via cfe-commits
thurstond wrote: This patch should be "[NFC] Precommit test for src:*=sanitize for UBSan" (or similar), have the test output "passing" for the current build of clang (i.e., probably "incorrect" output), reviewed and then merged. https://github.com/llvm/llvm-project/pull/140602

[clang] [UBSan] Implement src:*=sanitize for UBSan (PR #140529)

2025-05-19 Thread Thurston Dang via cfe-commits
@@ -44,6 +44,13 @@ bool NoSanitizeList::containsFunction(SanitizerMask Mask, bool NoSanitizeList::containsFile(SanitizerMask Mask, StringRef FileName, StringRef Category) const { + unsigned NoSanLine = SSCL->inSectionBlame(Mask, "src", FileNa

[clang] [UBSan] Implement src:*=sanitize for UBSan (PR #140529)

2025-05-19 Thread Thurston Dang via cfe-commits
@@ -0,0 +1,37 @@ +// RUN: rm -rf %t thurstond wrote: Consider pre-committing this test (with the "bad" output) as a separate patch, so that the current patch will show how the test output is fixed. https://github.com/llvm/llvm-project/pull/140529 __

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-19 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/139809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFCI][cfi] Refactor into 'SanitizerInfoFromCFICheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/140117 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFCI][cfi] Refactor into 'SanitizerInfoFromCFICheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/140117 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-15 Thread Thurston Dang via cfe-commits
@@ -2779,13 +2779,47 @@ void CodeGenFunction::EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD, } } +std::pair +CodeGenFunction::ParseCFITypeCheckKind(CFITypeCheckKind TCK) { + SanitizerKind::SanitizerOrdinal M; + llvm::SanitizerStatKind SSK; + + switch (TCK) { + ca

[clang] [NFCI][cfi] Refactor into 'SanitizerInfoFromCFICheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/140117 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFCI][cfi] Refactor into 'SanitizerInfoFromCFICheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/140117 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFCI][cfi] Refactor into 'ParseCFITypeCheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
@@ -2779,6 +2779,39 @@ void CodeGenFunction::EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD, } } +/// Converts the CFITypeCheckKind into SanitizerKind::SanitizerOrdinal and +/// llvm::SanitizerStatKind. +static std::pair +ParseCFITypeCheckKind(CodeGenFunction::CFIType

[clang] [NFCI][cfi] Refactor into 'ParseCFITypeCheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/140117 >From 97c6fe5ac09e5ad7663de556753d5e31c05f7aa5 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Thu, 15 May 2025 18:22:05 + Subject: [PATCH 1/3] [NFCI] Refactor into 'ParseCFITypeCheckKind' This refacto

[clang] [NFCI][cfi] Refactor into 'ParseCFITypeCheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/140117 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [NFCI] Refactor into 'ParseCFITypeCheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
@@ -2779,6 +2779,39 @@ void CodeGenFunction::EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD, } } +/// Converts the CFITypeCheckKind into SanitizerKind::SanitizerOrdinal and +/// llvm::SanitizerStatKind. +static std::pair +ParseCFITypeCheckKind(CodeGenFunction::CFIType

[clang] [NFCI] Refactor into 'ParseCFITypeCheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
@@ -3358,6 +3358,11 @@ class CodeGenFunction : public CodeGenTypeCache { SanitizerSet SkippedChecks = SanitizerSet(), llvm::Value *ArraySize = nullptr); + /// Converts the CFITypeCheckKind into SanitizerKind::SanitizerOrdinal and + /

[clang] [NFCI] Refactor into 'ParseCFITypeCheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/140117 >From 97c6fe5ac09e5ad7663de556753d5e31c05f7aa5 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Thu, 15 May 2025 18:22:05 + Subject: [PATCH 1/2] [NFCI] Refactor into 'ParseCFITypeCheckKind' This refacto

[clang] [NFCI] Refactor into 'ParseCFITypeCheckKind' (PR #140117)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/140117 This refactors existing code into a 'ParseCFITypeCheckKind' helper function. This will be useful in future work to annotate CFI checks with debug info (https://github.com/llvm/llvm-project/pull/139809). >Fro

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-15 Thread Thurston Dang via cfe-commits
thurstond wrote: Marking as draft - I'll pull out ParseCFITypeCheckKind as a separate NFC patch https://github.com/llvm/llvm-project/pull/139809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] [sanitizer] Fix empty string in unsupported argument error for -fsanitize-trap (PR #136549)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/136549 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [sanitizer] Fix empty string in unsupported argument error for -fsanitize-trap (PR #136549)

2025-05-15 Thread Thurston Dang via cfe-commits
thurstond wrote: > @thurstond can you please merge this? I don't have write access. Sure! Thanks for the fix :-) https://github.com/llvm/llvm-project/pull/136549 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] [sanitizer] Fix empty string in unsupported argument error for -fsanitize-trap (PR #136549)

2025-05-15 Thread Thurston Dang via cfe-commits
thurstond wrote: > > Perhaps a better fix would be to correct the toString function > > I agree, but adding groups to `toString` breaks its other uses. What do you > think about separate `toStringWithGroups`? Hmm, that's a good point. I like your `toStringWithGroups` idea! https://github.com/

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond converted_to_draft https://github.com/llvm/llvm-project/pull/139809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [sanitizer] Fix empty string in unsupported argument error for -fsanitize-trap (PR #136549)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/136549 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-15 Thread Thurston Dang via cfe-commits
@@ -2842,24 +2882,12 @@ void CodeGenFunction::EmitVTablePtrCheck(const CXXRecordDecl *RD, !CGM.HasHiddenLTOVisibility(RD)) return; - SanitizerKind::SanitizerOrdinal M; - llvm::SanitizerStatKind SSK; + auto [M, SSK] = ParseCFITypeCheckKind(TCK); switch (TCK) {

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-15 Thread Thurston Dang via cfe-commits
@@ -2779,13 +2779,50 @@ void CodeGenFunction::EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD, } } +std::pair +CodeGenFunction::ParseCFITypeCheckKind(CFITypeCheckKind TCK) { + SanitizerKind::SanitizerOrdinal M; + llvm::SanitizerStatKind SSK; + + switch (TCK) { + ca

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139809 >From 3c8c0d59725092fdc51ceeaef913852ba930acce Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 7 May 2025 23:33:21 + Subject: [PATCH 1/9] [cfi] Enable -fsanitize-annotate-debug-info functionality

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/139809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139809 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans

[clang] [sanitizer][NFCI] Add 'SanitizerAnnotateDebugInfo' (PR #139965)

2025-05-15 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/139965 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-14 Thread Thurston Dang via cfe-commits
@@ -1217,6 +1217,35 @@ void CodeGenFunction::EmitBoundsCheck(const Expr *E, const Expr *Base, EmitBoundsCheckImpl(E, Bound, Index, IndexType, IndexedType, Accessed); } +llvm::DILocation *CodeGenFunction::SanitizerAnnotateDebugInfo( thurstond wrote: Spun of

[clang] [sanitizer][NFCI] Add 'SanitizerAnnotateDebugInfo' (PR #139965)

2025-05-14 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/139965 This generalizes the debug info annotation code from https://github.com/llvm/llvm-project/pull/139149 and moves it into a helper function, SanitizerAnnotateDebugInfo(). Future work can use 'ApplyDebugLocatio

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-14 Thread Thurston Dang via cfe-commits
@@ -2842,24 +2882,12 @@ void CodeGenFunction::EmitVTablePtrCheck(const CXXRecordDecl *RD, !CGM.HasHiddenLTOVisibility(RD)) return; - SanitizerKind::SanitizerOrdinal M; - llvm::SanitizerStatKind SSK; + auto [M, SSK] = ParseCFITypeCheckKind(TCK); switch (TCK) {

[clang] [sanitizer] Fix empty string in unsupported argument error for -fsanitize-trap (PR #136549)

2025-05-14 Thread Thurston Dang via cfe-commits
@@ -259,6 +259,9 @@ // RUN: not %clang --target=aarch64-linux -fsanitize=memtag -I +mte %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANMT-NOMT-1 // CHECK-SANMT-NOMT-1: '-fsanitize=memtag-stack' requires hardware support (+memtag) +// RUN: not %clang --target=aarch64-lin

[clang] [sanitizer] Fix empty string in unsupported argument error for -fsanitize-trap (PR #136549)

2025-05-14 Thread Thurston Dang via cfe-commits
thurstond wrote: Sorry, I didn't notice being tagged earlier. It didn't show up in my review queue since the "Request Review" wasn't used. Thanks for the patch! I agree this is an improvement over the empty output, but it's arguably confusing to tell the user `unsupported argument 'memtag-sta

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-14 Thread Thurston Dang via cfe-commits
@@ -68,9 +68,9 @@ double f1(int b, int i) { //. // CHECK-TRAP: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None) -// CHEC

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-14 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139809 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-14 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139809 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-14 Thread Thurston Dang via cfe-commits
@@ -96,9 +96,9 @@ double f1(int b, int i) { // CHECK-TRAP: [[DBG28]] = !DILocation(line: 66, column: 3, scope: [[DBG4]]) //. // CHECK-NOTRAP: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], isOptimized: false, runtimeVersion: 0, emi

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-14 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139809 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-13 Thread Thurston Dang via cfe-commits
thurstond wrote: > > > I am not a fan of the change to the function used for array-bounds. > > > > > > More specific? I like it in general. It's about just about the name of a > > new fake function? > > Sorry, I meant the new name. > > I don't like that it has a `-` in it, and I don't like t

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/139809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-13 Thread Thurston Dang via cfe-commits
@@ -3353,6 +3353,17 @@ class CodeGenFunction : public CodeGenTypeCache { SanitizerSet SkippedChecks = SanitizerSet(), llvm::Value *ArraySize = nullptr); + /// Returns debug info, with additional annotation if enabled by + /// CGM.get

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-13 Thread Thurston Dang via cfe-commits
@@ -2779,13 +2779,47 @@ void CodeGenFunction::EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD, } } +void CodeGenFunction::ParseCFITypeCheckKind(CFITypeCheckKind TCK, thurstond wrote: Fixed in https://github.com/llvm/llvm-project/pull/139809/commits/f

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-13 Thread Thurston Dang via cfe-commits
@@ -89,7 +89,7 @@ double f1(int b, int i) { // CHECK-TRAP: [[DBG21]] = !DILocation(line: 65, column: 3, scope: [[DBG4]]) // CHECK-TRAP: [[DBG22]] = !DILocation(line: 66, column: 12, scope: [[DBG4]]) // CHECK-TRAP: [[DBG23]] = !DILocation(line: 0, scope: [[META24:![0-9]+]], inl

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139809 >From ead256dfd33d04877766ddb26830f264682e9b48 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 7 May 2025 23:33:21 + Subject: [PATCH 1/4] [cfi] Enable -fsanitize-annotate-debug-info functionality

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139809 >From ead256dfd33d04877766ddb26830f264682e9b48 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 7 May 2025 23:33:21 + Subject: [PATCH 1/2] [cfi] Enable -fsanitize-annotate-debug-info functionality

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/139809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [cfi] Enable -fsanitize-annotate-debug-info functionality for CFI checks (PR #139809)

2025-05-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/139809 This connects the -fsanitize-annotate-debug-info plumbing (https://github.com/llvm/llvm-project/pull/138577) to CFI check codegen. Updates the tests from https://github.com/llvm/llvm-project/pull/139149. A s

[clang] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info tests for CFI (PR #139149)

2025-05-12 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/139149 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info tests for CFI (PR #139149)

2025-05-12 Thread Thurston Dang via cfe-commits
thurstond wrote: > windows bot fails. argument ordering strikes again? Test output fixed in https://github.com/llvm/llvm-project/pull/139149/commits/bb3df7d6a0f7c90afff5a05b31bda5fe763a2484, tests now pass https://github.com/llvm/llvm-project/pull/139149 __

[clang] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info tests for CFI (PR #139149)

2025-05-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139149 >From c2a5ecf9d89b4942fb1e95c7a7713585155099d0 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Thu, 8 May 2025 20:18:22 + Subject: [PATCH 1/4] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info test

[clang] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info tests for CFI (PR #139149)

2025-05-08 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139149 >From c2a5ecf9d89b4942fb1e95c7a7713585155099d0 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Thu, 8 May 2025 20:18:22 + Subject: [PATCH 1/3] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info test

[clang] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info tests for CFI (PR #139149)

2025-05-08 Thread Thurston Dang via cfe-commits
@@ -0,0 +1,47 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 +// RUN: %clang_cc1 -triple x86_64-unknown-linux -O0 -fsanitize-cfi-cross-dso \ thurstond wrote: Changed to -O2 in https://github.com/llvm/llvm

[clang] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info tests for CFI (PR #139149)

2025-05-08 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/139149 >From c2a5ecf9d89b4942fb1e95c7a7713585155099d0 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Thu, 8 May 2025 20:18:22 + Subject: [PATCH 1/2] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info test

[clang] [cfi][NFCI] Pre-commit -fsanitize-annotate-debug-info tests for CFI (PR #139149)

2025-05-08 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/139149 These tests will show progress as the -fsanitize-annotate-debug-info plumbing (https://github.com/llvm/llvm-project/pull/138577) gets connected to CFI check codegen. >From c2a5ecf9d89b4942fb1e95c7a7713585155

[clang] [sanitizer] Add plumbing for -fsanitize-annotate-debug-info and partly replace '-mllvm -array-bounds-pseudofn' (PR #138577)

2025-05-07 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/138577 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [sanitizer] Add plumbing for -fsanitize-annotate-debug-info and partly replace '-mllvm -array-bounds-pseudofn' (PR #138577)

2025-05-07 Thread Thurston Dang via cfe-commits
thurstond wrote: YOLO https://github.com/llvm/llvm-project/pull/138577 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   4   5   >