[PATCH] D78116: [AST] dont invaliate VarDecl when the initializer contains errors.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 14 12:58:20 PDT 2020
sammccall added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:11998
ExprResult Result = InitSeq.Perform(*this, Entity, Kind, Args, &DclT);
if (Result.isInvalid()) {
+ auto RecoveryExpr =
----------------
if the variable is an undeduced auto (and the type of the recoveryexpr is unknown), we still have to mark it invalid. Does that happen somewhere else?
================
Comment at: clang/test/AST/ast-dump-invalid-initialized.cpp:19
+ // CHECK: `-VarDecl {{.*}} a6 'A'
+ A a6(invalid());
+ // CHECK: `-VarDecl {{.*}} a7 'A'
----------------
what actually is the AST here? invalid() is a recoveryexpr, does it get wrapped in a second recoveryexpr by the code in this patch? Or is this testing existing behavior?
================
Comment at: clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp:1
-// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify %s
-// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -frecovery-ast -verify %s
+// RUN: %clang_cc1 -std=c++14 -fsyntax-only -frecovery-ast -verify %s
----------------
not sure we should be switching this until we flip the default.
Are we regressing the diagnostics under default flags?
(and in 2 other files)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78116/new/
https://reviews.llvm.org/D78116
More information about the cfe-commits
mailing list