mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[flang][directive] Get rid of flangClassValue in TableGen
The TableGen emitter for directives has two slots for flangClass information and this was mainly to be able to keep up with the legacy openmp parser at the time. Now that all clauses are encapsulated in AccClause or OmpClause, these two strings are not necessary anymore and were the the source of couple of problem while working with the generic structure checker for OpenMP. This patch remove the flangClassValue string from DirectiveBase.td and use the string flangClass as the placeholder for the encapsulated class. Reviewed By: sameeranjoshi Differential Revision: https://reviews.llvm.org/D94821
This commit is contained in:
parent
c88264fd68
commit
715d713b9e
@ -77,15 +77,8 @@ class Clause<string c> {
|
||||
// Optional class holding value of the clause in clang AST.
|
||||
string clangClass = "";
|
||||
|
||||
// Optional class holding the clause in flang AST. If left blank, the class
|
||||
// is assumed to be the name of the clause with capitalized word and
|
||||
// underscores removed.
|
||||
// ex: async -> Async
|
||||
// num_threads -> NumThreads
|
||||
string flangClass = "";
|
||||
|
||||
// Optional class holding value of the clause in flang AST.
|
||||
string flangClassValue = "";
|
||||
string flangClass = "";
|
||||
|
||||
// If set to true, value is optional. Not optional by default.
|
||||
bit isValueOptional = false;
|
||||
|
@ -34,7 +34,7 @@ def OpenACC : DirectiveLanguage {
|
||||
|
||||
// 2.16.1
|
||||
def ACCC_Async : Clause<"async"> {
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
let isValueOptional = true;
|
||||
}
|
||||
|
||||
@ -43,12 +43,12 @@ def ACCC_Auto : Clause<"auto"> {}
|
||||
|
||||
// 2.7.12
|
||||
def ACCC_Attach : Clause<"attach"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.15.1
|
||||
def ACCC_Bind : Clause<"bind"> {
|
||||
let flangClassValue = "AccBindClause";
|
||||
let flangClass = "AccBindClause";
|
||||
}
|
||||
|
||||
// 2.12
|
||||
@ -57,26 +57,26 @@ def ACCC_Capture : Clause<"capture"> {
|
||||
|
||||
// 2.9.1
|
||||
def ACCC_Collapse : Clause<"collapse"> {
|
||||
let flangClassValue = "ScalarIntConstantExpr";
|
||||
let flangClass = "ScalarIntConstantExpr";
|
||||
}
|
||||
|
||||
// 2.7.6
|
||||
def ACCC_Copy : Clause<"copy"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
// 2.7.7
|
||||
def ACCC_Copyin : Clause<"copyin"> {
|
||||
let flangClassValue = "AccObjectListWithModifier";
|
||||
let flangClass = "AccObjectListWithModifier";
|
||||
}
|
||||
|
||||
// 2.7.8
|
||||
def ACCC_Copyout : Clause<"copyout"> {
|
||||
let flangClassValue = "AccObjectListWithModifier";
|
||||
let flangClass = "AccObjectListWithModifier";
|
||||
}
|
||||
|
||||
// 2.7.9
|
||||
def ACCC_Create : Clause<"create"> {
|
||||
let flangClassValue = "AccObjectListWithModifier";
|
||||
let flangClass = "AccObjectListWithModifier";
|
||||
}
|
||||
|
||||
// 2.5.15
|
||||
@ -84,7 +84,7 @@ def ACC_Default_none : ClauseVal<"none", 1, 1> { let isDefault = 1; }
|
||||
def ACC_Default_present : ClauseVal<"present", 0, 1> {}
|
||||
|
||||
def ACCC_Default : Clause<"default"> {
|
||||
let flangClassValue = "AccDefaultClause";
|
||||
let flangClass = "AccDefaultClause";
|
||||
let enumClauseValue = "DefaultValue";
|
||||
let allowedClauseValues = [
|
||||
ACC_Default_present,
|
||||
@ -94,42 +94,42 @@ def ACCC_Default : Clause<"default"> {
|
||||
|
||||
// 2.14.3
|
||||
def ACCC_DefaultAsync : Clause<"default_async"> {
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
|
||||
// 2.7.11
|
||||
def ACCC_Delete : Clause<"delete"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.7.13
|
||||
def ACCC_Detach : Clause<"detach"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.14.4
|
||||
def ACCC_Device : Clause<"device"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.14.1 - 2.14.2
|
||||
def ACCC_DeviceNum : Clause<"device_num"> {
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
|
||||
// 2.7.4
|
||||
def ACCC_DevicePtr : Clause<"deviceptr"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.13.1
|
||||
def ACCC_DeviceResident : Clause<"device_resident"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.4
|
||||
def ACCC_DeviceType : Clause<"device_type"> {
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
let defaultValue = "*";
|
||||
let isValueOptional = true;
|
||||
let isValueList = true;
|
||||
@ -140,23 +140,23 @@ def ACCC_Finalize : Clause<"finalize"> {}
|
||||
|
||||
// 2.5.13
|
||||
def ACCC_FirstPrivate : Clause<"firstprivate"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.9.2
|
||||
def ACCC_Gang : Clause<"gang"> {
|
||||
let flangClassValue = "AccGangArgument";
|
||||
let flangClass = "AccGangArgument";
|
||||
let isValueOptional = true;
|
||||
}
|
||||
|
||||
// 2.14.4
|
||||
def ACCC_Host : Clause<"host"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.5.5
|
||||
def ACCC_If : Clause <"if"> {
|
||||
let flangClassValue = "ScalarLogicalExpr";
|
||||
let flangClass = "ScalarLogicalExpr";
|
||||
}
|
||||
|
||||
// 2.14.4
|
||||
@ -167,12 +167,12 @@ def ACCC_Independent : Clause<"independent"> {}
|
||||
|
||||
// 2.13.3
|
||||
def ACCC_Link : Clause<"link"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.7.10
|
||||
def ACCC_NoCreate : Clause<"no_create"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.15.1
|
||||
@ -180,32 +180,32 @@ def ACCC_NoHost : Clause<"nohost"> {}
|
||||
|
||||
// 2.5.9
|
||||
def ACCC_NumGangs : Clause<"num_gangs"> {
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
|
||||
// 2.5.10
|
||||
def ACCC_NumWorkers : Clause<"num_workers"> {
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
|
||||
// 2.7.5
|
||||
def ACCC_Present : Clause<"present"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.5.12
|
||||
def ACCC_Private : Clause<"private"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.9.8
|
||||
def ACCC_Tile : Clause <"tile"> {
|
||||
let flangClassValue = "AccTileExprList";
|
||||
let flangClass = "AccTileExprList";
|
||||
}
|
||||
|
||||
// 2.8.1
|
||||
def ACCC_UseDevice : Clause <"use_device"> {
|
||||
let flangClassValue = "AccObjectList";
|
||||
let flangClass = "AccObjectList";
|
||||
}
|
||||
|
||||
// 2.12
|
||||
@ -213,12 +213,12 @@ def ACCC_Read : Clause<"read"> {}
|
||||
|
||||
// 2.5.14
|
||||
def ACCC_Reduction : Clause<"reduction"> {
|
||||
let flangClassValue = "AccObjectListWithReduction";
|
||||
let flangClass = "AccObjectListWithReduction";
|
||||
}
|
||||
|
||||
// 2.5.6
|
||||
def ACCC_Self : Clause<"self"> {
|
||||
let flangClassValue = "AccSelfClause";
|
||||
let flangClass = "AccSelfClause";
|
||||
}
|
||||
|
||||
// 2.9.5
|
||||
@ -226,24 +226,24 @@ def ACCC_Seq : Clause<"seq"> {}
|
||||
|
||||
// 2.9.4
|
||||
def ACCC_Vector : Clause<"vector"> {
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
let isValueOptional = true;
|
||||
}
|
||||
|
||||
// 2.5.11
|
||||
def ACCC_VectorLength : Clause<"vector_length"> {
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
|
||||
// 2.16.2
|
||||
def ACCC_Wait : Clause<"wait"> {
|
||||
let flangClassValue = "AccWaitArgument";
|
||||
let flangClass = "AccWaitArgument";
|
||||
let isValueOptional = true;
|
||||
}
|
||||
|
||||
// 2.9.3
|
||||
def ACCC_Worker: Clause<"worker"> {
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
let isValueOptional = true;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ def OpenMP : DirectiveLanguage {
|
||||
|
||||
def OMPC_Allocator : Clause<"allocator"> {
|
||||
let clangClass = "OMPAllocatorClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
def OMPC_If : Clause<"if"> {
|
||||
let clangClass = "OMPIfClause";
|
||||
@ -42,47 +42,47 @@ def OMPC_If : Clause<"if"> {
|
||||
}
|
||||
def OMPC_Final : Clause<"final"> {
|
||||
let clangClass = "OMPFinalClause";
|
||||
let flangClassValue = "ScalarLogicalExpr";
|
||||
let flangClass = "ScalarLogicalExpr";
|
||||
}
|
||||
def OMPC_NumThreads : Clause<"num_threads"> {
|
||||
let clangClass = "OMPNumThreadsClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
def OMPC_SafeLen : Clause<"safelen"> {
|
||||
let clangClass = "OMPSafelenClause";
|
||||
let flangClassValue = "ScalarIntConstantExpr";
|
||||
let flangClass = "ScalarIntConstantExpr";
|
||||
}
|
||||
def OMPC_SimdLen : Clause<"simdlen"> {
|
||||
let clangClass = "OMPSimdlenClause";
|
||||
let flangClassValue = "ScalarIntConstantExpr";
|
||||
let flangClass = "ScalarIntConstantExpr";
|
||||
}
|
||||
def OMPC_Collapse : Clause<"collapse"> {
|
||||
let clangClass = "OMPCollapseClause";
|
||||
let flangClassValue = "ScalarIntConstantExpr";
|
||||
let flangClass = "ScalarIntConstantExpr";
|
||||
}
|
||||
def OMPC_Default : Clause<"default"> {
|
||||
let clangClass = "OMPDefaultClause";
|
||||
let flangClassValue = "OmpDefaultClause";
|
||||
let flangClass = "OmpDefaultClause";
|
||||
}
|
||||
def OMPC_Private : Clause<"private"> {
|
||||
let clangClass = "OMPPrivateClause";
|
||||
let flangClassValue = "OmpObjectList";
|
||||
let flangClass = "OmpObjectList";
|
||||
}
|
||||
def OMPC_FirstPrivate : Clause<"firstprivate"> {
|
||||
let clangClass = "OMPFirstprivateClause";
|
||||
let flangClassValue = "OmpObjectList";
|
||||
let flangClass = "OmpObjectList";
|
||||
}
|
||||
def OMPC_LastPrivate : Clause<"lastprivate"> {
|
||||
let clangClass = "OMPLastprivateClause";
|
||||
let flangClassValue = "OmpObjectList";
|
||||
let flangClass = "OmpObjectList";
|
||||
}
|
||||
def OMPC_Shared : Clause<"shared"> {
|
||||
let clangClass = "OMPSharedClause";
|
||||
let flangClassValue = "OmpObjectList";
|
||||
let flangClass = "OmpObjectList";
|
||||
}
|
||||
def OMPC_Reduction : Clause<"reduction"> {
|
||||
let clangClass = "OMPReductionClause";
|
||||
let flangClassValue = "OmpReductionClause";
|
||||
let flangClass = "OmpReductionClause";
|
||||
}
|
||||
def OMPC_Linear : Clause<"linear"> {
|
||||
let clangClass = "OMPLinearClause";
|
||||
@ -94,11 +94,11 @@ def OMPC_Aligned : Clause<"aligned"> {
|
||||
}
|
||||
def OMPC_Copyin : Clause<"copyin"> {
|
||||
let clangClass = "OMPCopyinClause";
|
||||
let flangClassValue = "OmpObjectList";
|
||||
let flangClass = "OmpObjectList";
|
||||
}
|
||||
def OMPC_CopyPrivate : Clause<"copyprivate"> {
|
||||
let clangClass = "OMPCopyprivateClause";
|
||||
let flangClassValue = "OmpObjectList";
|
||||
let flangClass = "OmpObjectList";
|
||||
}
|
||||
def OMP_PROC_BIND_master : ClauseVal<"master",2,1> {}
|
||||
def OMP_PROC_BIND_close : ClauseVal<"close",3,1> {}
|
||||
@ -107,7 +107,7 @@ def OMP_PROC_BIND_default : ClauseVal<"default",5,0> {}
|
||||
def OMP_PROC_BIND_unknown : ClauseVal<"unknown",6,0> { let isDefault = true; }
|
||||
def OMPC_ProcBind : Clause<"proc_bind"> {
|
||||
let clangClass = "OMPProcBindClause";
|
||||
let flangClassValue = "OmpProcBindClause";
|
||||
let flangClass = "OmpProcBindClause";
|
||||
let enumClauseValue = "ProcBindKind";
|
||||
let allowedClauseValues = [
|
||||
OMP_PROC_BIND_master,
|
||||
@ -142,7 +142,7 @@ def OMPC_Schedule : Clause<"schedule"> {
|
||||
|
||||
def OMPC_Ordered : Clause<"ordered"> {
|
||||
let clangClass = "OMPOrderedClause";
|
||||
let flangClassValue = "ScalarIntConstantExpr";
|
||||
let flangClass = "ScalarIntConstantExpr";
|
||||
let isValueOptional = true;
|
||||
}
|
||||
def OMPC_NoWait : Clause<"nowait"> {
|
||||
@ -167,7 +167,7 @@ def OMPC_Depend : Clause<"depend"> {
|
||||
}
|
||||
def OMPC_Device : Clause<"device"> {
|
||||
let clangClass = "OMPDeviceClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
def OMPC_Threads : Clause<"threads"> { let clangClass = "OMPThreadsClause"; }
|
||||
def OMPC_Simd : Clause<"simd"> { let clangClass = "OMPSIMDClause"; }
|
||||
@ -177,34 +177,34 @@ def OMPC_Map : Clause<"map"> {
|
||||
}
|
||||
def OMPC_NumTeams : Clause<"num_teams"> {
|
||||
let clangClass = "OMPNumTeamsClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
def OMPC_ThreadLimit : Clause<"thread_limit"> {
|
||||
let clangClass = "OMPThreadLimitClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
def OMPC_Priority : Clause<"priority"> {
|
||||
let clangClass = "OMPPriorityClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
def OMPC_GrainSize : Clause<"grainsize"> {
|
||||
let clangClass = "OMPGrainsizeClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
def OMPC_NoGroup : Clause<"nogroup"> {
|
||||
let clangClass = "OMPNogroupClause";
|
||||
}
|
||||
def OMPC_NumTasks : Clause<"num_tasks"> {
|
||||
let clangClass = "OMPNumTasksClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
}
|
||||
def OMPC_Hint : Clause<"hint"> {
|
||||
let clangClass = "OMPHintClause";
|
||||
let flangClassValue = "ConstantExpr";
|
||||
let flangClass = "ConstantExpr";
|
||||
}
|
||||
def OMPC_DistSchedule : Clause<"dist_schedule"> {
|
||||
let clangClass = "OMPDistScheduleClause";
|
||||
let flangClassValue = "ScalarIntExpr";
|
||||
let flangClass = "ScalarIntExpr";
|
||||
let isValueOptional = true;
|
||||
}
|
||||
def OMPC_DefaultMap : Clause<"defaultmap"> {
|
||||
@ -213,25 +213,25 @@ def OMPC_DefaultMap : Clause<"defaultmap"> {
|
||||
}
|
||||
def OMPC_To : Clause<"to"> {
|
||||
let clangClass = "OMPToClause";
|
||||
let flangClassValue = "OmpObjectList";
|
||||
let flangClass = "OmpObjectList";
|
||||
}
|
||||
def OMPC_From : Clause<"from"> {
|
||||
let clangClass = "OMPFromClause";
|
||||
let flangClassValue = "OmpObjectList";
|
||||
let flangClass = "OmpObjectList";
|
||||
}
|
||||
def OMPC_UseDevicePtr : Clause<"use_device_ptr"> {
|
||||
let clangClass = "OMPUseDevicePtrClause";
|
||||
let flangClassValue = "Name";
|
||||
let flangClass = "Name";
|
||||
let isValueList = true;
|
||||
}
|
||||
def OMPC_IsDevicePtr : Clause<"is_device_ptr"> {
|
||||
let clangClass = "OMPIsDevicePtrClause";
|
||||
let flangClassValue = "Name";
|
||||
let flangClass = "Name";
|
||||
let isValueList = true;
|
||||
}
|
||||
def OMPC_TaskReduction : Clause<"task_reduction"> {
|
||||
let clangClass = "OMPTaskReductionClause";
|
||||
let flangClassValue = "OmpReductionClause";
|
||||
let flangClass = "OmpReductionClause";
|
||||
}
|
||||
def OMPC_InReduction : Clause<"in_reduction"> {
|
||||
let clangClass = "OMPInReductionClause";
|
||||
@ -253,7 +253,7 @@ def OMPC_AtomicDefaultMemOrder : Clause<"atomic_default_mem_order"> {
|
||||
}
|
||||
def OMPC_Allocate : Clause<"allocate"> {
|
||||
let clangClass = "OMPAllocateClause";
|
||||
let flangClassValue = "OmpAllocateClause";
|
||||
let flangClass = "OmpAllocateClause";
|
||||
}
|
||||
def OMPC_NonTemporal : Clause<"nontemporal"> {
|
||||
let clangClass = "OMPNontemporalClause";
|
||||
@ -289,7 +289,7 @@ def OMPC_UseDeviceAddr : Clause<"use_device_addr"> {
|
||||
let clangClass = "OMPUseDeviceAddrClause";
|
||||
}
|
||||
def OMPC_Uniform : Clause<"uniform"> {
|
||||
let flangClassValue = "Name";
|
||||
let flangClass = "Name";
|
||||
let isValueList = true;
|
||||
}
|
||||
def OMPC_DeviceType : Clause<"device_type"> {}
|
||||
@ -311,7 +311,7 @@ def OMPC_Unknown : Clause<"unknown"> {
|
||||
let isDefault = true;
|
||||
}
|
||||
def OMPC_Link : Clause<"link"> {
|
||||
let flangClassValue = "OmpObjectList";
|
||||
let flangClass = "OmpObjectList";
|
||||
}
|
||||
def OMPC_Inbranch : Clause<"inbranch"> {}
|
||||
def OMPC_Notinbranch : Clause<"notinbranch"> {}
|
||||
|
@ -138,11 +138,6 @@ public:
|
||||
return Def->getValueAsString("flangClass");
|
||||
}
|
||||
|
||||
// Optional field.
|
||||
StringRef getFlangClassValue() const {
|
||||
return Def->getValueAsString("flangClassValue");
|
||||
}
|
||||
|
||||
// Get the formatted name for Flang parser class. The generic formatted class
|
||||
// name is constructed from the name were the first letter of each word is
|
||||
// captitalized and the underscores are removed.
|
||||
|
@ -20,7 +20,6 @@ def TDLCV_valb : ClauseVal<"valb",2,1> {}
|
||||
def TDLCV_valc : ClauseVal<"valc",3,0> { let isDefault = 1; }
|
||||
|
||||
def TDLC_ClauseA : Clause<"clausea"> {
|
||||
let flangClass = "TdlClauseA";
|
||||
let enumClauseValue = "AKind";
|
||||
let allowedClauseValues = [
|
||||
TDLCV_vala,
|
||||
@ -30,7 +29,7 @@ def TDLC_ClauseA : Clause<"clausea"> {
|
||||
}
|
||||
|
||||
def TDLC_ClauseB : Clause<"clauseb"> {
|
||||
let flangClassValue = "IntExpr";
|
||||
let flangClass = "IntExpr";
|
||||
let isValueOptional = 1;
|
||||
let isDefault = 1;
|
||||
}
|
||||
@ -226,6 +225,7 @@ def TDL_DirA : Directive<"dira"> {
|
||||
// GEN-NEXT: #ifdef GEN_FLANG_CLAUSE_PARSER_CLASSES
|
||||
// GEN-NEXT: #undef GEN_FLANG_CLAUSE_PARSER_CLASSES
|
||||
// GEN-EMPTY:
|
||||
// GEN-NEXT: EMPTY_CLASS(Clausea);
|
||||
// GEN-NEXT: WRAPPER_CLASS(Clauseb, std::optional<IntExpr>);
|
||||
// GEN-EMPTY:
|
||||
// GEN-NEXT: #endif // GEN_FLANG_CLAUSE_PARSER_CLASSES
|
||||
@ -233,7 +233,7 @@ def TDL_DirA : Directive<"dira"> {
|
||||
// GEN-NEXT: #ifdef GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
|
||||
// GEN-NEXT: #undef GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
|
||||
// GEN-EMPTY:
|
||||
// GEN-NEXT: TdlClauseA
|
||||
// GEN-NEXT: Clausea
|
||||
// GEN-NEXT: , Clauseb
|
||||
// GEN-EMPTY:
|
||||
// GEN-NEXT: #endif // GEN_FLANG_CLAUSE_PARSER_CLASSES_LIST
|
||||
@ -241,6 +241,7 @@ def TDL_DirA : Directive<"dira"> {
|
||||
// GEN-NEXT: #ifdef GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
|
||||
// GEN-NEXT: #undef GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
|
||||
// GEN-EMPTY:
|
||||
// GEN-NEXT: NODE(TdlClause, Clausea)
|
||||
// GEN-NEXT: NODE(TdlClause, Clauseb)
|
||||
// GEN-EMPTY:
|
||||
// GEN-NEXT: #endif // GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
|
||||
@ -248,6 +249,7 @@ def TDL_DirA : Directive<"dira"> {
|
||||
// GEN-NEXT: #ifdef GEN_FLANG_CLAUSE_UNPARSE
|
||||
// GEN-NEXT: #undef GEN_FLANG_CLAUSE_UNPARSE
|
||||
// GEN-EMPTY:
|
||||
// GEN-NEXT: void Before(const TdlClause::Clausea &) { Word("CLAUSEA"); }
|
||||
// GEN-NEXT: void Unparse(const TdlClause::Clauseb &x) {
|
||||
// GEN-NEXT: Word("CLAUSEB");
|
||||
// GEN-NEXT: Walk("(", x.v, ")");
|
||||
|
@ -19,12 +19,12 @@ def TDLC_ClauseA : Clause<"clausea"> {
|
||||
}
|
||||
def TDLC_ClauseB : Clause<"clauseb"> {
|
||||
let isDefault = 1;
|
||||
let flangClassValue = "IntExpr";
|
||||
let flangClass = "IntExpr";
|
||||
let isValueList = 1;
|
||||
}
|
||||
def TDLC_ClauseC : Clause<"clausec"> {
|
||||
let clangClass = "ClauseC";
|
||||
let flangClassValue = "Name";
|
||||
let flangClass = "Name";
|
||||
let defaultValue = "*";
|
||||
let isValueOptional = 1;
|
||||
}
|
||||
|
@ -535,20 +535,16 @@ void GenerateFlangClauseParserClass(const DirectiveLanguage &DirLang,
|
||||
|
||||
for (const auto &C : DirLang.getClauses()) {
|
||||
Clause Clause{C};
|
||||
// Clause has a non generic class.
|
||||
if (!Clause.getFlangClass().empty())
|
||||
continue;
|
||||
if (!Clause.getFlangClassValue().empty()) {
|
||||
if (!Clause.getFlangClass().empty()) {
|
||||
OS << "WRAPPER_CLASS(" << Clause.getFormattedParserClassName() << ", ";
|
||||
if (Clause.isValueOptional() && Clause.isValueList()) {
|
||||
OS << "std::optional<std::list<" << Clause.getFlangClassValue()
|
||||
<< ">>";
|
||||
OS << "std::optional<std::list<" << Clause.getFlangClass() << ">>";
|
||||
} else if (Clause.isValueOptional()) {
|
||||
OS << "std::optional<" << Clause.getFlangClassValue() << ">";
|
||||
OS << "std::optional<" << Clause.getFlangClass() << ">";
|
||||
} else if (Clause.isValueList()) {
|
||||
OS << "std::list<" << Clause.getFlangClassValue() << ">";
|
||||
OS << "std::list<" << Clause.getFlangClass() << ">";
|
||||
} else {
|
||||
OS << Clause.getFlangClassValue();
|
||||
OS << Clause.getFlangClass();
|
||||
}
|
||||
} else {
|
||||
OS << "EMPTY_CLASS(" << Clause.getFormattedParserClassName();
|
||||
@ -566,10 +562,7 @@ void GenerateFlangClauseParserClassList(const DirectiveLanguage &DirLang,
|
||||
OS << "\n";
|
||||
llvm::interleaveComma(DirLang.getClauses(), OS, [&](Record *C) {
|
||||
Clause Clause{C};
|
||||
if (Clause.getFlangClass().empty())
|
||||
OS << Clause.getFormattedParserClassName() << "\n";
|
||||
else
|
||||
OS << Clause.getFlangClass() << "\n";
|
||||
OS << Clause.getFormattedParserClassName() << "\n";
|
||||
});
|
||||
}
|
||||
|
||||
@ -582,10 +575,6 @@ void GenerateFlangClauseDump(const DirectiveLanguage &DirLang,
|
||||
OS << "\n";
|
||||
for (const auto &C : DirLang.getClauses()) {
|
||||
Clause Clause{C};
|
||||
// Clause has a non generic class.
|
||||
if (!Clause.getFlangClass().empty())
|
||||
continue;
|
||||
|
||||
OS << "NODE(" << DirLang.getFlangClauseBaseClass() << ", "
|
||||
<< Clause.getFormattedParserClassName() << ")\n";
|
||||
}
|
||||
@ -602,10 +591,7 @@ void GenerateFlangClauseUnparse(const DirectiveLanguage &DirLang,
|
||||
|
||||
for (const auto &C : DirLang.getClauses()) {
|
||||
Clause Clause{C};
|
||||
// Clause has a non generic class.
|
||||
if (!Clause.getFlangClass().empty())
|
||||
continue;
|
||||
if (!Clause.getFlangClassValue().empty()) {
|
||||
if (!Clause.getFlangClass().empty()) {
|
||||
if (Clause.isValueOptional() && Clause.getDefaultValue().empty()) {
|
||||
OS << "void Unparse(const " << DirLang.getFlangClauseBaseClass()
|
||||
<< "::" << Clause.getFormattedParserClassName() << " &x) {\n";
|
||||
|
Loading…
Reference in New Issue
Block a user