@@ -959,25 +959,21 @@ class DICompileUnit : public DIScope {
959959 StringRef Producer, bool IsOptimized, StringRef Flags,
960960 unsigned RuntimeVersion, StringRef SplitDebugFilename,
961961 unsigned EmissionKind, DICompositeTypeArray EnumTypes,
962- DITypeArray RetainedTypes, DISubprogramArray Subprograms,
963- DIGlobalVariableArray GlobalVariables,
962+ DIScopeArray RetainedTypes, DIGlobalVariableArray GlobalVariables,
964963 DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
965964 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);
974971 }
975972 static DICompileUnit *
976973 getImpl (LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
977974 MDString *Producer, bool IsOptimized, MDString *Flags,
978975 unsigned RuntimeVersion, MDString *SplitDebugFilename,
979- unsigned EmissionKind, Metadata *EnumTypes,
980- Metadata *RetainedTypes, Metadata *Subprograms,
976+ unsigned EmissionKind, Metadata *EnumTypes, Metadata *RetainedTypes,
981977 Metadata *GlobalVariables, Metadata *ImportedEntities,
982978 Metadata *Macros, uint64_t DWOId, StorageType Storage,
983979 bool ShouldCreate = true );
@@ -986,7 +982,7 @@ class DICompileUnit : public DIScope {
986982 return getTemporary (
987983 getContext (), getSourceLanguage (), getFile (), getProducer (),
988984 isOptimized (), getFlags (), getRuntimeVersion (), getSplitDebugFilename (),
989- getEmissionKind (), getEnumTypes (), getRetainedTypes (), getSubprograms (),
985+ getEmissionKind (), getEnumTypes (), getRetainedTypes (),
990986 getGlobalVariables (), getImportedEntities (), getMacros (), DWOId);
991987 }
992988
@@ -999,23 +995,22 @@ class DICompileUnit : public DIScope {
999995 (unsigned SourceLanguage, DIFile *File, StringRef Producer,
1000996 bool IsOptimized, StringRef Flags, unsigned RuntimeVersion,
1001997 StringRef SplitDebugFilename, DebugEmissionKind EmissionKind,
1002- DICompositeTypeArray EnumTypes, DITypeArray RetainedTypes,
1003- DISubprogramArray Subprograms, DIGlobalVariableArray GlobalVariables,
998+ DICompositeTypeArray EnumTypes, DIScopeArray RetainedTypes,
999+ DIGlobalVariableArray GlobalVariables,
10041000 DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
10051001 uint64_t DWOId),
10061002 (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1007- SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, Subprograms,
1003+ SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
10081004 GlobalVariables, ImportedEntities, Macros, DWOId))
10091005 DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(
10101006 DICompileUnit,
10111007 (unsigned SourceLanguage, Metadata *File, MDString *Producer,
10121008 bool IsOptimized, MDString *Flags, unsigned RuntimeVersion,
10131009 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),
10171012 (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1018- SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes, Subprograms,
1013+ SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
10191014 GlobalVariables, ImportedEntities, Macros, DWOId))
10201015
10211016 TempDICompileUnit clone() const { return cloneImpl (); }
@@ -1032,12 +1027,9 @@ class DICompileUnit : public DIScope {
10321027 DICompositeTypeArray getEnumTypes () const {
10331028 return cast_or_null<MDTuple>(getRawEnumTypes ());
10341029 }
1035- DITypeArray getRetainedTypes () const {
1030+ DIScopeArray getRetainedTypes () const {
10361031 return cast_or_null<MDTuple>(getRawRetainedTypes ());
10371032 }
1038- DISubprogramArray getSubprograms () const {
1039- return cast_or_null<MDTuple>(getRawSubprograms ());
1040- }
10411033 DIGlobalVariableArray getGlobalVariables () const {
10421034 return cast_or_null<MDTuple>(getRawGlobalVariables ());
10431035 }
@@ -1057,10 +1049,9 @@ class DICompileUnit : public DIScope {
10571049 }
10581050 Metadata *getRawEnumTypes () const { return getOperand (4 ); }
10591051 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 ); }
10641055
10651056 // / \brief Replace arrays.
10661057 // /
@@ -1074,16 +1065,13 @@ class DICompileUnit : public DIScope {
10741065 void replaceRetainedTypes (DITypeArray N) {
10751066 replaceOperandWith (5 , N.get ());
10761067 }
1077- void replaceSubprograms (DISubprogramArray N) {
1078- replaceOperandWith (6 , N.get ());
1079- }
10801068 void replaceGlobalVariables (DIGlobalVariableArray N) {
1081- replaceOperandWith (7 , N.get ());
1069+ replaceOperandWith (6 , N.get ());
10821070 }
10831071 void replaceImportedEntities (DIImportedEntityArray N) {
1084- replaceOperandWith (8 , N.get ());
1072+ replaceOperandWith (7 , N.get ());
10851073 }
1086- void replaceMacros (DIMacroNodeArray N) { replaceOperandWith (9 , N.get ()); }
1074+ void replaceMacros (DIMacroNodeArray N) { replaceOperandWith (8 , N.get ()); }
10871075 // / @}
10881076
10891077 static bool classof (const Metadata *MD) {
@@ -1266,13 +1254,13 @@ class DISubprogram : public DILocalScope {
12661254 DISubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
12671255 unsigned ScopeLine, DITypeRef ContainingType, unsigned Virtuality,
12681256 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 ) {
12721260 return getImpl (Context, Scope, getCanonicalMDString (Context, Name),
12731261 getCanonicalMDString (Context, LinkageName), File, Line, Type,
12741262 IsLocalToUnit, IsDefinition, ScopeLine, ContainingType,
1275- Virtuality, VirtualIndex, Flags, IsOptimized,
1263+ Virtuality, VirtualIndex, Flags, IsOptimized, Unit,
12761264 TemplateParams.get (), Declaration, Variables.get (), Storage,
12771265 ShouldCreate);
12781266 }
@@ -1281,16 +1269,17 @@ class DISubprogram : public DILocalScope {
12811269 MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
12821270 bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
12831271 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 );
12871275
12881276 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 ());
12941283 }
12951284
12961285public:
@@ -1300,24 +1289,25 @@ class DISubprogram : public DILocalScope {
13001289 bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
13011290 DITypeRef ContainingType, unsigned Virtuality,
13021291 unsigned VirtualIndex, unsigned Flags, bool IsOptimized,
1292+ DICompileUnit *Unit,
13031293 DITemplateParameterArray TemplateParams = nullptr ,
13041294 DISubprogram *Declaration = nullptr ,
13051295 DILocalVariableArray Variables = nullptr ),
13061296 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
13071297 IsDefinition, ScopeLine, ContainingType, Virtuality,
1308- VirtualIndex, Flags, IsOptimized, TemplateParams,
1298+ VirtualIndex, Flags, IsOptimized, Unit, TemplateParams,
13091299 Declaration, Variables))
13101300 DEFINE_MDNODE_GET(
13111301 DISubprogram,
13121302 (Metadata * Scope, MDString *Name, MDString *LinkageName, Metadata *File,
13131303 unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
13141304 unsigned ScopeLine, Metadata *ContainingType, unsigned Virtuality,
13151305 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 ),
13181308 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
13191309 ScopeLine, ContainingType, Virtuality, VirtualIndex, Flags, IsOptimized,
1320- TemplateParams, Declaration, Variables))
1310+ Unit, TemplateParams, Declaration, Variables))
13211311
13221312 TempDISubprogram clone() const { return cloneImpl (); }
13231313
@@ -1376,6 +1366,12 @@ class DISubprogram : public DILocalScope {
13761366 return DITypeRef (getRawContainingType ());
13771367 }
13781368
1369+ DICompileUnit *getUnit () const {
1370+ return cast_or_null<DICompileUnit>(getRawUnit ());
1371+ }
1372+ void replaceUnit (DICompileUnit *CU) {
1373+ replaceOperandWith (7 , CU);
1374+ }
13791375 DITemplateParameterArray getTemplateParams () const {
13801376 return cast_or_null<MDTuple>(getRawTemplateParams ());
13811377 }
@@ -1389,9 +1385,10 @@ class DISubprogram : public DILocalScope {
13891385 Metadata *getRawScope () const { return getOperand (1 ); }
13901386 Metadata *getRawType () const { return getOperand (5 ); }
13911387 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 ); }
13951392
13961393 // / \brief Check if this subprogram describes the given function.
13971394 // /
0 commit comments