summaryrefslogtreecommitdiffstats
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
commit38cbc4ba202c05556d13734f43c5d3cf26f86fe8 (patch)
tree068e67e218867720fe99bc276837cc95153bdf2d
parent7e8202fce483f012dad4cbf8264b16606afcd629 (diff)
downloadbcm5719-llvm-38cbc4ba202c05556d13734f43c5d3cf26f86fe8.tar.gz
bcm5719-llvm-38cbc4ba202c05556d13734f43c5d3cf26f86fe8.zip
Add an assert to catch user errors like:
MyFunctionPass() : FunctionPass(ID) {} when the user actually meant to write: MyFunctionPass() : FunctionPass(&ID) {} llvm-svn: 58518
-rw-r--r--llvm/include/llvm/Pass.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/include/llvm/Pass.h b/llvm/include/llvm/Pass.h
index 305ac37b17d..247805f4dbf 100644
--- a/llvm/include/llvm/Pass.h
+++ b/llvm/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
OpenPOWER on IntegriCloud