]> granicus.if.org Git - clang/commitdiff
Update to use hasAttr() instead of getAttr().
authorDaniel Dunbar <daniel@zuster.org>
Mon, 13 Apr 2009 21:08:27 +0000 (21:08 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 13 Apr 2009 21:08:27 +0000 (21:08 +0000)
 - No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68987 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGExpr.cpp
lib/CodeGen/CGObjC.cpp
lib/CodeGen/CGObjCMac.cpp
lib/CodeGen/CodeGenFunction.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/Mangle.cpp

index 8767eb4fb363be4364833c1ebd02b02dc3c918e5..5ef01ac5f0df540005c09c39379f0f41b09ed7be 100644 (file)
@@ -383,7 +383,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
   case Builtin::BIsqrtf:
   case Builtin::BIsqrtl: {
     // Rewrite sqrt to intrinsic if allowed.
-    if (!FD->getAttr<ConstAttr>())
+    if (!FD->hasAttr<ConstAttr>())
       break;
     Value *Arg0 = EmitScalarExpr(E->getArg(0));
     const llvm::Type *ArgType = Arg0->getType();
@@ -395,7 +395,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
   case Builtin::BIpowf:
   case Builtin::BIpowl: {
     // Rewrite sqrt to intrinsic if allowed.
-    if (!FD->getAttr<ConstAttr>())
+    if (!FD->hasAttr<ConstAttr>())
       break;
     Value *Base = EmitScalarExpr(E->getArg(0));
     Value *Exponent = EmitScalarExpr(E->getArg(1));
index bad76409cb1315b7b887312f628565696be6d4d8..e6474cb9ee770953cbdfd538dc19ad8ddb379bde 100644 (file)
@@ -1650,13 +1650,13 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
 
   // FIXME: handle sseregparm someday...
   if (TargetDecl) {
-    if (TargetDecl->getAttr<NoThrowAttr>())
+    if (TargetDecl->hasAttr<NoThrowAttr>())
       FuncAttrs |= llvm::Attribute::NoUnwind;
-    if (TargetDecl->getAttr<NoReturnAttr>())
+    if (TargetDecl->hasAttr<NoReturnAttr>())
       FuncAttrs |= llvm::Attribute::NoReturn;
-    if (TargetDecl->getAttr<ConstAttr>())
+    if (TargetDecl->hasAttr<ConstAttr>())
       FuncAttrs |= llvm::Attribute::ReadNone;
-    else if (TargetDecl->getAttr<PureAttr>())
+    else if (TargetDecl->hasAttr<PureAttr>())
       FuncAttrs |= llvm::Attribute::ReadOnly;
   }
 
index 2060b5c449d2a62fe4c4e808964f75689297c7b1..4cb4f5530b2ed6e64d737941a4e3e185bfef90d1 100644 (file)
@@ -60,7 +60,7 @@ void CodeGenFunction::EmitDecl(const Decl &D) {
 /// EmitBlockVarDecl - This method handles emission of any variable declaration
 /// inside a function, including static vars etc.
 void CodeGenFunction::EmitBlockVarDecl(const VarDecl &D) {
-  if (D.getAttr<AsmLabelAttr>())
+  if (D.hasAttr<AsmLabelAttr>())
     CGM.ErrorUnsupported(&D, "__asm__");
   
   // We don't support __thread yet.
@@ -175,7 +175,7 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) {
   if (const SectionAttr *SA = D.getAttr<SectionAttr>())
     GV->setSection(SA->getName());
   
-  if (D.getAttr<UsedAttr>())
+  if (D.hasAttr<UsedAttr>())
     CGM.AddUsedGlobal(GV);
 
   // We may have to cast the constant because of the initializer
@@ -235,7 +235,7 @@ const llvm::Type *CodeGenFunction::BuildByRefType(QualType Ty,
 /// These turn into simple stack objects, or GlobalValues depending on target.
 void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
   QualType Ty = D.getType();
-  bool isByRef = D.getAttr<BlocksAttr>();
+  bool isByRef = D.hasAttr<BlocksAttr>();
   bool needsDispose = false;
 
   llvm::Value *DeclPtr;
index e1cb1d17ec0aae2c4e5620cff68cc2b65dadefb8..2e7161c080e5c73c1ea3ba385726594fefbf7863 100644 (file)
@@ -644,7 +644,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
       // local static?
       if (!VD->hasLocalStorage())
         attr = getContext().getObjCGCAttrKind(E->getType());
-      if (VD->getAttr<BlocksAttr>()) {
+      if (VD->hasAttr<BlocksAttr>()) {
         bool needsCopyDispose = BlockRequiresCopying(VD->getType());
         const llvm::Type *PtrStructTy = V->getType();
         const llvm::Type *Ty = PtrStructTy;
index 487da7a603dbf9fb5c24fef2713b37c5dc7d68f0..4423217c7dd2553530bba8e2b32b4bee46a19c17 100644 (file)
@@ -127,7 +127,7 @@ void CodeGenFunction::StartObjCMethod(const ObjCMethodDecl *OMD,
 /// its pointer, name, and types registered in the class struture.  
 void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) {
   // Check if we should generate debug info for this method.
-  if (CGM.getDebugInfo() && !OMD->getAttr<NodebugAttr>())
+  if (CGM.getDebugInfo() && !OMD->hasAttr<NodebugAttr>())
     DebugInfo = CGM.getDebugInfo();
   StartObjCMethod(OMD, OMD->getClassInterface());
   EmitStmt(OMD->getBody());
index ae70dc568b0691101dbd483644204bbf12af7b9d..c69f5937d026236e2d7ac3eb26ba470e845d657a 100644 (file)
@@ -895,7 +895,7 @@ static llvm::Constant *getConstantGEP(llvm::Constant *C,
 /// hasObjCExceptionAttribute - Return true if this class or any super
 /// class has the __objc_exception__ attribute.
 static bool hasObjCExceptionAttribute(const ObjCInterfaceDecl *OID) {
-  if (OID->getAttr<ObjCExceptionAttr>())
+  if (OID->hasAttr<ObjCExceptionAttr>())
     return true;
   if (const ObjCInterfaceDecl *Super = OID->getSuperClass())
     return hasObjCExceptionAttribute(Super);
index b9a803286c4405ab55df35a50ee8781e7ffaf85c..7ddc2213705f5d2f9b67b4d6f5bfa5b9ed5081a3 100644 (file)
@@ -199,7 +199,7 @@ void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy,
 void CodeGenFunction::GenerateCode(const FunctionDecl *FD,
                                    llvm::Function *Fn) {
   // Check if we should generate debug info for this function.
-  if (CGM.getDebugInfo() && !FD->getAttr<NodebugAttr>())
+  if (CGM.getDebugInfo() && !FD->hasAttr<NodebugAttr>())
     DebugInfo = CGM.getDebugInfo();
   
   FunctionArgList Args;
index 79bf4de4f7a2ec5e9330f04df9e44dcdea35184a..f981453bf081255c95a4f30e7fb4e219aaa1b717 100644 (file)
@@ -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<DLLImportAttr>()) {
+    if (D->hasAttr<DLLImportAttr>()) {
       // The dllimport attribute is overridden by a subsequent declaration as
       // dllexport.
-      if (!D->getAttr<DLLExportAttr>()) {
+      if (!D->hasAttr<DLLExportAttr>()) {
         // dllimport attribute can be applied only to function decls, not to
         // definitions.
         if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
@@ -251,8 +251,8 @@ void CodeGenModule::SetGlobalValueAttributes(const Decl *D,
         } else
           GV->setLinkage(llvm::Function::DLLImportLinkage);
       }
-    } else if (D->getAttr<WeakAttr>() || 
-               D->getAttr<WeakImportAttr>()) {
+    } else if (D->hasAttr<WeakAttr>() || 
+               D->hasAttr<WeakImportAttr>()) {
       // "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<DLLExportAttr>()) {
+      if (D->hasAttr<DLLExportAttr>()) {
         if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(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<WeakAttr>() || D->getAttr<WeakImportAttr>() || 
+      } else if (D->hasAttr<WeakAttr>() || D->hasAttr<WeakImportAttr>() || 
                  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<UsedAttr>())
+    if (D->hasAttr<UsedAttr>())
       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<FastCallAttr>())
+  if (D->hasAttr<FastCallAttr>())
     F->setCallingConv(llvm::CallingConv::X86_FastCall);
 
-  if (D->getAttr<StdCallAttr>())
+  if (D->hasAttr<StdCallAttr>())
     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<AlwaysInlineAttr>())
+  if (D->hasAttr<AlwaysInlineAttr>())
     F->addFnAttr(llvm::Attribute::AlwaysInline);
   
-  if (D->getAttr<NoinlineAttr>())
+  if (D->hasAttr<NoinlineAttr>())
     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<UsedAttr>())
+  if (Features.EmitAllDecls || Global->hasAttr<UsedAttr>())
     return false;
 
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(Global)) {
     // Constructors and destructors should never be deferred.
-    if (FD->getAttr<ConstructorAttr>() || FD->getAttr<DestructorAttr>())
+    if (FD->hasAttr<ConstructorAttr>() || FD->hasAttr<DestructorAttr>())
       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<AliasAttr>())
+  if (Global->hasAttr<AliasAttr>())
     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<WeakAttr>() || D->getAttr<WeakImportAttr>())
+    if (D->hasAttr<WeakAttr>() || D->hasAttr<WeakImportAttr>())
       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<DLLImportAttr>())
+  else if (D->hasAttr<DLLImportAttr>())
     GV->setLinkage(llvm::Function::DLLImportLinkage);
-  else if (D->getAttr<DLLExportAttr>())
+  else if (D->hasAttr<DLLExportAttr>())
     GV->setLinkage(llvm::Function::DLLExportLinkage);
-  else if (D->getAttr<WeakAttr>() || D->getAttr<WeakImportAttr>())
+  else if (D->hasAttr<WeakAttr>() || D->hasAttr<WeakImportAttr>())
     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<SectionAttr>())
     GV->setSection(SA->getName());
 
-  if (D->getAttr<UsedAttr>())
+  if (D->hasAttr<UsedAttr>())
     AddUsedGlobal(GV);
 
   // Emit global variable debug information.
index 049353faae99bf428d93f0078996d0b392e81c91..3d78b2381072fee52f7cb648db85cf6c34c28dfe 100644 (file)
@@ -74,7 +74,7 @@ static bool isInCLinkageSpecification(const Decl *D) {
 bool CXXNameMangler::mangleFunctionDecl(const FunctionDecl *FD) {
   // Clang's "overloadable" attribute extension to C/C++ implies
   // name mangling (always).
-  if (FD->getAttr<OverloadableAttr>()) {
+  if (FD->hasAttr<OverloadableAttr>()) {
     ; // fall into mangling code unconditionally.
   } else if (// C functions are not mangled
              !Context.getLangOptions().CPlusPlus ||