diff options
author | Hans Wennborg <hans@hanshq.net> | 2015-06-09 00:38:56 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2015-06-09 00:38:56 +0000 |
commit | 29b7a939350ed4fb577545c56d54e23b06bce6d9 (patch) | |
tree | 3e35fc9fb5d07dbce79e4acefb08c76d61263a4f /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | 87bb56984427bdc6cb9c951f06deceb5f8e3f795 (diff) | |
download | bcm5719-llvm-29b7a939350ed4fb577545c56d54e23b06bce6d9.tar.gz bcm5719-llvm-29b7a939350ed4fb577545c56d54e23b06bce6d9.zip |
Narrow the -Wunsupported-dll-base-class-template warning.
Don't warn about not being able to propagate dll attribute to a base class template
when that base already has a different attribute.
MSVC doesn't actually try to do this; the first attribute that was propagated
takes precedence, so Clang is already doing the right thing and there's no
need to warn.
(This is a step towards fixing PR21718.)
llvm-svn: 239372
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index b1dfe0e95e2..b67dfb8e342 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -1364,26 +1364,18 @@ static void propagateDLLAttrToBaseClassTemplate( return; } - bool DifferentAttribute = false; - if (Attr *SpecializationAttr = getDLLAttr(BaseTemplateSpec)) { - if (!SpecializationAttr->isInherited()) { - // The template has previously been specialized or instantiated with an - // explicit attribute. We should not try to change it. - return; - } - if (SpecializationAttr->getKind() == ClassAttr->getKind()) { - // The specialization already has the right attribute. - return; - } - DifferentAttribute = true; + if (getDLLAttr(BaseTemplateSpec)) { + // The template has already been specialized or instantiated with an + // attribute, explicitly or through propagation. We should not try to change + // it. + return; } // The template was previously instantiated or explicitly specialized without - // a dll attribute, or the template was previously instantiated with a - // different inherited attribute. It's too late for us to change the - // attribute, so warn that this is unsupported. + // a dll attribute, It's too late for us to add an attribute, so warn that + // this is unsupported. S.Diag(BaseLoc, diag::warn_attribute_dll_instantiated_base_class) - << BaseTemplateSpec->isExplicitSpecialization() << DifferentAttribute; + << BaseTemplateSpec->isExplicitSpecialization(); S.Diag(ClassAttr->getLocation(), diag::note_attribute); if (BaseTemplateSpec->isExplicitSpecialization()) { S.Diag(BaseTemplateSpec->getLocation(), |