[analyzer] Array CompoundLiteralExprs need to be treated like lvalues.

llvm-svn: 158588
This commit is contained in:
Jordan Rose 2012-06-16 01:28:03 +00:00
parent e42412be39
commit b4712d142a
2 changed files with 6 additions and 1 deletions

View File

@ -408,7 +408,7 @@ void ExprEngine::VisitCompoundLiteralExpr(const CompoundLiteralExpr *CL,
const LocationContext *LC = Pred->getLocationContext();
state = state->bindCompoundLiteral(CL, LC, ILV);
if (CL->isGLValue())
if (CL->isGLValue() || CL->getType()->isArrayType())
B.generateNode(CL, Pred, state->BindExpr(CL, LC, state->getLValue(CL, LC)));
else
B.generateNode(CL, Pred, state->BindExpr(CL, LC, ILV));

View File

@ -70,3 +70,8 @@ void vla(int n) {
clang_analyzer_eval(structs[0].x == 1); // expected-warning{{TRUE}}
}
void useIntArray(int []);
void testIntArrayLiteral() {
useIntArray((int []){ 1, 2, 3 });
}