[clang] [NFCI] Fix Wattributes warnings from Sema. (PR #157906)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 10 10:24:26 PDT 2025
https://github.com/erichkeane created https://github.com/llvm/llvm-project/pull/157906
See: https://github.com/llvm/llvm-project/issues/157834
There is some visibility concerns here, so this patch suppresses the diagnostic. I believe we are doing this intentionally, so unless someone comes up with a good reason we should either remove the visibility of Sema, or make these types visible, this seems like the right way forward.
Fixes: #157834
>From b0d4a469f6d16b92be58af0979894989f689f766 Mon Sep 17 00:00:00 2001
From: erichkeane <ekeane at nvidia.com>
Date: Wed, 10 Sep 2025 09:54:17 -0700
Subject: [PATCH] [NFCI] Fix Wattributes warnings from Sema.
See: https://github.com/llvm/llvm-project/issues/157834
There is some visibility concerns here, so this patch suppresses the
diagnostic. I believe we are doing this intentionally, so unless someone comes
up with a good reason we should either remove the visibility of Sema, or make
these types visible, this seems like the right way forward.
Fixes: #157834
---
clang/include/clang/Sema/Sema.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 88b67eed5fd37..0df125c9cec9e 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -3541,6 +3541,10 @@ class Sema final : public SemaBase {
llvm::SmallSetVector<const TypedefNameDecl *, 4>
UnusedLocalTypedefNameCandidates;
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
typedef LazyVector<const DeclaratorDecl *, ExternalSemaSource,
&ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2>
UnusedFileScopedDeclsType;
@@ -3555,6 +3559,9 @@ class Sema final : public SemaBase {
/// All the tentative definitions encountered in the TU.
TentativeDefinitionsType TentativeDefinitions;
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
/// All the external declarations encoutered and used in the TU.
SmallVector<DeclaratorDecl *, 4> ExternalDeclarations;
@@ -4858,6 +4865,10 @@ class Sema final : public SemaBase {
/// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
SmallVectorImpl<Decl *> &WeakTopLevelDecls() { return WeakTopLevelDecl; }
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
typedef LazyVector<TypedefNameDecl *, ExternalSemaSource,
&ExternalSemaSource::ReadExtVectorDecls, 2, 2>
ExtVectorDeclsType;
@@ -4866,6 +4877,9 @@ class Sema final : public SemaBase {
/// us to associate a raw vector type with one of the ext_vector type names.
/// This is only necessary for issuing pretty diagnostics.
ExtVectorDeclsType ExtVectorDecls;
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
/// Check if the argument \p E is a ASCII string literal. If not emit an error
/// and return false, otherwise set \p Str to the value of the string literal
@@ -6466,6 +6480,10 @@ class Sema final : public SemaBase {
/// same list more than once.
std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wattributes"
+#endif
typedef LazyVector<CXXConstructorDecl *, ExternalSemaSource,
&ExternalSemaSource::ReadDelegatingConstructors, 2, 2>
DelegatingCtorDeclsType;
@@ -6473,6 +6491,9 @@ class Sema final : public SemaBase {
/// All the delegating constructors seen so far in the file, used for
/// cycle detection at the end of the TU.
DelegatingCtorDeclsType DelegatingCtorDecls;
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
/// The C++ "std" namespace, where the standard library resides.
LazyDeclPtr StdNamespace;
More information about the cfe-commits
mailing list