[PATCH] D79160: [AST] Preserve the type in RecoveryExprs for broken function calls.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 06:54:31 PDT 2020


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/AST/ComputeDependence.cpp:488
 ExprDependence clang::computeDependence(RecoveryExpr *E) {
+  // Even we know the concrete type of the RecoveryExpr, we just get rid of the
+  // type-dependent bit (rather than all three bits) to avoid extra risk of
----------------
This comment is hard to understand in isolation: it describes what the patch is doing (compared to the baseline, and to some alternative), rather than what the code is doing.

I'd suggest something like:
```
Mark the expression as value- and instantiation- dependent to reuse existing suppressions for dependent code, e.g. avoiding constant-evaluation.
```


================
Comment at: clang/lib/AST/Expr.cpp:3309
 
-  if (isInstantiationDependent())
+  if (isInstantiationDependent() || containsErrors())
     return IncludePossibleEffects;
----------------
This can move into the later patch I think - we're always instantiation-dependent where it matters.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:12807
 
-  if (Init && !Init->isValueDependent()) {
+  if (Init && !Init->isValueDependent() && !Init->containsErrors()) {
     if (var->isConstexpr()) {
----------------
again - can move into later patch


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:15887
   if (!AssertExpr->isTypeDependent() && !AssertExpr->isValueDependent() &&
-      !Failed) {
+      !AssertExpr->containsErrors() && !Failed) {
     // In a static_assert-declaration, the constant-expression shall be a
----------------
can defer this too


================
Comment at: clang/test/CodeCompletion/member-access.cpp:283
+}
+// RUN: not %clang_cc1 -fsyntax-only -frecovery-ast -frecovery-ast-type -code-completion-at=%s:281:16 %s -o - | FileCheck -check-prefix=CHECK-CC10 %s
+// CHECK-CC10: [#int#]member
----------------
nit: CHECK-RECOVERY or so?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79160/new/

https://reviews.llvm.org/D79160





More information about the cfe-commits mailing list