diff options
author | Sean Silva <silvas@purdue.edu> | 2013-01-09 05:28:12 +0000 |
---|---|---|
committer | Sean Silva <silvas@purdue.edu> | 2013-01-09 05:28:12 +0000 |
commit | cc951b284bd55a51afc0412e3a7724070dd86767 (patch) | |
tree | f563cc2d172ce33011bde14f5e1a9f4e8156c8e2 /llvm/lib | |
parent | 977e0be4a0f7b1f66667ac0c905f2f752a5cd4b5 (diff) | |
download | bcm5719-llvm-cc951b284bd55a51afc0412e3a7724070dd86767.tar.gz bcm5719-llvm-cc951b284bd55a51afc0412e3a7724070dd86767.zip |
tblgen: use an early return to reduce indentation.
llvm-svn: 171954
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/TableGen/TGParser.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp index 1561e2cba22..860b80d5512 100644 --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/lib/TableGen/TGParser.cpp @@ -2368,24 +2368,24 @@ bool TGParser::ResolveMulticlassDef(MultiClass &MC, // Don't create a top level definition for defm inside multiclasses, // instead, only update the prototypes and bind the template args // with the new created definition. - if (CurMultiClass) { - for (unsigned i = 0, e = CurMultiClass->DefPrototypes.size(); - i != e; ++i) - if (CurMultiClass->DefPrototypes[i]->getNameInit() - == CurRec->getNameInit()) - return Error(DefmPrefixLoc, "defm '" + CurRec->getNameInitAsString() + - "' already defined in this multiclass!"); - CurMultiClass->DefPrototypes.push_back(CurRec); - - // Copy the template arguments for the multiclass into the new def. - const std::vector<Init *> &TA = - CurMultiClass->Rec.getTemplateArgs(); - - for (unsigned i = 0, e = TA.size(); i != e; ++i) { - const RecordVal *RV = CurMultiClass->Rec.getValue(TA[i]); - assert(RV && "Template arg doesn't exist?"); - CurRec->addValue(*RV); - } + if (!CurMultiClass) + return false; + for (unsigned i = 0, e = CurMultiClass->DefPrototypes.size(); + i != e; ++i) + if (CurMultiClass->DefPrototypes[i]->getNameInit() + == CurRec->getNameInit()) + return Error(DefmPrefixLoc, "defm '" + CurRec->getNameInitAsString() + + "' already defined in this multiclass!"); + CurMultiClass->DefPrototypes.push_back(CurRec); + + // Copy the template arguments for the multiclass into the new def. + const std::vector<Init *> &TA = + CurMultiClass->Rec.getTemplateArgs(); + + for (unsigned i = 0, e = TA.size(); i != e; ++i) { + const RecordVal *RV = CurMultiClass->Rec.getValue(TA[i]); + assert(RV && "Template arg doesn't exist?"); + CurRec->addValue(*RV); } return false; |