[all-commits] [llvm/llvm-project] 071f3b: [Modules] Fix ModuleDeclState transition when modu...

Fangrui Song via All-commits all-commits at lists.llvm.org
Thu Nov 2 22:13:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 071f3b5b659fe26812d413a3acb7455fa11e93c8
      https://github.com/llvm/llvm-project/commit/071f3b5b659fe26812d413a3acb7455fa11e93c8
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-11-02 (Thu, 02 Nov 2023)

  Changed paths:
    M clang/lib/Lex/Preprocessor.cpp
    M clang/test/Preprocessor/include-in-module-purview.cppm

  Log Message:
  -----------
  [Modules] Fix ModuleDeclState transition when module is used as a regular identifier (#71134)

`ModuleDeclState` is incorrectly changed to `NamedModuleImplementation`
for `struct module {}; void foo(module a);`. This is mostly benign but
leads to a spurious warning after #69555.

A real world example is:
```
// pybind11.h
class module_ { ... };
using module = module_;

// tensorflow
void DefineMetricsModule(pybind11::module main_module);
// `module main_module);` incorrectly changes `ModuleDeclState` to `NamedModuleImplementation`

#include <algorithm> // spurious warning
```




More information about the All-commits mailing list