@@ -2280,18 +2294,18 @@ class FunctionDecl : public DeclaratorDecl,
/// Returns whether this specific declaration of the function has a body.
bool doesThisDeclarationHaveABody() const {
-return (!FunctionDeclBits.HasDefaultedFunctionInfo && Body) ||
+return
@@ -2280,18 +2294,18 @@ class FunctionDecl : public DeclaratorDecl,
/// Returns whether this specific declaration of the function has a body.
bool doesThisDeclarationHaveABody() const {
-return (!FunctionDeclBits.HasDefaultedFunctionInfo && Body) ||
+return
@@ -2280,18 +2294,18 @@ class FunctionDecl : public DeclaratorDecl,
/// Returns whether this specific declaration of the function has a body.
bool doesThisDeclarationHaveABody() const {
-return (!FunctionDeclBits.HasDefaultedFunctionInfo && Body) ||
+return
https://github.com/Sirraide closed
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -70,8 +108,14 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(
? diag::warn_cxx98_compat_defaulted_deleted_function
: diag::ext_defaulted_deleted_function)
<< 1 /* deleted */;
- Actions.SetDeclDeleted(FnD, KWLoc);
+
@@ -1936,6 +1936,9 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl
*D) {
if (D->isTrivial())
OS << " trivial";
+ if (const StringLiteral *M = D->getDeletedMessage())
Sirraide wrote:
Thanks for pointing that out; it’s sometimes hard to
@@ -0,0 +1,48 @@
+// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,pre26 -pedantic %s
+// RUN: %clang_cc1 -std=c++2c -fsyntax-only -verify=expected,compat
-Wpre-c++26-compat %s
+// RUN: %clang_cc1 -std=c++2c -fsyntax-only -verify %s
+
+struct S {
+ void a() =
@@ -1415,6 +1416,12 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator
,
: diag::ext_defaulted_deleted_function)
<< 1 /* deleted */;
BodyKind = Sema::FnBodyKind::Delete;
+ DeletedMessage = ParseCXXDeletedFunctionMessage();
+
@@ -70,8 +108,14 @@ NamedDecl *Parser::ParseCXXInlineMethodDef(
? diag::warn_cxx98_compat_defaulted_deleted_function
: diag::ext_defaulted_deleted_function)
<< 1 /* deleted */;
- Actions.SetDeclDeleted(FnD, KWLoc);
+
@@ -1936,6 +1936,9 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl
*D) {
if (D->isTrivial())
OS << " trivial";
+ if (const StringLiteral *M = D->getDeletedMessage())
AaronBallman wrote:
You should do similar in JSONNodeDumper.cpp as
@@ -1981,21 +1981,35 @@ class FunctionDecl : public DeclaratorDecl,
};
- /// Stashed information about a defaulted function definition whose body has
- /// not yet been lazily generated.
- class DefaultedFunctionInfo final
- : llvm::TrailingObjects {
+ /// Stashed
@@ -8857,7 +8856,7 @@ def
err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
"address argument to nontemporal builtin must be a pointer to integer,
float, "
"pointer, or a vector of such types (%0 invalid)">;
-def err_deleted_function_use :
https://github.com/AaronBallman edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/AaronBallman approved this pull request.
In general, this LGTM, thank you! I did spot some minor stuff, but feel free to
fix it up when landing.
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
@@ -14527,20 +14525,24 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc,
UnaryOperatorKind Opc,
UnaryOperator::getOpcodeStr(Opc), OpLoc);
return ExprError();
- case OR_Deleted:
+ case OR_Deleted: {
// CreateOverloadedUnaryOp fills the first element of
@@ -14527,20 +14525,24 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc,
UnaryOperatorKind Opc,
UnaryOperator::getOpcodeStr(Opc), OpLoc);
return ExprError();
- case OR_Deleted:
+ case OR_Deleted: {
// CreateOverloadedUnaryOp fills the first element of
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -14527,20 +14525,24 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc,
UnaryOperatorKind Opc,
UnaryOperator::getOpcodeStr(Opc), OpLoc);
return ExprError();
- case OR_Deleted:
+ case OR_Deleted: {
// CreateOverloadedUnaryOp fills the first element of
https://github.com/erichkeane approved this pull request.
1 set of 'nits' a few places, else LGTM.
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -3092,30 +3092,65 @@ bool FunctionDecl::isVariadic() const {
return false;
}
-FunctionDecl::DefaultedFunctionInfo *
-FunctionDecl::DefaultedFunctionInfo::Create(ASTContext ,
-ArrayRef Lookups) {
- DefaultedFunctionInfo *Info =
@@ -3092,30 +3092,65 @@ bool FunctionDecl::isVariadic() const {
return false;
}
-FunctionDecl::DefaultedFunctionInfo *
-FunctionDecl::DefaultedFunctionInfo::Create(ASTContext ,
-ArrayRef Lookups) {
- DefaultedFunctionInfo *Info =
@@ -14527,20 +14525,24 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc,
UnaryOperatorKind Opc,
UnaryOperator::getOpcodeStr(Opc), OpLoc);
return ExprError();
- case OR_Deleted:
+ case OR_Deleted: {
// CreateOverloadedUnaryOp fills the first element of
https://github.com/erichkeane edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/cor3ntin approved this pull request.
Thanks for putting up with my comments and working on this feature.
I'm pretty happy with the state of the PR.
Please give it a day or two in case @erichkeane @AaronBallman @shafik
@Fznamznon have further comments
@@ -1981,21 +1981,35 @@ class FunctionDecl : public DeclaratorDecl,
};
- /// Stashed information about a defaulted function definition whose body has
- /// not yet been lazily generated.
- class DefaultedFunctionInfo final
- : llvm::TrailingObjects {
+ /// Stashed
@@ -1981,21 +1981,35 @@ class FunctionDecl : public DeclaratorDecl,
};
- /// Stashed information about a defaulted function definition whose body has
- /// not yet been lazily generated.
- class DefaultedFunctionInfo final
- : llvm::TrailingObjects {
+ /// Stashed
@@ -2484,6 +2498,9 @@ class FunctionDecl : public DeclaratorDecl,
void setDeletedAsWritten(bool D = true) { FunctionDeclBits.IsDeleted = D; }
+ /// Only valid if isDeletedAsWritten() returns true.
+ void setDeletedMessage(StringLiteral *Message);
+
@@ -2484,6 +2498,9 @@ class FunctionDecl : public DeclaratorDecl,
void setDeletedAsWritten(bool D = true) { FunctionDeclBits.IsDeleted = D; }
+ /// Only valid if isDeletedAsWritten() returns true.
+ void setDeletedMessage(StringLiteral *Message);
+
@@ -1981,21 +1981,35 @@ class FunctionDecl : public DeclaratorDecl,
};
- /// Stashed information about a defaulted function definition whose body has
- /// not yet been lazily generated.
- class DefaultedFunctionInfo final
- : llvm::TrailingObjects {
+ /// Stashed
@@ -1981,21 +1981,35 @@ class FunctionDecl : public DeclaratorDecl,
};
- /// Stashed information about a defaulted function definition whose body has
- /// not yet been lazily generated.
- class DefaultedFunctionInfo final
- : llvm::TrailingObjects {
+ /// Stashed
@@ -2484,6 +2498,9 @@ class FunctionDecl : public DeclaratorDecl,
void setDeletedAsWritten(bool D = true) { FunctionDeclBits.IsDeleted = D; }
+ /// Only valid if isDeletedAsWritten() returns true.
+ void setDeletedMessage(StringLiteral *Message);
+
@@ -1981,21 +1981,35 @@ class FunctionDecl : public DeclaratorDecl,
};
- /// Stashed information about a defaulted function definition whose body has
- /// not yet been lazily generated.
- class DefaultedFunctionInfo final
- : llvm::TrailingObjects {
+ /// Stashed
@@ -709,6 +712,11 @@ void ODRHash::AddFunctionDecl(const FunctionDecl *Function,
return;
}
+ if (DeletedMessage) {
+ID.AddString(DeletedMessage->getBytes());
+return;
+ }
+
Sirraide wrote:
> (there is a question of whether
https://github.com/cor3ntin commented:
Last batch of nitpicks, and then I think I'll be happy enough to approve this
patch!
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
@@ -2484,6 +2498,9 @@ class FunctionDecl : public DeclaratorDecl,
void setDeletedAsWritten(bool D = true) { FunctionDeclBits.IsDeleted = D; }
+ /// Only valid if isDeletedAsWritten() returns true.
+ void setDeletedMessage(StringLiteral *Message);
+
@@ -1981,21 +1981,35 @@ class FunctionDecl : public DeclaratorDecl,
};
- /// Stashed information about a defaulted function definition whose body has
- /// not yet been lazily generated.
- class DefaultedFunctionInfo final
- : llvm::TrailingObjects {
+ /// Stashed
@@ -750,6 +750,9 @@ static void InitializeCPlusPlusFeatureTestMacros(const
LangOptions ,
Builder.defineMacro("__cpp_named_character_escapes", "202207L");
Builder.defineMacro("__cpp_placeholder_variables", "202306L");
+ // C++26 features supported in earlier language
https://github.com/cor3ntin edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -709,6 +712,11 @@ void ODRHash::AddFunctionDecl(const FunctionDecl *Function,
return;
}
+ if (DeletedMessage) {
+ID.AddString(DeletedMessage->getBytes());
+return;
+ }
+
cor3ntin wrote:
I would move that after `AddBoolean(DeletedMessage);`
Sirraide wrote:
Just added the deleted message to the ODR hash as well. Not too familiar w/ ODR
checking though, so I wasn’t sure whether to include it only if `SkipBody` is
`false`.
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits
Sirraide wrote:
> did you see this comment? [#86526
> (review)](https://github.com/llvm/llvm-project/pull/86526#pullrequestreview-1976690810)
Thanks for reminding me; I did see that one but ended up forgetting about it
because I was sick for pretty much all of last week; I’ll take a look at
cor3ntin wrote:
Thanks for the new tests. did you see this comment?
https://github.com/llvm/llvm-project/pull/86526#pullrequestreview-1976690810
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
Sirraide wrote:
I’ve also added a parser test for that as well just now.
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Sirraide wrote:
> I wanted to make you aware of this new core issue
> https://cplusplus.github.io/CWG/issues/2876.html (which i think we should
> have tests for). Thanks
So, as of now, this
```c++
using T = void ();
using U = int;
T a = delete ("hello");
U b = delete ("hello"), c, d = delete
cor3ntin wrote:
I wanted to make you aware of this new core issue
https://cplusplus.github.io/CWG/issues/2876.html (which i think we should have
tests for). Thanks
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
Sirraide wrote:
> Tests need to be fleshed out, I'd like to see template specializations +
> partial template specializations as well as special member functions and
> operators.
Forgot to mention it explicitly, but I’ve added more tests and implemented this
for all the other sema
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/86526
>From 98af47e8ccc633016c14b91c221f9f8fc620f068 Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Mon, 25 Mar 2024 14:46:52 +0100
Subject: [PATCH 01/15] [Clang] Parse `= delete("message")`
---
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/86526
>From 98af47e8ccc633016c14b91c221f9f8fc620f068 Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Mon, 25 Mar 2024 14:46:52 +0100
Subject: [PATCH 01/14] [Clang] Parse `= delete("message")`
---
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/86526
>From 98af47e8ccc633016c14b91c221f9f8fc620f068 Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Mon, 25 Mar 2024 14:46:52 +0100
Subject: [PATCH 01/13] [Clang] Parse `= delete("message")`
---
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -std=c++2c -fsyntax-only -verify %s
Sirraide wrote:
Done.
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/86526
>From 98af47e8ccc633016c14b91c221f9f8fc620f068 Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Mon, 25 Mar 2024 14:46:52 +0100
Subject: [PATCH 01/11] [Clang] Parse `= delete("message")`
---
@@ -18157,7 +18158,7 @@ void Sema::SetDeclDeleted(Decl *Dcl, SourceLocation
DelLoc) {
// C++11 [dcl.fct.def.delete]p4:
// A deleted function is implicitly inline.
Fn->setImplicitlyInline();
- Fn->setDeletedAsWritten();
+ Fn->setDeletedWithMessage(Message);
Sirraide wrote:
So, the message is now stored in the `DefaultFunctionInfo`, which I’ve renamed
to `ExtraFunctionInfo`; because setting the deleted message may require
allocating a `DefaultFunctionInfo`, I’ve added a separate function for that
(`FunctionDecl::setDeletedMessage()`).
@@ -2013,6 +2013,12 @@ class FunctionDecl : public DeclaratorDecl,
DefaultedFunctionInfo *DefaultedInfo;
};
+ /// Message that indicates why this function was deleted.
+ ///
+ /// FIXME: Figure out where to actually put this; maybe in the
+ /// 'DefaultedInfo'
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/86526
>From 98af47e8ccc633016c14b91c221f9f8fc620f068 Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Mon, 25 Mar 2024 14:46:52 +0100
Subject: [PATCH 01/10] [Clang] Parse `= delete("message")`
---
@@ -1473,7 +1475,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator
,
D.getMutableDeclSpec().abort();
if (BodyKind != Sema::FnBodyKind::Other) {
-Actions.SetFunctionBodyKind(Res, KWLoc, BodyKind);
+Actions.SetFunctionBodyKind(Res, KWLoc, BodyKind,
@@ -761,6 +761,13 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
}
}
+ // FIXME: Hack: We're out of bits in FunctionDeclBits, so always
+ // add this even though it's 0 in the vast majority of cases. We
+ // might really want to consider storing this in
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/86526
>From 98af47e8ccc633016c14b91c221f9f8fc620f068 Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Mon, 25 Mar 2024 14:46:52 +0100
Subject: [PATCH 1/9] [Clang] Parse `= delete("message")`
---
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/86526
>From 98af47e8ccc633016c14b91c221f9f8fc620f068 Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Mon, 25 Mar 2024 14:46:52 +0100
Subject: [PATCH 1/8] [Clang] Parse `= delete("message")`
---
@@ -873,9 +873,14 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
if (D->isPureVirtual())
Out << " = 0";
- else if (D->isDeletedAsWritten())
+ else if (D->isDeletedAsWritten()) {
Out << " = delete";
- else if (D->isExplicitlyDefaulted())
+if (const
@@ -1936,6 +1936,9 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl
*D) {
if (D->isTrivial())
OS << " trivial";
+ if (const auto *M = D->getDeletedMessage())
Fznamznon wrote:
Here too.
```suggestion
if (const StringLiteral *M =
@@ -873,9 +873,14 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
if (D->isPureVirtual())
Out << " = 0";
- else if (D->isDeletedAsWritten())
+ else if (D->isDeletedAsWritten()) {
Out << " = delete";
- else if (D->isExplicitlyDefaulted())
+if (const
@@ -761,6 +761,13 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
}
}
+ // FIXME: Hack: We're out of bits in FunctionDeclBits, so always
+ // add this even though it's 0 in the vast majority of cases. We
+ // might really want to consider storing this in
@@ -761,6 +761,13 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
}
}
+ // FIXME: Hack: We're out of bits in FunctionDeclBits, so always
+ // add this even though it's 0 in the vast majority of cases. We
+ // might really want to consider storing this in
cor3ntin wrote:
The last bullet point of your todo list should be done as a follow up PR.
everything else can/should be done here.
I agree that back-porting this feature seems reasonable
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/86526
>From 98af47e8ccc633016c14b91c221f9f8fc620f068 Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Mon, 25 Mar 2024 14:46:52 +0100
Subject: [PATCH 1/7] [Clang] Parse `= delete("message")`
---
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/Sirraide updated
https://github.com/llvm/llvm-project/pull/86526
>From 98af47e8ccc633016c14b91c221f9f8fc620f068 Mon Sep 17 00:00:00 2001
From: Sirraide
Date: Mon, 25 Mar 2024 14:46:52 +0100
Subject: [PATCH 1/6] [Clang] Parse `= delete("message")`
---
github-actions[bot] wrote:
:white_check_mark: With the latest revision this PR passed the Python code
formatter.
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
github-actions[bot] wrote:
:white_check_mark: With the latest revision this PR passed the C/C++ code
formatter.
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://github.com/Sirraide edited
https://github.com/llvm/llvm-project/pull/86526
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
77 matches
Mail list logo