================ @@ -0,0 +1,97 @@ +//===- llvm/IR/DebugInfoODRUniquer.h - Debug info metadata ------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// Defines a class used to merge debug info for ODR types. +// +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/DenseMap.h" +#include "llvm/IR/DebugInfoMetadata.h" +#include "llvm/IR/Metadata.h" + +namespace llvm { +class MDString; +class Metadata; +class DICompositeType; + +/// Dense set/map find_as key for use alongside DISubprogramODRInfo to +/// merge function declarations of ODR types. +struct DISubprogramODRKey { + StringRef ScopeIdentifier; + StringRef LinkageName; + + DISubprogramODRKey(StringRef ScopeIdentifier, StringRef LinkageName) + : ScopeIdentifier(ScopeIdentifier), LinkageName(LinkageName) {} + + DISubprogramODRKey(const DISubprogram *SP) { + auto *CT = dyn_cast_or_null<DICompositeType>(SP->getRawScope()); + ScopeIdentifier = CT ? CT->getIdentifier() : StringRef(); + LinkageName = SP->getLinkageName(); + } + + static bool isEqual(const DISubprogramODRKey &LHS, const DISubprogram *RHS) { + if (LHS.LinkageName.empty() || LHS.ScopeIdentifier.empty()) + return false; ---------------- OCHyams wrote:
Hrm. Good point, I think it is fine, but no reason to keep it this way. Fixed https://github.com/llvm/llvm-project/pull/217042 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
