diff options
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 24 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaModule.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 4 |
6 files changed, 18 insertions, 22 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 1842a78..12915a3 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -7336,7 +7336,7 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto, if (Context.getTargetInfo().getTriple().isOSAIX() && FDecl && Arg && FDecl->hasLinkage() && - FDecl->getFormalLinkage() != InternalLinkage && + FDecl->getFormalLinkage() != Linkage::Internal && CallType == VariadicDoesNotApply) checkAIXMemberAlignment((Arg->getExprLoc()), Arg); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index a8bad12..b4affa7 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1730,9 +1730,9 @@ bool Sema::CheckRedeclarationExported(NamedDecl *New, NamedDecl *Old) { auto Lk = Old->getFormalLinkage(); int S = 0; - if (Lk == Linkage::InternalLinkage) + if (Lk == Linkage::Internal) S = 1; - else if (Lk == Linkage::ModuleLinkage) + else if (Lk == Linkage::Module) S = 2; Diag(New->getLocation(), diag::err_redeclaration_non_exported) << New << S; Diag(Old->getLocation(), diag::note_previous_declaration); @@ -4843,11 +4843,9 @@ void Sema::notePreviousDefinition(const NamedDecl *Old, SourceLocation New) { /// of the same variable. Either diagnose or fix the problem. bool Sema::checkVarDeclRedefinition(VarDecl *Old, VarDecl *New) { if (!hasVisibleDefinition(Old) && - (New->getFormalLinkage() == InternalLinkage || - New->isInline() || + (New->getFormalLinkage() == Linkage::Internal || New->isInline() || isa<VarTemplateSpecializationDecl>(New) || - New->getDescribedVarTemplate() || - New->getNumTemplateParameterLists() || + New->getDescribedVarTemplate() || New->getNumTemplateParameterLists() || New->getDeclContext()->isDependentContext())) { // The previous definition is hidden, and multiple definitions are // permitted (in separate TUs). Demote this to a declaration. @@ -13413,9 +13411,8 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { // units. if (getLangOpts().CPlusPlusModules && currentModuleIsHeaderUnit() && !VDecl->isInvalidDecl() && VDecl->isThisDeclarationADefinition() && - VDecl->getFormalLinkage() == Linkage::ExternalLinkage && - !VDecl->isInline() && !VDecl->isTemplated() && - !isa<VarTemplateSpecializationDecl>(VDecl)) { + VDecl->getFormalLinkage() == Linkage::External && !VDecl->isInline() && + !VDecl->isTemplated() && !isa<VarTemplateSpecializationDecl>(VDecl)) { Diag(VDecl->getLocation(), diag::err_extern_def_in_header_unit); VDecl->setInvalidDecl(); } @@ -15394,9 +15391,8 @@ Sema::CheckForFunctionRedefinition(FunctionDecl *FD, // If we don't have a visible definition of the function, and it's inline or // a template, skip the new definition. if (SkipBody && !hasVisibleDefinition(Definition) && - (Definition->getFormalLinkage() == InternalLinkage || - Definition->isInlined() || - Definition->getDescribedFunctionTemplate() || + (Definition->getFormalLinkage() == Linkage::Internal || + Definition->isInlined() || Definition->getDescribedFunctionTemplate() || Definition->getNumTemplateParameterLists())) { SkipBody->ShouldSkip = true; SkipBody->Previous = const_cast<FunctionDecl*>(Definition); @@ -15652,8 +15648,8 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D, if (getLangOpts().CPlusPlusModules && currentModuleIsHeaderUnit() && !FD->isInvalidDecl() && !FD->isInlined() && BodyKind != FnBodyKind::Delete && BodyKind != FnBodyKind::Default && - FD->getFormalLinkage() == Linkage::ExternalLinkage && - !FD->isTemplated() && !FD->isTemplateInstantiation()) { + FD->getFormalLinkage() == Linkage::External && !FD->isTemplated() && + !FD->isTemplateInstantiation()) { assert(FD->isThisDeclarationADefinition()); Diag(FD->getLocation(), diag::err_extern_def_in_header_unit); FD->setInvalidDecl(); diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 2a3cd7a..4a4cb02 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -173,7 +173,7 @@ static void diagnoseUseOfInternalDeclInInlineFunction(Sema &S, return; // Check if the decl has internal linkage. - if (D->getFormalLinkage() != InternalLinkage) + if (D->getFormalLinkage() != Linkage::Internal) return; // Downgrade from ExtWarn to Extension if diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index 5582afb..8a29683 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -844,7 +844,7 @@ static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) { // Don't diagnose anonymous union objects; we'll diagnose their members // instead. HasName = (bool)ND->getDeclName(); - if (HasName && ND->getFormalLinkage() == InternalLinkage) { + if (HasName && ND->getFormalLinkage() == Linkage::Internal) { S.Diag(ND->getLocation(), diag::err_export_internal) << ND; if (BlockStart.isValid()) S.Diag(BlockStart, diag::note_export); @@ -858,9 +858,9 @@ static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) { if (auto *USD = dyn_cast<UsingShadowDecl>(D)) { NamedDecl *Target = USD->getUnderlyingDecl(); Linkage Lk = Target->getFormalLinkage(); - if (Lk == InternalLinkage || Lk == ModuleLinkage) { + if (Lk == Linkage::Internal || Lk == Linkage::Module) { S.Diag(USD->getLocation(), diag::err_export_using_internal) - << (Lk == InternalLinkage ? 0 : 1) << Target; + << (Lk == Linkage::Internal ? 0 : 1) << Target; S.Diag(Target->getLocation(), diag::note_using_decl_target); if (BlockStart.isValid()) S.Diag(BlockStart, diag::note_export); diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index d3d2dfe..f97e244 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -6795,7 +6795,7 @@ void Sema::AddOverloadCandidate( if (auto *SpecInfo = Function->getTemplateSpecializationInfo()) ND = SpecInfo->getTemplate(); - if (ND->getFormalLinkage() == Linkage::InternalLinkage) { + if (ND->getFormalLinkage() == Linkage::Internal) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_module_mismatched; return; diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 9044400..4d6b237 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -6874,7 +6874,7 @@ static bool CheckTemplateArgumentAddressOfObjectOrFunction( } // Address / reference template args must have external linkage in C++98. - if (Entity->getFormalLinkage() == InternalLinkage) { + if (Entity->getFormalLinkage() == Linkage::Internal) { S.Diag(Arg->getBeginLoc(), S.getLangOpts().CPlusPlus11 ? diag::warn_cxx98_compat_template_arg_object_internal @@ -9896,7 +9896,7 @@ static bool CheckExplicitInstantiation(Sema &S, NamedDecl *D, // An explicit instantiation declaration shall not name a specialization of // a template with internal linkage. if (TSK == TSK_ExplicitInstantiationDeclaration && - D->getFormalLinkage() == InternalLinkage) { + D->getFormalLinkage() == Linkage::Internal) { S.Diag(InstLoc, diag::err_explicit_instantiation_internal_linkage) << D; return true; } |