Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:42

0001 //===- MergedFunctionsInfo.h ------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_DEBUGINFO_GSYM_MERGEDFUNCTIONSINFO_H
0010 #define LLVM_DEBUGINFO_GSYM_MERGEDFUNCTIONSINFO_H
0011 
0012 #include "llvm/DebugInfo/GSYM/ExtractRanges.h"
0013 #include "llvm/Support/Error.h"
0014 #include <stdint.h>
0015 #include <vector>
0016 
0017 namespace llvm {
0018 class raw_ostream;
0019 
0020 namespace gsym {
0021 
0022 class GsymReader;
0023 struct FunctionInfo;
0024 struct MergedFunctionsInfo {
0025   std::vector<FunctionInfo> MergedFunctions;
0026 
0027   void clear();
0028 
0029   /// Query if a MergedFunctionsInfo object is valid.
0030   ///
0031   /// \returns A boolean indicating if this FunctionInfo is valid.
0032   bool isValid() { return !MergedFunctions.empty(); }
0033 
0034   /// Get a vector of DataExtractor objects for the functions in this
0035   /// MergedFunctionsInfo object.
0036   ///
0037   /// \param Data The binary stream to read the data from. This object must have
0038   /// the data for the MergedFunctionsInfo object starting at offset zero. The
0039   /// data can contain more data than needed.
0040   ///
0041   /// \returns An llvm::Expected containing a vector of DataExtractor objects on
0042   /// success, or an error object if parsing fails.
0043   static llvm::Expected<std::vector<DataExtractor>>
0044   getFuncsDataExtractors(DataExtractor &Data);
0045 
0046   /// Decode an MergedFunctionsInfo object from a binary data stream.
0047   ///
0048   /// \param Data The binary stream to read the data from. This object must have
0049   /// the data for the MergedFunctionsInfo object starting at offset zero. The
0050   /// data can contain more data than needed.
0051   ///
0052   /// \param BaseAddr The base address to use when encoding all address ranges.
0053   ///
0054   /// \returns An MergedFunctionsInfo or an error describing the issue that was
0055   /// encountered during decoding.
0056   static llvm::Expected<MergedFunctionsInfo> decode(DataExtractor &Data,
0057                                                     uint64_t BaseAddr);
0058 
0059   /// Encode this MergedFunctionsInfo object into FileWriter stream.
0060   ///
0061   /// \param O The binary stream to write the data to at the current file
0062   /// position.
0063   /// \returns An error object that indicates success or failure for the
0064   /// encoding process.
0065   llvm::Error encode(FileWriter &O) const;
0066 };
0067 
0068 bool operator==(const MergedFunctionsInfo &LHS, const MergedFunctionsInfo &RHS);
0069 
0070 } // namespace gsym
0071 } // namespace llvm
0072 
0073 #endif // LLVM_DEBUGINFO_GSYM_MERGEDFUNCTIONSINFO_H