[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-29 Thread Justin Stitt via cfe-commits
@@ -1480,6 +1480,14 @@ class DeclRefExpr final return DeclRefExprBits.IsImmediateEscalating; } + bool isOverflowBehaviorDiscarded() const { JustinStitt wrote: Was able to avoid adding a bit to `ExprBits` in [5a4ac21](https://github.com/llvm/llvm-proje

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-29 Thread Justin Stitt via cfe-commits
@@ -550,6 +550,39 @@ explicit ``overflow_behavior`` attribute. // [-Wimplicit-overflow-behavior-conversion-pedantic] } +Format String Functions +=== + +When overflow behavior types are used with format string functions (printf-famil

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

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

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-29 Thread Justin Stitt via cfe-commits
@@ -1480,6 +1480,14 @@ class DeclRefExpr final return DeclRefExprBits.IsImmediateEscalating; } + bool isOverflowBehaviorDiscarded() const { JustinStitt wrote: Thoughts on not passing anything through but rather computing whether we are in an assignmen

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

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

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

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

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-27 Thread Justin Stitt via cfe-commits
JustinStitt wrote: @efriedma-quic thanks for your review. I've tried to address the concerns you brought up and marked the review points as resolved. If I didn't properly fix the issues then please un-resolve the messages. I'm happy to iterate :) https://github.com/llvm/llvm-project/pull/14891

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-27 Thread Justin Stitt via cfe-commits
@@ -199,6 +233,19 @@ static bool CanElideOverflowCheck(const ASTContext &Ctx, const BinOpInfo &Op) { if (!Op.mayHaveIntegerOverflow()) return true; + const UnaryOperator *UO = dyn_cast(Op.E); + if (UO && Ctx.isUnaryOverflowPatternExcluded(UO)) +return true; + + c

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-27 Thread Justin Stitt via cfe-commits
@@ -3189,16 +3227,21 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, // Note that signed integer inc/dec with width less than int can't // overflow because of promotion rules; we're just eliding a few steps // here. -} els

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-27 Thread Justin Stitt via cfe-commits
@@ -405,6 +405,9 @@ ArgType::matchesType(ASTContext &C, QualType argTy) const { argTy = PT->getPointeeType(); } + if (const auto *OBT = argTy->getAs()) +argTy = OBT->getUnderlyingType(); JustinStitt wrote: Done in [4f3062d](https://github.com/llvm

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-27 Thread Justin Stitt via cfe-commits
@@ -1480,6 +1480,14 @@ class DeclRefExpr final return DeclRefExprBits.IsImmediateEscalating; } + bool isOverflowBehaviorDiscarded() const { JustinStitt wrote: The purpose is to emit a different diagnostic for when an OBT is lost during assignment. ``

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-27 Thread Justin Stitt via cfe-commits
@@ -12504,6 +12514,14 @@ void Sema::CheckImplicitConversion(Expr *E, QualType T, SourceLocation CC, IntRange TargetRange = IntRange::forTargetOfCanonicalType(Context, Target); if (LikelySourceRange->Width > TargetRange.Width) { +// Check if target is a wrapping OBT -

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-26 Thread Justin Stitt via cfe-commits
JustinStitt wrote: Thanks for the tips on how to handle qualifier lifting @mizvekov. Check out [`1ea51b8`](https://github.com/llvm/llvm-project/pull/148914/commits/1ea51b8d1fced1cc9c9ca2d398c137b13f266bda). I also had to fix a bug with how scoped enums were handled so that is included in the p

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-26 Thread Justin Stitt via cfe-commits
JustinStitt wrote: > Yes. Great see commit [`af63956`](https://github.com/llvm/llvm-project/pull/148914/commits/af6395691ad98c3763d89e4794f353e77f0e3d9b). I just stole the pattern from the array canonicalization code. https://github.com/llvm/llvm-project/pull/148914 __

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-26 Thread Justin Stitt via cfe-commits
JustinStitt wrote: > It doesn't seem plausible to me that these qualifiers have different > meanings, that is to say, that the two types in my example should be > different types, instead of two spellings of the same type. I'm getting conflicting ideas from this sentence. Do you mean to say th

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

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

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-25 Thread Justin Stitt via cfe-commits
@@ -14308,6 +14455,12 @@ static QualType getCommonNonSugarTypeNode(const ASTContext &Ctx, const Type *X, getCommonTypeKeyword(NX, NY, /*IsSame=*/true), getCommonQualifier(Ctx, NX, NY, /*IsSame=*/true), NX->getIdentifier()); } + case Type::OverflowBehavior: {

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-25 Thread Justin Stitt via cfe-commits
@@ -11710,6 +11809,48 @@ QualType ASTContext::mergeTagDefinitions(QualType LHS, QualType RHS) { return Ctx.IsEquivalent(LHS, RHS) ? LHS : QualType{}; } +std::optional ASTContext::tryMergeOverflowBehaviorTypes( +QualType LHS, QualType RHS, bool OfBlockPointer, bool Unqua

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

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

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-25 Thread Justin Stitt via cfe-commits
@@ -5776,6 +5826,51 @@ QualType ASTContext::getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, return QualType(Ty, 0); } +QualType ASTContext::getOverflowBehaviorType(const OverflowBehaviorAttr *Attr, + QualType Underlying) co

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-25 Thread Justin Stitt via cfe-commits
@@ -2844,6 +2872,8 @@ inline T TypeLoc::getAsAdjusted() const { Cur = ATL.getModifiedLoc(); else if (auto ATL = Cur.getAs()) Cur = ATL.getWrappedLoc(); +// else if (auto ATL = Cur.getAs()) +// Cur = ATL.getWrappedLoc(); JustinStitt wro

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-25 Thread Justin Stitt via cfe-commits
@@ -9120,6 +9191,8 @@ template const T *Type::getAsAdjusted() const { Ty = A->getModifiedType().getTypePtr(); else if (const auto *A = dyn_cast(Ty)) Ty = A->getWrappedType().getTypePtr(); +// else if (const auto *A = dyn_cast(Ty)) +// Ty = A->getWrap

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-25 Thread Justin Stitt via cfe-commits
@@ -8976,7 +9043,7 @@ inline bool Type::isScalarType() const { isa(CanonicalType) || isa(CanonicalType) || isa(CanonicalType) || - isBitIntType(); + isa(CanonicalType) || isBitIntType(); JustinStitt wrote: fixed with

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-25 Thread Justin Stitt via cfe-commits
@@ -8914,6 +8975,12 @@ inline bool Type::isIntegerType() const { return IsEnumDeclComplete(ET->getOriginalDecl()) && !IsEnumDeclScoped(ET->getOriginalDecl()); } + + if (isOverflowBehaviorType()) +return cast(CanonicalType) +->getUnderlyingType() +

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-25 Thread Justin Stitt via cfe-commits
@@ -6660,6 +6672,51 @@ class BTFTagAttributedType : public Type, public llvm::FoldingSetNode { } }; +class OverflowBehaviorType : public Type, public llvm::FoldingSetNode { +public: + enum OverflowBehaviorKind { Wrap, NoWrap }; + +private: + friend class ASTContext; // AS

[clang] [CIR] Change unreachable to diagnostic for ill-equipped clang (PR #152614)

2025-08-08 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt updated https://github.com/llvm/llvm-project/pull/152614 >From 590919c26c01c25bf7e0f16df37e3dd8d43bd2b2 Mon Sep 17 00:00:00 2001 From: Justin Stitt Date: Thu, 7 Aug 2025 16:09:54 -0700 Subject: [PATCH 1/2] [CIR] Replace unreachable with diagnostic when not built

[clang] [clang] Fix constant evaluation of member pointer access into sibling class. (PR #150829)

2025-08-07 Thread Justin Stitt via cfe-commits
JustinStitt wrote: > @erichkeane Thank you. > > I realized that both issues fixed by this PR are still present in similar > form if `-fexperimental-new-constant-interpreter` is used cc @tbaederr https://github.com/llvm/llvm-project/pull/150829 __

[clang] [Clang][NFC] Enumerate Clang ABI versions in a separate header file (PR #151995)

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

[clang] [Clang][NFC] Enumerate Clang ABI versions in a separate header file (PR #151995)

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

[clang] [Clang][NFC] Enumerate Clang ABI versions in a separate header file (PR #151995)

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

[clang] [Clang][NFC] Enumerate Clang ABI versions in a separate header file (PR #151995)

2025-08-05 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt approved this pull request. https://github.com/llvm/llvm-project/pull/151995 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][NFC] Enumerate Clang ABI versions in a separate header file (PR #151995)

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

[clang] [clang] Fix constant evaluation of member pointer access into sibling class. (PR #150829)

2025-08-05 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt approved this pull request. https://github.com/llvm/llvm-project/pull/150829 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Fix constant evaluation of member pointer access into sibling class. (PR #150829)

2025-08-05 Thread Justin Stitt via cfe-commits
@@ -43,6 +43,26 @@ C++ Specific Potentially Breaking Changes regressions if your build system supports two-phase compilation model but haven't support reduced BMI or it is a compiler bug or a bug in users code. +- Clang now correctly diagnoses during constant expression e

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-08-05 Thread Justin Stitt via cfe-commits
JustinStitt wrote: gentle ping. https://github.com/llvm/llvm-project/pull/148914 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add an option to format integer and float literal case (PR #151590)

2025-08-02 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt approved this pull request. Again, can't give any comprehensive code critiques but you addressed my nits and such so LGTM. https://github.com/llvm/llvm-project/pull/151590 ___ cfe-commits mailing list cfe-commits@lists.l

[clang] [clang-format] Add an option to format integer and float literal case (PR #151590)

2025-08-02 Thread Justin Stitt via cfe-commits
@@ -5076,6 +5075,78 @@ the configuration (without a prefix: ``Auto``). For example: TESTSUITE +.. _NumericLiteralCase: + +**NumericLiteralCase** (``NumericLiteralCaseStyle``) :versionbadge:`clang-format 21` :ref:`¶ ` + Controls character case in numeric literals. + + Pos

[clang] [Clang] Handle C++20 export declarations in -dump-minimization-hints (PR #151666)

2025-08-01 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt approved this pull request. https://github.com/llvm/llvm-project/pull/151666 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add an option to format integer and float literal case (PR #151590)

2025-07-31 Thread Justin Stitt via cfe-commits
@@ -0,0 +1,368 @@ +//===--- NumericLiteralCaseFixer.cpp ---*- C++ -*-===// +// +// 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

[clang] [clang-format] Add an option to format integer and float literal case (PR #151590)

2025-07-31 Thread Justin Stitt via cfe-commits
@@ -5076,6 +5075,78 @@ the configuration (without a prefix: ``Auto``). For example: TESTSUITE +.. _NumericLiteralCase: + +**NumericLiteralCase** (``NumericLiteralCaseStyle``) :versionbadge:`clang-format 21` :ref:`¶ ` JustinStitt wrote: Let's go with `clan

[clang] [Clang] Dump minimization hints for namespaces (PR #151534)

2025-07-31 Thread Justin Stitt via cfe-commits
JustinStitt wrote: Hi Ilya, I did some testing and found an inconsistency in the behaviors between exporting entire namespaces or exporting declarations within a namespace piecemeal. See this test ```cpp export module some_lib; namespace piecemeal { // line 3 export int add_one(int n) { re

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

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

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

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

[clang] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-07-24 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/148914 ___ 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)

2025-07-21 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt closed 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)

2025-07-21 Thread Justin Stitt via cfe-commits
JustinStitt wrote: superseded by https://github.com/llvm/llvm-project/pull/148914. closing this. 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/c

[clang] [UBSan] Move type:*=sanitize handling. (PR #142006)

2025-05-29 Thread Justin Stitt via cfe-commits
@@ -34,7 +34,11 @@ bool NoSanitizeList::containsGlobal(SanitizerMask Mask, StringRef GlobalName, bool NoSanitizeList::containsType(SanitizerMask Mask, StringRef MangledTypeName, StringRef Category) const { - return SSCL->inSection(Mask, "ty

[clang] [UBSan] Move type:*=sanitize handling. (PR #142006)

2025-05-29 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt commented: LGTM (but I don't have official powers to `Approve`). https://github.com/llvm/llvm-project/pull/142006 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] [UBSan] Move type:*=sanitize handling. (PR #142006)

2025-05-29 Thread Justin Stitt via cfe-commits
https://github.com/JustinStitt edited https://github.com/llvm/llvm-project/pull/142006 ___ 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)

2025-01-31 Thread Justin Stitt via cfe-commits
JustinStitt wrote: RFC regarding canonical wrapping/non-wrapping types in Clang: https://discourse.llvm.org/t/rfc-clang-canonical-wrapping-and-non-wrapping-types/84356 Ultimately, a type like what the RFC describes would supersede this PR in terms of feature completeness and usefulness. I'll c

[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] Implement labelled type filtering for overflow/truncation sanitizers w/ SSCLs (PR #107332)

2024-11-14 Thread Justin Stitt via cfe-commits
JustinStitt wrote: > > @vitalybuka any idea how lldb-server is failing with `UNRESOLVED`? How in > > the world are any of the changes here affecting lldb-server? > > flake? I believe it was unrelated to this PR https://github.com/llvm/llvm-project/pull/107332 ___

[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 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 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 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

  1   2   3   4   >