[llvm] 7b67bc1 - [openmp] Fix warning in generated OMP.cpp
Valentin Clement via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 10 18:13:29 PDT 2020
Author: Valentin Clement
Date: 2020-07-10T21:13:12-04:00
New Revision: 7b67bc16ef1b954eea5f99e478ccd4840ebe7a06
URL: https://github.com/llvm/llvm-project/commit/7b67bc16ef1b954eea5f99e478ccd4840ebe7a06
DIFF: https://github.com/llvm/llvm-project/commit/7b67bc16ef1b954eea5f99e478ccd4840ebe7a06.diff
LOG: [openmp] Fix warning in generated OMP.cpp
Added:
Modified:
llvm/utils/TableGen/DirectiveEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/DirectiveEmitter.cpp b/llvm/utils/TableGen/DirectiveEmitter.cpp
index 37f1677a7a84..f51f98872bb5 100644
--- a/llvm/utils/TableGen/DirectiveEmitter.cpp
+++ b/llvm/utils/TableGen/DirectiveEmitter.cpp
@@ -236,27 +236,32 @@ void GenerateIsAllowedClause(const std::vector<Record *> &Directives,
for (const auto &D : Directives) {
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)
<< ":\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,
- DirectivePrefix, ClausePrefix);
+ GenerateCaseForVersionedClauses(AllowedClauses, OS, DirectiveName,
+ DirectivePrefix, ClausePrefix);
- const auto &AllowedOnceClauses =
- D->getValueAsListOfDefs("allowedOnceClauses");
- GenerateCaseForVersionedClauses(AllowedOnceClauses, OS, DirectiveName,
- DirectivePrefix, ClausePrefix);
+ GenerateCaseForVersionedClauses(AllowedOnceClauses, OS, DirectiveName,
+ DirectivePrefix, ClausePrefix);
- const auto &RequiredClauses = D->getValueAsListOfDefs("requiredClauses");
- GenerateCaseForVersionedClauses(RequiredClauses, OS, DirectiveName,
- DirectivePrefix, ClausePrefix);
+ GenerateCaseForVersionedClauses(RequiredClauses, OS, DirectiveName,
+ DirectivePrefix, ClausePrefix);
- OS << " default:\n";
- OS << " return false;\n";
- OS << " }\n"; // End of clauses switch
+ OS << " default:\n";
+ OS << " return false;\n";
+ OS << " }\n"; // End of clauses switch
+ }
OS << " break;\n";
}
More information about the llvm-commits
mailing list