diff options
| author | Torok Edwin <edwintorok@gmail.com> | 2008-10-31 17:27:41 +0000 |
|---|---|---|
| committer | Torok Edwin <edwintorok@gmail.com> | 2008-10-31 17:27:41 +0000 |
| commit | 38cbc4ba202c05556d13734f43c5d3cf26f86fe8 (patch) | |
| tree | 068e67e218867720fe99bc276837cc95153bdf2d | |
| parent | 7e8202fce483f012dad4cbf8264b16606afcd629 (diff) | |
| download | bcm5719-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.h | 8 |
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 |

