[PATCH] D55492: Implement Attr dumping in terms of visitors

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 9 11:57:19 PST 2018


aaron.ballman added inline comments.


================
Comment at: include/clang/AST/AttrVisitor.h:23-24
+
+template <typename T> struct make_ptr { using type = T *; };
+template <typename T> struct make_const_ptr { using type = const T *; };
+
----------------
aaron.ballman wrote:
> steveire wrote:
> > aaron.ballman wrote:
> > > Oh, this is cute. We have StmtVisitor which does not use a namespace, but defines these functions. Then we duplicate these function definitions in each of the comment, decl, and attribute visitors under distinct namespaces so we don't get ODR violations.
> > > 
> > > I think we should add `llvm::make_const_ptr` to STLExtras.h so we can use the same definition from everywhere. We can use `std::add_pointer` in place of `make_ptr`, because that is a one-to-one mapping, so we can drop `make_ptr` entirely. However, I don't think we can use `std::add_pointer<std::add_const>` similarly because there's no way to bind that to the template template parameter directly. I'm happy to make these changes if you'd like.
> > Yes, I've thought about this duplication too. If you deduplicate, I'll rebase this change.  
> Sounds good, I'll try to get that in shortly.
r348729 (LLVM) and r348730 (Clang).


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55492/new/

https://reviews.llvm.org/D55492





More information about the cfe-commits mailing list