LCOV - code coverage report
Current view: top level - lib/MC - MCSectionWasm.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 0 36 0.0 %
Date: 2017-09-14 15:23:50 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- lib/MC/MCSectionWasm.cpp - Wasm Code Section Representation --------===//
       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/MCSectionWasm.h"
      11             : #include "llvm/MC/MCAsmInfo.h"
      12             : #include "llvm/MC/MCContext.h"
      13             : #include "llvm/MC/MCExpr.h"
      14             : #include "llvm/MC/MCSymbol.h"
      15             : #include "llvm/Support/raw_ostream.h"
      16             : 
      17             : using namespace llvm;
      18             : 
      19           0 : MCSectionWasm::~MCSectionWasm() {} // anchor.
      20             : 
      21             : // Decides whether a '.section' directive
      22             : // should be printed before the section name.
      23           0 : bool MCSectionWasm::ShouldOmitSectionDirective(StringRef Name,
      24             :                                                const MCAsmInfo &MAI) const {
      25           0 :   return MAI.shouldOmitSectionDirective(Name);
      26             : }
      27             : 
      28           0 : static void printName(raw_ostream &OS, StringRef Name) {
      29           0 :   if (Name.find_first_not_of("0123456789_."
      30             :                              "abcdefghijklmnopqrstuvwxyz"
      31             :                              "ABCDEFGHIJKLMNOPQRSTUVWXYZ") == Name.npos) {
      32           0 :     OS << Name;
      33           0 :     return;
      34             :   }
      35           0 :   OS << '"';
      36           0 :   for (const char *B = Name.begin(), *E = Name.end(); B < E; ++B) {
      37           0 :     if (*B == '"') // Unquoted "
      38           0 :       OS << "\\\"";
      39           0 :     else if (*B != '\\') // Neither " or backslash
      40           0 :       OS << *B;
      41           0 :     else if (B + 1 == E) // Trailing backslash
      42           0 :       OS << "\\\\";
      43             :     else {
      44           0 :       OS << B[0] << B[1]; // Quoted character
      45             :       ++B;
      46             :     }
      47             :   }
      48             :   OS << '"';
      49             : }
      50             : 
      51           0 : void MCSectionWasm::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
      52             :                                          raw_ostream &OS,
      53             :                                          const MCExpr *Subsection) const {
      54             : 
      55           0 :   if (ShouldOmitSectionDirective(SectionName, MAI)) {
      56           0 :     OS << '\t' << getSectionName();
      57           0 :     if (Subsection) {
      58           0 :       OS << '\t';
      59           0 :       Subsection->print(OS, &MAI);
      60             :     }
      61             :     OS << '\n';
      62             :     return;
      63             :   }
      64             : 
      65           0 :   OS << "\t.section\t";
      66           0 :   printName(OS, getSectionName());
      67           0 :   OS << ",\"";
      68             : 
      69             :   // TODO: Print section flags.
      70             : 
      71           0 :   OS << '"';
      72             : 
      73           0 :   OS << ',';
      74             : 
      75             :   // If comment string is '@', e.g. as on ARM - use '%' instead
      76           0 :   if (MAI.getCommentString()[0] == '@')
      77             :     OS << '%';
      78             :   else
      79             :     OS << '@';
      80             : 
      81             :   // TODO: Print section type.
      82             : 
      83           0 :   if (isUnique())
      84           0 :     OS << ",unique," << UniqueID;
      85             : 
      86           0 :   OS << '\n';
      87             : 
      88           0 :   if (Subsection) {
      89           0 :     OS << "\t.subsection\t";
      90           0 :     Subsection->print(OS, &MAI);
      91             :     OS << '\n';
      92             :   }
      93             : }
      94             : 
      95           0 : bool MCSectionWasm::UseCodeAlign() const { return false; }
      96             : 
      97           0 : bool MCSectionWasm::isVirtualSection() const { return false; }

Generated by: LCOV version 1.13