mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 08:14:15 +00:00
Dump to .tmp file
This commit is contained in:
parent
27fb20b265
commit
1e8a7c7416
3 changed files with 47 additions and 4 deletions
|
|
@ -27,6 +27,7 @@
|
|||
(require 'llvm-shared)
|
||||
(require 'action-map-lib)
|
||||
(require 'anaphora)
|
||||
(require 'make-tmp-output-file)
|
||||
|
||||
(defvar ll/c-file-action-map
|
||||
'((debug :key ?d :major-mode llvm-mode :buffer-string "debug" :description "[d]ebug pass" :compiler-action assemble)
|
||||
|
|
@ -151,7 +152,7 @@
|
|||
|
||||
(defun ll/act-on-c-file (file)
|
||||
(let* ((action (aml/read-action-map ll/c-file-action-map))
|
||||
(output (make-temp-file (concat (file-name-sans-extension file) "-") nil ".ll")))
|
||||
(output (ll/make-tmp-file file ".ll")))
|
||||
(if (eq action 'diff)
|
||||
(ll/diff-c-on-two-compilations file action)
|
||||
(let ((comm (ll/build-clang-command (lls/un-trampify file) action output)))
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
;;; Code:
|
||||
(require 'llvm-shared)
|
||||
(require 'action-map-lib)
|
||||
(require 'make-tmp-output-file)
|
||||
|
||||
(defvar ll/ll-file-action-map
|
||||
'((assembly :key ?a :major-mode asm-mode :buffer-string "assembly" :description "[a]ssembly")
|
||||
|
|
@ -45,9 +46,12 @@
|
|||
;; I just recently noticed that the default directory is changing, but
|
||||
;; I don't know what changed. Should investigate later.
|
||||
(default-directory (file-name-directory file))
|
||||
(output (make-temp-file
|
||||
(concat (file-name-sans-extension file) "-")
|
||||
nil ".mir")))
|
||||
(output (ll/make-tmp-file
|
||||
file
|
||||
(cond
|
||||
((eq action 'assembly)
|
||||
".S")
|
||||
(t ".mir")))))
|
||||
(aprog1
|
||||
(compilation-start
|
||||
(ll/build-llc-command file action output pass)
|
||||
|
|
|
|||
38
lisp/llvm-lib/llvm-act-on-file/make-tmp-output-file.el
Normal file
38
lisp/llvm-lib/llvm-act-on-file/make-tmp-output-file.el
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
;;; make-tmp-output-file.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2024 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2024-10-25 19:36]
|
||||
|
||||
;; 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/make-tmp-file (file ext)
|
||||
(let (fname temporary-file-directory)
|
||||
(if (string-match-p (rx "/.tmp") file)
|
||||
(setq fname (file-name-sans-extension file)
|
||||
temporary-file-directory (file-name-directory file))
|
||||
(setq fname (file-name-nondirectory (file-name-sans-extension file))
|
||||
temporary-file-directory (expand-file-name ".tmp" default-directory)))
|
||||
(make-temp-file (concat fname "-")
|
||||
nil ext)))
|
||||
|
||||
(provide 'make-tmp-output-file)
|
||||
;;; make-tmp-output-file.el ends here
|
||||
Loading…
Reference in a new issue