@@ -959,25 +959,21 @@ class DICompileUnit : public DIScope {
959
959
StringRef Producer, bool IsOptimized, StringRef Flags,
960
960
unsigned RuntimeVersion, StringRef SplitDebugFilename,
961
961
unsigned EmissionKind, DICompositeTypeArray EnumTypes,
962
- DITypeArray RetainedTypes, DISubprogramArray Subprograms,
963
- DIGlobalVariableArray GlobalVariables,
962
+ DIScopeArray RetainedTypes, DIGlobalVariableArray GlobalVariables,
964
963
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
965
964
uint64_t DWOId, StorageType Storage, bool ShouldCreate = true ) {
966
- return getImpl (Context, SourceLanguage, File,
967
- getCanonicalMDString (Context, Producer), IsOptimized,
968
- getCanonicalMDString (Context, Flags), RuntimeVersion,
969
- getCanonicalMDString (Context, SplitDebugFilename),
970
- EmissionKind, EnumTypes.get (), RetainedTypes.get (),
971
- Subprograms.get (), GlobalVariables.get (),
972
- ImportedEntities.get (), Macros.get (), DWOId, Storage,
973
- ShouldCreate);
965
+ return getImpl (
966
+ Context, SourceLanguage, File, getCanonicalMDString (Context, Producer),
967
+ IsOptimized, getCanonicalMDString (Context, Flags), RuntimeVersion,
968
+ getCanonicalMDString (Context, SplitDebugFilename), EmissionKind,
969
+ EnumTypes.get (), RetainedTypes.get (), GlobalVariables.get (),
970
+ ImportedEntities.get (), Macros.get (), DWOId, Storage, ShouldCreate);
974
971
}
975
972
static DICompileUnit *
976
973
getImpl (LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
977
974
MDString *Producer, bool IsOptimized, MDString *Flags,
978
975
unsigned RuntimeVersion, MDString *SplitDebugFilename,
979
- unsigned EmissionKind, Metadata *EnumTypes,
980
- Metadata *RetainedTypes, Metadata *Subprograms,
976
+ unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
981
977
Metadata *GlobalVariables, Metadata *ImportedEntities,
982
978
Metadata *Macros, uint64_t DWOId, StorageType Storage,
983
979
bool ShouldCreate = true );
@@ -986,7 +982,7 @@ class DICompileUnit : public DIScope {
986
982
return getTemporary (
987
983
getContext (), getSourceLanguage (), getFile (), getProducer (),
988
984
isOptimized (), getFlags (), getRuntimeVersion (), getSplitDebugFilename (),
989
- getEmissionKind (), getEnumTypes (), getRetainedTypes (), getSubprograms (),
985
+ getEmissionKind (), getEnumTypes (), getRetainedTypes (),
990
986
getGlobalVariables (), getImportedEntities (), getMacros (), DWOId);
991
987
}
992
988
@@ -999,23 +995,22 @@ class DICompileUnit : public DIScope {
999
995
(unsigned SourceLanguage, DIFile *File, StringRef Producer,
1000
996
bool IsOptimized, StringRef Flags, unsigned RuntimeVersion,
1001
997
StringRef SplitDebugFilename, DebugEmissionKind EmissionKind,
1002
- DICompositeTypeArray EnumTypes, DITypeArray RetainedTypes,
1003
- DISubprogramArray Subprograms, DIGlobalVariableArray GlobalVariables,
998
+ DICompositeTypeArray EnumTypes, DIScopeArray RetainedTypes,
999
+ DIGlobalVariableArray GlobalVariables,
1004
1000
DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
1005
1001
uint64_t DWOId),
1006
1002
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1007
- SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, Subprograms,
1003
+ SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
1008
1004
GlobalVariables, ImportedEntities, Macros, DWOId))
1009
1005
DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(
1010
1006
DICompileUnit,
1011
1007
(unsigned SourceLanguage, Metadata *File, MDString *Producer,
1012
1008
bool IsOptimized, MDString *Flags, unsigned RuntimeVersion,
1013
1009
MDString *SplitDebugFilename, unsigned EmissionKind, Metadata *EnumTypes,
1014
- Metadata *RetainedTypes, Metadata *Subprograms,
1015
- Metadata *GlobalVariables, Metadata *ImportedEntities, Metadata *Macros,
1016
- uint64_t DWOId),
1010
+ Metadata *RetainedTypes, Metadata *GlobalVariables,
1011
+ Metadata *ImportedEntities, Metadata *Macros, uint64_t DWOId),
1017
1012
(SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1018
- SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, Subprograms,
1013
+ SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
1019
1014
GlobalVariables, ImportedEntities, Macros, DWOId))
1020
1015
1021
1016
TempDICompileUnit clone() const { return cloneImpl (); }
@@ -1032,12 +1027,9 @@ class DICompileUnit : public DIScope {
1032
1027
DICompositeTypeArray getEnumTypes () const {
1033
1028
return cast_or_null<MDTuple>(getRawEnumTypes ());
1034
1029
}
1035
- DITypeArray getRetainedTypes () const {
1030
+ DIScopeArray getRetainedTypes () const {
1036
1031
return cast_or_null<MDTuple>(getRawRetainedTypes ());
1037
1032
}
1038
- DISubprogramArray getSubprograms () const {
1039
- return cast_or_null<MDTuple>(getRawSubprograms ());
1040
- }
1041
1033
DIGlobalVariableArray getGlobalVariables () const {
1042
1034
return cast_or_null<MDTuple>(getRawGlobalVariables ());
1043
1035
}
@@ -1057,10 +1049,9 @@ class DICompileUnit : public DIScope {
1057
1049
}
1058
1050
Metadata *getRawEnumTypes () const { return getOperand (4 ); }
1059
1051
Metadata *getRawRetainedTypes () const { return getOperand (5 ); }
1060
- Metadata *getRawSubprograms () const { return getOperand (6 ); }
1061
- Metadata *getRawGlobalVariables () const { return getOperand (7 ); }
1062
- Metadata *getRawImportedEntities () const { return getOperand (8 ); }
1063
- Metadata *getRawMacros () const { return getOperand (9 ); }
1052
+ Metadata *getRawGlobalVariables () const { return getOperand (6 ); }
1053
+ Metadata *getRawImportedEntities () const { return getOperand (7 ); }
1054
+ Metadata *getRawMacros () const { return getOperand (8 ); }
1064
1055
1065
1056
// / \brief Replace arrays.
1066
1057
// /
@@ -1074,16 +1065,13 @@ class DICompileUnit : public DIScope {
1074
1065
void replaceRetainedTypes (DITypeArray N) {
1075
1066
replaceOperandWith (5 , N.get ());
1076
1067
}
1077
- void replaceSubprograms (DISubprogramArray N) {
1078
- replaceOperandWith (6 , N.get ());
1079
- }
1080
1068
void replaceGlobalVariables (DIGlobalVariableArray N) {
1081
- replaceOperandWith (7 , N.get ());
1069
+ replaceOperandWith (6 , N.get ());
1082
1070
}
1083
1071
void replaceImportedEntities (DIImportedEntityArray N) {
1084
- replaceOperandWith (8 , N.get ());
1072
+ replaceOperandWith (7 , N.get ());
1085
1073
}
1086
- void replaceMacros (DIMacroNodeArray N) { replaceOperandWith (9 , N.get ()); }
1074
+ void replaceMacros (DIMacroNodeArray N) { replaceOperandWith (8 , N.get ()); }
1087
1075
// / @}
1088
1076
1089
1077
static bool classof (const Metadata *MD) {
@@ -1266,13 +1254,13 @@ class DISubprogram : public DILocalScope {
1266
1254
DISubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
1267
1255
unsigned ScopeLine, DITypeRef ContainingType, unsigned Virtuality,
1268
1256
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
1269
- DITemplateParameterArray TemplateParams, DISubprogram *Declaration ,
1270
- DILocalVariableArray Variables, StorageType Storage ,
1271
- bool ShouldCreate = true ) {
1257
+ DICompileUnit *Unit, DITemplateParameterArray TemplateParams ,
1258
+ DISubprogram *Declaration, DILocalVariableArray Variables ,
1259
+ StorageType Storage, bool ShouldCreate = true ) {
1272
1260
return getImpl (Context, Scope, getCanonicalMDString (Context, Name),
1273
1261
getCanonicalMDString (Context, LinkageName), File, Line, Type,
1274
1262
IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
1275
- Virtuality, VirtualIndex, Flags, IsOptimized,
1263
+ Virtuality, VirtualIndex, Flags, IsOptimized, Unit,
1276
1264
TemplateParams.get (), Declaration, Variables.get (), Storage,
1277
1265
ShouldCreate);
1278
1266
}
@@ -1281,16 +1269,17 @@ class DISubprogram : public DILocalScope {
1281
1269
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
1282
1270
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
1283
1271
Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
1284
- unsigned Flags, bool IsOptimized, Metadata *TemplateParams ,
1285
- Metadata *Declaration , Metadata *Variables, StorageType Storage ,
1286
- bool ShouldCreate = true );
1272
+ unsigned Flags, bool IsOptimized, Metadata *Unit ,
1273
+ Metadata *TemplateParams , Metadata *Declaration, Metadata *Variables ,
1274
+ StorageType Storage, bool ShouldCreate = true );
1287
1275
1288
1276
TempDISubprogram cloneImpl () const {
1289
- return getTemporary (
1290
- getContext (), getScope (), getName (), getLinkageName (), getFile (),
1291
- getLine (), getType (), isLocalToUnit (), isDefinition (), getScopeLine (),
1292
- getContainingType (), getVirtuality (), getVirtualIndex (), getFlags (),
1293
- isOptimized (), getTemplateParams (), getDeclaration (), getVariables ());
1277
+ return getTemporary (getContext (), getScope (), getName (), getLinkageName (),
1278
+ getFile (), getLine (), getType (), isLocalToUnit (),
1279
+ isDefinition (), getScopeLine (), getContainingType (),
1280
+ getVirtuality (), getVirtualIndex (), getFlags (),
1281
+ isOptimized (), getUnit (), getTemplateParams (),
1282
+ getDeclaration (), getVariables ());
1294
1283
}
1295
1284
1296
1285
public:
@@ -1300,24 +1289,25 @@ class DISubprogram : public DILocalScope {
1300
1289
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
1301
1290
DITypeRef ContainingType, unsigned Virtuality,
1302
1291
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
1292
+ DICompileUnit *Unit,
1303
1293
DITemplateParameterArray TemplateParams = nullptr ,
1304
1294
DISubprogram *Declaration = nullptr ,
1305
1295
DILocalVariableArray Variables = nullptr ),
1306
1296
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
1307
1297
IsDefinition, ScopeLine, ContainingType, Virtuality,
1308
- VirtualIndex, Flags, IsOptimized, TemplateParams,
1298
+ VirtualIndex, Flags, IsOptimized, Unit, TemplateParams,
1309
1299
Declaration, Variables))
1310
1300
DEFINE_MDNODE_GET(
1311
1301
DISubprogram,
1312
1302
(Metadata * Scope, MDString *Name, MDString *LinkageName, Metadata *File,
1313
1303
unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
1314
1304
unsigned ScopeLine, Metadata *ContainingType, unsigned Virtuality,
1315
1305
unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
1316
- Metadata *TemplateParams = nullptr , Metadata *Declaration = nullptr ,
1317
- Metadata *Variables = nullptr ),
1306
+ Metadata *Unit , Metadata *TemplateParams = nullptr ,
1307
+ Metadata *Declaration = nullptr , Metadata * Variables = nullptr ),
1318
1308
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
1319
1309
ScopeLine, ContainingType, Virtuality, VirtualIndex, Flags, IsOptimized,
1320
- TemplateParams, Declaration, Variables))
1310
+ Unit, TemplateParams, Declaration, Variables))
1321
1311
1322
1312
TempDISubprogram clone() const { return cloneImpl (); }
1323
1313
@@ -1376,6 +1366,12 @@ class DISubprogram : public DILocalScope {
1376
1366
return DITypeRef (getRawContainingType ());
1377
1367
}
1378
1368
1369
+ DICompileUnit *getUnit () const {
1370
+ return cast_or_null<DICompileUnit>(getRawUnit ());
1371
+ }
1372
+ void replaceUnit (DICompileUnit *CU) {
1373
+ replaceOperandWith (7 , CU);
1374
+ }
1379
1375
DITemplateParameterArray getTemplateParams () const {
1380
1376
return cast_or_null<MDTuple>(getRawTemplateParams ());
1381
1377
}
@@ -1389,9 +1385,10 @@ class DISubprogram : public DILocalScope {
1389
1385
Metadata *getRawScope () const { return getOperand (1 ); }
1390
1386
Metadata *getRawType () const { return getOperand (5 ); }
1391
1387
Metadata *getRawContainingType () const { return getOperand (6 ); }
1392
- Metadata *getRawTemplateParams () const { return getOperand (7 ); }
1393
- Metadata *getRawDeclaration () const { return getOperand (8 ); }
1394
- Metadata *getRawVariables () const { return getOperand (9 ); }
1388
+ Metadata *getRawUnit () const { return getOperand (7 ); }
1389
+ Metadata *getRawTemplateParams () const { return getOperand (8 ); }
1390
+ Metadata *getRawDeclaration () const { return getOperand (9 ); }
1391
+ Metadata *getRawVariables () const { return getOperand (10 ); }
1395
1392
1396
1393
// / \brief Check if this subprogram describes the given function.
1397
1394
// /
0 commit comments