Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

hokein
Copy link
Collaborator

@hokein hokein commented Mar 28, 2024

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

This is an oversight spot in llvm#86869, we should always check the invalid bit after
constructing the `Sema::InstantiatingTemplate` RAII object.
@hokein hokein requested a review from shafik March 28, 2024 12:27
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Mar 28, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 28, 2024

@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 --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 &S, 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<A1, A2, ..., AN>,

Copy link
Contributor

@Sirraide Sirraide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s a typo, but LGTM otherwise.

clang/lib/Sema/SemaConcept.cpp Outdated Show resolved Hide resolved
@hokein hokein merged commit 5990278 into llvm:main Mar 28, 2024
3 of 4 checks passed
@hokein hokein deleted the invalid-instantiating-template branch March 28, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants