diff options
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 036082c941..6d7dc677f1 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -5747,7 +5747,7 @@ Sema::CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *NewTD) { TypeSourceInfo *TInfo = NewTD->getTypeSourceInfo(); QualType T = TInfo->getType(); if (T->isVariablyModifiedType()) { - getCurFunction()->setHasBranchProtectedScope(); + setFunctionHasBranchProtectedScope(); if (S->getFnParent() == nullptr) { bool SizeIsNegative; @@ -7407,7 +7407,7 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) { bool isVM = T->isVariablyModifiedType(); if (isVM || NewVD->hasAttr<CleanupAttr>() || NewVD->hasAttr<BlocksAttr>()) - getCurFunction()->setHasBranchProtectedScope(); + setFunctionHasBranchProtectedScope(); if ((isVM && NewVD->hasLinkage()) || (T->isVariableArrayType() && NewVD->hasGlobalStorage())) { @@ -10644,7 +10644,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { } if (VDecl->hasLocalStorage()) - getCurFunction()->setHasBranchProtectedScope(); + setFunctionHasBranchProtectedScope(); if (DiagnoseUnexpandedParameterPack(Init, UPPC_Initializer)) { VDecl->setInvalidDecl(); @@ -11178,11 +11178,11 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl) { if (const RecordType *Record = Context.getBaseElementType(Type)->getAs<RecordType>()) { CXXRecordDecl *CXXRecord = cast<CXXRecordDecl>(Record->getDecl()); - // Mark the function for further checking even if the looser rules of - // C++11 do not require such checks, so that we can diagnose - // incompatibilities with C++98. + // Mark the function (if we're in one) for further checking even if the + // looser rules of C++11 do not require such checks, so that we can + // diagnose incompatibilities with C++98. if (!CXXRecord->isPOD()) - getCurFunction()->setHasBranchProtectedScope(); + setFunctionHasBranchProtectedScope(); } } @@ -11318,13 +11318,14 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) { case Qualifiers::OCL_Weak: case Qualifiers::OCL_Strong: - getCurFunction()->setHasBranchProtectedScope(); + setFunctionHasBranchProtectedScope(); break; } } - if (var->getType().isDestructedType() == QualType::DK_nontrivial_c_struct) - getCurFunction()->setHasBranchProtectedScope(); + if (var->hasLocalStorage() && + var->getType().isDestructedType() == QualType::DK_nontrivial_c_struct) + setFunctionHasBranchProtectedScope(); // Warn about externally-visible variables being defined without a // prior declaration. We only want to do this for global |