aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ComputeDependence.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein.wu@gmail.com>2020-07-09 12:55:46 +0200
committerHaojian Wu <hokein.wu@gmail.com>2020-07-13 11:32:32 +0200
commit6ac9e589f869b6a63c9966e7c7ec7cc8207cf2f2 (patch)
tree511c14a27f362af7d5eb00cb1d0c01a9b13528bc /clang/lib/AST/ComputeDependence.cpp
parent26cf6c1513f95082cedd4f2acf0881dd9ab56461 (diff)
downloadllvm-6ac9e589f869b6a63c9966e7c7ec7cc8207cf2f2.zip
llvm-6ac9e589f869b6a63c9966e7c7ec7cc8207cf2f2.tar.gz
llvm-6ac9e589f869b6a63c9966e7c7ec7cc8207cf2f2.tar.bz2
[clang][RecoveryExpr] Clarify the dependence-bits documentation.
The expr dependent-bits described that the expression somehow depends on a template paramter. With RecoveryExpr, we have generalized it to "the expression depends on a template parameter, or an error". This patch updates/cleanups all related comments of dependence-bits. Differential Revision: https://reviews.llvm.org/D83213
Diffstat (limited to 'clang/lib/AST/ComputeDependence.cpp')
-rw-r--r--clang/lib/AST/ComputeDependence.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/AST/ComputeDependence.cpp b/clang/lib/AST/ComputeDependence.cpp
index 53c43b1..2333993 100644
--- a/clang/lib/AST/ComputeDependence.cpp
+++ b/clang/lib/AST/ComputeDependence.cpp
@@ -495,13 +495,16 @@ ExprDependence clang::computeDependence(DeclRefExpr *E, const ASTContext &Ctx) {
}
ExprDependence clang::computeDependence(RecoveryExpr *E) {
- // Mark the expression as value- and instantiation- dependent to reuse
- // existing suppressions for dependent code, e.g. avoiding
- // constant-evaluation.
- // FIXME: drop type+value+instantiation once Error is sufficient to suppress
- // bogus dianostics.
+ // RecoveryExpr is
+ // - always value-dependent, and therefore instantiation dependent
+ // - contains errors (ExprDependence::Error), by definition
+ // - type-dependent if we don't know the type (fallback to an opaque
+ // dependent type), or the type is known and dependent, or it has
+ // type-dependent subexpressions.
auto D = toExprDependence(E->getType()->getDependence()) |
ExprDependence::ValueInstantiation | ExprDependence::Error;
+ // FIXME: remove the type-dependent bit from subexpressions, if the
+ // RecoveryExpr has a non-dependent type.
for (auto *S : E->subExpressions())
D |= S->getDependence();
return D;