<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/79734>79734</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Clang Issues Deprecation Warning on System Headers with Small C++ Modules Project
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          gen740
      </td>
    </tr>
</table>

<pre>
    ## Step to reproduce
- Create the following two `.ccm` files.
```cpp
// std_module.ccm
module;

#include<vector>

export module std_modules;

export namespace std {
    using std::vector;
};

// A.ccm
export module A;

import std_modules;

auto test() {
 std::vector<int>().push_back(42);
}
```
- Compile with the following commands.
```
$CXX -std=c++20 -stdlib=libc++ -Wdeprecated-declarations -c std_modules.ccm -fmodule-output=std_modules.pcm
$CXX -std=c++20 -stdlib=libc++ -Wdeprecated-declarations -c A.ccm -fmodule-output=A.pcm -fmodule-file=std_modules=std_modules.pcm
```

## Output
```
In module 'std_modules' imported from A.ccm:3:
/usr/lib/llvm-18/bin/../include/c++/v1/__iterator/reverse_iterator.h:53:14: warning: 'iterator<std::random_access_iterator_tag, int>' is deprecated [-Wdeprecated-declarations]
   53 |     : public iterator<typename iterator_traits<_Iter>::iterator_category,
      | ^
/usr/lib/llvm-18/bin/../include/c++/v1/vector:991:33: note: in instantiation of template class 'std::reverse_iterator<int *>' requested here
  991 |                      __alloc(), _RevIter(__end_), _RevIter(__begin_), _RevIter(__v.__begin_))
      | ^
/usr/lib/llvm-18/bin/../include/c++/v1/vector:1455:3: note: in instantiation of member function 'std::__1::vector<int>::__swap_out_circular_buffer' requested here
 1455 | __swap_out_circular_buffer(__v);
      | ^
/usr/lib/llvm-18/bin/../include/c++/v1/vector:1479:13: note: in instantiation of function template specialization 'std::__1::vector<int>::__push_back_slow_path<int>' requested here
 1479 | __end = __push_back_slow_path(std::move(__x));
      | ^
A.ccm:6:23: note: in instantiation of member function 'std::__1::vector<int>::push_back' requested here
    6 | std::vector<int>().push_back(32);
      | ^
/usr/lib/llvm-18/bin/../include/c++/v1/__iterator/iterator.h:23:29: note: 'iterator<std::random_access_iterator_tag, int>' has been explicitly marked deprecated here
   23 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 iterator {
      | ^
/usr/lib/llvm-18/bin/../include/c++/v1/__config:1006:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX17'
 1006 | #    define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
      | ^
/usr/lib/llvm-18/bin/../include/c++/v1/__config:979:49: note: expanded from macro '_LIBCPP_DEPRECATED'
  979 | #      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
      | ^
1 warning generated.
```

## Environment
- ubuntu 22.04 (docker)
- clang (Installed from https://apt.llvm.org)
```
Ubuntu clang version 18.1.0 (++20240127043115+ed48280f8e9d-1~exp1~20240127043233.6)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
```

## Additional context
I could reproduce this warning on Compile Explorer (https://godbolt.org/z/157e981MY).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0V1tv47oR_jX0C2FDomTLevCD4gtq4GwbnKTd9EmgyLHNLkWqJOU4-7C_vaButpM4i-3ZBAFsk0POzDffXEitFXsFsEDTOzRdjWjtDtos9qCSOBgVmr8sEIkQifCDgwo7jQ1URvOaAQpWKMjGeGmAOsDuAHinpdTPQu2xe9YYzYIJYyWaBXgnJNhJewLNgvafVVW3QjaIbLB1PC81ryU0x5qt9jeK7jrJTj4SismaA4qWR2BOGxStLyXgVGnjcHv64mL76qZOTtESbEVZI4pR0slgjHFtvTvWcRRlKMp6bf0tyeqNbY0v2dmFa1uyV_KibHZvm0hrp7ED6xCZI5JeWPfGqKVQzgPRCE6q2h7ygrJviMxjgkh6ZfV1KIZY6rISEvCzcIdXEWW6LKnib6LYux0vn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