Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions clang/lib/AST/ByteCode/EvalEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,16 @@ EvaluationResult EvalEmitter::interpretExpr(const Expr *E,

EvaluationResult EvalEmitter::interpretDecl(const VarDecl *VD, const Expr *Init,
bool CheckFullyInitialized) {
assert(VD);
assert(Init);
this->CheckFullyInitialized = CheckFullyInitialized;
S.EvaluatingDecl = VD;
S.setEvalLocation(VD->getLocation());
EvalResult.setSource(VD);

// FIXME: I think Init is never null.
if (Init) {
QualType T = VD->getType();
this->ConvertResultToRValue = !Init->isGLValue() && !T->isPointerType() &&
!T->isObjCObjectPointerType();
} else
this->ConvertResultToRValue = false;

QualType T = VD->getType();
this->ConvertResultToRValue = !Init->isGLValue() && !T->isPointerType() &&
!T->isObjCObjectPointerType();
EvalResult.setSource(VD);

if (!this->visitDeclAndReturn(VD, Init, S.inConstantContext()))
Expand Down
1 change: 1 addition & 0 deletions clang/lib/AST/ExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17761,6 +17761,7 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx,
bool IsConstantInitialization) const {
assert(!isValueDependent() &&
"Expression evaluator can't be called on a dependent expression.");
assert(VD && "Need a valid VarDecl");

llvm::TimeTraceScope TimeScope("EvaluateAsInitializer", [&] {
std::string Name;
Expand Down