[all-commits] [llvm/llvm-project] b69dcb: [clang][frontend] Require invocation to construct ...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Thu May 1 07:31:51 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b69dcb873476cd8e7d3f6f9ffd5b6d0bbe1a3a17
      https://github.com/llvm/llvm-project/commit/b69dcb873476cd8e7d3f6f9ffd5b6d0bbe1a3a17
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2025-05-01 (Thu, 01 May 2025)

  Changed paths:
    M clang-tools-extra/clang-include-fixer/IncludeFixer.cpp
    M clang-tools-extra/clangd/Compiler.cpp
    M clang-tools-extra/include-cleaner/unittests/RecordTest.cpp
    M clang/include/clang/Frontend/CompilerInstance.h
    M clang/lib/Frontend/ASTUnit.cpp
    M clang/lib/Frontend/ChainedIncludesSource.cpp
    M clang/lib/Frontend/CompilerInstance.cpp
    M clang/lib/Frontend/PrecompiledPreamble.cpp
    M clang/lib/Frontend/Rewrite/FrontendActions.cpp
    M clang/lib/StaticAnalyzer/Frontend/ModelInjector.cpp
    M clang/lib/Testing/TestAST.cpp
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    M clang/lib/Tooling/Tooling.cpp
    M clang/tools/clang-import-test/clang-import-test.cpp
    M clang/tools/driver/cc1_main.cpp
    M clang/unittests/AST/ExternalASTSourceTest.cpp
    M clang/unittests/Frontend/CodeGenActionTest.cpp
    M clang/unittests/Frontend/CompilerInstanceTest.cpp
    M clang/unittests/Frontend/FrontendActionTest.cpp
    M clang/unittests/Frontend/OutputStreamTest.cpp
    M clang/unittests/Sema/SemaNoloadLookupTest.cpp
    M clang/unittests/Serialization/ForceCheckFileInputTest.cpp
    M clang/unittests/Serialization/LoadSpecLazilyTest.cpp
    M clang/unittests/Serialization/ModuleCacheTest.cpp
    M clang/unittests/Serialization/NoCommentsTest.cpp
    M clang/unittests/Serialization/PreambleInNamedModulesTest.cpp
    M clang/unittests/Serialization/VarDeclConstantInitTest.cpp
    M clang/unittests/Support/TimeProfilerTest.cpp
    M clang/unittests/Tooling/DependencyScanning/DependencyScannerTest.cpp
    M clang/unittests/Tooling/Syntax/TokensTest.cpp
    M clang/unittests/Tooling/Syntax/TreeTestBase.cpp
    M lldb/source/Commands/CommandObjectTarget.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

  Log Message:
  -----------
  [clang][frontend] Require invocation to construct `CompilerInstance` (#137668)

This PR makes it so that `CompilerInvocation` needs to be provided to
`CompilerInstance` on construction. There are a couple of benefits in my
view:
* Making it impossible to mis-use some `CompilerInstance` APIs. For
example there are cases, where `createDiagnostics()` was called before
`setInvocation()`, causing the `DiagnosticEngine` to use the
default-constructed `DiagnosticOptions` instead of the intended ones.
* This shrinks `CompilerInstance`'s state space.
* This makes it possible to access **the** invocation in
`CompilerInstance`'s constructor (to be used in a follow-up).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list