diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-06-07 22:00:26 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-06-07 22:00:26 +0000 |
commit | 4f1bd9e9963239c119db70070db1d68286b3de7e (patch) | |
tree | d1606a0f29f57d16f5db895bb11a151a83cf0f11 /lib | |
parent | 6296b3cac5448afe910e9dd7953fb10082721c77 (diff) | |
download | external_llvm-4f1bd9e9963239c119db70070db1d68286b3de7e.tar.gz external_llvm-4f1bd9e9963239c119db70070db1d68286b3de7e.tar.bz2 external_llvm-4f1bd9e9963239c119db70070db1d68286b3de7e.zip |
For PR780:
1. Fix the macros in IncludeFile.h to put everything in the llvm namespace
2. Replace the previous explicit mechanism in all the .h and .cpp files
with the macros in IncludeFile.h
This gets us a consistent mechanism throughout LLVM for ensuring linkage.
Next step is to make sure its used in enough places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28715 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/AliasAnalysis.cpp | 6 | ||||
-rw-r--r-- | lib/Analysis/BasicAliasAnalysis.cpp | 6 | ||||
-rw-r--r-- | lib/Analysis/IPA/CallGraph.cpp | 9 | ||||
-rw-r--r-- | lib/Analysis/IPA/FindUsedTypes.cpp | 6 | ||||
-rw-r--r-- | lib/Analysis/LoopInfo.cpp | 5 | ||||
-rw-r--r-- | lib/Analysis/PostDominators.cpp | 5 | ||||
-rw-r--r-- | lib/Analysis/ValueNumbering.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/Dominators.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/IntrinsicInst.cpp | 6 |
9 files changed, 21 insertions, 29 deletions
diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index 2abcbde74e..1843cd41d4 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -188,8 +188,4 @@ bool AliasAnalysis::canInstructionRangeModify(const Instruction &I1, // be pulled in if the AliasAnalysis classes are pulled in. Otherwise we run // the risk of AliasAnalysis being used, but the default implementation not // being linked into the tool that uses it. -// -namespace llvm { - extern int BasicAAStub; -} -static IncludeFile INCLUDE_BASICAA_CPP((void*)&BasicAAStub); +DEFINING_FILE_FOR(AliasAnalysis) diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 3cda92e49f..fa4a029648 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -26,9 +26,6 @@ #include <algorithm> using namespace llvm; -// Make sure that anything that uses AliasAnalysis pulls in this file... -int llvm::BasicAAStub; - namespace { /// NoAA - This class implements the -no-aa pass, which always returns "I /// don't know" for alias queries. NoAA is unlike other alias analysis @@ -846,3 +843,6 @@ BasicAliasAnalysis::getModRefBehavior(Function *F, CallSite CS, return UnknownModRefBehavior; } + +// Make sure that anything that uses AliasAnalysis pulls in this file... +DEFINING_FILE_FOR(BasicAliasAnalysis) diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp index f8846d390a..78bb735ffa 100644 --- a/lib/Analysis/IPA/CallGraph.cpp +++ b/lib/Analysis/IPA/CallGraph.cpp @@ -19,8 +19,6 @@ #include <iostream> using namespace llvm; -int llvm::BasicCallGraphStub; - static bool isOnlyADirectCall(Function *F, CallSite CS) { if (!CS.getInstruction()) return false; for (CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); I != E; ++I) @@ -256,10 +254,6 @@ CallGraphNode *CallGraph::getOrInsertFunction(const Function *F) { return CGN = new CallGraphNode(const_cast<Function*>(F)); } - - -int CallGraph::stub; // to ensure linkage of this file. - void CallGraphNode::print(std::ostream &OS) const { if (Function *F = getFunction()) OS << "Call graph node for function: '" << F->getName() <<"'\n"; @@ -297,3 +291,6 @@ void CallGraphNode::removeAnyCallEdgeTo(CallGraphNode *Callee) { --i; --e; } } + +// Enuse that users of CallGraph.h also link with this file +DEFINING_FILE_FOR(CallGraph) diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp index f7efc7d3a4..725cec4c01 100644 --- a/lib/Analysis/IPA/FindUsedTypes.cpp +++ b/lib/Analysis/IPA/FindUsedTypes.cpp @@ -24,9 +24,6 @@ using namespace llvm; static RegisterAnalysis<FindUsedTypes> X("printusedtypes", "Find Used Types"); -// stub to help linkage -int FindUsedTypes::stub; // to ensure linkage of this file - // IncorporateType - Incorporate one type and all of its subtypes into the // collection of used types. // @@ -104,3 +101,6 @@ void FindUsedTypes::print(std::ostream &o, const Module *M) const { E = UsedTypes.end(); I != E; ++I) o << " " << **I << "\n"; } + +// Ensure that this file gets linked in when FindUsedTypes.h is used. +DEFINING_FILE_FOR(FindUsedTypes) diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index f2ef17682f..c7ce58ef91 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -86,8 +86,6 @@ void Loop::dump() const { //===----------------------------------------------------------------------===// // LoopInfo implementation // -int LoopInfo::stub; - bool LoopInfo::runOnFunction(Function &) { releaseMemory(); Calculate(getAnalysis<ETForest>()); // Update @@ -557,3 +555,6 @@ Loop *Loop::removeChildLoop(iterator I) { void Loop::removeBlockFromLoop(BasicBlock *BB) { RemoveFromVector(Blocks, BB); } + +// Ensure this file gets linked when LoopInfo.h is used. +DEFINING_FILE_FOR(LoopInfo) diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp index 611ea60a67..e195d7a4c7 100644 --- a/lib/Analysis/PostDominators.cpp +++ b/lib/Analysis/PostDominators.cpp @@ -359,6 +359,5 @@ PostDominanceFrontier::calculate(const PostDominatorTree &DT, return S; } -// stub - a dummy function to make linking work ok. -int PostDominanceFrontier::stub; - +// Ensure that this .cpp file gets linked when PostDominators.h is used. +DEFINING_FILE_FOR(PostDominanceFrontier) diff --git a/lib/Analysis/ValueNumbering.cpp b/lib/Analysis/ValueNumbering.cpp index 0648222454..c534bba4dc 100644 --- a/lib/Analysis/ValueNumbering.cpp +++ b/lib/Analysis/ValueNumbering.cpp @@ -239,4 +239,5 @@ void BVNImpl::handleTernaryInst(Instruction &I) { } -int llvm::BasicValueNumberingStub; // to ensure linkage of this file +// Ensure that users of ValueNumbering.h will link with this file +DEFINING_FILE_FOR(BasicValueNumbering) diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index a0a6d253b2..35c847f7d6 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -304,8 +304,6 @@ bool DominatorSet::runOnFunction(Function &F) { return false; } -int DominatorSet::stub; - namespace llvm { static std::ostream &operator<<(std::ostream &o, const std::set<BasicBlock*> &BBs) { @@ -933,3 +931,5 @@ void ETForestBase::print(std::ostream &o, const Module *) const { } o << "\n"; } + +DEFINING_FILE_FOR(DominatorSet) diff --git a/lib/VMCore/IntrinsicInst.cpp b/lib/VMCore/IntrinsicInst.cpp index b4395e1cd3..598a99f18f 100644 --- a/lib/VMCore/IntrinsicInst.cpp +++ b/lib/VMCore/IntrinsicInst.cpp @@ -71,7 +71,5 @@ std::string DbgStopPointInst::getDirectory() const { } //===----------------------------------------------------------------------===// -/// LinkIntrinsicInstStub -- This is a hack to make sure that programs that -/// #include IntrinsicInst.h also link this file. See Support/IncludeFile.h -/// for further details. -char llvm::LinkIntrinsicInstStub; +/// Ensure that users of IntrinsicInst.h will link with this module. +DEFINING_FILE_FOR(IntrinsicInst) |