[PATCH] D28691: Add OpenCL 2.0 atomic builtin functions as Clang builtin

Alexey Bader via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 4 08:11:31 PDT 2017


bader accepted this revision.
bader added inline comments.


================
Comment at: lib/AST/Expr.cpp:4000-4004
+  if (auto AT = T->getAs<AtomicType>()) {
+    return AT->getValueType();
+  } else {
+    return T;
+  }
----------------
No need in else branch after return:
```
if (...) {
  return AT->getValueType();
}

return T;
```

http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return


================
Comment at: test/SemaOpenCL/atomic-ops.cl:1
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -finclude-default-header -verify -fsyntax-only -triple=spir64
+// RUN: %clang_cc1 %s -cl-std=CL2.0 -finclude-default-header -verify -fsyntax-only -triple=amdgcn-amdhsa-amd-opencl
----------------
It's a pity, we have to parse the whole opencl-c.h file to get two enums and one typedef...


https://reviews.llvm.org/D28691





More information about the cfe-commits mailing list