@@ -36,17 +36,28 @@ bool path_contains_namespace(clang::Decl* decl, Namespace n) noexcept {
3636}
3737
3838bool path_is_private (clang::NamedDecl* decl) noexcept {
39+ // clang::Linkage members were renamed in 18.
40+ #if CLANG_VERSION_MAJOR >= 18
41+ constexpr auto ModuleLinkage = clang::Linkage::Module;
42+ constexpr auto ExternalLinkage = clang::Linkage::External;
43+ constexpr auto NoneLinkage = clang::Linkage::None;
44+ #else
45+ constexpr auto ModuleLinkage = clang::Linkage::ModuleLinkage;
46+ constexpr auto ExternalLinkage = clang::Linkage::ExternalLinkage;
47+ constexpr auto NoneLinkage = clang::Linkage::NoLinkage;
48+ #endif
49+
3950 clang::Linkage linkage = decl->getLinkageInternal ();
40- if (linkage != clang::Linkage:: ModuleLinkage &&
41- linkage != clang::Linkage:: ExternalLinkage) {
42- // NoLinkage describes itself as "can only be referred to from within its
43- // scope".
51+ if (linkage != ModuleLinkage &&
52+ linkage != ExternalLinkage) {
53+ // Linkage::None describes itself as "can only be referred to from within
54+ // its scope".
4455 //
4556 // However `namespace a { using b::S; }` brings S into `a` in a way that is
46- // usable publicly from other scopes. So we accept `NoLinkage ` for
57+ // usable publicly from other scopes. So we accept `Linkage::None ` for
4758 // `UsingDecl` and `UsingEnumDecl` (aka `BaseUsingDecl`). Similar for
4859 // type aliases.
49- if (!(linkage == clang::Linkage::NoLinkage &&
60+ if (!(linkage == NoneLinkage &&
5061 (clang::isa<clang::BaseUsingDecl>(decl) ||
5162 clang::isa<clang::TypedefNameDecl>(decl)))) {
5263 return true ;
0 commit comments