summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2018-03-12 17:05:06 +0000
committerAkira Hatanaka <ahatanaka@apple.com>2018-03-12 17:05:06 +0000
commitbe7daa3d50e8a65e6bba6b522768ca225b818c39 (patch)
tree5f807d6ceabb3a1905d891ad6c85fdd7cc7c84db /clang/lib/Sema/SemaDecl.cpp
parent144b0c8036e1edac15ff1a69faa31eb23c1eef3f (diff)
downloadbcm5719-llvm-be7daa3d50e8a65e6bba6b522768ca225b818c39.tar.gz
bcm5719-llvm-be7daa3d50e8a65e6bba6b522768ca225b818c39.zip
Revert "[ObjC] Allow declaring __weak pointer fields in C structs in
ARC." This reverts commit r327206 as there were test failures caused by this patch. http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180312/221427.html llvm-svn: 327294
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 831aef21280..036082c9412 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -15260,6 +15260,7 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
// Get the type for the field.
const Type *FDTy = FD->getType().getTypePtr();
+ Qualifiers QS = FD->getType().getQualifiers();
if (!FD->isAnonymousStructOrUnion()) {
// Remember all fields written by the user.
@@ -15400,7 +15401,10 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
QualType T = Context.getObjCObjectPointerType(FD->getType());
FD->setType(T);
} else if (getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() &&
- Record && !ObjCFieldLifetimeErrReported && Record->isUnion()) {
+ Record && !ObjCFieldLifetimeErrReported &&
+ ((!getLangOpts().CPlusPlus &&
+ QS.getObjCLifetime() == Qualifiers::OCL_Weak) ||
+ Record->isUnion())) {
// It's an error in ARC or Weak if a field has lifetime.
// We don't want to report this in a system header, though,
// so we just make the field unavailable.
@@ -15446,8 +15450,6 @@ void Sema::ActOnFields(Scope *S, SourceLocation RecLoc, Decl *EnclosingDecl,
Record->setNonTrivialToPrimitiveCopy();
if (FT.isDestructedType())
Record->setNonTrivialToPrimitiveDestroy();
- if (!FT.canPassInRegisters())
- Record->setCanPassInRegisters(false);
}
if (Record && FD->getType().isVolatileQualified())
OpenPOWER on IntegriCloud