[all-commits] [llvm/llvm-project] b6c717: [C++20] [Modules] Don't generate unused variables ...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Wed May 10 02:42:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b6c7177145bc439c712208bfbe041db212c5262d
      https://github.com/llvm/llvm-project/commit/b6c7177145bc439c712208bfbe041db212c5262d
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M clang/include/clang/AST/DeclBase.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/DeclBase.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/lib/Sema/SemaTemplate.cpp
    A clang/test/Modules/pr61892.cppm

  Log Message:
  -----------
  [C++20] [Modules] Don't generate unused variables in other module units
even if its initializer has side effects

Close https://github.com/llvm/llvm-project/issues/61892

The variables whose initializer has side effects will be emitted even if
it is not used. But it shouldn't be true after we introduced modules.
The variables in other modules shouldn't be emitted if it is not used
even if its initializer has size effects.

Also this patch rename `Decl::isInCurrentModuleUnit` to
`Decl::isInAnotherModuleUnit` to make it closer to the semantics.




More information about the All-commits mailing list