From b11fa0d25d86169f0e0a29d5398116c0212bb787 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 13 Apr 2009 21:08:27 +0000 Subject: Update to use hasAttr() instead of getAttr(). - No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68987 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 79bf4de4f7..f981453bf0 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -239,10 +239,10 @@ void CodeGenModule::SetGlobalValueAttributes(const Decl *D, // approximation of what we really want. if (!ForDefinition) { // Only a few attributes are set on declarations. - if (D->getAttr()) { + if (D->hasAttr()) { // The dllimport attribute is overridden by a subsequent declaration as // dllexport. - if (!D->getAttr()) { + if (!D->hasAttr()) { // dllimport attribute can be applied only to function decls, not to // definitions. if (const FunctionDecl *FD = dyn_cast(D)) { @@ -251,8 +251,8 @@ void CodeGenModule::SetGlobalValueAttributes(const Decl *D, } else GV->setLinkage(llvm::Function::DLLImportLinkage); } - } else if (D->getAttr() || - D->getAttr()) { + } else if (D->hasAttr() || + D->hasAttr()) { // "extern_weak" is overloaded in LLVM; we probably should have // separate linkage types for this. GV->setLinkage(llvm::Function::ExternalWeakLinkage); @@ -261,14 +261,14 @@ void CodeGenModule::SetGlobalValueAttributes(const Decl *D, if (IsInternal) { GV->setLinkage(llvm::Function::InternalLinkage); } else { - if (D->getAttr()) { + if (D->hasAttr()) { if (const FunctionDecl *FD = dyn_cast(D)) { // The dllexport attribute is ignored for undefined symbols. if (FD->getBody()) GV->setLinkage(llvm::Function::DLLExportLinkage); } else GV->setLinkage(llvm::Function::DLLExportLinkage); - } else if (D->getAttr() || D->getAttr() || + } else if (D->hasAttr() || D->hasAttr() || IsInline) GV->setLinkage(llvm::Function::WeakAnyLinkage); } @@ -290,7 +290,7 @@ void CodeGenModule::SetGlobalValueAttributes(const Decl *D, // might add multiple times or risk the value being replaced by a // subsequent RAUW. if (ForDefinition) { - if (D->getAttr()) + if (D->hasAttr()) AddUsedGlobal(GV); } } @@ -305,10 +305,10 @@ void CodeGenModule::SetFunctionAttributes(const Decl *D, AttributeList.size())); // Set the appropriate calling convention for the Function. - if (D->getAttr()) + if (D->hasAttr()) F->setCallingConv(llvm::CallingConv::X86_FastCall); - if (D->getAttr()) + if (D->hasAttr()) F->setCallingConv(llvm::CallingConv::X86_StdCall); } @@ -327,10 +327,10 @@ void CodeGenModule::SetFunctionAttributesForDefinition(const Decl *D, if (!Features.Exceptions && !Features.ObjCNonFragileABI) F->addFnAttr(llvm::Attribute::NoUnwind); - if (D->getAttr()) + if (D->hasAttr()) F->addFnAttr(llvm::Attribute::AlwaysInline); - if (D->getAttr()) + if (D->hasAttr()) F->addFnAttr(llvm::Attribute::NoInline); } @@ -452,12 +452,12 @@ llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV, bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) { // Never defer when EmitAllDecls is specified or the decl has // attribute used. - if (Features.EmitAllDecls || Global->getAttr()) + if (Features.EmitAllDecls || Global->hasAttr()) return false; if (const FunctionDecl *FD = dyn_cast(Global)) { // Constructors and destructors should never be deferred. - if (FD->getAttr() || FD->getAttr()) + if (FD->hasAttr() || FD->hasAttr()) return false; // FIXME: What about inline, and/or extern inline? @@ -477,7 +477,7 @@ bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) { void CodeGenModule::EmitGlobal(const ValueDecl *Global) { // If this is an alias definition (which otherwise looks like a declaration) // emit it now. - if (Global->getAttr()) + if (Global->hasAttr()) return EmitAliasDefinition(Global); // Ignore declarations, they will be emitted on their first use. @@ -651,7 +651,7 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMGlobal(const char *MangledName, if (D->getStorageClass() == VarDecl::PrivateExtern) setGlobalVisibility(GV, VisibilityAttr::HiddenVisibility); - if (D->getAttr() || D->getAttr()) + if (D->hasAttr() || D->hasAttr()) GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage); } @@ -787,11 +787,11 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { // Set the llvm linkage type as appropriate. if (D->getStorageClass() == VarDecl::Static) GV->setLinkage(llvm::Function::InternalLinkage); - else if (D->getAttr()) + else if (D->hasAttr()) GV->setLinkage(llvm::Function::DLLImportLinkage); - else if (D->getAttr()) + else if (D->hasAttr()) GV->setLinkage(llvm::Function::DLLExportLinkage); - else if (D->getAttr() || D->getAttr()) + else if (D->hasAttr() || D->hasAttr()) GV->setLinkage(llvm::GlobalVariable::WeakAnyLinkage); else { // FIXME: This isn't right. This should handle common linkage and other @@ -826,7 +826,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) { if (const SectionAttr *SA = D->getAttr()) GV->setSection(SA->getName()); - if (D->getAttr()) + if (D->hasAttr()) AddUsedGlobal(GV); // Emit global variable debug information. -- cgit v1.2.3