[clang-tools-extra] r307535 - Improve error message when run from a buffer that doesn't visit a file

Philipp Stephani via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 10 06:49:18 PDT 2017


Author: phst
Date: Mon Jul 10 06:49:18 2017
New Revision: 307535

URL: http://llvm.org/viewvc/llvm-project?rev=307535&view=rev
Log:
Improve error message when run from a buffer that doesn't visit a file

Summary: In this case, users currently get a confusing type error.  Make the error message more obvious.

Reviewers: klimek

Reviewed By: klimek

Differential Revision: https://reviews.llvm.org/D35197

Modified:
    clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el

Modified: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el?rev=307535&r1=307534&r2=307535&view=diff
==============================================================================
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el (original)
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.el Mon Jul 10 06:49:18 2017
@@ -88,6 +88,8 @@ The current file name is passed after AR
 the call was successful the returned result is stored in a
 temporary buffer, and CALLBACK is called with the temporary
 buffer as only argument."
+  (unless buffer-file-name
+    (user-error "clang-include-fixer works only in buffers that visit a file"))
   (let ((process (if (fboundp 'make-process)
                      ;; Prefer using ‘make-process’ if available, because
                      ;; ‘start-process’ doesn’t allow us to separate the




More information about the cfe-commits mailing list