aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Pass.h
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2008-10-31 17:27:41 +0000
committerTorok Edwin <edwintorok@gmail.com>2008-10-31 17:27:41 +0000
commitd24931632b480e0472e88df200c4ef80649e48f1 (patch)
tree0d96b953bf7ebd3fd9457cf1750bc7f44289586c /include/llvm/Pass.h
parent9ed08f4a410a3f0b6d38eb6eec0ddb94349e74dd (diff)
downloadexternal_llvm-d24931632b480e0472e88df200c4ef80649e48f1.zip
external_llvm-d24931632b480e0472e88df200c4ef80649e48f1.tar.gz
external_llvm-d24931632b480e0472e88df200c4ef80649e48f1.tar.bz2
Add an assert to catch user errors like:
MyFunctionPass() : FunctionPass(ID) {} when the user actually meant to write: MyFunctionPass() : FunctionPass(&ID) {} git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58518 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Pass.h')
-rw-r--r--include/llvm/Pass.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index 305ac37..247805f 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -81,8 +81,12 @@ class Pass {
void operator=(const Pass&); // DO NOT IMPLEMENT
Pass(const Pass &); // DO NOT IMPLEMENT
public:
- explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {}
- explicit Pass(const void *pid) : Resolver(0), PassID((intptr_t)pid) {}
+ explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {
+ assert(pid && "pid cannot be 0");
+ }
+ explicit Pass(const void *pid) : Resolver(0), PassID((intptr_t)pid) {
+ assert(pid && "pid cannot be 0");
+ }
virtual ~Pass();
/// getPassName - Return a nice clean name for a pass. This usually