r361680 - Fix crash deserializing a CUDAKernelCallExpr with a +Asserts binary.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri May 24 16:26:07 PDT 2019
Author: rsmith
Date: Fri May 24 16:26:07 2019
New Revision: 361680
URL: http://llvm.org/viewvc/llvm-project?rev=361680&view=rev
Log:
Fix crash deserializing a CUDAKernelCallExpr with a +Asserts binary.
The assertion in setConfig read from the (uninitialized) CONFIG
expression.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=361680&r1=361679&r2=361680&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Fri May 24 16:26:07 2019
@@ -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;
}
Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=361680&r1=361679&r2=361680&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Fri May 24 16:26:07 2019
@@ -1904,7 +1904,7 @@ void ASTStmtReader::VisitSEHTryStmt(SEHT
void ASTStmtReader::VisitCUDAKernelCallExpr(CUDAKernelCallExpr *E) {
VisitCallExpr(E);
- E->setConfig(cast<CallExpr>(Record.readSubExpr()));
+ E->setPreArg(CUDAKernelCallExpr::CONFIG, Record.readSubExpr());
}
//===----------------------------------------------------------------------===//
More information about the cfe-commits
mailing list