summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2017-07-10 13:49:18 +0000
committerPhilipp Stephani <phst@google.com>2017-07-10 13:49:18 +0000
commit7ac5d595548377cf6e15c304bbb157f9376b2b87 (patch)
tree43a3fa5390257eb941b44c9c15683abc7c03384e
parenta3b84168801916f78e2ce68dc13814db67f74a9e (diff)
downloadbcm5719-llvm-7ac5d595548377cf6e15c304bbb157f9376b2b87.tar.gz
bcm5719-llvm-7ac5d595548377cf6e15c304bbb157f9376b2b87.zip
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 llvm-svn: 307535
-rw-r--r--clang-tools-extra/include-fixer/tool/clang-include-fixer.el2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang-tools-extra/include-fixer/tool/clang-include-fixer.el b/clang-tools-extra/include-fixer/tool/clang-include-fixer.el
index f704b30311c..4cd0dd1a6ef 100644
--- a/clang-tools-extra/include-fixer/tool/clang-include-fixer.el
+++ b/clang-tools-extra/include-fixer/tool/clang-include-fixer.el
@@ -88,6 +88,8 @@ The current file name is passed after ARGS as last argument. If
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
OpenPOWER on IntegriCloud