mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[flang][directive] Enforce basic semantic check for all clauses
This patch is a follow up to D94821 to ensure the correct behavior of the general directive structure checker. This patch add the generation of the Enter function declaration for clauses in the TableGen backend. This helps to ensure each clauses declared in the TableGen file has at least a basic check. Reviewed By: kiranchandramohan Differential Revision: https://reviews.llvm.org/D95108
This commit is contained in:
parent
8985ce20e1
commit
c1dd747b25
@ -633,6 +633,20 @@ void GenerateFlangClauseUnparse(const DirectiveLanguage &DirLang,
|
||||
}
|
||||
}
|
||||
|
||||
// Generate check in the Enter functions for clauses classes.
|
||||
void GenerateFlangClauseCheckPrototypes(const DirectiveLanguage &DirLang,
|
||||
raw_ostream &OS) {
|
||||
|
||||
IfDefScope Scope("GEN_FLANG_CLAUSE_CHECK_ENTER", OS);
|
||||
|
||||
OS << "\n";
|
||||
for (const auto &C : DirLang.getClauses()) {
|
||||
Clause Clause{C};
|
||||
OS << "void Enter(const parser::" << DirLang.getFlangClauseBaseClass()
|
||||
<< "::" << Clause.getFormattedParserClassName() << " &);\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the implementation section for the enumeration in the directive
|
||||
// language
|
||||
void EmitDirectivesFlangImpl(const DirectiveLanguage &DirLang,
|
||||
@ -649,6 +663,8 @@ void EmitDirectivesFlangImpl(const DirectiveLanguage &DirLang,
|
||||
GenerateFlangClauseDump(DirLang, OS);
|
||||
|
||||
GenerateFlangClauseUnparse(DirLang, OS);
|
||||
|
||||
GenerateFlangClauseCheckPrototypes(DirLang, OS);
|
||||
}
|
||||
|
||||
void GenerateClauseClassMacro(const DirectiveLanguage &DirLang,
|
||||
|
Loading…
Reference in New Issue
Block a user