[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-03 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,12 @@ +// This reports a warning to follow the default behavior of ClangAs. +// RUN: %clang -fexperimental-bounds-safety -x assembler -c %s -o /dev/null 2>&1 | FileCheck -check-prefix WARN %s + + +// WARN: warning: argument unused during compilation: '-fexperimental-b

[clang] [CodeGen] Revamp counted_by calculations (PR #70606)

2023-11-03 Thread Yeoul Na via cfe-commits
rapidsna wrote: > With this PR I get: > > ``` > $ clang -O2 ~/llvm/bdos.c > $ ./a.out > 400 > 400 > 404 > ``` Oh I see. > I think the first two `printf` s in your code seem correct with 40, because > they're both looking at only the FAM, not the entire struct. Interesting. So this sounds di

[compiler-rt] [clang] [libc] [clang-tools-extra] [libcxx] [llvm] [flang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-11 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna unassigned https://github.com/llvm/llvm-project/pull/73730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[libcxx] [clang] [clang-tools-extra] [compiler-rt] [libc] [llvm] [flang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-11 Thread Yeoul Na via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[libc] [llvm] [clang] [compiler-rt] [flang] [clang-tools-extra] [libcxx] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-12 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/73730 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [llvm] [libcxx] [flang] [compiler-rt] [libc] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-12 Thread Yeoul Na via cfe-commits
@@ -956,60 +951,199 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * -CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base, - const ValueDecl *CountedByVD) { +namespace { + +/// \

[compiler-rt] [llvm] [libc] [flang] [libcxx] [clang] [clang-tools-extra] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-12 Thread Yeoul Na via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[compiler-rt] [clang] [libcxx] [llvm] [flang] [clang-tools-extra] [libc] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-12 Thread Yeoul Na via cfe-commits
@@ -956,60 +951,199 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * -CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base, - const ValueDecl *CountedByVD) { +namespace { + +/// \

[compiler-rt] [libc] [clang] [clang-tools-extra] [flang] [llvm] [libcxx] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-12 Thread Yeoul Na via cfe-commits
@@ -956,60 +951,199 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * -CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base, - const ValueDecl *CountedByVD) { +namespace { + +/// \

[llvm] [libc] [libcxx] [flang] [clang] [compiler-rt] [clang-tools-extra] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-12 Thread Yeoul Na via cfe-commits
@@ -876,31 +876,26 @@ CodeGenFunction::emitFlexibleArrayMemberSize(const Expr *E, unsigned Type, } // Get the flexible array member Decl. - const ValueDecl *FAMDecl = nullptr; + const RecordDecl *OuterRD = nullptr; if (const auto *ME = dyn_cast(Base)) { // Check

[flang] [libc] [libcxx] [llvm] [compiler-rt] [clang] [clang-tools-extra] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-12 Thread Yeoul Na via cfe-commits
@@ -956,60 +951,199 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } -const Expr * -CodeGenFunction::BuildCountedByFieldExpr(const Expr *Base, - const ValueDecl *CountedByVD) { +namespace { + +/// \

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-12-12 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,844 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[llvm] [libc] [libcxx] [clang-tools-extra] [clang] [compiler-rt] [flang] [Clang] Generate the GEP instead of adding AST nodes (PR #73730)

2023-12-17 Thread Yeoul Na via cfe-commits
@@ -4022,8 +4169,36 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, ArrayLV = EmitArraySubscriptExpr(ASE, /*Accessed*/ true); else ArrayLV = EmitLValue(Array); + auto *Idx = EmitIdxAfterBase(/*Promote*/true); +if (SanOp

[clang] Revert counted_by attribute feature (PR #75857)

2023-12-18 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna approved this pull request. https://github.com/llvm/llvm-project/pull/75857 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,362 @@ +== +``-fbounds-safety``: Enforcing bounds safety for C +== + +.. contents:: + :local: + +Overview + + +``-fbounds-safety`` is a C extension to enforce bound

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
@@ -485,20 +499,83 @@ Pointer types in a ``typedef`` can still have explicit annotations, e.g., ``typedef int *__single``, in which case the bounds annotation ``__single`` will apply to every use of the ``typedef``. -Array to pointer promotion --- - -

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2023-11-29 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna ready_for_review https://github.com/llvm/llvm-project/pull/70749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/76348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -1155,15 +1159,14 @@ const FieldDecl *CodeGenFunction::FindCountedByField(const FieldDecl *FD) { return nullptr; auto GetNonAnonStructOrUnion = [](const RecordDecl *RD) { -while (RD && !RD->getDeclName()) - if (const auto *R = dyn_cast(RD->getDeclContext()))

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } +const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField( +ASTContext &Ctx, const RecordDecl *R

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -944,22 +951,259 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } +namespace { + +/// \p StructAccessBase returns the base \p Expr of a field access. It returns +/// either a \p DeclRefExpr, representing the base pointer to the struct,

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -944,22 +951,259 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } +namespace { + +/// \p StructAccessBase returns the base \p Expr of a field access. It returns +/// either a \p DeclRefExpr, representing the base pointer to the struct,

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } +const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField( +ASTContext &Ctx, const RecordDecl *R

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } +const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField( +ASTContext &Ctx, const RecordDecl *R

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -944,22 +951,262 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } +namespace { + +/// \p StructAccessBase returns the base \p Expr of a field access. It returns +/// either a \p DeclRefExpr, representing the base pointer to the struct,

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -944,22 +951,259 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } +namespace { + +/// \p StructAccessBase returns the base \p Expr of a field access. It returns +/// either a \p DeclRefExpr, representing the base pointer to the struct,

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna commented: I left some comments. Looking good overall but `LocalDeclMap` doesn't seem to serve the purpose for this PR. And I'm not sure the code block using it would be actually necessary. Please see my inlined review. https://github.com/llvm/llvm-project/pull/7634

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -944,22 +951,259 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } +namespace { + +/// \p StructAccessBase returns the base \p Expr of a field access. It returns +/// either a \p DeclRefExpr, representing the base pointer to the struct,

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } +const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField( +ASTContext &Ctx, const RecordDecl *R

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -818,6 +819,189 @@ CodeGenFunction::evaluateOrEmitBuiltinObjectSize(const Expr *E, unsigned Type, return ConstantInt::get(ResType, ObjectSize, /*isSigned=*/true); } +const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField( +ASTContext &Ctx, const RecordDecl *R

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -944,22 +951,262 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } +namespace { + +/// \p StructAccessBase returns the base \p Expr of a field access. It returns +/// either a \p DeclRefExpr, representing the base pointer to the struct,

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -944,22 +951,259 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } +namespace { + +/// \p StructAccessBase returns the base \p Expr of a field access. It returns +/// either a \p DeclRefExpr, representing the base pointer to the struct,

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-08 Thread Yeoul Na via cfe-commits
@@ -944,22 +951,259 @@ static llvm::Value *getArrayIndexingBound(CodeGenFunction &CGF, return nullptr; } +namespace { + +/// \p StructAccessBase returns the base \p Expr of a field access. It returns +/// either a \p DeclRefExpr, representing the base pointer to the struct,

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-09 Thread Yeoul Na via cfe-commits
rapidsna wrote: > This prints a wrapped calculation instead of the expected "0". Shouldn't `getDefaultBuiltinObjectSizeResult` return `-1`? Have you tried `-2` to see if it's returning the negative count value or it happens to be equal to the default value? https://github.com/llvm/llvm-projec

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-09 Thread Yeoul Na via cfe-commits
rapidsna wrote: > The return value of -1 means "I don't know how large this is". @kees Oh, I see. I did not know such the convention. Is it documented somewhere? https://github.com/llvm/llvm-project/pull/76348 ___ cfe-commits mailing list cfe-commits

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-10 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna approved this pull request. > Do you have anything to add? LGTM https://github.com/llvm/llvm-project/pull/76348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-comm

[clang] [Clang] Implement the 'counted_by' attribute (PR #76348)

2024-01-10 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/76348 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-14 Thread Yeoul Na via cfe-commits
rapidsna wrote: @AaronBallman Thank you! The -fbounds-safety documentation is currently shown https://clang.llvm.org/docs/BoundsSafety.html, but yes, we're planning to add the feature in the release note once we have more functionalities in place. https://github.com/llvm/llvm-project/pull/7800

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-15 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 3d2716ad6088f600c14d6ff724aa90453130a1f7 Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 01/14] [BoundsSafety] Introduce CountAttributedType CountAttributedTy

[clang] Unwrap CountAttributed for debug info (PR #86017)

2024-03-20 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna created https://github.com/llvm/llvm-project/pull/86017 Fix crash caused by 3eb9ff30959a670559bcba03d149d4c51bf7c9c9 >From abfcb60e7b65e755733f4d41795aa9cfd44e0cc3 Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Thu, 21 Mar 2024 06:47:05 +0900 Subject: [PATCH] Unwrap

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-20 Thread Yeoul Na via cfe-commits
rapidsna wrote: Thanks @nathanchance. Opened PR to fix the crash. https://github.com/llvm/llvm-project/pull/86017 https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/ma

[clang] Unwrap CountAttributed for debug info (PR #86017)

2024-03-20 Thread Yeoul Na via cfe-commits
rapidsna wrote: Fix crash in https://github.com/llvm/llvm-project/pull/78000 https://github.com/llvm/llvm-project/pull/86017 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Unwrap CountAttributed for debug info (PR #86017)

2024-03-20 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/86017 >From abfcb60e7b65e755733f4d41795aa9cfd44e0cc3 Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Thu, 21 Mar 2024 06:47:05 +0900 Subject: [PATCH 1/2] Unwrap CountAttributed for debug info Fix crash caused by 3eb9ff

[clang] Unwrap CountAttributed for debug info (PR #86017)

2024-03-21 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/86017 >From abfcb60e7b65e755733f4d41795aa9cfd44e0cc3 Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Thu, 21 Mar 2024 06:47:05 +0900 Subject: [PATCH 1/3] Unwrap CountAttributed for debug info Fix crash caused by 3eb9ff

[clang] Unwrap CountAttributed for debug info (PR #86017)

2024-03-22 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna closed https://github.com/llvm/llvm-project/pull/86017 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-06 Thread Yeoul Na via cfe-commits
@@ -8463,133 +8463,110 @@ static void handleZeroCallUsedRegsAttr(Sema &S, Decl *D, const ParsedAttr &AL) { D->addAttr(ZeroCallUsedRegsAttr::Create(S.Context, Kind, AL)); } -static void handleCountedByAttr(Sema &S, Decl *D, const ParsedAttr &AL) { - if (!AL.isArgIdent(0)) {

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-06 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-06 Thread Yeoul Na via cfe-commits
@@ -2917,6 +2942,133 @@ class PointerType : public Type, public llvm::FoldingSetNode { static bool classof(const Type *T) { return T->getTypeClass() == Pointer; } }; +/// [BoundsSafety] Represents information of declarations referenced by the +/// arguments of the `counted_

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-06 Thread Yeoul Na via cfe-commits
rapidsna wrote: > One possibility would be to use a type qualifier? It has basically the kind > of properties you want... the underlying type is > still there, and places > that strip qualifiers will automatically do the right thing in a lot of > cases. It might require a bit more > work to ha

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-06 Thread Yeoul Na via cfe-commits
rapidsna wrote: FWIW, in the context of `-fbounds-safety` (https://github.com/llvm/llvm-project/blob/main/clang/docs/BoundsSafety.rst), I think the best is to have the bounds-annotated types to be part of the canonical type system because they affect the semantics and the codegen (again with

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-07 Thread Yeoul Na via cfe-commits
rapidsna wrote: Thanks @AaronBallman! > I think AttributedType might be a reasonable way forward. That's how we model > nullability qualifiers, for example: The difference from nullability qualifiers is that they are actually encoded as `AttributeKind`, whereas `__counted_by` has to store mo

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-06 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/7] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-06 Thread Yeoul Na via cfe-commits
@@ -13233,6 +13262,32 @@ static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, return QualType(); return Ctx.getUsingType(CD, Ctx.getQualifiedType(Underlying)); } + case Type::CountAttributed: { +const auto *DX = cast(X), + *DY =

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-06 Thread Yeoul Na via cfe-commits
@@ -7239,6 +7239,13 @@ QualType TreeTransform::TransformAttributedType(TypeLocBuilder &TLB, }); } +template +QualType TreeTransform::TransformCountAttributedType( +TypeLocBuilder &TLB, CountAttributedTypeLoc TL) { + // TODO + llvm_unreachable("Unexpected TreeTran

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-06 Thread Yeoul Na via cfe-commits
@@ -4259,7 +4240,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E, if (const auto *ME = dyn_cast(Array); ME && ME->isFlexibleArrayMemberLike(getContext(), StrictFlexArraysLevel) && - ME->getMemberDecl()->hasAttr

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-06 Thread Yeoul Na via cfe-commits
@@ -1117,6 +1117,32 @@ class ObjCInterfaceTypeLoc : public ConcreteTypeLoc { +public: + TypeLoc getInnerLoc() const { return this->getInnerTypeLoc(); } + QualType getInnerType() const { return this->getTypePtr()->desugar(); } + void initializeLocal(ASTContext &Context, SourceL

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-06 Thread Yeoul Na via cfe-commits
@@ -2000,6 +2001,21 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { unsigned NumExpansions; }; + class CountAttributedTypeBitfields { +friend class CountAttributedType; + +LLVM_PREFERRED_TYPE(TypeBitfields) +unsigned : NumTypeBits; +

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-06 Thread Yeoul Na via cfe-commits
rapidsna wrote: @AaronBallman thanks for the review! I addressed your comments. https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-06 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/8] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-07 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/9] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-07 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 3d2716ad6088f600c14d6ff724aa90453130a1f7 Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/9] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-07 Thread Yeoul Na via cfe-commits
rapidsna wrote: @Endilll I just rebased it so you can review `Sema.h`. https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-08 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 3d2716ad6088f600c14d6ff724aa90453130a1f7 Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 01/10] [BoundsSafety] Introduce CountAttributedType CountAttributedTy

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-03-08 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 3d2716ad6088f600c14d6ff724aa90453130a1f7 Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 01/11] [BoundsSafety] Introduce CountAttributedType CountAttributedTy

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-26 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/6] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-26 Thread Yeoul Na via cfe-commits
rapidsna wrote: Gentle reminder @bwendling @AaronBallman. I'd like to land this patch soon, so we can open source more of -fbounds-safety work. Could you please take a look? https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list

[clang] [WIP] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-30 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/8] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-30 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-30 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/9] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] [clang-tools-extra] [llvm] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-30 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/9] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] [clang-tools-extra] [llvm] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna ready_for_review https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] [llvm] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 01/10] [BoundsSafety] Introduce CountAttributedType CountAttributedTy

[clang-tools-extra] [llvm] [clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 01/11] [BoundsSafety] Introduce CountAttributedType CountAttributedTy

[llvm] [clang-tools-extra] [clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 01/12] [BoundsSafety] Introduce CountAttributedType CountAttributedTy

[llvm] [clang-tools-extra] [clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 01/12] [BoundsSafety] Introduce CountAttributedType CountAttributedTy

[llvm] [clang-tools-extra] [clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 01/13] [BoundsSafety] Introduce CountAttributedType CountAttributedTy

[clang-tools-extra] [llvm] [clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna converted_to_draft https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH] [BoundsSafety] Introduce CountAttributedType CountAttributedType is

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna ready_for_review https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From c39871ed2ec642ab00360f2c3a18fba7c915f82d Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/2] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-01 Thread Yeoul Na via cfe-commits
rapidsna wrote: @AaronBallman @bwendling I'd appreciate your feedback! https://github.com/llvm/llvm-project/pull/78000 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-02-05 Thread Yeoul Na via cfe-commits
rapidsna wrote: > It's generally not a good idea to use sugar to represent constructs that are > semantically significant: anything that uses the canonical type will throw it > away. We try to avoid throwing away sugar in most cases, but we aren't always > successful. > It's possible there ar

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2024-01-12 Thread Yeoul Na via cfe-commits
rapidsna wrote: > Thank you for the updates; the changes LGTM! @AaronBallman Thanks for your review and insightful feedback! https://github.com/llvm/llvm-project/pull/70749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2024-01-12 Thread Yeoul Na via cfe-commits
rapidsna wrote: Rebased https://github.com/llvm/llvm-project/pull/70749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WIP] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-12 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna created https://github.com/llvm/llvm-project/pull/78000 In `-fbounds-safety`, bounds annotations are considered type attributes rather than declaration attributes. Constructing them as type attributes allows us to extend the attribute to apply nested pointers, which

[clang] [BoundsSafety] Initial documentation for -fbounds-safety (PR #70749)

2024-01-16 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna closed https://github.com/llvm/llvm-project/pull/70749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WIP] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-22 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/4] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] [WIP] Turn 'counted_by' into a type attribute and parse it into 'CountAttributedType' (PR #78000)

2024-01-22 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/78000 >From 1a17c254ddf09cd4faf5217b2f72da3f44622f8a Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Mon, 18 Dec 2023 10:58:16 +0900 Subject: [PATCH 1/5] [BoundsSafety] Introduce CountAttributedType CountAttributedType

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna created https://github.com/llvm/llvm-project/pull/70480 -fbounds-safety-experimental is an experimental flag for -fbounds-safety, which is a bounds-safety extension for C. -fbounds-safety will require substantial changes across the Clang codebase. So we introduce th

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Yeoul Na via cfe-commits
rapidsna wrote: I'll push BoundsSafety.rst documentation in a separate PR. https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2   3   >