diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2013-12-19 02:39:40 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2013-12-19 02:39:40 +0000 |
commit | 9ead1243a5d9eb671bbe8925dda083d865f6c449 (patch) | |
tree | e1d32c7f41b21f915a5010a60536742c32026854 /clang/lib/Sema/SemaDecl.cpp | |
parent | 386328f96f63424d2b13c46db5dce7d54cb4c611 (diff) | |
download | bcm5719-llvm-9ead1243a5d9eb671bbe8925dda083d865f6c449.tar.gz bcm5719-llvm-9ead1243a5d9eb671bbe8925dda083d865f6c449.zip |
Replacing calls to getAttr with calls to hasAttr for clarity. No functional change intended -- this only replaces Boolean uses of getAttr.
llvm-svn: 197648
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 7d9c25ed2dd..8cc489b3f6e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -3035,9 +3035,9 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) { mergeDeclAttributes(New, Old); // Warn if an already-declared variable is made a weak_import in a subsequent // declaration - if (New->getAttr<WeakImportAttr>() && + if (New->hasAttr<WeakImportAttr>() && Old->getStorageClass() == SC_None && - !Old->getAttr<WeakImportAttr>()) { + !Old->hasAttr<WeakImportAttr>()) { Diag(New->getLocation(), diag::warn_weak_import) << New->getDeclName(); Diag(Old->getLocation(), diag::note_previous_definition); // Remove weak_import attribute on new declaration. @@ -9673,7 +9673,7 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) { // Checking attributes of current function definition // dllimport attribute. DLLImportAttr *DA = FD->getAttr<DLLImportAttr>(); - if (DA && (!FD->getAttr<DLLExportAttr>())) { + if (DA && (!FD->hasAttr<DLLExportAttr>())) { // dllimport attribute cannot be directly applied to definition. // Microsoft accepts dllimport for functions defined within class scope. if (!DA->isInherited() && @@ -10065,7 +10065,7 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { unsigned FormatIdx; bool HasVAListArg; if (Context.BuiltinInfo.isPrintfLike(BuiltinID, FormatIdx, HasVAListArg)) { - if (!FD->getAttr<FormatAttr>()) { + if (!FD->hasAttr<FormatAttr>()) { const char *fmt = "printf"; unsigned int NumParams = FD->getNumParams(); if (FormatIdx < NumParams && // NumParams may be 0 (e.g. vfprintf) @@ -10079,7 +10079,7 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { } if (Context.BuiltinInfo.isScanfLike(BuiltinID, FormatIdx, HasVAListArg)) { - if (!FD->getAttr<FormatAttr>()) + if (!FD->hasAttr<FormatAttr>()) FD->addAttr(::new (Context) FormatAttr(FD->getLocation(), Context, &Context.Idents.get("scanf"), FormatIdx+1, @@ -10091,16 +10091,16 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { // IRgen to use LLVM intrinsics for such functions. if (!getLangOpts().MathErrno && Context.BuiltinInfo.isConstWithoutErrno(BuiltinID)) { - if (!FD->getAttr<ConstAttr>()) + if (!FD->hasAttr<ConstAttr>()) FD->addAttr(::new (Context) ConstAttr(FD->getLocation(), Context)); } if (Context.BuiltinInfo.isReturnsTwice(BuiltinID) && - !FD->getAttr<ReturnsTwiceAttr>()) + !FD->hasAttr<ReturnsTwiceAttr>()) FD->addAttr(::new (Context) ReturnsTwiceAttr(FD->getLocation(), Context)); - if (Context.BuiltinInfo.isNoThrow(BuiltinID) && !FD->getAttr<NoThrowAttr>()) + if (Context.BuiltinInfo.isNoThrow(BuiltinID) && !FD->hasAttr<NoThrowAttr>()) FD->addAttr(::new (Context) NoThrowAttr(FD->getLocation(), Context)); - if (Context.BuiltinInfo.isConst(BuiltinID) && !FD->getAttr<ConstAttr>()) + if (Context.BuiltinInfo.isConst(BuiltinID) && !FD->hasAttr<ConstAttr>()) FD->addAttr(::new (Context) ConstAttr(FD->getLocation(), Context)); } @@ -10120,7 +10120,7 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { if (Name->isStr("asprintf") || Name->isStr("vasprintf")) { // FIXME: asprintf and vasprintf aren't C99 functions. Should they be // target-specific builtins, perhaps? - if (!FD->getAttr<FormatAttr>()) + if (!FD->hasAttr<FormatAttr>()) FD->addAttr(::new (Context) FormatAttr(FD->getLocation(), Context, &Context.Idents.get("printf"), 2, Name->isStr("vasprintf") ? 0 : 3)); @@ -10129,7 +10129,7 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { if (Name->isStr("__CFStringMakeConstantString")) { // We already have a __builtin___CFStringMakeConstantString, // but builds that use -fno-constant-cfstrings don't go through that. - if (!FD->getAttr<FormatArgAttr>()) + if (!FD->hasAttr<FormatArgAttr>()) FD->addAttr(::new (Context) FormatArgAttr(FD->getLocation(), Context, 1)); } } @@ -12784,7 +12784,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, // The C99 rule is modified by a gcc extension QualType BestPromotionType; - bool Packed = Enum->getAttr<PackedAttr>() ? true : false; + bool Packed = Enum->hasAttr<PackedAttr>(); // -fshort-enums is the equivalent to specifying the packed attribute on all // enum definitions. if (LangOpts.ShortEnums) |