[all-commits] [llvm/llvm-project] 59a3b1: clang-format: Assert in-memory file created in cre...

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Fri Oct 16 07:21:31 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 59a3b1afb28541d5bf37445b028bfd711e3c556a
      https://github.com/llvm/llvm-project/commit/59a3b1afb28541d5bf37445b028bfd711e3c556a
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2020-10-16 (Fri, 16 Oct 2020)

  Changed paths:
    M clang/tools/clang-format/ClangFormat.cpp

  Log Message:
  -----------
  clang-format: Assert in-memory file created in createInMemoryFile, NFC

`SourceManager::createFileID` asserts that the given `FileEntry` is not
null, so remove the logic that passed in `nullptr`. Since we just added
the file to an in-memory FS via an API that cannot fail, use
`llvm_unreachable` on the error path. Didn't use an `assert` since it
seems cleaner semantically to check the error (and better,
hypothetically, for updating the API to use `Expected` instead of
`ErrorOr`).

I noticed this incidentally while auditing calls to `createFileID`.




More information about the All-commits mailing list