aaron.ballman added inline comments.

================
Comment at: lib/Sema/SemaDeclAttr.cpp:5823
@@ -5788,8 +5822,3 @@
 
-  // Walk the declarator structure, applying decl attributes that were in a 
type
-  // position to the decl itself.  This handles cases like:
-  //   int *__attr__(x)** D;
-  // when X is a decl attribute.
-  for (unsigned i = 0, e = PD.getNumTypeObjects(); i != e; ++i)
-    if (const AttributeList *Attrs = PD.getTypeObject(i).getAttrs())
-      ProcessDeclAttributeList(S, D, Attrs, /*IncludeCXX11Attributes=*/false);
+  // Skip pipe type, otherwise it will be processed twice with its element type
+  const ParmVarDecl *PDecl = llvm::dyn_cast<ParmVarDecl>(D);
----------------
Anastasia wrote:
> aaron.ballman wrote:
> > Anastasia wrote:
> > > . missing
> > Missing punctuation.
> > 
> > Of bigger concern -- this code is highly suspect -- this is called for 
> > every declaration in the source code. Why is this complexity needed here 
> > instead of elsewhere?
> I assume we could do this check in ProcessDeclAttributeList or just after:
>   if (const AttributeList *Attrs = PD.getTypeObject(i).getAttrs())
Is this an attribute that's written on the type declarator, and needs to be 
"slid" onto the declaration? If so, we do that in ProcessDeclAttributes, around 
line 5794. But we should not be adding ad hoc special cases to filter these 
out, they should probably be handled in distributeTypeAttrsFromDeclarator() in 
SemaType.cpp.


http://reviews.llvm.org/D16040



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to