LCOV - code coverage report
Current view: top level - lib/MC/MCParser - MCAsmLexer.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 21 97 21.6 %
Date: 2018-10-20 13:21:21 Functions: 6 6 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- MCAsmLexer.cpp - Abstract Asm Lexer Interface ----------------------===//
       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             : #include "llvm/MC/MCParser/MCAsmLexer.h"
      11             : #include "llvm/ADT/StringRef.h"
      12             : #include "llvm/Support/SMLoc.h"
      13             : #include "llvm/Support/Debug.h"
      14             : #include "llvm/Support/raw_ostream.h"
      15             : 
      16             : using namespace llvm;
      17             : 
      18       18554 : MCAsmLexer::MCAsmLexer() {
      19       18554 :   CurTok.emplace_back(AsmToken::Space, StringRef());
      20       18554 : }
      21             : 
      22             : MCAsmLexer::~MCAsmLexer() = default;
      23             : 
      24     3386463 : SMLoc MCAsmLexer::getLoc() const {
      25     3386463 :   return SMLoc::getFromPointer(TokStart);
      26             : }
      27             : 
      28    11148035 : SMLoc AsmToken::getLoc() const {
      29    11148035 :   return SMLoc::getFromPointer(Str.data());
      30             : }
      31             : 
      32     1708081 : SMLoc AsmToken::getEndLoc() const {
      33     1708081 :   return SMLoc::getFromPointer(Str.data() + Str.size());
      34             : }
      35             : 
      36         126 : SMRange AsmToken::getLocRange() const {
      37         126 :   return SMRange(getLoc(), getEndLoc());
      38             : }
      39             : 
      40           4 : void AsmToken::dump(raw_ostream &OS) const {
      41           4 :   switch (Kind) {
      42           0 :   case AsmToken::Error:
      43           0 :     OS << "error";
      44           0 :     break;
      45           2 :   case AsmToken::Identifier:
      46           2 :     OS << "identifier: " << getString();
      47           2 :     break;
      48           0 :   case AsmToken::Integer:
      49           0 :     OS << "int: " << getString();
      50           0 :     break;
      51           0 :   case AsmToken::Real:
      52           0 :     OS << "real: " << getString();
      53           0 :     break;
      54           0 :   case AsmToken::String:
      55           0 :     OS << "string: " << getString();
      56           0 :     break;
      57             : 
      58           0 :   case AsmToken::Amp:                OS << "Amp"; break;
      59           0 :   case AsmToken::AmpAmp:             OS << "AmpAmp"; break;
      60           0 :   case AsmToken::At:                 OS << "At"; break;
      61           0 :   case AsmToken::BackSlash:          OS << "BackSlash"; break;
      62           0 :   case AsmToken::BigNum:             OS << "BigNum"; break;
      63           0 :   case AsmToken::Caret:              OS << "Caret"; break;
      64           0 :   case AsmToken::Colon:              OS << "Colon"; break;
      65           0 :   case AsmToken::Comma:              OS << "Comma"; break;
      66           0 :   case AsmToken::Comment:            OS << "Comment"; break;
      67           0 :   case AsmToken::Dollar:             OS << "Dollar"; break;
      68           0 :   case AsmToken::Dot:                OS << "Dot"; break;
      69           2 :   case AsmToken::EndOfStatement:     OS << "EndOfStatement"; break;
      70           0 :   case AsmToken::Eof:                OS << "Eof"; break;
      71           0 :   case AsmToken::Equal:              OS << "Equal"; break;
      72           0 :   case AsmToken::EqualEqual:         OS << "EqualEqual"; break;
      73           0 :   case AsmToken::Exclaim:            OS << "Exclaim"; break;
      74           0 :   case AsmToken::ExclaimEqual:       OS << "ExclaimEqual"; break;
      75           0 :   case AsmToken::Greater:            OS << "Greater"; break;
      76           0 :   case AsmToken::GreaterEqual:       OS << "GreaterEqual"; break;
      77           0 :   case AsmToken::GreaterGreater:     OS << "GreaterGreater"; break;
      78           0 :   case AsmToken::Hash:               OS << "Hash"; break;
      79           0 :   case AsmToken::HashDirective:      OS << "HashDirective"; break;
      80           0 :   case AsmToken::LBrac:              OS << "LBrac"; break;
      81           0 :   case AsmToken::LCurly:             OS << "LCurly"; break;
      82           0 :   case AsmToken::LParen:             OS << "LParen"; break;
      83           0 :   case AsmToken::Less:               OS << "Less"; break;
      84           0 :   case AsmToken::LessEqual:          OS << "LessEqual"; break;
      85           0 :   case AsmToken::LessGreater:        OS << "LessGreater"; break;
      86           0 :   case AsmToken::LessLess:           OS << "LessLess"; break;
      87           0 :   case AsmToken::Minus:              OS << "Minus"; break;
      88           0 :   case AsmToken::Percent:            OS << "Percent"; break;
      89           0 :   case AsmToken::Pipe:               OS << "Pipe"; break;
      90           0 :   case AsmToken::PipePipe:           OS << "PipePipe"; break;
      91           0 :   case AsmToken::Plus:               OS << "Plus"; break;
      92           0 :   case AsmToken::RBrac:              OS << "RBrac"; break;
      93           0 :   case AsmToken::RCurly:             OS << "RCurly"; break;
      94           0 :   case AsmToken::RParen:             OS << "RParen"; break;
      95           0 :   case AsmToken::Slash:              OS << "Slash"; break;
      96           0 :   case AsmToken::Space:              OS << "Space"; break;
      97           0 :   case AsmToken::Star:               OS << "Star"; break;
      98           0 :   case AsmToken::Tilde:              OS << "Tilde"; break;
      99           0 :   case AsmToken::PercentCall16:      OS << "PercentCall16"; break;
     100           0 :   case AsmToken::PercentCall_Hi:     OS << "PercentCall_Hi"; break;
     101           0 :   case AsmToken::PercentCall_Lo:     OS << "PercentCall_Lo"; break;
     102           0 :   case AsmToken::PercentDtprel_Hi:   OS << "PercentDtprel_Hi"; break;
     103           0 :   case AsmToken::PercentDtprel_Lo:   OS << "PercentDtprel_Lo"; break;
     104           0 :   case AsmToken::PercentGot:         OS << "PercentGot"; break;
     105           0 :   case AsmToken::PercentGot_Disp:    OS << "PercentGot_Disp"; break;
     106           0 :   case AsmToken::PercentGot_Hi:      OS << "PercentGot_Hi"; break;
     107           0 :   case AsmToken::PercentGot_Lo:      OS << "PercentGot_Lo"; break;
     108           0 :   case AsmToken::PercentGot_Ofst:    OS << "PercentGot_Ofst"; break;
     109           0 :   case AsmToken::PercentGot_Page:    OS << "PercentGot_Page"; break;
     110           0 :   case AsmToken::PercentGottprel:    OS << "PercentGottprel"; break;
     111           0 :   case AsmToken::PercentGp_Rel:      OS << "PercentGp_Rel"; break;
     112           0 :   case AsmToken::PercentHi:          OS << "PercentHi"; break;
     113           0 :   case AsmToken::PercentHigher:      OS << "PercentHigher"; break;
     114           0 :   case AsmToken::PercentHighest:     OS << "PercentHighest"; break;
     115           0 :   case AsmToken::PercentLo:          OS << "PercentLo"; break;
     116           0 :   case AsmToken::PercentNeg:         OS << "PercentNeg"; break;
     117           0 :   case AsmToken::PercentPcrel_Hi:    OS << "PercentPcrel_Hi"; break;
     118           0 :   case AsmToken::PercentPcrel_Lo:    OS << "PercentPcrel_Lo"; break;
     119           0 :   case AsmToken::PercentTlsgd:       OS << "PercentTlsgd"; break;
     120           0 :   case AsmToken::PercentTlsldm:      OS << "PercentTlsldm"; break;
     121           0 :   case AsmToken::PercentTprel_Hi:    OS << "PercentTprel_Hi"; break;
     122           0 :   case AsmToken::PercentTprel_Lo:    OS << "PercentTprel_Lo"; break;
     123             :   }
     124             : 
     125             :   // Print the token string.
     126           4 :   OS << " (\"";
     127           4 :   OS.write_escaped(getString());
     128           4 :   OS << "\")";
     129           4 : }

Generated by: LCOV version 1.13