[llvm-bugs] [Bug 50595] New: ProfileFoldOpInit vs FoldOpInit::get/FoldOpInit::Profile - argument order mismatch

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 6 06:47:55 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50595

            Bug ID: 50595
           Summary: ProfileFoldOpInit vs
                    FoldOpInit::get/FoldOpInit::Profile - argument order
                    mismatch
           Product: tools
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: TableGen
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: llvm-bugs at lists.llvm.org, nhaehnle at gmail.com,
                    paul at windfall-software.com

static void ProfileFoldOpInit(FoldingSetNodeID &ID, Init *A, Init *B,
                              Init *Start, Init *List, Init *Expr,
                              RecTy *Type) {
  ID.AddPointer(Start);
  ID.AddPointer(List);
  ID.AddPointer(A);
  ID.AddPointer(B);
  ID.AddPointer(Expr);
  ID.AddPointer(Type);
}

FoldOpInit *FoldOpInit::get(Init *Start, Init *List, Init *A, Init *B,
                            Init *Expr, RecTy *Type) {
  static FoldingSet<FoldOpInit> ThePool;

  FoldingSetNodeID ID;
  ProfileFoldOpInit(ID, Start, List, A, B, Expr, Type);

  void *IP = nullptr;
  if (FoldOpInit *I = ThePool.FindNodeOrInsertPos(ID, IP))
    return I;

  FoldOpInit *I = new (Allocator) FoldOpInit(Start, List, A, B, Expr, Type);
  ThePool.InsertNode(I, IP);
  return I;
}

void FoldOpInit::Profile(FoldingSetNodeID &ID) const {
  ProfileFoldOpInit(ID, Start, List, A, B, Expr, getType());
}


Reported by coverity - which doesn't like the fact that we call
ProfileFoldOpInit with args that have the same names as OTHER args....

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210606/1dc570d7/attachment.html>


More information about the llvm-bugs mailing list