[clang-tools-extra] 47abb43 - [clang-tidy] Fix performance-noexcept-move-constructor-fix test on non-English locale

Alexandre Ganea via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 13 11:46:54 PST 2020


Author: Alexandre Ganea
Date: 2020-02-13T14:46:44-05:00
New Revision: 47abb43fc36433154eb796bd1d098f100503473e

URL: https://github.com/llvm/llvm-project/commit/47abb43fc36433154eb796bd1d098f100503473e
DIFF: https://github.com/llvm/llvm-project/commit/47abb43fc36433154eb796bd1d098f100503473e.diff

LOG: [clang-tidy] Fix performance-noexcept-move-constructor-fix test on non-English locale

When running on Windows under the following locale:

D:\llvm-project>python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getlocale()
('French_Canada', '1252')

This patch fixes the following issue:

# command stderr:
Traceback (most recent call last):
  File "D:/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py", line 249, in <module>
    main()
  File "D:/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py", line 245, in main
    run_test_once(args, extra_args)
  File "D:/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py", line 162, in run_test_once
    diff_output.decode() +
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 2050: invalid continuation byte
This is caused by diff reporting no EOL on the last line, and unfortunately this is written in French with accentuation on my locale.

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

Added: 
    

Modified: 
    clang-tools-extra/test/clang-tidy/check_clang_tidy.py

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
index 368b674d2d32..8567c18bf9a0 100755
--- a/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
+++ b/clang-tools-extra/test/clang-tidy/check_clang_tidy.py
@@ -159,7 +159,7 @@ def run_test_once(args, extra_args):
     
diff _output = e.output
 
   print('------------------------------ Fixes -----------------------------\n' +
-        
diff _output.decode() +
+        
diff _output.decode(errors='ignore') +
         '\n------------------------------------------------------------------')
 
   if has_check_fixes:


        


More information about the cfe-commits mailing list