Fix crash deserializing a CUDAKernelCallExpr with a +Asserts binary.

The assertion in setConfig read from the (uninitialized) CONFIG
expression.

llvm-svn: 361680
This commit is contained in:
Richard Smith 2019-05-24 23:26:07 +00:00
parent 97d668d70f
commit fd42079255
2 changed files with 3 additions and 15 deletions

View File

@ -216,6 +216,8 @@ public:
/// Represents a call to a CUDA kernel function.
class CUDAKernelCallExpr final : public CallExpr {
friend class ASTStmtReader;
enum { CONFIG, END_PREARG };
// CUDAKernelCallExpr has some trailing objects belonging
@ -241,20 +243,6 @@ public:
}
CallExpr *getConfig() { return cast_or_null<CallExpr>(getPreArg(CONFIG)); }
/// Sets the kernel configuration expression.
///
/// Note that this method cannot be called if config has already been set to a
/// non-null value.
void setConfig(CallExpr *E) {
assert(!getConfig() &&
"Cannot call setConfig if config is not null");
setPreArg(CONFIG, E);
setInstantiationDependent(isInstantiationDependent() ||
E->isInstantiationDependent());
setContainsUnexpandedParameterPack(containsUnexpandedParameterPack() ||
E->containsUnexpandedParameterPack());
}
static bool classof(const Stmt *T) {
return T->getStmtClass() == CUDAKernelCallExprClass;
}

View File

@ -1904,7 +1904,7 @@ void ASTStmtReader::VisitSEHTryStmt(SEHTryStmt *S) {
void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
VisitCallExpr(E);
E->setConfig(cast<CallExpr>(Record.readSubExpr()));
E->setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
}
//===----------------------------------------------------------------------===//