Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jul 2023 18:27:17 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 784ed70844eb - stable/13 - Merge commit 9ca395b5ade1 from llvm-project (by Haojian Wu):
Message-ID:  <202307231827.36NIRHkC058927@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=784ed70844eb12f3b62dfc9e9f03b9bef97bee54

commit 784ed70844eb12f3b62dfc9e9f03b9bef97bee54
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-07-19 09:18:50 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-07-23 17:38:12 +0000

    Merge commit 9ca395b5ade1 from llvm-project (by Haojian Wu):
    
      [clang][AST] Propagate the contains-errors bit to DeclRefExpr from VarDecl's initializer.
    
      Similar to the https://reviews.llvm.org/D86048 (it only sets the bit for C++
      code), we propagate the contains-errors bit for C-code path.
    
      Fixes https://github.com/llvm/llvm-project/issues/50236
      Fixes https://github.com/llvm/llvm-project/issues/50243
      Fixes https://github.com/llvm/llvm-project/issues/48636
      Fixes https://github.com/llvm/llvm-project/issues/50320
    
      Differential Revision: https://reviews.llvm.org/D154861
    
    This fixes an assertion ('Assertion failed: ((LHSExpr->containsErrors()
    || RHSExpr->containsErrors()) && "Should only occur in error-recovery
    path."), function BuildBinOp') when building parts of dtrace in certain
    scenarios.
    
    Reported by:    dstolfa
    PR:             271047
    MFC after:      1 month
    
    (cherry picked from commit 8d0cab8800e19cddc56d4a532abdbe9f0ac6c620)
---
 contrib/llvm-project/clang/lib/AST/ComputeDependence.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/contrib/llvm-project/clang/lib/AST/ComputeDependence.cpp b/contrib/llvm-project/clang/lib/AST/ComputeDependence.cpp
index eb9afbdb1c87..b5c783b07d92 100644
--- a/contrib/llvm-project/clang/lib/AST/ComputeDependence.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ComputeDependence.cpp
@@ -489,7 +489,7 @@ ExprDependence clang::computeDependence(DeclRefExpr *E, const ASTContext &Ctx) {
   // more bullets here that we handle by treating the declaration as having a
   // dependent type if they involve a placeholder type that can't be deduced.]
   if (Type->isDependentType())
-    return Deps | ExprDependence::TypeValueInstantiation;
+    Deps |= ExprDependence::TypeValueInstantiation;
   else if (Type->isInstantiationDependentType())
     Deps |= ExprDependence::Instantiation;
 
@@ -525,13 +525,13 @@ ExprDependence clang::computeDependence(DeclRefExpr *E, const ASTContext &Ctx) {
   //   - it names a potentially-constant variable that is initialized with an
   //     expression that is value-dependent
   if (const auto *Var = dyn_cast<VarDecl>(Decl)) {
-    if (Var->mightBeUsableInConstantExpressions(Ctx)) {
-      if (const Expr *Init = Var->getAnyInitializer()) {
-        if (Init->isValueDependent())
-          Deps |= ExprDependence::ValueInstantiation;
-        if (Init->containsErrors())
-          Deps |= ExprDependence::Error;
-      }
+    if (const Expr *Init = Var->getAnyInitializer()) {
+      if (Init->containsErrors())
+        Deps |= ExprDependence::Error;
+
+      if (Var->mightBeUsableInConstantExpressions(Ctx) &&
+          Init->isValueDependent())
+        Deps |= ExprDependence::ValueInstantiation;
     }
 
     // - it names a static data member that is a dependent member of the



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307231827.36NIRHkC058927>