[PATCH] D29819: Introduce an 'external_source_symbol' attribute that describes the origin and the nature of a declaration

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 1 10:17:59 PST 2017

arphaman added inline comments.

Comment at: lib/Parse/ParseDeclCXX.cpp:3830-3837
+  unsigned NumArgs;
+  // Some Clang-scoped attributes have some special parsing behavior.
+  if (ScopeName && ScopeName->getName() == "clang")
+    NumArgs =
+        ParseClangAttributeArgs(AttrName, AttrNameLoc, Attrs, EndLoc, ScopeName,
+                                ScopeLoc, AttributeList::AS_CXX11);
+  else
aaron.ballman wrote:
> This code is equivalent to the old code, which is good. However, it points out what I think may be a latent bug -- for attributes in the clang namespace that are also standard attributes, I'm not certain we should be generating parse errors for the clang-namespaced spelling. This only impacts [[fallthrough]] vs [[clang::fallthrough]], according to the implementation of `IsBuiltInOrStandardCXX11Attribute()`.
> All of that is to say: I'm not certain we need to hoist `NumArgs` to get to the call to `IsBuiltInOrStandardCXX11Attribute()` below, because attributes in the clang namespace are not built-in or standard attributes.
> This requires a bit further exploration, but I won't have time to do that for a few weeks. I don't want to hold your patch up for that, so I think this is fine for now -- I can modify the code later when I have the chance to finish my exploration.

I agree with the comment about `NumArgs`, I wasn't sure if we need it for `clang::` attributes as well.



More information about the cfe-commits mailing list