[clang] [clang] Add invalid check in NormalizedConstraint::fromConstraintExpr. (PR #86943)

2024-03-28 Thread Haojian Wu via cfe-commits

https://github.com/hokein closed https://github.com/llvm/llvm-project/pull/86943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add invalid check in NormalizedConstraint::fromConstraintExpr. (PR #86943)

2024-03-28 Thread Haojian Wu via cfe-commits


@@ -1356,6 +1356,8 @@ NormalizedConstraint::fromConstraintExpr(Sema , 
NamedDecl *D, const Expr *E) {
   S, CSE->getExprLoc(),
   Sema::InstantiatingTemplate::ConstraintNormalization{}, D,
   CSE->getSourceRange());
+  if (Inst.isInvalid())
+return std::nullptr;

hokein wrote:

good catch!

https://github.com/llvm/llvm-project/pull/86943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add invalid check in NormalizedConstraint::fromConstraintExpr. (PR #86943)

2024-03-28 Thread Haojian Wu via cfe-commits

https://github.com/hokein updated 
https://github.com/llvm/llvm-project/pull/86943

>From cb863750a7c57e76bbb8d63cc88975f5adaa65aa Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Thu, 28 Mar 2024 13:23:51 +0100
Subject: [PATCH 1/2] [clang] Add invalid check in
 NormalizedConstraint::fromConstraintExpr.

This is an oversight spot in #86869, we should always check the invalid bit 
after
constructing the `Sema::InstantiatingTemplate` RAII object.
---
 clang/lib/Sema/SemaConcept.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index a2d8ba9a96d7a4..61979816bf4e3c 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1356,6 +1356,8 @@ NormalizedConstraint::fromConstraintExpr(Sema , 
NamedDecl *D, const Expr *E) {
   S, CSE->getExprLoc(),
   Sema::InstantiatingTemplate::ConstraintNormalization{}, D,
   CSE->getSourceRange());
+  if (Inst.isInvalid())
+return std::nullptr;
   // C++ [temp.constr.normal]p1.1
   // [...]
   // The normal form of an id-expression of the form C,

>From efb0e700a7f007164cd73c7d43e22b01cb652da0 Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Thu, 28 Mar 2024 18:52:08 +0100
Subject: [PATCH 2/2] Fix a typo

---
 clang/lib/Sema/SemaConcept.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 61979816bf4e3c..b2986c5012ea2b 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1357,7 +1357,7 @@ NormalizedConstraint::fromConstraintExpr(Sema , 
NamedDecl *D, const Expr *E) {
   Sema::InstantiatingTemplate::ConstraintNormalization{}, D,
   CSE->getSourceRange());
   if (Inst.isInvalid())
-return std::nullptr;
+return std::nullopt;
   // C++ [temp.constr.normal]p1.1
   // [...]
   // The normal form of an id-expression of the form C,

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add invalid check in NormalizedConstraint::fromConstraintExpr. (PR #86943)

2024-03-28 Thread via cfe-commits

https://github.com/Sirraide approved this pull request.

There’s a typo, but LGTM otherwise.

https://github.com/llvm/llvm-project/pull/86943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add invalid check in NormalizedConstraint::fromConstraintExpr. (PR #86943)

2024-03-28 Thread via cfe-commits


@@ -1356,6 +1356,8 @@ NormalizedConstraint::fromConstraintExpr(Sema , 
NamedDecl *D, const Expr *E) {
   S, CSE->getExprLoc(),
   Sema::InstantiatingTemplate::ConstraintNormalization{}, D,
   CSE->getSourceRange());
+  if (Inst.isInvalid())
+return std::nullptr;

Sirraide wrote:

```suggestion
return std::nullopt;
```
Typo.

https://github.com/llvm/llvm-project/pull/86943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add invalid check in NormalizedConstraint::fromConstraintExpr. (PR #86943)

2024-03-28 Thread via cfe-commits

https://github.com/Sirraide edited 
https://github.com/llvm/llvm-project/pull/86943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add invalid check in NormalizedConstraint::fromConstraintExpr. (PR #86943)

2024-03-28 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Haojian Wu (hokein)


Changes

This is an oversight spot in #86869, we should always check the invalid 
bit after constructing the `Sema::InstantiatingTemplate` RAII object.

---
Full diff: https://github.com/llvm/llvm-project/pull/86943.diff


1 Files Affected:

- (modified) clang/lib/Sema/SemaConcept.cpp (+2) 


``diff
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index a2d8ba9a96d7a4..61979816bf4e3c 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1356,6 +1356,8 @@ NormalizedConstraint::fromConstraintExpr(Sema , 
NamedDecl *D, const Expr *E) {
   S, CSE->getExprLoc(),
   Sema::InstantiatingTemplate::ConstraintNormalization{}, D,
   CSE->getSourceRange());
+  if (Inst.isInvalid())
+return std::nullptr;
   // C++ [temp.constr.normal]p1.1
   // [...]
   // The normal form of an id-expression of the form C,

``




https://github.com/llvm/llvm-project/pull/86943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang] Add invalid check in NormalizedConstraint::fromConstraintExpr. (PR #86943)

2024-03-28 Thread Haojian Wu via cfe-commits

https://github.com/hokein created 
https://github.com/llvm/llvm-project/pull/86943

This is an oversight spot in #86869, we should always check the invalid bit 
after constructing the `Sema::InstantiatingTemplate` RAII object.

>From cb863750a7c57e76bbb8d63cc88975f5adaa65aa Mon Sep 17 00:00:00 2001
From: Haojian Wu 
Date: Thu, 28 Mar 2024 13:23:51 +0100
Subject: [PATCH] [clang] Add invalid check in
 NormalizedConstraint::fromConstraintExpr.

This is an oversight spot in #86869, we should always check the invalid bit 
after
constructing the `Sema::InstantiatingTemplate` RAII object.
---
 clang/lib/Sema/SemaConcept.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index a2d8ba9a96d7a4..61979816bf4e3c 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1356,6 +1356,8 @@ NormalizedConstraint::fromConstraintExpr(Sema , 
NamedDecl *D, const Expr *E) {
   S, CSE->getExprLoc(),
   Sema::InstantiatingTemplate::ConstraintNormalization{}, D,
   CSE->getSourceRange());
+  if (Inst.isInvalid())
+return std::nullptr;
   // C++ [temp.constr.normal]p1.1
   // [...]
   // The normal form of an id-expression of the form C,

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits