Fix PR14321, a crash when Clang is built with GCC 4.7 at -O1 or greater.

GCC 4.7 reuses stack slots fairly aggressively, which exposes more temporary
lifetime bugs.

No new test, this was caught by the existing CodeGenCXX/mangle-ms-templates.cpp.

llvm-svn: 168124
This commit is contained in:
Matt Beaumont-Gay 2012-11-16 01:14:52 +00:00
parent aff2a269e3
commit c08fa18596
1 changed files with 1 additions and 1 deletions

View File

@ -373,7 +373,7 @@ isTemplate(const NamedDecl *ND,
dyn_cast<ClassTemplateSpecializationDecl>(ND)) { dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
TypeSourceInfo *TSI = Spec->getTypeAsWritten(); TypeSourceInfo *TSI = Spec->getTypeAsWritten();
if (TSI) { if (TSI) {
TemplateSpecializationTypeLoc &TSTL = TemplateSpecializationTypeLoc TSTL =
cast<TemplateSpecializationTypeLoc>(TSI->getTypeLoc()); cast<TemplateSpecializationTypeLoc>(TSI->getTypeLoc());
TemplateArgumentListInfo LI(TSTL.getLAngleLoc(), TSTL.getRAngleLoc()); TemplateArgumentListInfo LI(TSTL.getLAngleLoc(), TSTL.getRAngleLoc());
for (unsigned i = 0, e = TSTL.getNumArgs(); i != e; ++i) for (unsigned i = 0, e = TSTL.getNumArgs(); i != e; ++i)