<div dir="ltr"><div dir="ltr">On Mon, 1 Jun 2020 at 23:23, Roman Lebedev <<a href="mailto:lebedev.ri@gmail.com">lebedev.ri@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Jun 2, 2020 at 8:03 AM Richard Smith via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
><br>
> Author: Richard Smith<br>
> Date: 2020-06-01T22:03:05-07:00<br>
> New Revision: 4ccb6c36a9159809f4b98176325ae202753fe136<br>
><br>
> URL: <a href="https://github.com/llvm/llvm-project/commit/4ccb6c36a9159809f4b98176325ae202753fe136" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/4ccb6c36a9159809f4b98176325ae202753fe136</a><br>
> DIFF: <a href="https://github.com/llvm/llvm-project/commit/4ccb6c36a9159809f4b98176325ae202753fe136.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/4ccb6c36a9159809f4b98176325ae202753fe136.diff</a><br>
><br>
> LOG: Fix violations of [basic.class.scope]p2.<br>
><br>
> These cases all follow the same pattern:<br>
><br>
> struct A {<br>
>   friend class X;<br>
>   //...<br>
>   class X {};<br>
> };<br>
><br>
> But 'friend class X;' injects 'X' into the surrounding namespace scope,<br>
> rather than introducing a class member. So the second 'class X {}' is a<br>
> completely different type, which changes the meaning of the earlier name<br>
> 'X' from '::X' to 'A::X'.<br>
><br>
> Additionally, the friend declaration is pointless -- members of a class<br>
> don't need to be befriended to be able to access private members.<br>
Should there be a clang diagnostic for such a situation?<br></blockquote><div><br></div><div><a href="https://reviews.llvm.org/D80977" rel="noreferrer" target="_blank">https://reviews.llvm.org/D80977</a> :)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Roman<br>
<br>
> Added:<br>
><br>
><br>
> Modified:<br>
>     clang/lib/Analysis/CFG.cpp<br>
>     clang/utils/TableGen/NeonEmitter.cpp<br>
>     llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
>     llvm/lib/CodeGen/InterferenceCache.h<br>
><br>
> Removed:<br>
><br>
><br>
><br>
> ################################################################################<br>
> diff  --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp<br>
> index bedc8455366f..fc74226951a4 100644<br>
> --- a/clang/lib/Analysis/CFG.cpp<br>
> +++ b/clang/lib/Analysis/CFG.cpp<br>
> @@ -223,8 +223,6 @@ class AddStmtChoice {<br>
>  ///<br>
>  class LocalScope {<br>
>  public:<br>
> -  friend class const_iterator;<br>
> -<br>
>    using AutomaticVarsTy = BumpVector<VarDecl *>;<br>
><br>
>    /// const_iterator - Iterates local scope backwards and jumps to previous<br>
><br>
> diff  --git a/clang/utils/TableGen/NeonEmitter.cpp b/clang/utils/TableGen/NeonEmitter.cpp<br>
> index 9166e7a718ec..625954fe8a04 100644<br>
> --- a/clang/utils/TableGen/NeonEmitter.cpp<br>
> +++ b/clang/utils/TableGen/NeonEmitter.cpp<br>
> @@ -303,8 +303,6 @@ class Variable {<br>
>  /// The main grunt class. This represents an instantiation of an intrinsic with<br>
>  /// a particular typespec and prototype.<br>
>  class Intrinsic {<br>
> -  friend class DagEmitter;<br>
> -<br>
>    /// The Record this intrinsic was created from.<br>
>    Record *R;<br>
>    /// The unmangled name.<br>
><br>
> diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
> index df0899930a80..bb0f550b9654 100644<br>
> --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
> +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h<br>
> @@ -640,7 +640,6 @@ class DwarfDebug : public DebugHandlerBase {<br>
>    void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier,<br>
>                              DIE &Die, const DICompositeType *CTy);<br>
><br>
> -  friend class NonTypeUnitContext;<br>
>    class NonTypeUnitContext {<br>
>      DwarfDebug *DD;<br>
>      decltype(DwarfDebug::TypeUnitsUnderConstruction) TypeUnitsUnderConstruction;<br>
><br>
> diff  --git a/llvm/lib/CodeGen/InterferenceCache.h b/llvm/lib/CodeGen/InterferenceCache.h<br>
> index 50c6ac62d194..9019e9f61fa0 100644<br>
> --- a/llvm/lib/CodeGen/InterferenceCache.h<br>
> +++ b/llvm/lib/CodeGen/InterferenceCache.h<br>
> @@ -157,8 +157,6 @@ class LLVM_LIBRARY_VISIBILITY InterferenceCache {<br>
>    Entry *get(unsigned PhysReg);<br>
><br>
>  public:<br>
> -  friend class Cursor;<br>
> -<br>
>    InterferenceCache() = default;<br>
><br>
>    ~InterferenceCache() {<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>