[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.
    Ben Hamilton via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Apr 27 12:07:37 PDT 2018
    
    
  
benhamilton added inline comments.
================
Comment at: clang-tools-extra/trunk/clangd/SourceCode.cpp:38
+    // 0xxx is ASCII, handled above. 10xxx is a trailing byte, invalid here.
+    // 11111xxx is not valid UTF-8 at all. Assert because it's probably our bug.
+    assert((UTF8Length >= 2 && UTF8Length <= 4) &&
----------------
This is user input, right? Have we actually checked for valid UTF-8, or do we just assume it's valid?
If not, it seems like an assertion is not the right check, but we should reject it when we're reading the input.
Repository:
  rL LLVM
https://reviews.llvm.org/D46035
    
    
More information about the llvm-commits
mailing list