]> granicus.if.org Git - clang/commit
Fix -Wmismatched-tags to not warn on redeclarations of structs in system
authorRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 4 Dec 2018 02:45:28 +0000 (02:45 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Tue, 4 Dec 2018 02:45:28 +0000 (02:45 +0000)
commit1a0f6a2ab41ee8b0b5a5e957208dfe5cd46a9a92
tree32aba09ef3a82d6ea70e93081f83672f73f801db
parent2e8d7182c2c18e961dfb34dcb84c70baf98e2549
Fix -Wmismatched-tags to not warn on redeclarations of structs in system
headers.

Previously, we would only check whether the new declaration is in a
system header, but that requires the user to be able to correctly guess
whether a declaration in a system header is declared as a struct or a
class when specializing standard library traits templates.

We now entirely ignore declarations for which the warning was disabled
when determining whether to warn on a tag mismatch.

Also extend the diagnostic message to clarify that
 a) code containing such a tag mismatch is in fact valid and correct,
    and
 b) the (non-coding-style) reason to emit such a warning is that the
    Microsoft C++ ABI is broken and includes the tag kind in decorated
    names,
as it seems a lot of users are confused by our diagnostic here (either
not understanding why we produce it, or believing that it represents an
actual language rule).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348233 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDecl.cpp
test/SemaCXX/struct-class-redecl.cpp