]> git.eshelyaron.com Git - emacs.git/commitdiff
* Add to possibility to write per pass specific tests
authorAndrea Corallo <akrl@sdf.org>
Thu, 2 Jul 2020 19:29:34 +0000 (21:29 +0200)
committerAndrea Corallo <akrl@sdf.org>
Thu, 2 Jul 2020 20:39:32 +0000 (22:39 +0200)
* lisp/emacs-lisp/comp.el (comp-post-pass-hooks): New special
variable.
(native-compile): Run what is registered in
`comp-post-pass-hooks'.

lisp/emacs-lisp/comp.el

index 39b47f079e2d507cbb00b633bd9b5427dea88612..205966f57c68bc87d8ed053af331de05b7b03222 100644 (file)
@@ -172,6 +172,11 @@ Can be one of: 'd-default', 'd-impure' or 'd-ephemeral'.  See `comp-ctxt'.")
                         comp-final)
   "Passes to be executed in order.")
 
+(defvar comp-post-pass-hooks ()
+  "Alist PASS FUNCTIONS.
+Each function in FUNCTIONS is run after PASS.
+Useful to hook into pass checkers.")
+
 (defconst comp-known-ret-types '((cons . cons)
                                  (1+ . number)
                                  (1- . number)
@@ -2617,7 +2622,9 @@ Return the compilation unit file name."
                 (comp-log (format "(%s) Running pass %s:\n"
                                   function-or-file pass)
                           2)
-                (setf data (funcall pass data)))
+                (setf data (funcall pass data))
+                (cl-loop for f in (alist-get pass comp-post-pass-hooks)
+                         do (funcall f data)))
               comp-passes)
       (native-compiler-error
        ;; Add source input.