/// getGlobalVariablesUsing - Return all of the GlobalVariables that use the
/// named GlobalVariable.
- std::vector<GlobalVariable*>
- getGlobalVariablesUsing(Module &M, const std::string &RootName);
+ void getGlobalVariablesUsing(Module &M, const std::string &RootName,
+ std::vector<GlobalVariable*> &Result);
/// getAnchoredDescriptors - Return a vector of anchored debug descriptors.
///
- template <class T>std::vector<T *> getAnchoredDescriptors(Module &M) {
+ template <class T>
+ void getAnchoredDescriptors(Module &M, std::vector<T*> &AnchoredDescs) {
T Desc;
- std::vector<GlobalVariable *> Globals =
- getGlobalVariablesUsing(M, Desc.getAnchorString());
- std::vector<T *> AnchoredDescs;
+ std::vector<GlobalVariable *> Globals;
+ getGlobalVariablesUsing(M, Desc.getAnchorString(), Globals);
+
for (unsigned i = 0, N = Globals.size(); i < N; ++i) {
GlobalVariable *GV = Globals[i];
AnchoredDescs.push_back(cast<T>(DR.Deserialize(GV)));
}
}
-
- return AnchoredDescs;
}
/// RecordRegionStart - Indicate the start of a region.
/// ConstructGlobalDIEs - Create DIEs for each of the externally visible
/// global variables.
void ConstructGlobalDIEs() {
- std::vector<GlobalVariableDesc *> GlobalVariables =
- MMI->getAnchoredDescriptors<GlobalVariableDesc>(*M);
+ std::vector<GlobalVariableDesc *> GlobalVariables;
+ MMI->getAnchoredDescriptors<GlobalVariableDesc>(*M, GlobalVariables);
for (unsigned i = 0, N = GlobalVariables.size(); i < N; ++i) {
GlobalVariableDesc *GVD = GlobalVariables[i];
/// ConstructSubprogramDIEs - Create DIEs for each of the externally visible
/// subprograms.
void ConstructSubprogramDIEs() {
- std::vector<SubprogramDesc *> Subprograms =
- MMI->getAnchoredDescriptors<SubprogramDesc>(*M);
+ std::vector<SubprogramDesc *> Subprograms;
+ MMI->getAnchoredDescriptors<SubprogramDesc>(*M, Subprograms);
for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) {
SubprogramDesc *SPD = Subprograms[i];
/// getGlobalVariablesUsing - Return all of the GlobalVariables that use the
/// named GlobalVariable.
-static std::vector<GlobalVariable*>
-getGlobalVariablesUsing(Module &M, const std::string &RootName) {
- std::vector<GlobalVariable*> Result; // GlobalVariables matching criteria.
-
+static void
+getGlobalVariablesUsing(Module &M, const std::string &RootName,
+ std::vector<GlobalVariable*> &Result) {
std::vector<const Type*> FieldTypes;
FieldTypes.push_back(Type::Int32Ty);
FieldTypes.push_back(Type::Int32Ty);
StructType::get(FieldTypes));
// If present and linkonce then scan for users.
- if (UseRoot && UseRoot->hasLinkOnceLinkage()) {
+ if (UseRoot && UseRoot->hasLinkOnceLinkage())
getGlobalVariablesUsing(UseRoot, Result);
- }
-
- return Result;
}
/// isStringValue - Return true if the given value can be coerced to a string.
/// SetupCompileUnits - Set up the unique vector of compile units.
///
void MachineModuleInfo::SetupCompileUnits(Module &M) {
- std::vector<CompileUnitDesc *>CU = getAnchoredDescriptors<CompileUnitDesc>(M);
+ std::vector<CompileUnitDesc *> CU;
+ getAnchoredDescriptors<CompileUnitDesc>(M, CU);
for (unsigned i = 0, N = CU.size(); i < N; i++) {
CompileUnits.insert(CU[i]);
/// getGlobalVariablesUsing - Return all of the GlobalVariables that use the
/// named GlobalVariable.
-std::vector<GlobalVariable*>
+void
MachineModuleInfo::getGlobalVariablesUsing(Module &M,
- const std::string &RootName) {
- return ::getGlobalVariablesUsing(M, RootName);
+ const std::string &RootName,
+ std::vector<GlobalVariable*>&Result){
+ return ::getGlobalVariablesUsing(M, RootName, Result);
}
/// RecordSourceLine - Records location information and associates it with a