Change from using a stub function to a stub variable for passing to the

IncludeFile hack to ensure linkage of analysis passes. This works around
some -pedantic warnings about assigning an object to a function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28621 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2006-06-01 07:02:51 +00:00
parent 177284ce89
commit 192913e281
15 changed files with 22 additions and 23 deletions

View File

@@ -321,8 +321,8 @@ public:
// the risk of AliasAnalysis being used, but the default implementation not // the risk of AliasAnalysis being used, but the default implementation not
// being linked into the tool that uses it. // being linked into the tool that uses it.
// //
extern void BasicAAStub(); extern int BasicAAStub;
static IncludeFile HDR_INCLUDE_BASICAA_CPP((void*)&BasicAAStub); static IncludeFile HDR_INCLUDE_BASICAA_CPP(&BasicAAStub);
} // End llvm namespace } // End llvm namespace

View File

@@ -155,7 +155,7 @@ public:
void dump() const; void dump() const;
// stub - dummy function, just ignore it // stub - dummy function, just ignore it
static void stub(); static int stub;
protected: protected:
// destroy - Release memory for the call graph // destroy - Release memory for the call graph
@@ -289,7 +289,7 @@ template<> struct GraphTraits<const CallGraph*> :
// Make sure that any clients of this file link in CallGraph.cpp // Make sure that any clients of this file link in CallGraph.cpp
static IncludeFile static IncludeFile
CALLGRAPH_INCLUDE_FILE((void*)&CallGraph::stub); CALLGRAPH_INCLUDE_FILE(&CallGraph::stub);
extern void BasicCallGraphStub(); extern void BasicCallGraphStub();
static IncludeFile HDR_INCLUDE_CALLGRAPH_CPP((void*)&BasicCallGraphStub); static IncludeFile HDR_INCLUDE_CALLGRAPH_CPP((void*)&BasicCallGraphStub);

View File

@@ -276,7 +276,7 @@ public:
} }
// stub - dummy function, just ignore it // stub - dummy function, just ignore it
static void stub(); static int stub;
}; };
@@ -654,7 +654,7 @@ private:
// Make sure that any clients of this file link in Dominators.cpp // Make sure that any clients of this file link in Dominators.cpp
static IncludeFile static IncludeFile
DOMINATORS_INCLUDE_FILE((void*)&DominatorSet::stub); DOMINATORS_INCLUDE_FILE(&DominatorSet::stub);
} // End llvm namespace } // End llvm namespace
#endif #endif

View File

@@ -55,12 +55,12 @@ public:
} }
// stub - dummy function, just ignore it // stub - dummy function, just ignore it
static void stub(); static int stub;
}; };
// Make sure that any clients of this file link in PostDominators.cpp // Make sure that any clients of this file link in PostDominators.cpp
static IncludeFile static IncludeFile
FIND_USED_TYPES_INCLUDE_FILE((void*)(&FindUsedTypes::stub)); FIND_USED_TYPES_INCLUDE_FILE(&FindUsedTypes::stub);
} // End llvm namespace } // End llvm namespace

View File

@@ -295,7 +295,7 @@ public:
/// BasicBlocks to loops. /// BasicBlocks to loops.
void removeBlock(BasicBlock *BB); void removeBlock(BasicBlock *BB);
static void stub(); // Noop static int stub; // Noop
private: private:
void Calculate(ETForest &EF); void Calculate(ETForest &EF);
Loop *ConsiderForLoop(BasicBlock *BB, ETForest &EF); Loop *ConsiderForLoop(BasicBlock *BB, ETForest &EF);
@@ -306,7 +306,7 @@ private:
// Make sure that any clients of this file link in LoopInfo.cpp // Make sure that any clients of this file link in LoopInfo.cpp
static IncludeFile static IncludeFile
LOOP_INFO_INCLUDE_FILE((void*)(&LoopInfo::stub)); LOOP_INFO_INCLUDE_FILE(&LoopInfo::stub);
// Allow clients to walk the list of nested loops... // Allow clients to walk the list of nested loops...
template <> struct GraphTraits<const Loop*> { template <> struct GraphTraits<const Loop*> {

View File

@@ -129,7 +129,7 @@ struct PostDominanceFrontier : public DominanceFrontierBase {
} }
// stub - dummy function, just ignore it // stub - dummy function, just ignore it
static void stub(); static int stub;
private: private:
const DomSetType &calculate(const PostDominatorTree &DT, const DomSetType &calculate(const PostDominatorTree &DT,
@@ -138,7 +138,7 @@ private:
// Make sure that any clients of this file link in PostDominators.cpp // Make sure that any clients of this file link in PostDominators.cpp
static IncludeFile static IncludeFile
POST_DOMINATOR_INCLUDE_FILE((void*)&PostDominanceFrontier::stub); POST_DOMINATOR_INCLUDE_FILE(&PostDominanceFrontier::stub);
} // End llvm namespace } // End llvm namespace

View File

@@ -65,9 +65,9 @@ struct ValueNumbering {
} }
}; };
extern void BasicValueNumberingStub(); extern int BasicValueNumberingStub;
static IncludeFile static IncludeFile
HDR_INCLUDE_VALUENUMBERING_CPP((void*)&BasicValueNumberingStub); HDR_INCLUDE_VALUENUMBERING_CPP(&BasicValueNumberingStub);
} // End llvm namespace } // End llvm namespace

View File

@@ -189,6 +189,6 @@ bool AliasAnalysis::canInstructionRangeModify(const Instruction &I1,
// being linked into the tool that uses it. // being linked into the tool that uses it.
// //
namespace llvm { namespace llvm {
extern void BasicAAStub(); extern int BasicAAStub;
} }
static IncludeFile INCLUDE_BASICAA_CPP((void*)&BasicAAStub); static IncludeFile INCLUDE_BASICAA_CPP((void*)&BasicAAStub);

View File

@@ -27,7 +27,7 @@
using namespace llvm; using namespace llvm;
// Make sure that anything that uses AliasAnalysis pulls in this file... // Make sure that anything that uses AliasAnalysis pulls in this file...
void llvm::BasicAAStub() {} int llvm::BasicAAStub;
namespace { namespace {
/// NoAA - This class implements the -no-aa pass, which always returns "I /// NoAA - This class implements the -no-aa pass, which always returns "I

View File

@@ -258,7 +258,7 @@ CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) {
void CallGraph::stub() {} int CallGraph::stub; // to ensure linkage of this file.
void CallGraphNode::print(std::ostream &OS) const { void CallGraphNode::print(std::ostream &OS) const {
if (Function *F = getFunction()) if (Function *F = getFunction())

View File

@@ -25,7 +25,7 @@ static RegisterAnalysis<FindUsedTypes>
X("printusedtypes", "Find Used Types"); X("printusedtypes", "Find Used Types");
// stub to help linkage // stub to help linkage
void FindUsedTypes::stub() {} int FindUsedTypes::stub; // to ensure linkage of this file
// IncorporateType - Incorporate one type and all of its subtypes into the // IncorporateType - Incorporate one type and all of its subtypes into the
// collection of used types. // collection of used types.

View File

@@ -86,7 +86,7 @@ void Loop::dump() const {
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// LoopInfo implementation // LoopInfo implementation
// //
void LoopInfo::stub() {} int LoopInfo::stub;
bool LoopInfo::runOnFunction(Function &) { bool LoopInfo::runOnFunction(Function &) {
releaseMemory(); releaseMemory();

View File

@@ -360,6 +360,5 @@ PostDominanceFrontier::calculate(const PostDominatorTree &DT,
} }
// stub - a dummy function to make linking work ok. // stub - a dummy function to make linking work ok.
void PostDominanceFrontier::stub() { int PostDominanceFrontier::stub;
}

View File

@@ -239,4 +239,4 @@ void BVNImpl::handleTernaryInst(Instruction &I) {
} }
void llvm::BasicValueNumberingStub() { } int llvm::BasicValueNumberingStub; // to ensure linkage of this file

View File

@@ -304,7 +304,7 @@ bool DominatorSet::runOnFunction(Function &F) {
return false; return false;
} }
void DominatorSet::stub() {} int DominatorSet::stub;
namespace llvm { namespace llvm {
static std::ostream &operator<<(std::ostream &o, static std::ostream &operator<<(std::ostream &o,