[PATCH] D95581: Frontend: Refactor compileModuleAndReadAST, NFC

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 27 18:34:09 PST 2021


dexonsmith created this revision.
dexonsmith added reviewers: Bigcheese, jansvoboda11.
Herald added a subscriber: ributzka.
dexonsmith requested review of this revision.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95581

Files:
  clang/lib/Frontend/CompilerInstance.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95581.319733.patch
Type: text/x-patch
Size: 8554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210128/00f07efb/attachment-0001.bin>


More information about the cfe-commits mailing list