diff options
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index aa827a40c6..d4b9988d88 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -1694,9 +1694,16 @@ static void handleVisibilityAttr(Sema &S, Decl *D, const AttributeList &Attr) { type = VisibilityAttr::Hidden; else if (TypeStr == "internal") type = VisibilityAttr::Hidden; // FIXME - else if (TypeStr == "protected") - type = VisibilityAttr::Protected; - else { + else if (TypeStr == "protected") { + // Complain about attempts to use protected visibility on targets + // (like Darwin) that don't support it. + if (!S.Context.getTargetInfo().hasProtectedVisibility()) { + S.Diag(Attr.getLoc(), diag::warn_attribute_protected_visibility); + type = VisibilityAttr::Default; + } else { + type = VisibilityAttr::Protected; + } + } else { S.Diag(Attr.getLoc(), diag::warn_attribute_unknown_visibility) << TypeStr; return; } |