From: Richard Smith Date: Tue, 2 Jun 2020 04:10:27 +0000 (-0700) Subject: Fix violations of [basic.class.scope]p2. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ccb6c36a9159809f4b98176325ae202753fe136;p=platform%2Fupstream%2Fllvm.git Fix violations of [basic.class.scope]p2. These cases all follow the same pattern: struct A { friend class X; //... class X {}; }; But 'friend class X;' injects 'X' into the surrounding namespace scope, rather than introducing a class member. So the second 'class X {}' is a completely different type, which changes the meaning of the earlier name 'X' from '::X' to 'A::X'. Additionally, the friend declaration is pointless -- members of a class don't need to be befriended to be able to access private members. --- diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index bedc845..fc74226 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -223,8 +223,6 @@ private: /// class LocalScope { public: - friend class const_iterator; - using AutomaticVarsTy = BumpVector; /// const_iterator - Iterates local scope backwards and jumps to previous diff --git a/clang/utils/TableGen/NeonEmitter.cpp b/clang/utils/TableGen/NeonEmitter.cpp index 9166e7a..625954f 100644 --- a/clang/utils/TableGen/NeonEmitter.cpp +++ b/clang/utils/TableGen/NeonEmitter.cpp @@ -303,8 +303,6 @@ public: /// The main grunt class. This represents an instantiation of an intrinsic with /// a particular typespec and prototype. class Intrinsic { - friend class DagEmitter; - /// The Record this intrinsic was created from. Record *R; /// The unmangled name. diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index df08999..bb0f550 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -640,7 +640,6 @@ public: void addDwarfTypeUnitType(DwarfCompileUnit &CU, StringRef Identifier, DIE &Die, const DICompositeType *CTy); - friend class NonTypeUnitContext; class NonTypeUnitContext { DwarfDebug *DD; decltype(DwarfDebug::TypeUnitsUnderConstruction) TypeUnitsUnderConstruction; diff --git a/llvm/lib/CodeGen/InterferenceCache.h b/llvm/lib/CodeGen/InterferenceCache.h index 50c6ac6..9019e9f 100644 --- a/llvm/lib/CodeGen/InterferenceCache.h +++ b/llvm/lib/CodeGen/InterferenceCache.h @@ -157,8 +157,6 @@ class LLVM_LIBRARY_VISIBILITY InterferenceCache { Entry *get(unsigned PhysReg); public: - friend class Cursor; - InterferenceCache() = default; ~InterferenceCache() {