[all-commits] [llvm/llvm-project] c13030: Frontend: Refactor compileModuleAndReadAST, NFC

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Thu Aug 12 15:16:46 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c130300f8ba0363749cf2490bbd43515fad8a759
      https://github.com/llvm/llvm-project/commit/c130300f8ba0363749cf2490bbd43515fad8a759
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2021-08-12 (Thu, 12 Aug 2021)

  Changed paths:
    M clang/lib/Frontend/CompilerInstance.cpp

  Log Message:
  -----------
  Frontend: Refactor compileModuleAndReadAST, NFC

This renames `compileModuleAndReadAST`, adding a `BehindLock` suffix,
and refactors it to significantly reduce nesting.

- Split out helpers `compileModuleAndReadASTImpl` and
  `readASTAfterCompileModule` which have straight-line code that doesn't
  worry about locks.
- Use `break` in the interesting cases of `switch` statements to reduce
  nesting.
- Use early `return`s to reduce nesting.

Detangling the compile-and-read logic from the check-for-locks logic
should be a net win for readability, although I also have a side
motivation of making the locks optional in a follow-up.

No functionality change here.

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




More information about the All-commits mailing list