[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-24 Thread Vitaly Buka via cfe-commits
vitalybuka wrote: > @vitalybuka > > > Would it make sense to support attributes like > > `__attribute__((no_sanitize("-undefined")))` ? Seems like better > > representation of the fact that we want to undo sanitizer suppression. > > Is there some other precedence for this `-undefined` syntax

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-18 Thread Justin Stitt via cfe-commits
JustinStitt wrote: @vitalybuka > Would it make sense to support attributes like > `__attribute__((no_sanitize("-undefined")))` ? Seems like better > representation of the fact that we want to undo sanitizer suppression. I am working on the PR for supporting `__attribute__((no_sanitize()))` fo

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Vitaly Buka via cfe-commits
vitalybuka wrote: Naming wise I prefer `wrap` -> `no_sanitize("undefined")` already exists but does not apply to variables and types `no_wrap` -> `sanitize("undefined")` does not exist, and a little confusing (no_wrap as well). It may look it enabled sanitization. Would it make sense to suppo

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Vitaly Buka via cfe-commits
https://github.com/vitalybuka edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Vitaly Buka via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/115094 >From b5515eba87ffd96d010952bf18fe4044861df298 Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 01/15] add wraps, no_wraps attributes --- clang/docs/ReleaseN

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/115094 >From b5515eba87ffd96d010952bf18fe4044861df298 Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 01/14] add wraps, no_wraps attributes --- clang/docs/ReleaseN

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
@@ -4852,6 +4862,10 @@ BinaryOperator::BinaryOperator(const ASTContext &Ctx, Expr *lhs, Expr *rhs, if (hasStoredFPFeatures()) setStoredFPFeatures(FPFeatures); setDependence(computeDependence(this)); + if (hasWrappingOperand(Ctx)) JustinStitt wrote: A

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
@@ -10818,11 +10819,39 @@ static bool IsImplicitBoolFloatConversion(Sema &S, Expr *Ex, bool ToBool) { FloatCandidateBT && (FloatCandidateBT->isFloatingPoint())); } +/// Check to see if the wraps or no_wraps attribute may have been lost through +/// a function call.

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
@@ -6664,6 +6664,13 @@ def err_builtin_counted_by_ref_invalid_lhs_use : Error< def err_builtin_counted_by_ref_has_side_effects : Error< "'__builtin_counted_by_ref' argument cannot have side-effects">; +def warn_wraps_attr_var_decl_type_not_integer : Warning< + "using attrib

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
@@ -6664,6 +6664,13 @@ def err_builtin_counted_by_ref_invalid_lhs_use : Error< def err_builtin_counted_by_ref_has_side_effects : Error< "'__builtin_counted_by_ref' argument cannot have side-effects">; +def warn_wraps_attr_var_decl_type_not_integer : Warning<

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
@@ -6536,6 +6536,30 @@ static void HandleBTFTypeTagAttribute(QualType &Type, const ParsedAttr &Attr, ::new (Ctx) BTFTypeTagAttr(Ctx, Attr, BTFTypeTag), Type); } +static void handleWrapsAttr(QualType &Type, const ParsedAttr &Attr, +TypeProcess

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-12 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-11 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-11 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-11 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-11 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-11 Thread Justin Stitt via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-11 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/115094 >From b5515eba87ffd96d010952bf18fe4044861df298 Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 01/12] add wraps, no_wraps attributes --- clang/docs/ReleaseN

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-11 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-11 Thread Justin Stitt via cfe-commits
@@ -6664,6 +6664,13 @@ def err_builtin_counted_by_ref_invalid_lhs_use : Error< def err_builtin_counted_by_ref_has_side_effects : Error< "'__builtin_counted_by_ref' argument cannot have side-effects">; +def warn_wraps_attr_var_decl_type_not_integer : Warning< + "using attrib

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
JustinStitt wrote: @erichkeane > Also, did we have an RFC on this? I'd like to see what the community at large > has to say. Yes, here's the [RFC](https://discourse.llvm.org/t/rfc-add-wraps-attribute-for-granular-integer-overflow-handling/77670) and the [previous PR](https://github.com/llvm/

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -6536,6 +6536,30 @@ static void HandleBTFTypeTagAttribute(QualType &Type, const ParsedAttr &Attr, ::new (Ctx) BTFTypeTagAttr(Ctx, Attr, BTFTypeTag), Type); } +static void handleWrapsAttr(QualType &Type, const ParsedAttr &Attr, +TypeProcess

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -4852,6 +4862,10 @@ BinaryOperator::BinaryOperator(const ASTContext &Ctx, Expr *lhs, Expr *rhs, if (hasStoredFPFeatures()) setStoredFPFeatures(FPFeatures); setDependence(computeDependence(this)); + if (hasWrappingOperand(Ctx)) JustinStitt wrote: I

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
https://github.com/vitalybuka edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
https://github.com/vitalybuka edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
https://github.com/vitalybuka edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Erich Keane via cfe-commits
@@ -6664,6 +6664,13 @@ def err_builtin_counted_by_ref_invalid_lhs_use : Error< def err_builtin_counted_by_ref_has_side_effects : Error< "'__builtin_counted_by_ref' argument cannot have side-effects">; +def warn_wraps_attr_var_decl_type_not_integer : Warning<

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Erich Keane via cfe-commits
@@ -4852,6 +4862,10 @@ BinaryOperator::BinaryOperator(const ASTContext &Ctx, Expr *lhs, Expr *rhs, if (hasStoredFPFeatures()) setStoredFPFeatures(FPFeatures); setDependence(computeDependence(this)); + if (hasWrappingOperand(Ctx)) erichkeane wrote: Th

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Erich Keane via cfe-commits
@@ -6664,6 +6664,13 @@ def err_builtin_counted_by_ref_invalid_lhs_use : Error< def err_builtin_counted_by_ref_has_side_effects : Error< "'__builtin_counted_by_ref' argument cannot have side-effects">; +def warn_wraps_attr_var_decl_type_not_integer : Warning< + "using attrib

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Erich Keane via cfe-commits
@@ -6536,6 +6536,30 @@ static void HandleBTFTypeTagAttribute(QualType &Type, const ParsedAttr &Attr, ::new (Ctx) BTFTypeTagAttr(Ctx, Attr, BTFTypeTag), Type); } +static void handleWrapsAttr(QualType &Type, const ParsedAttr &Attr, +TypeProcess

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane commented: It seems to me that this should just modify the type, rather than risk getting lost like it does. If you want to define the conversion to the underlying integer type(likely via cast!) that is sensible as well, but this is going to end up getting lost p

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Erich Keane via cfe-commits
@@ -4870,6 +4884,10 @@ BinaryOperator::BinaryOperator(const ASTContext &Ctx, Expr *lhs, Expr *rhs, if (hasStoredFPFeatures()) setStoredFPFeatures(FPFeatures); setDependence(computeDependence(this)); + if (hasWrappingOperand(Ctx)) erichkeane wrote: Sa

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Erich Keane via cfe-commits
@@ -2863,6 +2863,15 @@ bool QualType::isWebAssemblyFuncrefType() const { getAddressSpace() == LangAS::wasm_funcref; } +bool QualType::hasWrapsAttr() const { + return !isNull() && getTypePtr()->hasAttr(attr::Wraps) && erichkeane wrote: we probably wa

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Erich Keane via cfe-commits
@@ -10818,11 +10819,39 @@ static bool IsImplicitBoolFloatConversion(Sema &S, Expr *Ex, bool ToBool) { FloatCandidateBT && (FloatCandidateBT->isFloatingPoint())); } +/// Check to see if the wraps or no_wraps attribute may have been lost through +/// a function call.

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Erich Keane via cfe-commits
https://github.com/erichkeane edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple x86_64-pc-linux-gnu +typedef int __attribute__((wraps)) wrapping_int; JustinStitt wrote: > Can we test more types? Yes, I'll add some more tests 😄 > > Can the attributes be applied to point

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -433,6 +433,26 @@ Attribute Changes in Clang - Fix a bug where clang doesn't automatically apply the ``[[gsl::Owner]]`` or ``[[gsl::Pointer]]`` to STL explicit template specialization decls. (#GH109442) +- Introduced ``__attribute__((wraps))`` which can be added to type

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -67,9 +67,11 @@ types specified within an ignorelist. int a = 2147483647; // INT_MAX ++a;// Normally, an overflow with -fsanitize=signed-integer-overflow } + JustinStitt wrote: I don't have commit access, but I'll revert that whit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
https://github.com/vitalybuka edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
https://github.com/vitalybuka commented: I guess we already discussed that before. My preference is the wrap and sanitize attributes are interdependent. Open to be convinced otherwise. But seems like we want consistency with https://godbolt.org/z/crhdaczx1 * `__attribute__((wraps,no_sanitize("

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
@@ -433,6 +433,26 @@ Attribute Changes in Clang - Fix a bug where clang doesn't automatically apply the ``[[gsl::Owner]]`` or ``[[gsl::Pointer]]`` to STL explicit template specialization decls. (#GH109442) +- Introduced ``__attribute__((wraps))`` which can be added to type

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
https://github.com/vitalybuka edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
@@ -67,9 +67,11 @@ types specified within an ignorelist. int a = 2147483647; // INT_MAX ++a;// Normally, an overflow with -fsanitize=signed-integer-overflow } + vitalybuka wrote: Yes, I'ts about spaces. Even if it's useful change ju

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Vitaly Buka via cfe-commits
vitalybuka wrote: I am comfortable accepting sanitization related stuff, and will be happy to look into implementation details. To me this approach is LGTM, but this patch goes beyond sanitizers into the area of tuning behavior of UB code, so I think we need feedback from maintainers of the rel

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -433,6 +433,26 @@ Attribute Changes in Clang - Fix a bug where clang doesn't automatically apply the ``[[gsl::Owner]]`` or ``[[gsl::Pointer]]`` to STL explicit template specialization decls. (#GH109442) +- Introduced ``__attribute__((wraps))`` which can be added to type

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Justin Stitt via cfe-commits
@@ -433,6 +433,26 @@ Attribute Changes in Clang - Fix a bug where clang doesn't automatically apply the ``[[gsl::Owner]]`` or ``[[gsl::Pointer]]`` to STL explicit template specialization decls. (#GH109442) +- Introduced ``__attribute__((wraps))`` which can be added to type

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
@@ -433,6 +433,26 @@ Attribute Changes in Clang - Fix a bug where clang doesn't automatically apply the ``[[gsl::Owner]]`` or ``[[gsl::Pointer]]`` to STL explicit template specialization decls. (#GH109442) +- Introduced ``__attribute__((wraps))`` which can be added to type

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
@@ -0,0 +1,48 @@ +// RUN: %clang_cc1 %s -verify -fsyntax-only -triple x86_64-pc-linux-gnu +typedef int __attribute__((wraps)) wrapping_int; melver wrote: Can we test more types? Can the attributes be applied to pointers? Both the pointer itself and the pointee?

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
https://github.com/melver requested changes to this pull request. https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-08 Thread Marco Elver via cfe-commits
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot of ``nonallocating`` by the compiler. }]; } + +def WrapsDocs : Documentation { + let Category = DocCatField; + let Content = [{ +The ``wraps`` attribute can be used wit

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-07 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/115094 >From b5515eba87ffd96d010952bf18fe4044861df298 Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 1/6] add wraps, no_wraps attributes --- clang/docs/ReleaseNot

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-07 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/115094 >From f58e6481650f8cda6089b2a0637c94596a45370e Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 1/6] add wraps, no_wraps attributes --- clang/docs/ReleaseNot

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-06 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/115094 >From f58e6481650f8cda6089b2a0637c94596a45370e Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 1/5] add wraps, no_wraps attributes --- clang/docs/ReleaseNot

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-06 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-06 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/115094 >From f58e6481650f8cda6089b2a0637c94596a45370e Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 1/6] add wraps, no_wraps attributes --- clang/docs/ReleaseNot

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-06 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-06 Thread Justin Stitt via cfe-commits
@@ -4142,6 +4142,12 @@ class BinaryOperator : public Expr { return getFPFeaturesInEffect(LO).getAllowFEnvAccess(); } + /// Does one of the subexpressions have the wraps attribute? + bool hasWrappingOperand(const ASTContext &Ctx) const; + + /// How about the no_wraps a

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-06 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/115094 >From f58e6481650f8cda6089b2a0637c94596a45370e Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Tue, 5 Mar 2024 03:14:49 + Subject: [PATCH 1/5] add wraps, no_wraps attributes --- clang/docs/ReleaseNot

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-06 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/115094 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-06 Thread Justin Stitt via cfe-commits
@@ -67,9 +67,11 @@ types specified within an ignorelist. int a = 2147483647; // INT_MAX ++a;// Normally, an overflow with -fsanitize=signed-integer-overflow } + JustinStitt wrote: The wraps docs reference the SSCL docs and I fixed so

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-05 Thread Vitaly Buka via cfe-commits
@@ -67,9 +67,11 @@ types specified within an ignorelist. int a = 2147483647; // INT_MAX ++a;// Normally, an overflow with -fsanitize=signed-integer-overflow } + vitalybuka wrote: Please do unrelated fixes in separate PRs. https://gi

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-05 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff c949500d519085a4e5b93928b14ca766a353ad73 bd63565b43c17f16b9c2a79143368e7ef607f14c --e

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Justin Stitt (JustinStitt) Changes > [!NOTE] > Expansion of https://github.com/llvm/llvm-project/pull/86618, with a larger scope including `no_wraps` and [SSCL](https://clang.llvm.org/docs/SanitizerSpecialCaseList.html) integration. Th

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-05 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Justin Stitt (JustinStitt) Changes > [!NOTE] > Expansion of https://github.com/llvm/llvm-project/pull/86618, with a larger scope including `no_wraps` and [SSCL](https://clang.llvm.org/docs/SanitizerSpecialCaseList.html) integrat

[clang] [Clang] add wraps and no_wraps attributes (PR #115094)

2024-11-05 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt created https://github.com/llvm/llvm-project/pull/115094 > [!NOTE] > Expansion of https://github.com/llvm/llvm-project/pull/86618, with a larger > scope including `no_wraps` and > [SSCL](https://clang.llvm.org/docs/SanitizerSpecialCaseList.html) > integration.