summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2015-11-12 23:39:39 +0000
committerJohn McCall <rjmccall@apple.com>2015-11-12 23:39:39 +0000
commitd6da23d2dfeb0d40cc49bb2b34c7ca3b6f8dfed9 (patch)
treee088169786e8cb6981f577ec4b3278402be42670 /clang/lib
parentb883b01a8e44f841339023593b461b09e008f27a (diff)
downloadbcm5719-llvm-d6da23d2dfeb0d40cc49bb2b34c7ca3b6f8dfed9.tar.gz
bcm5719-llvm-d6da23d2dfeb0d40cc49bb2b34c7ca3b6f8dfed9.zip
Remove -Wobjc-weak-compat; there isn't a compelling use case for this.
llvm-svn: 252971
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaType.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index bbd0c3fbd06..b6bc1594282 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -5187,6 +5187,18 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state,
type = S.Context.getAttributedType(AttributedType::attr_objc_ownership,
origType, type);
+ auto diagnoseOrDelay = [](Sema &S, SourceLocation loc,
+ unsigned diagnostic, QualType type) {
+ if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {
+ S.DelayedDiagnostics.add(
+ sema::DelayedDiagnostic::makeForbiddenType(
+ S.getSourceManager().getExpansionLoc(loc),
+ diagnostic, type, /*ignored*/ 0));
+ } else {
+ S.Diag(loc, diagnostic);
+ }
+ };
+
// Sometimes, __weak isn't allowed.
if (lifetime == Qualifiers::OCL_Weak &&
!S.getLangOpts().ObjCWeak && !NonObjCPointer) {
@@ -5197,26 +5209,12 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state,
: diag::err_arc_weak_no_runtime);
// In any case, delay the diagnostic until we know what we're parsing.
- if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {
- S.DelayedDiagnostics.add(
- sema::DelayedDiagnostic::makeForbiddenType(
- S.getSourceManager().getExpansionLoc(AttrLoc),
- diagnostic, type, /*ignored*/ 0));
- } else {
- S.Diag(AttrLoc, diagnostic);
- }
+ diagnoseOrDelay(S, AttrLoc, diagnostic, type);
attr.setInvalid();
return true;
}
- // If we accepted __weak, we might still need to warn about it.
- if (lifetime == Qualifiers::OCL_Weak &&
- !S.getLangOpts().ObjCAutoRefCount &&
- S.getLangOpts().ObjCWeak) {
- S.Diag(AttrLoc, diag::warn_objc_weak_compat);
- }
-
// Forbid __weak for class objects marked as
// objc_arc_weak_reference_unavailable
if (lifetime == Qualifiers::OCL_Weak) {
OpenPOWER on IntegriCloud