Avoid including FileManager.h from SourceManager.h
authorReid Kleckner <rnk@google.com>
Sat, 29 Feb 2020 17:10:42 +0000 (09:10 -0800)
committerReid Kleckner <rnk@google.com>
Wed, 11 Mar 2020 20:53:12 +0000 (13:53 -0700)
commite08464fb450456881733c885267b32dc7339cf11
tree1a11e18cf258b651cdb87814626417a70271ea71
parent526a4f2ac365a5babbc80e0f7c17be310728a538
Avoid including FileManager.h from SourceManager.h

Most clients of SourceManager.h need to do things like turning source
locations into file & line number pairs, but this doesn't require
bringing in FileManager.h and LLVM's FS headers.

The main code change here is to sink SM::createFileID into the cpp file.
I reason that this is not performance critical because it doesn't happen
on the diagnostic path, it happens along the paths of macro expansion
(could be hot) and new includes (less hot).

Saves some includes:
    309 -    /usr/local/google/home/rnk/llvm-project/clang/include/clang/Basic/FileManager.h
    272 -    /usr/local/google/home/rnk/llvm-project/clang/include/clang/Basic/FileSystemOptions.h
    271 -    /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/VirtualFileSystem.h
    267 -    /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/FileSystem.h
    266 -    /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Chrono.h

Differential Revision: https://reviews.llvm.org/D75406
37 files changed:
clang-tools-extra/clang-include-fixer/find-all-symbols/FindAllMacros.cpp
clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.cpp
clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h
clang-tools-extra/clangd/Format.cpp
clang-tools-extra/pp-trace/PPCallbacksTracker.cpp
clang/include/clang/ASTMatchers/ASTMatchers.h
clang/include/clang/Basic/SourceManager.h
clang/include/clang/Frontend/CompilerInstance.h
clang/include/clang/Frontend/VerifyDiagnosticConsumer.h
clang/include/clang/Lex/DirectoryLookup.h
clang/include/clang/Lex/ModuleMap.h
clang/include/clang/Lex/PPCallbacks.h
clang/lib/AST/ExternalASTSource.cpp
clang/lib/AST/MicrosoftMangle.cpp
clang/lib/Basic/SanitizerBlacklist.cpp
clang/lib/Basic/SourceManager.cpp
clang/lib/Basic/XRayLists.cpp
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CoverageMappingGen.cpp
clang/lib/Frontend/CompilerInstance.cpp
clang/lib/Frontend/PrecompiledPreamble.cpp
clang/lib/Index/CommentToXML.cpp
clang/lib/Index/USRGeneration.cpp
clang/lib/Lex/ModuleMap.cpp
clang/lib/Lex/PPCallbacks.cpp
clang/lib/Lex/PPLexerChange.cpp
clang/lib/Parse/Parser.cpp
clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
clang/lib/Tooling/Inclusions/HeaderIncludes.cpp
clang/tools/clang-import-test/clang-import-test.cpp
clang/tools/clang-refactor/TestSupport.cpp
clang/tools/libclang/CXSourceLocation.cpp
clang/unittests/Frontend/ASTUnitTest.cpp
clang/unittests/Frontend/CompilerInstanceTest.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
lldb/source/Plugins/Language/ClangCommon/ClangHighlighter.cpp