[PATCH] D50390: [SEMA]Uniform printing of Attributes

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 7 08:52:02 PDT 2018


erichkeane added inline comments.


================
Comment at: include/clang/Sema/ParsedAttr.h:956
+
+inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
+                                           const ParsedAttr *At) {
----------------
Note that the pointer-overload is required since a couple of templates are used that switch between an Attr and a ParsedAttr, so we need to have the same form as the Attr.

Also note that we cannot do what Attr does (which is store an Attr Pointer in the diagnostic) without making Basic dependent on Sema, which seemed worse than the allocation in diagnostic situations.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:3941
 
-CommonAttr *Sema::mergeCommonAttr(Decl *D, SourceRange Range,
-                                  IdentifierInfo *Ident,
-                                  unsigned AttrSpellingListIndex) {
-  if (checkAttrMutualExclusion<InternalLinkageAttr>(*this, D, Range, Ident))
+CommonAttr *Sema::mergeCommonAttr(Decl *D, const ParsedAttr &AL) {
+  if (checkAttrMutualExclusion<InternalLinkageAttr>(*this, D, AL))
----------------
It was tempting to template-these, but that would require moving them (or forcing instantiation) in the header file.  Additionally, since there is a difference between the spelling of how to get a location between the two types, this would become awkward.


https://reviews.llvm.org/D50390





More information about the cfe-commits mailing list