[phc-internals] [phc commit] r1492 - in trunk/src: lib process_ir

codesite-noreply at google.com codesite-noreply at google.com
Thu Jul 31 17:38:17 IST 2008


Author: paul.biggar
Date: Thu Jul 31 09:37:44 2008
New Revision: 1492

Modified:
   trunk/src/lib/Object.h
   trunk/src/process_ir/IR.h

Log:
Move isa<T> and dyc<T> to Object.h, and make them use Objects, not 
IR::Nodes, to make them more usable generally.


Modified: trunk/src/lib/Object.h
==============================================================================
--- trunk/src/lib/Object.h	(original)
+++ trunk/src/lib/Object.h	Thu Jul 31 09:37:44 2008
@@ -41,4 +41,20 @@
 	virtual Object* clone() = 0;
 };

+/* These are copies of ideas from LLVM. All of our uses of casts can be
+ * characterized as one of these. */
+template <class T> bool isa(Object* in)
+{
+	return dynamic_cast<T*> (in) != NULL;
+}
+
+template <class T> T* dyc(Object* in)
+{
+	if (in == NULL) return NULL;
+
+	T* result = dynamic_cast<T*> (in);
+	assert (result != NULL);
+	return result;
+}
+
 #endif /* OBJECT_H */

Modified: trunk/src/process_ir/IR.h
==============================================================================
--- trunk/src/process_ir/IR.h	(original)
+++ trunk/src/process_ir/IR.h	Thu Jul 31 09:37:44 2008
@@ -119,24 +119,4 @@

 }

-
-/* These are copies of ideas from LLVM. All of our uses of casts can be
- * characterized as one of these. */
-template <class T> bool isa(IR::Node* in)
-{
-	return dynamic_cast<T*> (in) != NULL;
-}
-
-template <class T> T* dyc(IR::Node* in)
-{
-	if (in == NULL) return NULL;
-
-	T* result = dynamic_cast<T*> (in);
-	assert (result != NULL);
-	return result;
-}
-
-
-
-
 #endif // PHC_IR_H


More information about the phc-internals mailing list