summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineModuleInfo.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-07-03 23:13:02 +0000
committerBill Wendling <isanbard@gmail.com>2008-07-03 23:13:02 +0000
commitc04f46567c3ebf64257d8f03e29d80a69606a6bc (patch)
tree53afbe1b9267df3a9f088aa94f0ed1b92d31bb44 /lib/CodeGen/MachineModuleInfo.cpp
parent10fff6078a7bc42f142c536bd55e9569253b280b (diff)
downloadllvm-c04f46567c3ebf64257d8f03e29d80a69606a6bc.tar.gz
llvm-c04f46567c3ebf64257d8f03e29d80a69606a6bc.tar.bz2
llvm-c04f46567c3ebf64257d8f03e29d80a69606a6bc.tar.xz
Don't return std::vector by value, but pass it in by reference to be filled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53123 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r--lib/CodeGen/MachineModuleInfo.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp
index b33a2d3e36..3d3a9957bb 100644
--- a/lib/CodeGen/MachineModuleInfo.cpp
+++ b/lib/CodeGen/MachineModuleInfo.cpp
@@ -52,10 +52,9 @@ getGlobalVariablesUsing(Value *V, std::vector<GlobalVariable*> &Result) {
/// 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);
@@ -65,11 +64,8 @@ getGlobalVariablesUsing(Module &M, const std::string &RootName) {
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.
@@ -1593,7 +1589,8 @@ void MachineModuleInfo::AnalyzeModule(Module &M) {
/// 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]);
@@ -1608,10 +1605,11 @@ const UniqueVector<CompileUnitDesc *> MachineModuleInfo::getCompileUnits()const{
/// 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