[llvm-commits] [llvm] r58518 - /llvm/trunk/include/llvm/Pass.h

Torok Edwin edwintorok at gmail.com
Fri Oct 31 10:27:42 PDT 2008


Author: edwin
Date: Fri Oct 31 12:27:41 2008
New Revision: 58518

URL: http://llvm.org/viewvc/llvm-project?rev=58518&view=rev
Log:
Add an assert to catch user errors like:
MyFunctionPass() : FunctionPass(ID) {}

when the user actually meant to write:
MyFunctionPass() : FunctionPass(&ID) {}


Modified:
    llvm/trunk/include/llvm/Pass.h

Modified: llvm/trunk/include/llvm/Pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=58518&r1=58517&r2=58518&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Pass.h (original)
+++ llvm/trunk/include/llvm/Pass.h Fri Oct 31 12:27:41 2008
@@ -81,8 +81,12 @@
   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





More information about the llvm-commits mailing list