summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-06-07 22:00:26 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-06-07 22:00:26 +0000
commit4f1bd9e9963239c119db70070db1d68286b3de7e (patch)
treed1606a0f29f57d16f5db895bb11a151a83cf0f11 /include/llvm
parent6296b3cac5448afe910e9dd7953fb10082721c77 (diff)
downloadllvm-4f1bd9e9963239c119db70070db1d68286b3de7e.tar.gz
llvm-4f1bd9e9963239c119db70070db1d68286b3de7e.tar.bz2
llvm-4f1bd9e9963239c119db70070db1d68286b3de7e.tar.xz
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 'include/llvm')
-rw-r--r--include/llvm/Analysis/AliasAnalysis.h9
-rw-r--r--include/llvm/Analysis/CallGraph.h10
-rw-r--r--include/llvm/Analysis/Dominators.h6
-rw-r--r--include/llvm/Analysis/FindUsedTypes.h10
-rw-r--r--include/llvm/Analysis/LoopInfo.h8
-rw-r--r--include/llvm/Analysis/PostDominators.h10
-rw-r--r--include/llvm/Analysis/ValueNumbering.h7
-rw-r--r--include/llvm/IntrinsicInst.h9
-rw-r--r--include/llvm/Support/IncludeFile.h8
-rw-r--r--include/llvm/System/IncludeFile.h8
10 files changed, 36 insertions, 49 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h
index d715e0880b..2fff77420a 100644
--- a/include/llvm/Analysis/AliasAnalysis.h
+++ b/include/llvm/Analysis/AliasAnalysis.h
@@ -318,14 +318,13 @@ public:
}
};
+} // End llvm namespace
+
// Because of the way .a files work, we must force the BasicAA implementation to
// be pulled in if the AliasAnalysis header is included. Otherwise we run
// the risk of AliasAnalysis being used, but the default implementation not
// being linked into the tool that uses it.
-//
-extern int BasicAAStub;
-static IncludeFile HDR_INCLUDE_BASICAA_CPP(&BasicAAStub);
-
-} // End llvm namespace
+FORCE_DEFINING_FILE_TO_BE_LINKED(AliasAnalysis)
+FORCE_DEFINING_FILE_TO_BE_LINKED(BasicAliasAnalysis)
#endif
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index e51a3c7fb1..94cea10048 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -287,13 +287,9 @@ template<> struct GraphTraits<const CallGraph*> :
static nodes_iterator nodes_end (const CallGraph *CG) { return CG->end(); }
};
-// Make sure that any clients of this file link in CallGraph.cpp
-static IncludeFile
-CALLGRAPH_INCLUDE_FILE(&CallGraph::stub);
-
-extern int BasicCallGraphStub;
-static IncludeFile HDR_INCLUDE_CALLGRAPH_CPP(&BasicCallGraphStub);
-
} // End llvm namespace
+// Make sure that any clients of this file link in CallGraph.cpp
+FORCE_DEFINING_FILE_TO_BE_LINKED(CallGraph)
+
#endif
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 224e529915..31b8562f2c 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -652,9 +652,9 @@ private:
};
-// Make sure that any clients of this file link in Dominators.cpp
-static IncludeFile
-DOMINATORS_INCLUDE_FILE(&DominatorSet::stub);
} // End llvm namespace
+// Make sure that any clients of this file link in Dominators.cpp
+FORCE_DEFINING_FILE_TO_BE_LINKED(DominatorSet)
+
#endif
diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h
index e16fe9d7c3..fbf41de7cb 100644
--- a/include/llvm/Analysis/FindUsedTypes.h
+++ b/include/llvm/Analysis/FindUsedTypes.h
@@ -53,15 +53,11 @@ public:
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
-
- // stub - dummy function, just ignore it
- static int stub;
};
-// Make sure that any clients of this file link in PostDominators.cpp
-static IncludeFile
-FIND_USED_TYPES_INCLUDE_FILE(&FindUsedTypes::stub);
-
} // End llvm namespace
+// Make sure that any clients of this file link in PostDominators.cpp
+FORCE_DEFINING_FILE_TO_BE_LINKED(FindUsedTypes)
+
#endif
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 065ce31d8b..06b007cf3f 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -295,7 +295,6 @@ public:
/// BasicBlocks to loops.
void removeBlock(BasicBlock *BB);
- static int stub; // Noop
private:
void Calculate(ETForest &EF);
Loop *ConsiderForLoop(BasicBlock *BB, ETForest &EF);
@@ -304,10 +303,6 @@ private:
};
-// Make sure that any clients of this file link in LoopInfo.cpp
-static IncludeFile
-LOOP_INFO_INCLUDE_FILE(&LoopInfo::stub);
-
// Allow clients to walk the list of nested loops...
template <> struct GraphTraits<const Loop*> {
typedef const Loop NodeType;
@@ -337,4 +332,7 @@ template <> struct GraphTraits<Loop*> {
} // End llvm namespace
+// Make sure that any clients of this file link in LoopInfo.cpp
+FORCE_DEFINING_FILE_TO_BE_LINKED(LoopInfo)
+
#endif
diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h
index 1436be3037..4d8d140373 100644
--- a/include/llvm/Analysis/PostDominators.h
+++ b/include/llvm/Analysis/PostDominators.h
@@ -128,18 +128,14 @@ struct PostDominanceFrontier : public DominanceFrontierBase {
AU.addRequired<PostDominatorTree>();
}
- // stub - dummy function, just ignore it
- static int stub;
-
private:
const DomSetType &calculate(const PostDominatorTree &DT,
const DominatorTree::Node *Node);
};
-// Make sure that any clients of this file link in PostDominators.cpp
-static IncludeFile
-POST_DOMINATOR_INCLUDE_FILE(&PostDominanceFrontier::stub);
-
} // End llvm namespace
+// Make sure that any clients of this file link in PostDominators.cpp
+FORCE_DEFINING_FILE_TO_BE_LINKED(PostDominanceFrontier)
+
#endif
diff --git a/include/llvm/Analysis/ValueNumbering.h b/include/llvm/Analysis/ValueNumbering.h
index 2fc949766e..f708f48382 100644
--- a/include/llvm/Analysis/ValueNumbering.h
+++ b/include/llvm/Analysis/ValueNumbering.h
@@ -65,10 +65,9 @@ struct ValueNumbering {
}
};
-extern int BasicValueNumberingStub;
-static IncludeFile
-HDR_INCLUDE_VALUENUMBERING_CPP(&BasicValueNumberingStub);
-
} // End llvm namespace
+// Force any file including this header to get the implementation as well
+FORCE_DEFINING_FILE_TO_BE_LINKED(BasicValueNumbering)
+
#endif
diff --git a/include/llvm/IntrinsicInst.h b/include/llvm/IntrinsicInst.h
index fbc3968f26..5b784fc2b9 100644
--- a/include/llvm/IntrinsicInst.h
+++ b/include/llvm/IntrinsicInst.h
@@ -314,11 +314,10 @@ namespace llvm {
}
};
-// A hack to ensure that the IntrinsicInst.cpp file gets added as a dependency
-// of any file that
-extern char LinkIntrinsicInstStub;
-static IncludeFile LinkIntrinsicInst(&LinkIntrinsicInstStub);
-
}
+// Ensure that the IntrinsicInst.cpp file gets added as a dependency of any
+// file that includes this header
+FORCE_DEFINING_FILE_TO_BE_LINKED(IntrinsicInst)
+
#endif
diff --git a/include/llvm/Support/IncludeFile.h b/include/llvm/Support/IncludeFile.h
index 8e96f7571f..798c6b454f 100644
--- a/include/llvm/Support/IncludeFile.h
+++ b/include/llvm/Support/IncludeFile.h
@@ -27,13 +27,15 @@
/// And, foo.cp would use:<br/>
/// <tt>DEFINING_FILE_FOR(foo)</tt><br/>
#define FORCE_DEFINING_FILE_TO_BE_LINKED(name) \
- extern char name ## LinkVar; \
- static IncludeFile name ## LinkObj ( &name ## LinkVar )
+ namespace llvm { \
+ extern char name ## LinkVar; \
+ static IncludeFile name ## LinkObj ( &name ## LinkVar ); \
+ }
/// This macro is the counterpart to FORCE_DEFINING_FILE_TO_BE_LINKED. It should
/// be used in a .cpp file to define the name referenced in a header file that
/// will cause linkage of the .cpp file. It should only be used at extern level.
-#define DEFINING_FILE_FOR(name) char name
+#define DEFINING_FILE_FOR(name) namespace llvm { char name ## LinkVar; }
namespace llvm {
diff --git a/include/llvm/System/IncludeFile.h b/include/llvm/System/IncludeFile.h
index 8e96f7571f..798c6b454f 100644
--- a/include/llvm/System/IncludeFile.h
+++ b/include/llvm/System/IncludeFile.h
@@ -27,13 +27,15 @@
/// And, foo.cp would use:<br/>
/// <tt>DEFINING_FILE_FOR(foo)</tt><br/>
#define FORCE_DEFINING_FILE_TO_BE_LINKED(name) \
- extern char name ## LinkVar; \
- static IncludeFile name ## LinkObj ( &name ## LinkVar )
+ namespace llvm { \
+ extern char name ## LinkVar; \
+ static IncludeFile name ## LinkObj ( &name ## LinkVar ); \
+ }
/// This macro is the counterpart to FORCE_DEFINING_FILE_TO_BE_LINKED. It should
/// be used in a .cpp file to define the name referenced in a header file that
/// will cause linkage of the .cpp file. It should only be used at extern level.
-#define DEFINING_FILE_FOR(name) char name
+#define DEFINING_FILE_FOR(name) namespace llvm { char name ## LinkVar; }
namespace llvm {