[PATCH] D30643: [OpenCL] Extended diagnostics for atomic initialization
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 9 08:36:54 PST 2017
Anastasia added inline comments.
================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:8263
+def err_atomic_init_addressspace : Error<
+ "initialization of atomic variables is restricted to variables in global address space">;
def err_atomic_init_constant : Error<
----------------
Could we combine this error diag with the one below? I guess they are semantically very similar apart from one is about initialization and another is about assignment?
================
Comment at: lib/Sema/SemaInit.cpp:6498
+
+ if (S.getLangOpts().OpenCL && S.getLangOpts().OpenCLVersion >= 200 &&
+ ETy->isAtomicType() && !HasGlobalAS &&
----------------
I would remove S.getLangOpts().OpenCL check, it's redundant in my opinion!
================
Comment at: lib/Sema/SemaInit.cpp:6501
+ Entity.getKind() == InitializedEntity::EK_Variable && Args.size() > 0) {
+ const Expr *Init = Args[0];
+ S.Diag(Init->getLocStart(), diag::err_atomic_init_addressspace) <<
----------------
Even thought it's done above too, I don't really see the point of having this variable.
https://reviews.llvm.org/D30643
More information about the cfe-commits
mailing list