[openmp] Fix warning in generated OMP.cpp

This commit is contained in:
Valentin Clement 2020-07-10 20:57:00 -04:00
parent 16e9ccb2be
commit 7b67bc16ef
1 changed files with 19 additions and 14 deletions

View File

@ -236,27 +236,32 @@ void GenerateIsAllowedClause(const std::vector<Record *> &Directives,
for (const auto &D : Directives) { for (const auto &D : Directives) {
const auto DirectiveName = D->getValueAsString("name"); const auto DirectiveName = D->getValueAsString("name");
const auto &AllowedClauses = D->getValueAsListOfDefs("allowedClauses");
const auto &AllowedOnceClauses =
D->getValueAsListOfDefs("allowedOnceClauses");
const auto &RequiredClauses = D->getValueAsListOfDefs("requiredClauses");
OS << " case " << DirectivePrefix << getFormattedName(DirectiveName) OS << " case " << DirectivePrefix << getFormattedName(DirectiveName)
<< ":\n"; << ":\n";
OS << " switch (C) {\n"; if (AllowedClauses.size() == 0 && AllowedOnceClauses.size() == 0 &&
AllowedOnceClauses.size() == 0) {
OS << " return false;\n";
} else {
OS << " switch (C) {\n";
const auto &AllowedClauses = D->getValueAsListOfDefs("allowedClauses"); GenerateCaseForVersionedClauses(AllowedClauses, OS, DirectiveName,
GenerateCaseForVersionedClauses(AllowedClauses, OS, DirectiveName, DirectivePrefix, ClausePrefix);
DirectivePrefix, ClausePrefix);
const auto &AllowedOnceClauses = GenerateCaseForVersionedClauses(AllowedOnceClauses, OS, DirectiveName,
D->getValueAsListOfDefs("allowedOnceClauses"); DirectivePrefix, ClausePrefix);
GenerateCaseForVersionedClauses(AllowedOnceClauses, OS, DirectiveName,
DirectivePrefix, ClausePrefix);
const auto &RequiredClauses = D->getValueAsListOfDefs("requiredClauses"); GenerateCaseForVersionedClauses(RequiredClauses, OS, DirectiveName,
GenerateCaseForVersionedClauses(RequiredClauses, OS, DirectiveName, DirectivePrefix, ClausePrefix);
DirectivePrefix, ClausePrefix);
OS << " default:\n"; OS << " default:\n";
OS << " return false;\n"; OS << " return false;\n";
OS << " }\n"; // End of clauses switch OS << " }\n"; // End of clauses switch
}
OS << " break;\n"; OS << " break;\n";
} }