LCOV - code coverage report
Current view: top level - include/llvm/AsmParser - Parser.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 1 1 100.0 %
Date: 2018-10-20 13:21:21 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===-- Parser.h - Parser for LLVM IR text assembly files -------*- C++ -*-===//
       2             : //
       3             : //                     The LLVM Compiler Infrastructure
       4             : //
       5             : // This file is distributed under the University of Illinois Open Source
       6             : // License. See LICENSE.TXT for details.
       7             : //
       8             : //===----------------------------------------------------------------------===//
       9             : //
      10             : //  These classes are implemented by the lib/AsmParser library.
      11             : //
      12             : //===----------------------------------------------------------------------===//
      13             : 
      14             : #ifndef LLVM_ASMPARSER_PARSER_H
      15             : #define LLVM_ASMPARSER_PARSER_H
      16             : 
      17             : #include "llvm/Support/MemoryBuffer.h"
      18             : 
      19             : namespace llvm {
      20             : 
      21             : class Constant;
      22             : class LLVMContext;
      23             : class Module;
      24             : class ModuleSummaryIndex;
      25             : struct SlotMapping;
      26             : class SMDiagnostic;
      27             : class Type;
      28             : 
      29             : /// This function is a main interface to the LLVM Assembly Parser. It parses
      30             : /// an ASCII file that (presumably) contains LLVM Assembly code. It returns a
      31             : /// Module (intermediate representation) with the corresponding features. Note
      32             : /// that this does not verify that the generated Module is valid, so you should
      33             : /// run the verifier after parsing the file to check that it is okay.
      34             : /// Parse LLVM Assembly from a file
      35             : /// \param Filename The name of the file to parse
      36             : /// \param Err Error result info.
      37             : /// \param Context Context in which to allocate globals info.
      38             : /// \param Slots The optional slot mapping that will be initialized during
      39             : ///              parsing.
      40             : /// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
      41             : ///                         This option should only be set to false by llvm-as
      42             : ///                         for use inside the LLVM testuite!
      43             : /// \param DataLayoutString Override datalayout in the llvm assembly.
      44             : std::unique_ptr<Module>
      45             : parseAssemblyFile(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
      46             :                   SlotMapping *Slots = nullptr, bool UpgradeDebugInfo = true,
      47             :                   StringRef DataLayoutString = "");
      48             : 
      49             : /// The function is a secondary interface to the LLVM Assembly Parser. It parses
      50             : /// an ASCII string that (presumably) contains LLVM Assembly code. It returns a
      51             : /// Module (intermediate representation) with the corresponding features. Note
      52             : /// that this does not verify that the generated Module is valid, so you should
      53             : /// run the verifier after parsing the file to check that it is okay.
      54             : /// Parse LLVM Assembly from a string
      55             : /// \param AsmString The string containing assembly
      56             : /// \param Err Error result info.
      57             : /// \param Context Context in which to allocate globals info.
      58             : /// \param Slots The optional slot mapping that will be initialized during
      59             : ///              parsing.
      60             : /// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
      61             : ///                         This option should only be set to false by llvm-as
      62             : ///                         for use inside the LLVM testuite!
      63             : /// \param DataLayoutString Override datalayout in the llvm assembly.
      64             : std::unique_ptr<Module> parseAssemblyString(StringRef AsmString,
      65             :                                             SMDiagnostic &Err,
      66             :                                             LLVMContext &Context,
      67             :                                             SlotMapping *Slots = nullptr,
      68             :                                             bool UpgradeDebugInfo = true,
      69             :                                             StringRef DataLayoutString = "");
      70             : 
      71             : /// Holds the Module and ModuleSummaryIndex returned by the interfaces
      72             : /// that parse both.
      73        1220 : struct ParsedModuleAndIndex {
      74             :   std::unique_ptr<Module> Mod;
      75             :   std::unique_ptr<ModuleSummaryIndex> Index;
      76             : };
      77             : 
      78             : /// This function is a main interface to the LLVM Assembly Parser. It parses
      79             : /// an ASCII file that (presumably) contains LLVM Assembly code, including
      80             : /// a module summary. It returns a Module (intermediate representation) and
      81             : /// a ModuleSummaryIndex with the corresponding features. Note that this does
      82             : /// not verify that the generated Module or Index are valid, so you should
      83             : /// run the verifier after parsing the file to check that they are okay.
      84             : /// Parse LLVM Assembly from a file
      85             : /// \param Filename The name of the file to parse
      86             : /// \param Err Error result info.
      87             : /// \param Context Context in which to allocate globals info.
      88             : /// \param Slots The optional slot mapping that will be initialized during
      89             : ///              parsing.
      90             : /// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
      91             : ///                         This option should only be set to false by llvm-as
      92             : ///                         for use inside the LLVM testuite!
      93             : /// \param DataLayoutString Override datalayout in the llvm assembly.
      94             : ParsedModuleAndIndex
      95             : parseAssemblyFileWithIndex(StringRef Filename, SMDiagnostic &Err,
      96             :                            LLVMContext &Context, SlotMapping *Slots = nullptr,
      97             :                            bool UpgradeDebugInfo = true,
      98             :                            StringRef DataLayoutString = "");
      99             : 
     100             : /// This function is a main interface to the LLVM Assembly Parser. It parses
     101             : /// an ASCII file that (presumably) contains LLVM Assembly code for a module
     102             : /// summary. It returns a a ModuleSummaryIndex with the corresponding features.
     103             : /// Note that this does not verify that the generated Index is valid, so you
     104             : /// should run the verifier after parsing the file to check that it is okay.
     105             : /// Parse LLVM Assembly Index from a file
     106             : /// \param Filename The name of the file to parse
     107             : /// \param Err Error result info.
     108             : std::unique_ptr<ModuleSummaryIndex>
     109             : parseSummaryIndexAssemblyFile(StringRef Filename, SMDiagnostic &Err);
     110             : 
     111             : /// parseAssemblyFile and parseAssemblyString are wrappers around this function.
     112             : /// Parse LLVM Assembly from a MemoryBuffer.
     113             : /// \param F The MemoryBuffer containing assembly
     114             : /// \param Err Error result info.
     115             : /// \param Slots The optional slot mapping that will be initialized during
     116             : ///              parsing.
     117             : /// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
     118             : ///                         This option should only be set to false by llvm-as
     119             : ///                         for use inside the LLVM testuite!
     120             : /// \param DataLayoutString Override datalayout in the llvm assembly.
     121             : std::unique_ptr<Module> parseAssembly(MemoryBufferRef F, SMDiagnostic &Err,
     122             :                                       LLVMContext &Context,
     123             :                                       SlotMapping *Slots = nullptr,
     124             :                                       bool UpgradeDebugInfo = true,
     125             :                                       StringRef DataLayoutString = "");
     126             : 
     127             : /// Parse LLVM Assembly including the summary index from a MemoryBuffer.
     128             : ///
     129             : /// \param F The MemoryBuffer containing assembly with summary
     130             : /// \param Err Error result info.
     131             : /// \param Slots The optional slot mapping that will be initialized during
     132             : ///              parsing.
     133             : /// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
     134             : ///                         This option should only be set to false by llvm-as
     135             : ///                         for use inside the LLVM testuite!
     136             : /// \param DataLayoutString Override datalayout in the llvm assembly.
     137             : ///
     138             : /// parseAssemblyFileWithIndex is a wrapper around this function.
     139             : ParsedModuleAndIndex parseAssemblyWithIndex(MemoryBufferRef F,
     140             :                                             SMDiagnostic &Err,
     141             :                                             LLVMContext &Context,
     142             :                                             SlotMapping *Slots = nullptr,
     143             :                                             bool UpgradeDebugInfo = true,
     144             :                                             StringRef DataLayoutString = "");
     145             : 
     146             : /// Parse LLVM Assembly for summary index from a MemoryBuffer.
     147             : ///
     148             : /// \param F The MemoryBuffer containing assembly with summary
     149             : /// \param Err Error result info.
     150             : ///
     151             : /// parseSummaryIndexAssemblyFile is a wrapper around this function.
     152             : std::unique_ptr<ModuleSummaryIndex>
     153             : parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err);
     154             : 
     155             : /// This function is the low-level interface to the LLVM Assembly Parser.
     156             : /// This is kept as an independent function instead of being inlined into
     157             : /// parseAssembly for the convenience of interactive users that want to add
     158             : /// recently parsed bits to an existing module.
     159             : ///
     160             : /// \param F The MemoryBuffer containing assembly
     161             : /// \param M The module to add data to.
     162             : /// \param Index The index to add data to.
     163             : /// \param Err Error result info.
     164             : /// \param Slots The optional slot mapping that will be initialized during
     165             : ///              parsing.
     166             : /// \return true on error.
     167             : /// \param UpgradeDebugInfo Run UpgradeDebugInfo, which runs the Verifier.
     168             : ///                         This option should only be set to false by llvm-as
     169             : ///                         for use inside the LLVM testuite!
     170             : /// \param DataLayoutString Override datalayout in the llvm assembly.
     171             : bool parseAssemblyInto(MemoryBufferRef F, Module *M, ModuleSummaryIndex *Index,
     172             :                        SMDiagnostic &Err, SlotMapping *Slots = nullptr,
     173             :                        bool UpgradeDebugInfo = true,
     174             :                        StringRef DataLayoutString = "");
     175             : 
     176             : /// Parse a type and a constant value in the given string.
     177             : ///
     178             : /// The constant value can be any LLVM constant, including a constant
     179             : /// expression.
     180             : ///
     181             : /// \param Slots The optional slot mapping that will restore the parsing state
     182             : /// of the module.
     183             : /// \return null on error.
     184             : Constant *parseConstantValue(StringRef Asm, SMDiagnostic &Err, const Module &M,
     185             :                              const SlotMapping *Slots = nullptr);
     186             : 
     187             : /// Parse a type in the given string.
     188             : ///
     189             : /// \param Slots The optional slot mapping that will restore the parsing state
     190             : /// of the module.
     191             : /// \return null on error.
     192             : Type *parseType(StringRef Asm, SMDiagnostic &Err, const Module &M,
     193             :                 const SlotMapping *Slots = nullptr);
     194             : 
     195             : /// Parse a string \p Asm that starts with a type.
     196             : /// \p Read[out] gives the number of characters that have been read to parse
     197             : /// the type in \p Asm.
     198             : ///
     199             : /// \param Slots The optional slot mapping that will restore the parsing state
     200             : /// of the module.
     201             : /// \return null on error.
     202             : Type *parseTypeAtBeginning(StringRef Asm, unsigned &Read, SMDiagnostic &Err,
     203             :                            const Module &M, const SlotMapping *Slots = nullptr);
     204             : 
     205             : } // End llvm namespace
     206             : 
     207             : #endif

Generated by: LCOV version 1.13