summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/include-fixer/tool/clang-include-fixer.py
diff options
context:
space:
mode:
authorHaojian Wu <hokein@google.com>2017-05-17 14:13:59 +0000
committerHaojian Wu <hokein@google.com>2017-05-17 14:13:59 +0000
commitdbc3911ce2b66003122752873902fe1a69b74a92 (patch)
treeab56c8ff9d913bbd859687cec7c1dbb9a3747159 /clang-tools-extra/include-fixer/tool/clang-include-fixer.py
parent52c9a0c9f2fa1e79bdfcd5c20ca6e854d1b94470 (diff)
downloadbcm5719-llvm-dbc3911ce2b66003122752873902fe1a69b74a92.tar.gz
bcm5719-llvm-dbc3911ce2b66003122752873902fe1a69b74a92.zip
Recommit "[include-fixer] Don't throw exception when parsing unknown ar… …guments in vim script."
Summary: To make it work in neovim. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33273 llvm-svn: 303260
Diffstat (limited to 'clang-tools-extra/include-fixer/tool/clang-include-fixer.py')
-rw-r--r--clang-tools-extra/include-fixer/tool/clang-include-fixer.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang-tools-extra/include-fixer/tool/clang-include-fixer.py b/clang-tools-extra/include-fixer/tool/clang-include-fixer.py
index 7d669fd8258..0e9306d1a6a 100644
--- a/clang-tools-extra/include-fixer/tool/clang-include-fixer.py
+++ b/clang-tools-extra/include-fixer/tool/clang-include-fixer.py
@@ -136,7 +136,12 @@ def main():
help='clang-include-fixer input format.')
parser.add_argument('-input', default='',
help='String to initialize the database.')
- args = parser.parse_args()
+ # Don't throw exception when parsing unknown arguements to make the script
+ # work in neovim.
+ # Neovim (at least v0.2.1) somehow mangles the sys.argv in a weird way: it
+ # will pass additional arguments (e.g. "-c script_host.py") to sys.argv,
+ # which makes the script fail.
+ args, _ = parser.parse_known_args()
# Get the current text.
buf = vim.current.buffer
OpenPOWER on IntegriCloud