[all-commits] [llvm/llvm-project] 11d612: [clang][Preprocessor] Replace the slow translateFi...

Alex Lorenz via All-commits all-commits at lists.llvm.org
Thu May 14 14:14:04 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 11d612ac99a621c762c2cc8f7bacbb8ae32d7fe9
      https://github.com/llvm/llvm-project/commit/11d612ac99a621c762c2cc8f7bacbb8ae32d7fe9
  Author: Alex Lorenz <arphaman at gmail.com>
  Date:   2020-05-14 (Thu, 14 May 2020)

  Changed paths:
    M clang/include/clang/Basic/SourceManager.h
    M clang/lib/Basic/SourceManager.cpp
    M clang/lib/Lex/PPDirectives.cpp
    M clang/unittests/Basic/SourceManagerTest.cpp

  Log Message:
  -----------
  [clang][Preprocessor] Replace the slow translateFile call by a new, faster isMainFile check

The commit 3c28a2dc6bdc331e5a0d8097a5fa59d06682b9d0 introduced the check that checks if we're
trying to re-enter a main file when building a preamble. Unfortunately this slowed down the preamble
compilation by 80-90% in some test cases, as translateFile is really slow. This change checks
to see if the FileEntry is the main file without calling translateFile, but by using the new
isMainFile check instead. This speeds up preamble building by 1.5-2x for certain test cases that we have.

rdar://59361291

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




More information about the All-commits mailing list