================
@@ -764,6 +764,73 @@ void Parser::ParseGNUAttributeArgs(
                            ScopeLoc, Form);
 }
 
+void Parser::ParseAtomicAttribute(
----------------
yxsamliu wrote:

 I've simplified ParseAtomicAttribute by introducing a lambda that handles 
parsing a single option (including the optional '!' prefix) so we don't repeat 
the same code for every argument. This makes the function cleaner and easier to 
understand while still doing all the necessary work to support multiple atomic 
options.
 
I've already tested that GCC (https://godbolt.org/z/7qE81dnsq) and MSVC 
(https://godbolt.org/z/fT5bvbrf5) correctly parse and ignore this attribute if 
they don’t support it, so the syntax isn’t a problem for other compilers.
 
The current form gives us the flexibility to have fine-grained control over 
atomic operations, which alternative forms (like trying to fit it into existing 
attribute formats) wouldn’t allow as cleanly. Those could lead to ambiguity or 
limit our options later. Overall, while the logic here is a bit special, it’s 
necessary for handling the variable arguments and negations properly, and the 
refactoring should help keep it maintainable.

https://github.com/llvm/llvm-project/pull/114841
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to