[llvm] a5b6aef - [Attributor][NFCI] Remove anonymous namespaces

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 09:22:10 PST 2022


yeah, that'd be great!

On Mon, Feb 7, 2022 at 6:42 AM Johannes Doerfert <johannes at jdoerfert.de>
wrote:

> The problem is that we had to "open" the namespace more and more
> anyway to allow us to implement methods declared in the header in
> a reasonable location. That said. I can re-introduce them with smaller
> scope, as the coding standard suggests, one class at a time.
>
> Would that work for you?
>
> ~ Johannes
>
>
> On 2/6/22 21:43, David Blaikie wrote:
> > This seems unfortunate and not consistent with LLVM or general C++ style
> -
> > if these types are only in the .cpp file they really should be in
> anonymous
> > namespaces. (
> > https://llvm.org/docs/CodingStandards.html#anonymous-namespaces ) -
> could
> > you describe in more detail what motivated this change?
> >
> > On Mon, Jan 31, 2022 at 11:11 PM Johannes Doerfert via llvm-commits <
> > llvm-commits at lists.llvm.org> wrote:
> >
> >> Author: Johannes Doerfert
> >> Date: 2022-02-01T01:07:50-06:00
> >> New Revision: a5b6aef24e7a3f2a74cc4e716314d3f8d424d1c1
> >>
> >> URL:
> >>
> https://github.com/llvm/llvm-project/commit/a5b6aef24e7a3f2a74cc4e716314d3f8d424d1c1
> >> DIFF:
> >>
> https://github.com/llvm/llvm-project/commit/a5b6aef24e7a3f2a74cc4e716314d3f8d424d1c1.diff
> >>
> >> LOG: [Attributor][NFCI] Remove anonymous namespaces
> >>
> >> The namespaces made it more complicate to implement static helpers,
> >> among other things. We should not need them at all.
> >>
> >> Added:
> >>
> >>
> >> Modified:
> >>      llvm/lib/Transforms/IPO/AttributorAttributes.cpp
> >>
> >> Removed:
> >>
> >>
> >>
> >>
> >>
> ################################################################################
> >> diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
> >> b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
> >> index 76420783b2d1..ea3f449b649a 100644
> >> --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
> >> +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
> >> @@ -1026,7 +1026,6 @@ struct AA::PointerInfo::State : public
> AbstractState
> >> {
> >>     BooleanState BS;
> >>   };
> >>
> >> -namespace {
> >>   struct AAPointerInfoImpl
> >>       : public StateWrapper<AA::PointerInfo::State, AAPointerInfo> {
> >>     using BaseTy = StateWrapper<AA::PointerInfo::State, AAPointerInfo>;
> >> @@ -5085,7 +5084,6 @@ struct AANoCaptureCallSiteReturned final :
> >> AANoCaptureImpl {
> >>       STATS_DECLTRACK_CSRET_ATTR(nocapture)
> >>     }
> >>   };
> >> -} // namespace
> >>
> >>   /// ------------------ Value Simplify Attribute
> >> ----------------------------
> >>
> >> @@ -5106,7 +5104,6 @@ bool
> >> ValueSimplifyStateType::unionAssumed(Optional<Value *> Other) {
> >>     return true;
> >>   }
> >>
> >> -namespace {
> >>   struct AAValueSimplifyImpl : AAValueSimplify {
> >>     AAValueSimplifyImpl(const IRPosition &IRP, Attributor &A)
> >>         : AAValueSimplify(IRP, A) {}
> >> @@ -7378,7 +7375,6 @@ void
> >> AAMemoryBehaviorFloating::analyzeUseIn(Attributor &A, const Use &U,
> >>     if (UserI->mayWriteToMemory())
> >>       removeAssumedBits(NO_WRITES);
> >>   }
> >> -} // namespace
> >>
> >>   /// -------------------- Memory Locations Attributes
> >> ---------------------------
> >>   /// Includes read-none, argmemonly, inaccessiblememonly,
> >> @@ -7412,7 +7408,6 @@ std::string
> >> AAMemoryLocation::getMemoryLocationsAsStr(
> >>     return S;
> >>   }
> >>
> >> -namespace {
> >>   struct AAMemoryLocationImpl : public AAMemoryLocation {
> >>
> >>     AAMemoryLocationImpl(const IRPosition &IRP, Attributor &A)
> >> @@ -9790,8 +9785,6 @@ struct AAAssumptionInfoCallSite final :
> >> AAAssumptionInfoImpl {
> >>     }
> >>   };
> >>
> >> -} // namespace
> >> -
> >>   AACallGraphNode *AACallEdgeIterator::operator*() const {
> >>     return static_cast<AACallGraphNode *>(const_cast<AACallEdges *>(
> >>         &A.getOrCreateAAFor<AACallEdges>(IRPosition::function(**I))));
> >>
> >>
> >>
> >> _______________________________________________
> >> llvm-commits mailing list
> >> llvm-commits at lists.llvm.org
> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220207/4e280f08/attachment.html>


More information about the llvm-commits mailing list