Skip to content

Commit

Permalink
[libc++][modules] Fixes clang-tidy exports.
Browse files Browse the repository at this point in the history
As suggested in #71438 we should use
  export import std;
in the std.compat module.

Using this exports some named declarations from functions and records,
adding them to the global namespace. Clang correctly, does not export
these it's and issue in the declaration filtering. Declarations in
function or record context are not considered a global named
declaration.
  • Loading branch information
mordante committed Jan 17, 2024
1 parent 020ea3e commit 3d82f80
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,13 @@ static bool is_global_name_exported_by_std_module(std::string_view name) {

static bool is_valid_declaration_context(
const clang::NamedDecl& decl, std::string_view name, header_exportable_declarations::FileType file_type) {
if (decl.getDeclContext()->isNamespace())
const clang::DeclContext& context = *decl.getDeclContext();
if (context.isNamespace())
return true;

if (context.isFunctionOrMethod() || context.isRecord())
return false;

if (is_global_name_exported_by_std_module(name))
return true;

Expand Down

0 comments on commit 3d82f80

Please sign in to comment.