Skip to content

Commit 8fec764

Browse files
author
git apple-llvm automerger
committed
Merge commit '45218e01d69e' from llvm.org/main into next
2 parents 26a7781 + 45218e0 commit 8fec764

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -812,21 +812,25 @@ changes to one object won't affect the others, the object's initializer will run
812812
once per copy, etc.
813813

814814
Specifically, this warning fires when it detects an object which:
815-
1. Appears in a header file (so it might get compiled into multiple libaries), and
815+
1. Is defined as ``inline`` in a header file (so it might get compiled into multiple libaries), and
816816
2. Has external linkage (otherwise it's supposed to be duplicated), and
817817
3. Has hidden visibility.
818818

819819
As well as one of the following:
820820
1. The object is mutable, or
821821
2. The object's initializer definitely has side effects.
822822

823-
The warning is best resolved by making the object ``const`` (if possible), or by explicitly
824-
giving the object non-hidden visibility, e.g. using ``__attribute((visibility("default")))``.
825-
Note that all levels of a pointer variable must be constant; ``const int*`` will
826-
trigger the warning because the pointer itself is mutable.
823+
The warning can be resolved by removing one of the conditions above. In rough
824+
order of preference, this may be done by:
825+
1. Marking the object ``const`` (if possible)
826+
2. Moving the object's definition to a source file
827+
3. Giving the object non-hidden visibility, e.g. using ``__attribute((visibility("default")))``.
827828

828-
This warning is currently disabled on Windows since it uses import/export rules
829-
instead of visibility.
829+
Note that for (2), all levels of a pointer variable must be constant;
830+
``const int*`` will trigger the warning because the pointer itself is mutable.
831+
832+
This warning is not yet implemented for Windows, since Windows uses
833+
import/export rules instead of visibility.
830834
}];
831835
}
832836

0 commit comments

Comments
 (0)