New type of file

This commit is contained in:
Benson Chu 2023-01-25 12:56:45 -06:00
parent bd0156a85e
commit 1d8e9cea2a
2 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,43 @@
;;; act-on-llvm-source-file.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2023 Benson Chu
;; Author: Benson Chu <bensonchu457@gmail.com>
;; Created: [2023-01-19 10:52]
;; This file is not part of GNU Emacs
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(defun ll/is-llvm-source-file (file)
(and (string= "cpp" (file-name-extension file))
(string-match-p ".*llvm-project.*" file)))
(defun ll/act-on-llvm-source-file (file)
(let ((dir (lls/get-llvm-build-dir)))
(--> file
(list (format "touch %s" it)
(lls/ninja-build-tools dir (list (concat it "^")) t))
(string-join it " && ")
(compilation-start it nil
(lambda (_)
(format "*ninja-%s*"
(file-name-nondirectory file)))))))
(provide 'act-on-llvm-source-file)
;;; act-on-llvm-source-file.el ends here

View file

@ -41,6 +41,8 @@
(pcase (file-name-extension file)
((and _ (guard (ll/is-test-file file)))
(ll/act-on-test-file file))
((and _ (guard (ll/is-llvm-source-file file)))
(ll/act-on-llvm-source-file file))
("o" (ll/act-on-obj-file file))
("c" (ll/act-on-c-file file))
("ll" (ll/act-on-ll-file file))