This revision was automatically updated to reflect the committed changes.
Closed by commit rL303260: Recommit "[include-fixer] Don't throw exception when 
parsing unknown ar…… (authored by hokein).

Changed prior to commit:
  https://reviews.llvm.org/D33273?vs=99275&id=99298#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33273

Files:
  clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py


Index: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
===================================================================
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
@@ -136,7 +136,12 @@
                       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


Index: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
===================================================================
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
@@ -136,7 +136,12 @@
                       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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to