Fix a case where we'd return "is not a constant expr" without
return a location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44889 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/Expr.cpp b/AST/Expr.cpp
index 545ebd8..c6a6ab3 100644
--- a/AST/Expr.cpp
+++ b/AST/Expr.cpp
@@ -443,8 +443,13 @@
const UnaryOperator *Exp = cast<UnaryOperator>(this);
// C99 6.6p9
- if (Exp->getOpcode() == UnaryOperator::AddrOf)
- return Exp->getSubExpr()->hasStaticStorage();
+ if (Exp->getOpcode() == UnaryOperator::AddrOf) {
+ if (!Exp->getSubExpr()->hasStaticStorage()) {
+ if (Loc) *Loc = getLocStart();
+ return false;
+ }
+ return true;
+ }
// Get the operand value. If this is sizeof/alignof, do not evalute the
// operand. This affects C99 6.6p3.