@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/102549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/102549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
https://github.com/bwendling commented:
I made changes to use the CustomTypeChecking for the builtin. PTAL
https://github.com/llvm/llvm-project/pull/102549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/l
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/102549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -6590,8 +6590,34 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn,
SourceLocation LParenLoc,
return CallExpr::Create(Context, Fn, ArgExprs, Context.DependentTy,
VK_PRValue, RParenLoc, CurFPFeatureOverrides());
}
- return BuildResol
@@ -4678,6 +4678,19 @@ void FieldDecl::printName(raw_ostream &OS, const
PrintingPolicy &Policy) const {
DeclaratorDecl::printName(OS, Policy);
}
+const FieldDecl *FieldDecl::FindCountedByField() const {
+ const auto *CAT = getType()->getAs();
+ if (!CAT)
+return nullp
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
https://github.com/bwendling updated
https://github.com/llvm/llvm-project/pull/102549
>From 7ba43ae2b737fbd868848a23b58b3965f8d36ce1 Mon Sep 17 00:00:00 2001
From: Bill Wendling
Date: Tue, 6 Aug 2024 17:49:01 -0700
Subject: [PATCH 01/11] [WIP][Clang] Add __builtin_get_counted_by builtin
The __
@@ -4774,3 +4774,9 @@ def ArithmeticFence : LangBuiltin<"ALL_LANGUAGES"> {
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}
+
+def GetCountedBy : Builtin {
+ let Spellings = ["__builtin_get_counted_by"];
+ let Attributes = [NoThrow];
+ let
@@ -537,15 +537,21 @@ class Expr : public ValueStmt {
/// semantically correspond to a bool.
bool isKnownToHaveBooleanValue(bool Semantic = true) const;
- /// Check whether this array fits the idiom of a flexible array member,
- /// depending on the value of -fstrict-fle
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/102549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -537,15 +537,21 @@ class Expr : public ValueStmt {
/// semantically correspond to a bool.
bool isKnownToHaveBooleanValue(bool Semantic = true) const;
- /// Check whether this array fits the idiom of a flexible array member,
- /// depending on the value of -fstrict-fle
bwendling wrote:
> Hmm, I could see how this could be useful, but it seems like a rather niche
> use case.
>
> @AaronBallman Should this go through the ususal process of someone writing an
> RFC for it seeing as it is a language extension?
I'll be happy to open this up to the larger community
Sirraide wrote:
Also, as ever, I forgot to mention this, but this also needs a release note and
it should also go in the docs next to all the other builtins
(`clang/docs/LanguageExtensions.rst`).
https://github.com/llvm/llvm-project/pull/102549
___
c
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
@@ -6590,8 +6590,34 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn,
SourceLocation LParenLoc,
return CallExpr::Create(Context, Fn, ArgExprs, Context.DependentTy,
VK_PRValue, RParenLoc, CurFPFeatureOverrides());
}
- return BuildResol
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
@@ -6590,8 +6590,34 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn,
SourceLocation LParenLoc,
return CallExpr::Create(Context, Fn, ArgExprs, Context.DependentTy,
VK_PRValue, RParenLoc, CurFPFeatureOverrides());
}
- return BuildResol
@@ -4678,6 +4678,19 @@ void FieldDecl::printName(raw_ostream &OS, const
PrintingPolicy &Policy) const {
DeclaratorDecl::printName(OS, Policy);
}
+const FieldDecl *FieldDecl::FindCountedByField() const {
+ const auto *CAT = getType()->getAs();
+ if (!CAT)
+return nullp
@@ -6590,8 +6590,34 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn,
SourceLocation LParenLoc,
return CallExpr::Create(Context, Fn, ArgExprs, Context.DependentTy,
VK_PRValue, RParenLoc, CurFPFeatureOverrides());
}
- return BuildResol
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
@@ -222,6 +222,49 @@ bool Expr::isFlexibleArrayMemberLike(
IgnoreTemplateOrMacroSubstitution);
}
+namespace {
+
+/// MemberExprVisitor - Find the MemberExpr through all of the casts, array
+/// subscripts, and unary ops. This intentiona
@@ -4774,3 +4774,9 @@ def ArithmeticFence : LangBuiltin<"ALL_LANGUAGES"> {
let Attributes = [CustomTypeChecking, Constexpr];
let Prototype = "void(...)";
}
+
+def GetCountedBy : Builtin {
+ let Spellings = ["__builtin_get_counted_by"];
+ let Attributes = [NoThrow];
+ let
@@ -537,15 +537,21 @@ class Expr : public ValueStmt {
/// semantically correspond to a bool.
bool isKnownToHaveBooleanValue(bool Semantic = true) const;
- /// Check whether this array fits the idiom of a flexible array member,
- /// depending on the value of -fstrict-fle
@@ -6590,8 +6590,34 @@ ExprResult Sema::BuildCallExpr(Scope *Scope, Expr *Fn,
SourceLocation LParenLoc,
return CallExpr::Create(Context, Fn, ArgExprs, Context.DependentTy,
VK_PRValue, RParenLoc, CurFPFeatureOverrides());
}
- return BuildResol
https://github.com/Sirraide requested changes to this pull request.
Hmm, I could see how this could be useful, but it seems like a rather niche use
case.
@AaronBallman Should this go through the ususal process of someone writing an
RFC for it seeing as it is a language extension?
I also saw t
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/102549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
bwendling wrote:
I removed the WIP and updated the description. I'll look into adding some more
diagnostics.
https://github.com/llvm/llvm-project/pull/102549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailma
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/102549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/bwendling edited
https://github.com/llvm/llvm-project/pull/102549
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
35 matches
Mail list logo