This is an archive of the discontinued LLVM Phabricator instance.

Frontend: Clarify logic for using the preamble in ASTUnit::CodeComplete, almost NFC
ClosedPublic

Authored by dexonsmith on Nov 11 2020, 1:24 PM.

Details

Summary

Clarify the logic for using the preamble (and overriding the main file
buffer) in ASTUnit::CodeComplete by factoring out a couple of lambdas
(getUniqueID and hasSameUniqueID). While refactoring the logic,
hoist the check for Line > 1 and locally check if the filenames are
equal (both to avoid unnecessary stat calls) and skip copying out the
filenames to std::string.

Besides fewer calls to stat, there's no functionality change here.

Diff Detail