MC->dump();
errs() << "Template args:\n";
- for (Init *TA : TemplateArgs) {
+ for (Init *TA : TemplateArgs)
TA->dump();
- }
}
} // end namespace llvm
// Convert the incoming value to a bits type of the appropriate size...
Init *BI = V->convertInitializerTo(BitsRecTy::get(BitList.size()));
- if (!BI) {
+ if (!BI)
return Error(Loc, "Initializer is not compatible with bit range");
- }
// We should have a BitsInit type now.
BitsInit *BInit = cast<BitsInit>(BI);
if (RV->setValue(V)) {
std::string InitType = "";
- if (BitsInit *BI = dyn_cast<BitsInit>(V)) {
+ if (BitsInit *BI = dyn_cast<BitsInit>(V))
InitType = (Twine("' of type bit initializer with length ") +
Twine(BI->getNumBits())).str();
- }
return Error(Loc, "Value '" + ValName->getAsUnquotedString() +
"' of type '" + RV->getType()->getAsString() +
"' is incompatible with initializer '" + V->getAsString() +
Lex.Lex();
// Add to the range.
- if (Start < End) {
+ if (Start < End)
for (; Start <= End; ++Start)
Ranges.push_back(Start);
- } else {
+ else
for (; Start >= End; --Start)
Ranges.push_back(Start);
- }
return false;
}
Error(NameLoc, "Variable not defined: '" + Name + "'");
return nullptr;
}
-
+
return StringInit::get(Name);
}
TokError("untyped list element in unary operator");
return nullptr;
}
- if (Code == UnOpInit::HEAD) {
- Type = Itemt->getType();
- } else {
- Type = ListRecTy::get(Itemt->getType());
- }
+ Type = (Code == UnOpInit::HEAD) ? Itemt->getType()
+ : ListRecTy::get(Itemt->getType());
} else {
assert(LHSt && "expected list type argument in unary operator");
ListRecTy *LType = dyn_cast<ListRecTy>(LHSt->getType());
TokError("expected list type argument in unary operator");
return nullptr;
}
- if (Code == UnOpInit::HEAD) {
- Type = LType->getElementType();
- } else {
- Type = LType;
- }
+ Type = (Code == UnOpInit::HEAD) ? LType->getElementType() : LType;
}
}
}
Error(PasteLoc, "LHS of paste is not typed!");
return nullptr;
}
-
+
if (LHS->getType() != StringRecTy::get()) {
LHS = UnOpInit::get(UnOpInit::CAST, LHS, StringRecTy::get());
}
// These are all of the tokens that can begin an object body.
// Some of these can also begin values but we disallow those cases
// because they are unlikely to be useful.
-
+
// Trailing paste, concat with an empty string.
RHS = StringInit::get("");
break;
if (RHS->getType() != StringRecTy::get()) {
RHS = UnOpInit::get(UnOpInit::CAST, RHS, StringRecTy::get());
}
-
+
break;
}
Lex.Lex();
if (ParsingTemplateArgs) {
- if (CurRec) {
+ if (CurRec)
DeclName = QualifyName(*CurRec, CurMultiClass, DeclName, ":");
- } else {
+ else
assert(CurMultiClass);
- }
if (CurMultiClass)
DeclName = QualifyName(CurMultiClass->Rec, CurMultiClass, DeclName,
"::");
}
}
- if (ProcessForeachDefs(CurRec, DefLoc)) {
+ if (ProcessForeachDefs(CurRec, DefLoc))
return Error(DefLoc, "Could not process loops for def" +
CurRec->getNameInitAsString());
- }
return false;
}
// FOREACH Declaration IN Object
if (ParseObject(CurMultiClass))
return true;
- }
- else {
+ } else {
SMLoc BraceLoc = Lex.getLoc();
// Otherwise, this is a group foreach.
Lex.Lex(); // eat the '{'.
if (SetValue(CurRec, DefmPrefixLoc, TArgs[i], std::vector<unsigned>(),
TemplateVals[i]))
return true;
-
+
// Resolve it next.
CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i]));
if (DeleteArgs)
// Now remove it.
CurRec->removeValue(TArgs[i]);
-
+
} else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) {
return Error(SubClassLoc, "value not specified for template argument #" +
utostr(i) + " (" + TArgs[i]->getAsUnquotedString() +