Is there a test case we can add along with this which would otherwise be failing?
~Aaron On Sun, Mar 9, 2014 at 3:29 AM, Logan Chien <[email protected]> wrote: > Hi aaron.ballman, > > The uninitialized value for enum operand in AttributedTypeLoc > might be used during the serialization or deserialization of the > precompiled headers. This commit fix this issue by adding expression > variant for enum operand. Besides, several assertions are added to > prevent future unexpected situation. > > http://llvm-reviews.chandlerc.com/D3020 > > Files: > lib/Sema/SemaType.cpp > > Index: lib/Sema/SemaType.cpp > =================================================================== > --- lib/Sema/SemaType.cpp > +++ lib/Sema/SemaType.cpp > @@ -3444,10 +3444,17 @@ > } > > TL.setAttrNameLoc(attrs->getLoc()); > - if (TL.hasAttrExprOperand() && attrs->isArgExpr(0)) > + if (TL.hasAttrExprOperand()) { > + assert(attrs->isArgExpr(0) && "mismatched attribute operand kind"); > TL.setAttrExprOperand(attrs->getArgAsExpr(0)); > - else if (TL.hasAttrEnumOperand() && attrs->isArgIdent(0)) > - TL.setAttrEnumOperandLoc(attrs->getArgAsIdent(0)->Loc); > + } else if (TL.hasAttrEnumOperand()) { > + assert((attrs->isArgIdent(0) || attrs->isArgExpr(0)) && > + "unexpected attribute operand kind"); > + if (attrs->isArgIdent(0)) > + TL.setAttrEnumOperandLoc(attrs->getArgAsIdent(0)->Loc); > + else > + TL.setAttrEnumOperandLoc(attrs->getArgAsExpr(0)->getExprLoc()); > + } > > // FIXME: preserve this information to here. > if (TL.hasAttrOperand()) _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
