brintos

brintos / llvm-project-archived public Read only

0
0
Text · 18.2 KiB · ec02c1d Raw
602 lines · cpp
1//===- llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp ----------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===--------------------------------------------------------------------===//8#include "llvm/MC/MCAsmInfo.h"9#include "llvm/MC/MCContext.h"10#include "llvm/MC/MCInstrInfo.h"11#include "llvm/MC/MCObjectFileInfo.h"12#include "llvm/MC/MCParser/AsmLexer.h"13#include "llvm/MC/MCParser/MCTargetAsmParser.h"14#include "llvm/MC/MCRegisterInfo.h"15#include "llvm/MC/MCStreamer.h"16#include "llvm/MC/MCSubtargetInfo.h"17#include "llvm/MC/MCSymbol.h"18#include "llvm/MC/TargetRegistry.h"19#include "llvm/Support/MemoryBuffer.h"20#include "llvm/Support/SourceMgr.h"21#include "llvm/Support/TargetSelect.h"22 23#include "gtest/gtest.h"24 25using namespace llvm;26 27namespace {28 29// Setup a testing class that the GTest framework can call.30class SystemZAsmLexerTest : public ::testing::Test {31protected:32  static void SetUpTestCase() {33    LLVMInitializeSystemZTargetInfo();34    LLVMInitializeSystemZTargetMC();35    LLVMInitializeSystemZAsmParser();36  }37 38  std::unique_ptr<MCRegisterInfo> MRI;39  std::unique_ptr<MCAsmInfo> MAI;40  std::unique_ptr<const MCInstrInfo> MII;41  std::unique_ptr<MCObjectFileInfo> MOFI;42  std::unique_ptr<MCStreamer> Str;43  std::unique_ptr<MCAsmParser> Parser;44  std::unique_ptr<MCContext> Ctx;45  std::unique_ptr<MCSubtargetInfo> STI;46  std::unique_ptr<MCTargetAsmParser> TargetAsmParser;47 48  SourceMgr SrcMgr;49  StringRef TripleName;50  const llvm::Triple Triple;51  const Target *TheTarget;52 53  const MCTargetOptions MCOptions;54 55  SystemZAsmLexerTest() = delete;56 57  SystemZAsmLexerTest(StringRef SystemZTriple)58      : TripleName(SystemZTriple), Triple(SystemZTriple) {59    // We will use the SystemZ triple, because of missing60    // Object File and Streamer support for the z/OS target.61 62    std::string Error;63    TheTarget = TargetRegistry::lookupTarget(Triple, Error);64    EXPECT_NE(TheTarget, nullptr);65 66    MRI.reset(TheTarget->createMCRegInfo(Triple));67    EXPECT_NE(MRI, nullptr);68 69    MII.reset(TheTarget->createMCInstrInfo());70    EXPECT_NE(MII, nullptr);71 72    STI.reset(TheTarget->createMCSubtargetInfo(Triple, "z10", ""));73    EXPECT_NE(STI, nullptr);74 75    MAI.reset(TheTarget->createMCAsmInfo(*MRI, Triple, MCOptions));76    EXPECT_NE(MAI, nullptr);77  }78 79  void setupCallToAsmParser(StringRef AsmStr) {80    std::unique_ptr<MemoryBuffer> Buffer(MemoryBuffer::getMemBuffer(AsmStr));81    SrcMgr.AddNewSourceBuffer(std::move(Buffer), SMLoc());82    EXPECT_EQ(Buffer, nullptr);83 84    Ctx.reset(new MCContext(Triple, MAI.get(), MRI.get(), STI.get(), &SrcMgr,85                            &MCOptions));86    MOFI.reset(TheTarget->createMCObjectFileInfo(*Ctx, /*PIC=*/false,87                                                 /*LargeCodeModel=*/false));88    Ctx->setObjectFileInfo(MOFI.get());89 90    Str.reset(TheTarget->createNullStreamer(*Ctx));91 92    Parser.reset(createMCAsmParser(SrcMgr, *Ctx, *Str, *MAI));93 94    TargetAsmParser.reset(95        TheTarget->createMCAsmParser(*STI, *Parser, *MII, MCOptions));96    Parser->setTargetParser(*TargetAsmParser);97  }98 99  void lexAndCheckTokens(StringRef AsmStr,100                         SmallVector<AsmToken::TokenKind> ExpectedTokens) {101    // Get reference to AsmLexer.102    AsmLexer &Lexer = Parser->getLexer();103    // Loop through all expected tokens checking one by one.104    for (size_t I = 0; I < ExpectedTokens.size(); ++I) {105      EXPECT_EQ(Lexer.getTok().getKind(), ExpectedTokens[I]);106      Lexer.Lex();107    }108  }109 110  void lexAndCheckIntegerTokensAndValues(StringRef AsmStr,111                                         SmallVector<int64_t> ExpectedValues) {112    // Get reference to AsmLexer.113    AsmLexer &Lexer = Parser->getLexer();114    // Loop through all expected tokens and expected values.115    for (size_t I = 0; I < ExpectedValues.size(); ++I) {116      // Skip any EndOfStatement tokens, we're not concerned with them.117      if (Lexer.getTok().getKind() == AsmToken::EndOfStatement)118        continue;119      EXPECT_EQ(Lexer.getTok().getKind(), AsmToken::Integer);120      EXPECT_EQ(Lexer.getTok().getIntVal(), ExpectedValues[I]);121      Lexer.Lex();122    }123  }124};125 126class SystemZAsmLexerLinux : public SystemZAsmLexerTest {127protected:128  SystemZAsmLexerLinux() : SystemZAsmLexerTest("s390x-ibm-linux") {}129};130 131class SystemZAsmLexerZOS : public SystemZAsmLexerTest {132protected:133  SystemZAsmLexerZOS() : SystemZAsmLexerTest("s390x-ibm-zos") {}134};135 136TEST_F(SystemZAsmLexerLinux, CheckDontRestrictCommentStringToStartOfStatement) {137  StringRef AsmStr = "jne #-4";138 139  // Setup.140  setupCallToAsmParser(AsmStr);141 142  // Lex initially to get the string.143  Parser->getLexer().Lex();144 145  SmallVector<AsmToken::TokenKind> ExpectedTokens(146      {AsmToken::Identifier, AsmToken::EndOfStatement});147  lexAndCheckTokens(AsmStr /* "jne #-4" */, ExpectedTokens);148}149 150TEST_F(SystemZAsmLexerZOS, CheckRestrictCommentStringToStartOfStatement) {151  StringRef AsmStr = "jne #-4";152 153  // Setup.154  setupCallToAsmParser(AsmStr);155 156  // Lex initially to get the string.157  Parser->getLexer().Lex();158 159  // When we are restricting the comment string to only the start of the160  // statement, The sequence of tokens we are expecting are: Identifier - "jne"161  // Hash - '#'162  // Minus - '-'163  // Integer - '4'164  SmallVector<AsmToken::TokenKind> ExpectedTokens(165      {AsmToken::Identifier, AsmToken::Space, AsmToken::Identifier});166  lexAndCheckTokens(AsmStr /* "jne #-4" */, ExpectedTokens);167}168 169// Test HLASM Comment Syntax ('*')170TEST_F(SystemZAsmLexerZOS, CheckHLASMComment) {171  StringRef AsmStr = "* lhi 1,10";172 173  // Setup.174  setupCallToAsmParser(AsmStr);175 176  // Lex initially to get the string.177  Parser->getLexer().Lex();178 179  SmallVector<AsmToken::TokenKind> ExpectedTokens(180      {AsmToken::EndOfStatement, AsmToken::Eof});181  lexAndCheckTokens(AsmStr /* "* lhi 1,10" */, ExpectedTokens);182}183 184TEST_F(SystemZAsmLexerLinux, CheckHashDefault) {185  StringRef AsmStr = "lh#123";186 187  // Setup.188  setupCallToAsmParser(AsmStr);189 190  // Lex initially to get the string.191  Parser->getLexer().Lex();192 193  // "lh" -> Identifier194  // "#123" -> EndOfStatement (Lexed as a comment since CommentString is "#")195  SmallVector<AsmToken::TokenKind> ExpectedTokens(196      {AsmToken::Identifier, AsmToken::EndOfStatement, AsmToken::Eof});197  lexAndCheckTokens(AsmStr, ExpectedTokens);198}199 200// Test if "#" is accepted as an Identifier201TEST_F(SystemZAsmLexerZOS, CheckAllowHashInIdentifier) {202  StringRef AsmStr = "lh#123";203 204  // Setup.205  setupCallToAsmParser(AsmStr);206 207  // Lex initially to get the string.208  Parser->getLexer().Lex();209 210  // "lh123" -> Identifier211  SmallVector<AsmToken::TokenKind> ExpectedTokens(212      {AsmToken::Identifier, AsmToken::EndOfStatement, AsmToken::Eof});213  lexAndCheckTokens(AsmStr, ExpectedTokens);214}215 216TEST_F(SystemZAsmLexerZOS, CheckAllowHashInIdentifier2) {217  StringRef AsmStr = "lh#12*3";218 219  // Setup.220  setupCallToAsmParser(AsmStr);221 222  // Lex initially to get the string.223  Parser->getLexer().Lex();224 225  // "lh#12" -> Identifier226  // "*" -> Star227  // "3" -> Integer228  SmallVector<AsmToken::TokenKind> ExpectedTokens(229      {AsmToken::Identifier, AsmToken::Star, AsmToken::Integer,230       AsmToken::EndOfStatement, AsmToken::Eof});231  lexAndCheckTokens(AsmStr, ExpectedTokens);232}233 234TEST_F(SystemZAsmLexerLinux, DontCheckStrictCommentString) {235  StringRef AsmStr = "# abc\n/* def *///  xyz";236 237  // Setup.238  setupCallToAsmParser(AsmStr);239 240  // Lex initially to get the string.241  Parser->getLexer().Lex();242 243  SmallVector<AsmToken::TokenKind> ExpectedTokens(244      {AsmToken::EndOfStatement, AsmToken::Comment, AsmToken::EndOfStatement,245       AsmToken::Eof});246  lexAndCheckTokens(AsmStr, ExpectedTokens);247}248 249TEST_F(SystemZAsmLexerZOS, CheckStrictCommentString) {250  StringRef AsmStr = "# abc\n/* def *///  xyz";251 252  // Setup.253  setupCallToAsmParser(AsmStr);254 255  // Lex initially to get the string.256  Parser->getLexer().Lex();257 258  SmallVector<AsmToken::TokenKind> ExpectedTokens;259  ExpectedTokens.push_back(AsmToken::Identifier);     // "#"260  ExpectedTokens.push_back(AsmToken::Space);          // " "261  ExpectedTokens.push_back(AsmToken::Identifier);     // "abc"262  ExpectedTokens.push_back(AsmToken::EndOfStatement); // "\n"263  ExpectedTokens.push_back(AsmToken::Slash);          // "/"264  ExpectedTokens.push_back(AsmToken::Star);           // "*"265  ExpectedTokens.push_back(AsmToken::Space);          // " "266  ExpectedTokens.push_back(AsmToken::Identifier);     // "def"267  ExpectedTokens.push_back(AsmToken::Space);          // " "268  ExpectedTokens.push_back(AsmToken::Star);           // "*"269  ExpectedTokens.push_back(AsmToken::Slash);          // "/"270  ExpectedTokens.push_back(AsmToken::Slash);          // "/"271  ExpectedTokens.push_back(AsmToken::Slash);          // "/"272  ExpectedTokens.push_back(AsmToken::Space);          // " "273  ExpectedTokens.push_back(AsmToken::Identifier);     // "xyz"274  ExpectedTokens.push_back(AsmToken::EndOfStatement);275  ExpectedTokens.push_back(AsmToken::Eof);276 277  lexAndCheckTokens(AsmStr, ExpectedTokens);278}279 280TEST_F(SystemZAsmLexerZOS, CheckValidHLASMIntegers) {281  StringRef AsmStr = "123\n000123\n1999\n007\n12300\n12021\n";282  // StringRef AsmStr = "123";283  // Setup.284  setupCallToAsmParser(AsmStr);285 286  // Lex initially to get the string.287  Parser->getLexer().Lex();288 289  // SmallVector<int64_t> ExpectedValues({123});290  SmallVector<int64_t> ExpectedValues({123, 123, 1999, 7, 12300, 12021});291  lexAndCheckIntegerTokensAndValues(AsmStr, ExpectedValues);292}293 294TEST_F(SystemZAsmLexerZOS, CheckInvalidHLASMIntegers) {295  StringRef AsmStr = "0b0101\n0xDEADBEEF\nfffh\n.133\n";296 297  // Setup.298  setupCallToAsmParser(AsmStr);299 300  // Lex initially to get the string.301  Parser->getLexer().Lex();302 303  SmallVector<AsmToken::TokenKind> ExpectedTokens;304  ExpectedTokens.push_back(AsmToken::Integer);        // "0"305  ExpectedTokens.push_back(AsmToken::Identifier);     // "b0101"306  ExpectedTokens.push_back(AsmToken::EndOfStatement); // "\n"307  ExpectedTokens.push_back(AsmToken::Integer);        // "0"308  ExpectedTokens.push_back(AsmToken::Identifier);     // "xDEADBEEF"309  ExpectedTokens.push_back(AsmToken::EndOfStatement); // "\n"310  ExpectedTokens.push_back(AsmToken::Identifier);     // "fffh"311  ExpectedTokens.push_back(AsmToken::EndOfStatement); // "\n"312  ExpectedTokens.push_back(AsmToken::Real);           // ".133"313  ExpectedTokens.push_back(AsmToken::EndOfStatement); // "\n"314  ExpectedTokens.push_back(AsmToken::Eof);315  lexAndCheckTokens(AsmStr, ExpectedTokens);316}317 318TEST_F(SystemZAsmLexerLinux, CheckDefaultIntegers) {319  StringRef AsmStr = "0b0101\n0xDEADBEEF\nfffh\n";320 321  // Setup.322  setupCallToAsmParser(AsmStr);323 324  // Lex initially to get the string.325  Parser->getLexer().Lex();326 327  SmallVector<int64_t> ExpectedValues({5, 0xDEADBEEF, 0xFFF});328  lexAndCheckIntegerTokensAndValues(AsmStr, ExpectedValues);329}330 331TEST_F(SystemZAsmLexerLinux, CheckDefaultFloats) {332  StringRef AsmStr = "0.333\n1.3\n2.5\n3.0\n";333 334  // Setup.335  setupCallToAsmParser(AsmStr);336 337  // Lex initially to get the string.338  Parser->getLexer().Lex();339 340  SmallVector<AsmToken::TokenKind> ExpectedTokens;341 342  for (int I = 0; I < 4; ++I)343    ExpectedTokens.insert(ExpectedTokens.begin(),344                          {AsmToken::Real, AsmToken::EndOfStatement});345 346  ExpectedTokens.push_back(AsmToken::Eof);347  lexAndCheckTokens(AsmStr, ExpectedTokens);348}349 350TEST_F(SystemZAsmLexerLinux, CheckDefaultQuestionAtStartOfIdentifier) {351  StringRef AsmStr = "?lh1?23";352 353  // Setup.354  setupCallToAsmParser(AsmStr);355 356  // Lex initially to get the string.357  Parser->getLexer().Lex();358 359  SmallVector<AsmToken::TokenKind> ExpectedTokens(360      {AsmToken::Question, AsmToken::Identifier, AsmToken::EndOfStatement,361       AsmToken::Eof});362  lexAndCheckTokens(AsmStr, ExpectedTokens);363}364 365TEST_F(SystemZAsmLexerLinux, CheckDefaultAtAtStartOfIdentifier) {366  StringRef AsmStr = "@@lh1?23";367 368  // Setup.369  setupCallToAsmParser(AsmStr);370 371  // Lex initially to get the string.372  Parser->getLexer().Lex();373 374  SmallVector<AsmToken::TokenKind> ExpectedTokens(375      {AsmToken::At, AsmToken::At, AsmToken::Identifier,376       AsmToken::EndOfStatement, AsmToken::Eof});377  lexAndCheckTokens(AsmStr, ExpectedTokens);378}379 380TEST_F(SystemZAsmLexerZOS, CheckAcceptAtAtStartOfIdentifier) {381  StringRef AsmStr = "@@lh1?23";382 383  // Setup.384  setupCallToAsmParser(AsmStr);385 386  // Lex initially to get the string.387  Parser->getLexer().Lex();388 389  SmallVector<AsmToken::TokenKind> ExpectedTokens(390      {AsmToken::Identifier, AsmToken::EndOfStatement, AsmToken::Eof});391  lexAndCheckTokens(AsmStr, ExpectedTokens);392}393 394TEST_F(SystemZAsmLexerLinux, CheckDefaultDollarAtStartOfIdentifier) {395  StringRef AsmStr = "$$ac$c";396 397  // Setup.398  setupCallToAsmParser(AsmStr);399 400  // Lex initially to get the string.401  Parser->getLexer().Lex();402 403  SmallVector<AsmToken::TokenKind> ExpectedTokens(404      {AsmToken::Dollar, AsmToken::Dollar, AsmToken::Identifier,405       AsmToken::EndOfStatement, AsmToken::Eof});406  lexAndCheckTokens(AsmStr, ExpectedTokens);407}408 409TEST_F(SystemZAsmLexerZOS, CheckAcceptDollarAtStartOfIdentifier) {410  StringRef AsmStr = "$$ab$c";411 412  // Setup.413  setupCallToAsmParser(AsmStr);414 415  // Lex initially to get the string.416  Parser->getLexer().Lex();417 418  SmallVector<AsmToken::TokenKind> ExpectedTokens(419      {AsmToken::Identifier, AsmToken::EndOfStatement, AsmToken::Eof});420  lexAndCheckTokens(AsmStr, ExpectedTokens);421}422 423TEST_F(SystemZAsmLexerZOS, CheckAcceptHashAtStartOfIdentifier) {424  StringRef AsmStr = "##a#b$c";425 426  // Setup.427  setupCallToAsmParser(AsmStr);428 429  // Lex initially to get the string.430  Parser->getLexer().Lex();431 432  SmallVector<AsmToken::TokenKind> ExpectedTokens(433      {AsmToken::Identifier, AsmToken::EndOfStatement, AsmToken::Eof});434  lexAndCheckTokens(AsmStr, ExpectedTokens);435}436 437TEST_F(SystemZAsmLexerLinux, CheckAcceptHashAtStartOfIdentifier2) {438  StringRef AsmStr = "##a#b$c";439 440  // Setup.441  setupCallToAsmParser(AsmStr);442 443  // Lex initially to get the string.444  Parser->getLexer().Lex();445 446  // By default, the CommentString attribute is set to "#".447  // Hence, "##a#b$c" is lexed as a line comment irrespective448  // of whether the AllowHashAtStartOfIdentifier attribute is set to true.449  SmallVector<AsmToken::TokenKind> ExpectedTokens(450      {AsmToken::EndOfStatement, AsmToken::Eof});451  lexAndCheckTokens(AsmStr, ExpectedTokens);452}453 454TEST_F(SystemZAsmLexerZOS, CheckAcceptHashAtStartOfIdentifier3) {455  StringRef AsmStr = "##a#b$c";456 457  // Setup.458  setupCallToAsmParser(AsmStr);459 460  // Lex initially to get the string.461  Parser->getLexer().Lex();462 463  SmallVector<AsmToken::TokenKind> ExpectedTokens(464      {AsmToken::Identifier, AsmToken::EndOfStatement, AsmToken::Eof});465  lexAndCheckTokens(AsmStr, ExpectedTokens);466}467 468TEST_F(SystemZAsmLexerZOS, CheckAcceptHashAtStartOfIdentifier4) {469  StringRef AsmStr = "##a#b$c";470 471  // Setup.472  setupCallToAsmParser(AsmStr);473 474  // Lex initially to get the string.475  Parser->getLexer().Lex();476 477  // Since, the AllowAdditionalComments attribute is set to false,478  // only strings starting with the CommentString attribute are479  // lexed as possible comments.480  // Hence, "##a$b$c" is lexed as an Identifier because the481  // AllowHashAtStartOfIdentifier attribute is set to true.482  SmallVector<AsmToken::TokenKind> ExpectedTokens(483      {AsmToken::Identifier, AsmToken::EndOfStatement, AsmToken::Eof});484  lexAndCheckTokens(AsmStr, ExpectedTokens);485}486 487TEST_F(SystemZAsmLexerZOS, CheckRejectDotAsCurrentPC) {488  StringRef AsmStr = ".-4";489 490  // Setup.491  setupCallToAsmParser(AsmStr);492 493  // Lex initially to get the string.494  Parser->getLexer().Lex();495 496  const MCExpr *Expr;497  bool ParsePrimaryExpr = Parser->parseExpression(Expr);498  EXPECT_EQ(ParsePrimaryExpr, true);499  EXPECT_EQ(Parser->hasPendingError(), true);500}501 502TEST_F(SystemZAsmLexerLinux, CheckRejectStarAsCurrentPC) {503  StringRef AsmStr = "*-4";504 505  // Setup.506  setupCallToAsmParser(AsmStr);507 508  // Lex initially to get the string.509  Parser->getLexer().Lex();510 511  const MCExpr *Expr;512  bool ParsePrimaryExpr = Parser->parseExpression(Expr);513  EXPECT_EQ(ParsePrimaryExpr, true);514  EXPECT_EQ(Parser->hasPendingError(), true);515}516 517TEST_F(SystemZAsmLexerZOS, CheckRejectCharLiterals) {518  StringRef AsmStr = "abc 'd'";519 520  // Setup.521  setupCallToAsmParser(AsmStr);522 523  // Lex initially to get the string.524  Parser->getLexer().Lex();525 526  SmallVector<AsmToken::TokenKind> ExpectedTokens(527      {AsmToken::Identifier, AsmToken::Space, AsmToken::Error, AsmToken::Error,528       AsmToken::EndOfStatement, AsmToken::Eof});529  lexAndCheckTokens(AsmStr, ExpectedTokens);530}531 532TEST_F(SystemZAsmLexerZOS, CheckRejectStringLiterals) {533  StringRef AsmStr = "abc \"ef\"";534 535  // Setup.536  setupCallToAsmParser(AsmStr);537 538  // Lex initially to get the string.539  Parser->getLexer().Lex();540 541  SmallVector<AsmToken::TokenKind> ExpectedTokens(542      {AsmToken::Identifier, AsmToken::Space, AsmToken::Error,543       AsmToken::Identifier, AsmToken::Error, AsmToken::EndOfStatement,544       AsmToken::Eof});545  lexAndCheckTokens(AsmStr, ExpectedTokens);546}547 548TEST_F(SystemZAsmLexerZOS, CheckPrintAcceptableSymbol) {549  std::string AsmStr = "ab13_$.@";550  EXPECT_EQ(true, MAI->isValidUnquotedName(AsmStr));551  AsmStr += "#";552  EXPECT_EQ(true, MAI->isValidUnquotedName(AsmStr));553}554 555TEST_F(SystemZAsmLexerLinux, CheckPrintAcceptableSymbol) {556  std::string AsmStr = "ab13_$.";557  EXPECT_EQ(true, MAI->isValidUnquotedName(AsmStr));558  AsmStr = "ab13_$.@";559  EXPECT_EQ(false, MAI->isValidUnquotedName(AsmStr));560  AsmStr = "ab13_$.#";561  EXPECT_EQ(false, MAI->isValidUnquotedName(AsmStr));562}563 564TEST_F(SystemZAsmLexerZOS, CheckLabelCaseUpperCase) {565  StringRef AsmStr = "label";566 567  // Setup.568  setupCallToAsmParser(AsmStr);569 570  // Lex initially to get the string.571  Parser->getLexer().Lex();572 573  const MCExpr *Expr;574  bool ParsePrimaryExpr = Parser->parseExpression(Expr);575  EXPECT_EQ(ParsePrimaryExpr, false);576 577  const MCSymbolRefExpr *SymbolExpr = dyn_cast<MCSymbolRefExpr>(Expr);578  EXPECT_NE(SymbolExpr, nullptr);579  EXPECT_NE(&SymbolExpr->getSymbol(), nullptr);580  EXPECT_EQ((&SymbolExpr->getSymbol())->getName(), StringRef("LABEL"));581}582 583TEST_F(SystemZAsmLexerLinux, CheckLabelUpperCase2) {584  StringRef AsmStr = "label";585 586  // Setup.587  setupCallToAsmParser(AsmStr);588 589  // Lex initially to get the string.590  Parser->getLexer().Lex();591 592  const MCExpr *Expr;593  bool ParsePrimaryExpr = Parser->parseExpression(Expr);594  EXPECT_EQ(ParsePrimaryExpr, false);595 596  const MCSymbolRefExpr *SymbolExpr = dyn_cast<MCSymbolRefExpr>(Expr);597  EXPECT_NE(SymbolExpr, nullptr);598  EXPECT_NE(&SymbolExpr->getSymbol(), nullptr);599  EXPECT_EQ((&SymbolExpr->getSymbol())->getName(), StringRef("label"));600}601} // end anonymous namespace602