aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-01-20 01:26:23 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-01-20 01:26:23 +0000
commitef331b783bb96a0f0e34afdb7ef46677dc4764cb (patch)
tree76961cf2e3a83c1dedb9490266157be929dd64b4 /lib/Sema/SemaType.cpp
parent2bf8fd84087231fd92dfdebe18895e01a6ae405c (diff)
Remove PotentiallyPotentiallyEvaluated, and replace it with a much simpler and less error-prone way of handling the relevant cases. Towards marking of whether a declaration is used more accurately.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148522 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp31
1 files changed, 7 insertions, 24 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index f3582975ec..006cf973d8 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -1057,40 +1057,23 @@ static QualType inferARCLifetimeForPointee(Sema &S, QualType type,
} else if (type->isObjCARCImplicitlyUnretainedType()) {
implicitLifetime = Qualifiers::OCL_ExplicitNone;
- // If we are in an unevaluated context, like sizeof, assume Autoreleasing and
- // don't give error.
+ // If we are in an unevaluated context, like sizeof, skip adding a
+ // qualification.
} else if (S.ExprEvalContexts.back().Context == Sema::Unevaluated ||
S.ExprEvalContexts.back().Context == Sema::ConstantEvaluated) {
- implicitLifetime = Qualifiers::OCL_Autoreleasing;
+ return type;
// If that failed, give an error and recover using __autoreleasing.
} else {
// These types can show up in private ivars in system headers, so
// we need this to not be an error in those cases. Instead we
// want to delay.
- //
- // Also, make sure we delay appropriately in
- // PotentiallyPotentiallyEvaluated contexts.
if (S.DelayedDiagnostics.shouldDelayDiagnostics()) {
- if (S.ExprEvalContexts.back().Context ==
- Sema::PotentiallyPotentiallyEvaluated) {
- S.ExprEvalContexts.back().addDelayedDiagnostic(
- sema::DelayedDiagnostic::makeForbiddenType(loc,
- diag::err_arc_indirect_no_ownership, type, isReference));
- } else {
- S.DelayedDiagnostics.add(
- sema::DelayedDiagnostic::makeForbiddenType(loc,
- diag::err_arc_indirect_no_ownership, type, isReference));
- }
+ S.DelayedDiagnostics.add(
+ sema::DelayedDiagnostic::makeForbiddenType(loc,
+ diag::err_arc_indirect_no_ownership, type, isReference));
} else {
- if (S.ExprEvalContexts.back().Context ==
- Sema::PotentiallyPotentiallyEvaluated) {
- S.ExprEvalContexts.back().addDiagnostic(loc,
- S.PDiag(diag::err_arc_indirect_no_ownership)
- << type << isReference);
- } else {
- S.Diag(loc, diag::err_arc_indirect_no_ownership) << type << isReference;
- }
+ S.Diag(loc, diag::err_arc_indirect_no_ownership) << type << isReference;
}
implicitLifetime = Qualifiers::OCL_Autoreleasing;
}