[phc-internals] [phc commit] r1412 - branches/saturn/src/analyse

codesite-noreply at google.com codesite-noreply at google.com
Thu Jul 3 10:46:05 IST 2008


Author: paul.biggar
Date: Thu Jul  3 02:45:11 2008
New Revision: 1412

Added:
   branches/saturn/src/analyse/errors.clp

Log:
Add file missing from last commit.


Added: branches/saturn/src/analyse/errors.clp
==============================================================================
--- (empty file)
+++ branches/saturn/src/analyse/errors.clp	Thu Jul  3 02:45:11 2008
@@ -0,0 +1,25 @@
+% Support code for checking our analyses have no errors.
+
+% Error handling
+
+predicate error_in (BB:t_cfg_node).
+error_in (BB) :-
+	cfg_node (BB),
+	(
+	  ~live_handled (BB)
+	; ~alias_handled (BB)
+	).
+
+% This is done in separate predicates so that the error will print 
before the
+% assertion executes.
+predicate error (BB:t_cfg_node).
+error (BB) :-
+	error_in (BB),
+	tostring (BB, BB_STR),
+	((BB = nblock {B}, to_node (any{B}, NODE), mir()->source_rep (get_id 
(NODE), SOURCE))
+	;
+	(BB \= nblock{_}, SOURCE = "SOURCE NOT AVAILABLE")),
+	str_cat_list (["Error, not handled: ", BB_STR, " - ", SOURCE], ERROR),
+	+print (ERROR).
+
+assert ~error (_).


More information about the phc-internals mailing list