r246595 - Use hasAttr, not getAttr if we're just checking for presence.

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 1 15:03:56 PDT 2015


Author: echristo
Date: Tue Sep  1 17:03:56 2015
New Revision: 246595

URL: http://llvm.org/viewvc/llvm-project?rev=246595&view=rev
Log:
Use hasAttr, not getAttr if we're just checking for presence.

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=246595&r1=246594&r2=246595&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Sep  1 17:03:56 2015
@@ -1497,7 +1497,7 @@ void CodeGenModule::ConstructAttributeLi
     // parse that and add it to the feature set.
     StringRef TargetCPU = getTarget().getTargetOpts().CPU;
     const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(TargetDecl);
-    if (FD && FD->getAttr<TargetAttr>()) {
+    if (FD && FD->hasAttr<TargetAttr>()) {
       llvm::StringMap<bool> FeatureMap;
       const auto *TD = FD->getAttr<TargetAttr>();
 




More information about the cfe-commits mailing list