Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptor.cpp
35293 views
//===- DbiModuleDescriptor.cpp - PDB module information -------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"9#include "llvm/DebugInfo/PDB/Native/RawTypes.h"10#include "llvm/Support/BinaryStreamReader.h"11#include "llvm/Support/Error.h"12#include "llvm/Support/MathExtras.h"13#include <cstdint>1415using namespace llvm;16using namespace llvm::pdb;17using namespace llvm::support;1819Error DbiModuleDescriptor::initialize(BinaryStreamRef Stream,20DbiModuleDescriptor &Info) {21BinaryStreamReader Reader(Stream);22if (auto EC = Reader.readObject(Info.Layout))23return EC;2425if (auto EC = Reader.readCString(Info.ModuleName))26return EC;2728if (auto EC = Reader.readCString(Info.ObjFileName))29return EC;30return Error::success();31}3233bool DbiModuleDescriptor::hasECInfo() const {34return (Layout->Flags & ModInfoFlags::HasECFlagMask) != 0;35}3637uint16_t DbiModuleDescriptor::getTypeServerIndex() const {38return (Layout->Flags & ModInfoFlags::TypeServerIndexMask) >>39ModInfoFlags::TypeServerIndexShift;40}4142const SectionContrib &DbiModuleDescriptor::getSectionContrib() const {43return Layout->SC;44}4546uint16_t DbiModuleDescriptor::getModuleStreamIndex() const {47return Layout->ModDiStream;48}4950uint32_t DbiModuleDescriptor::getSymbolDebugInfoByteSize() const {51return Layout->SymBytes;52}5354uint32_t DbiModuleDescriptor::getC11LineInfoByteSize() const {55return Layout->C11Bytes;56}5758uint32_t DbiModuleDescriptor::getC13LineInfoByteSize() const {59return Layout->C13Bytes;60}6162uint32_t DbiModuleDescriptor::getNumberOfFiles() const {63return Layout->NumFiles;64}6566uint32_t DbiModuleDescriptor::getSourceFileNameIndex() const {67return Layout->SrcFileNameNI;68}6970uint32_t DbiModuleDescriptor::getPdbFilePathNameIndex() const {71return Layout->PdbFilePathNI;72}7374StringRef DbiModuleDescriptor::getModuleName() const { return ModuleName; }7576StringRef DbiModuleDescriptor::getObjFileName() const { return ObjFileName; }7778uint32_t DbiModuleDescriptor::getRecordLength() const {79uint32_t M = ModuleName.str().size() + 1;80uint32_t O = ObjFileName.str().size() + 1;81uint32_t Size = sizeof(ModuleInfoHeader) + M + O;82Size = alignTo(Size, 4);83return Size;84}858687