[PATCH] D32696: More detailed docs for UsingShadowDecl

Kim Gräsman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 1 01:27:55 PDT 2017


kimgr created this revision.

I couldn't make sense of the docs before, so I sent a question to cfe-dev. Richard was gracious enough to fill in the blanks:
http://lists.llvm.org/pipermail/cfe-dev/2017-April/053687.html

I've tried to transfer some of his response to the Doxygen for UsingShadowDecl. Here's to hoping I captured everything correctly.


Repository:
  rL LLVM

https://reviews.llvm.org/D32696

Files:
  include/clang/AST/DeclCXX.h


Index: include/clang/AST/DeclCXX.h
===================================================================
--- include/clang/AST/DeclCXX.h
+++ include/clang/AST/DeclCXX.h
@@ -2856,18 +2856,34 @@
 };
 
 /// \brief Represents a shadow declaration introduced into a scope by a
-/// (resolved) using declaration.
+/// (resolved) using declaration, whose target is made visible for name lookup.
 ///
 /// For example,
 /// \code
 /// namespace A {
-///   void foo();
+///   void foo(int);
+///   void foo(double);
 /// }
 /// namespace B {
 ///   using A::foo; // <- a UsingDecl
-///                 // Also creates a UsingShadowDecl for A::foo() in B
+///                 // Also creates UsingShadowDecls for both A::foo(int) and
+///                 // A::foo(double) in B
 /// }
 /// \endcode
+///
+/// Derived class member declarations can hide any shadow declarations brought
+/// in by a class-scope UsingDecl;
+/// \code
+/// class Base {
+/// public:
+///   void foo();
+/// };
+/// class Derived : public Base {
+/// public:
+///   using Base::foo; // <- a UsingDecl
+///   void foo();      // Hides Base::foo and suppresses its UsingShadowDecl.
+/// };
+/// \endcode
 class UsingShadowDecl : public NamedDecl, public Redeclarable<UsingShadowDecl> {
   void anchor() override;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32696.97270.patch
Type: text/x-patch
Size: 1279 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170501/cf1eb698/attachment.bin>


More information about the cfe-commits mailing list