[clang] [clang][ASTImporter] Fix AST import if anonymous namespaces are merged (PR #128735)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 28 05:41:24 PDT 2025


NagyDonat wrote:

If there is only one anonymous namespace for each TU, then what does the AST import do in a situation like
```c++
TEST_P(ImportAndMergeAnonymousNamespace, NamespaceInLinkageSpec) {
  const char *ToCode =
      R"(
      extern "C" {
      namespace {
      }
      }
      )";
  const char *FromCode =
      R"(
      namespace {
        void f();
      }
      )";
  test(ToCode, FromCode);
}
```
where one side is within an `extern "C"` block and the other is not?

Are these two anonymous namespaces merged by the ASTImporter code? Does this behavior cause any crashes?

https://github.com/llvm/llvm-project/pull/128735


More information about the cfe-commits mailing list