Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC][C++20][Modules] Relax ODR check in unnamed modules #111160

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Commits on Oct 4, 2024

  1. [RFC][C++20][Modules] Relax ODR check in unnamed modules

    Summary:
    Option `-fskip-odr-check-in-gmf` is set by default and I think it is what most of C++ developers want. But in header units clang ODR checking is too strict that makes them hard to use, see example in the diff. This diff relaxes ODR checks for unnamed modules to match GMF ODR checking.
    
    Alternative solution is to add special handling for CXXFoldExpr to ignore differences in “callee”. In particular it will treat the following fragments identical. I think it might be reasonable default behavior instead of `-fskip-odr-check-in-gmf`.
    ```
    CXXFoldExpr 0x55556588b1b8 '<dependent type>'
    |-<<<NULL>>>
    |-UnresolvedLookupExpr 0x55556588b140 '<dependent type>' lvalue (no ADL) = '__cmp_cat_id' 0x55556588ac18
    | `-TemplateArgument type '_Ts'
    |   `-TemplateTypeParmType 0x55556588adf0 '_Ts' dependent contains_unexpanded_pack depth 0 index 0 pack
    |     `-TemplateTypeParm 0x55556588ad70 '_Ts'
    `-<<<NULL>>>
    
    CXXFoldExpr 0x55556588b670 '<dependent type>'
    |-UnresolvedLookupExpr 0x55556588b628 '<overloaded function type>' lvalue (ADL) = 'operator|' 0x55556588ae60
    |-UnresolvedLookupExpr 0x55556588b5b0 '<dependent type>' lvalue (no ADL) = '__cmp_cat_id' 0x55556588b0d8
    | `-TemplateArgument type '_Ts'
    |   `-TemplateTypeParmType 0x55556588b260 '_Ts' dependent contains_unexpanded_pack depth 0 index 0 pack
    |     `-TemplateTypeParm 0x55556588b1e0 '_Ts'
    `-<<<NULL>>>
    ```
    
    Test Plan: check-clang
    dmpolukhin committed Oct 4, 2024
    Configuration menu
    Copy the full SHA
    dc4a79c View commit details
    Browse the repository at this point in the history

Commits on Oct 8, 2024

  1. Configuration menu
    Copy the full SHA
    6cb15c6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a1a9ef3 View commit details
    Browse the repository at this point in the history

Commits on Oct 9, 2024

  1. Configuration menu
    Copy the full SHA
    7329e60 View commit details
    Browse the repository at this point in the history