Use else if when checking multiple attributes.
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 5 Dec 2014 18:03:55 +0000 (18:03 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 5 Dec 2014 18:03:55 +0000 (18:03 +0000)
Only one of these can really match.

llvm-svn: 223489

clang/lib/Sema/SemaDeclAttr.cpp

index e5eb61c..af7cf57 100644 (file)
@@ -4764,12 +4764,10 @@ void Sema::ProcessDeclAttributeList(Scope *S, Decl *D,
     if (Attr *A = D->getAttr<ReqdWorkGroupSizeAttr>()) {
       Diag(D->getLocation(), diag::err_opencl_kernel_attr) << A;
       D->setInvalidDecl();
-    }
-    if (Attr *A = D->getAttr<WorkGroupSizeHintAttr>()) {
+    } else if (Attr *A = D->getAttr<WorkGroupSizeHintAttr>()) {
       Diag(D->getLocation(), diag::err_opencl_kernel_attr) << A;
       D->setInvalidDecl();
-    }
-    if (Attr *A = D->getAttr<VecTypeHintAttr>()) {
+    } else if (Attr *A = D->getAttr<VecTypeHintAttr>()) {
       Diag(D->getLocation(), diag::err_opencl_kernel_attr) << A;
       D->setInvalidDecl();
     }