summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-01-29 01:20:30 +0000
committerJohn McCall <rjmccall@apple.com>2012-01-29 01:20:30 +0000
commiteed64c77d27f0b442346c35aa5cadb774ae193d4 (patch)
tree0e384ca3b92abc799cb07117ed388030ccfeacb6 /clang/lib/Sema/SemaDeclAttr.cpp
parent1b3167edec7b2c34645324f4dbce5b0d9c2afcb0 (diff)
downloadbcm5719-llvm-eed64c77d27f0b442346c35aa5cadb774ae193d4.tar.gz
bcm5719-llvm-eed64c77d27f0b442346c35aa5cadb774ae193d4.zip
Complain about attempts to use 'protected' visibility on targets
like Darwin that don't support it. We should also complain about invalid -fvisibility=protected, but that information doesn't seem to exist at the most appropriate time, so I've left a FIXME behind. llvm-svn: 149186
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index aa827a40c62..d4b9988d88c 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud