}
/// setArg - Set the specified argument.
+ /// ! the dependence bits might be stale after calling this setter, it is
+ /// *caller*'s responsibility to recompute them by calling
+ /// computeDependence().
void setArg(unsigned Arg, Expr *ArgExpr) {
assert(Arg < getNumArgs() && "Arg access out of range!");
getArgs()[Arg] = ArgExpr;
}
+ /// Compute and set dependence bits.
+ void computeDependence() {
+ setDependence(clang::computeDependence(
+ this, llvm::makeArrayRef(
+ reinterpret_cast<Expr **>(getTrailingStmts() + PREARGS_START),
+ getNumPreArgs())));
+ }
+
/// Reduce the number of arguments in this call expression. This is used for
/// example during error recovery to drop extra arguments. There is no way
/// to perform the opposite because: 1.) We don't track how much storage
for (unsigned I = Args.size(); I != NumArgs; ++I)
setArg(I, nullptr);
- setDependence(computeDependence(this, PreArgs));
+ this->computeDependence();
CallExprBits.HasFPFeatures = FPFeatures.requiresTrailingStorage();
if (hasStoredFPFeatures())
for (unsigned i = 0; i < TotalNumArgs; ++i)
Call->setArg(i, AllArgs[i]);
+ Call->computeDependence();
return false;
}
TheCall->setArg(i, Arg);
}
+ TheCall->computeDependence();
}
if (CXXMethodDecl *Method = dyn_cast_or_null<CXXMethodDecl>(FDecl))
namespace test12 {
// Verify we do not crash.
-void fun(int *foo = no_such_function()); // expected-error {{undeclared identifier}}
-void baz() { fun(); }
+int fun(int *foo = no_such_function()); // expected-error {{undeclared identifier}}
+void crash1() { fun(); }
+void crash2() { constexpr int s = fun(); }
} // namespace test12