@@ -293,13 +293,11 @@ bool COFFAsmParser::parseDirectiveSymbolAttribute(StringRef Directive, SMLoc) {
293
293
assert (Attr != MCSA_Invalid && " unexpected symbol attribute directive!" );
294
294
if (getLexer ().isNot (AsmToken::EndOfStatement)) {
295
295
while (true ) {
296
- StringRef Name ;
296
+ MCSymbol *Sym ;
297
297
298
- if (getParser ().parseIdentifier (Name ))
298
+ if (getParser ().parseSymbol (Sym ))
299
299
return TokError (" expected identifier in directive" );
300
300
301
- MCSymbol *Sym = getContext ().getOrCreateSymbol (Name);
302
-
303
301
getStreamer ().emitSymbolAttribute (Sym, Attr);
304
302
305
303
if (getLexer ().is (AsmToken::EndOfStatement))
@@ -450,13 +448,11 @@ bool COFFAsmParser::parseDirectivePopSection(StringRef, SMLoc) {
450
448
}
451
449
452
450
bool COFFAsmParser::parseDirectiveDef (StringRef, SMLoc) {
453
- StringRef SymbolName ;
451
+ MCSymbol *Sym ;
454
452
455
- if (getParser ().parseIdentifier (SymbolName ))
453
+ if (getParser ().parseSymbol (Sym ))
456
454
return TokError (" expected identifier in directive" );
457
455
458
- MCSymbol *Sym = getContext ().getOrCreateSymbol (SymbolName);
459
-
460
456
getStreamer ().beginCOFFSymbolDef (Sym);
461
457
462
458
Lex ();
@@ -496,8 +492,8 @@ bool COFFAsmParser::parseDirectiveEndef(StringRef, SMLoc) {
496
492
}
497
493
498
494
bool COFFAsmParser::parseDirectiveSecRel32 (StringRef, SMLoc) {
499
- StringRef SymbolID ;
500
- if (getParser ().parseIdentifier (SymbolID ))
495
+ MCSymbol *Symbol ;
496
+ if (getParser ().parseSymbol (Symbol ))
501
497
return TokError (" expected identifier in directive" );
502
498
503
499
int64_t Offset = 0 ;
@@ -517,17 +513,15 @@ bool COFFAsmParser::parseDirectiveSecRel32(StringRef, SMLoc) {
517
513
" invalid '.secrel32' directive offset, can't be less "
518
514
" than zero or greater than std::numeric_limits<uint32_t>::max()" );
519
515
520
- MCSymbol *Symbol = getContext ().getOrCreateSymbol (SymbolID);
521
-
522
516
Lex ();
523
517
getStreamer ().emitCOFFSecRel32 (Symbol, Offset);
524
518
return false ;
525
519
}
526
520
527
521
bool COFFAsmParser::parseDirectiveRVA (StringRef, SMLoc) {
528
522
auto parseOp = [&]() -> bool {
529
- StringRef SymbolID ;
530
- if (getParser ().parseIdentifier (SymbolID ))
523
+ MCSymbol *Symbol ;
524
+ if (getParser ().parseSymbol (Symbol ))
531
525
return TokError (" expected identifier in directive" );
532
526
533
527
int64_t Offset = 0 ;
@@ -544,8 +538,6 @@ bool COFFAsmParser::parseDirectiveRVA(StringRef, SMLoc) {
544
538
" than -2147483648 or greater than "
545
539
" 2147483647" );
546
540
547
- MCSymbol *Symbol = getContext ().getOrCreateSymbol (SymbolID);
548
-
549
541
getStreamer ().emitCOFFImgRel32 (Symbol, Offset);
550
542
return false ;
551
543
};
@@ -556,75 +548,65 @@ bool COFFAsmParser::parseDirectiveRVA(StringRef, SMLoc) {
556
548
}
557
549
558
550
bool COFFAsmParser::parseDirectiveSafeSEH (StringRef, SMLoc) {
559
- StringRef SymbolID ;
560
- if (getParser ().parseIdentifier (SymbolID ))
551
+ MCSymbol *Symbol ;
552
+ if (getParser ().parseSymbol (Symbol ))
561
553
return TokError (" expected identifier in directive" );
562
554
563
555
if (getLexer ().isNot (AsmToken::EndOfStatement))
564
556
return TokError (" unexpected token in directive" );
565
557
566
- MCSymbol *Symbol = getContext ().getOrCreateSymbol (SymbolID);
567
-
568
558
Lex ();
569
559
getStreamer ().emitCOFFSafeSEH (Symbol);
570
560
return false ;
571
561
}
572
562
573
563
bool COFFAsmParser::parseDirectiveSecIdx (StringRef, SMLoc) {
574
- StringRef SymbolID ;
575
- if (getParser ().parseIdentifier (SymbolID ))
564
+ MCSymbol *Symbol ;
565
+ if (getParser ().parseSymbol (Symbol ))
576
566
return TokError (" expected identifier in directive" );
577
567
578
568
if (getLexer ().isNot (AsmToken::EndOfStatement))
579
569
return TokError (" unexpected token in directive" );
580
570
581
- MCSymbol *Symbol = getContext ().getOrCreateSymbol (SymbolID);
582
-
583
571
Lex ();
584
572
getStreamer ().emitCOFFSectionIndex (Symbol);
585
573
return false ;
586
574
}
587
575
588
576
bool COFFAsmParser::parseDirectiveSymIdx (StringRef, SMLoc) {
589
- StringRef SymbolID ;
590
- if (getParser ().parseIdentifier (SymbolID ))
577
+ MCSymbol *Symbol ;
578
+ if (getParser ().parseSymbol (Symbol ))
591
579
return TokError (" expected identifier in directive" );
592
580
593
581
if (getLexer ().isNot (AsmToken::EndOfStatement))
594
582
return TokError (" unexpected token in directive" );
595
583
596
- MCSymbol *Symbol = getContext ().getOrCreateSymbol (SymbolID);
597
-
598
584
Lex ();
599
585
getStreamer ().emitCOFFSymbolIndex (Symbol);
600
586
return false ;
601
587
}
602
588
603
589
bool COFFAsmParser::parseDirectiveSecNum (StringRef, SMLoc) {
604
- StringRef SymbolID ;
605
- if (getParser ().parseIdentifier (SymbolID ))
590
+ MCSymbol *Symbol ;
591
+ if (getParser ().parseSymbol (Symbol ))
606
592
return TokError (" expected identifier in directive" );
607
593
608
594
if (getLexer ().isNot (AsmToken::EndOfStatement))
609
595
return TokError (" unexpected token in directive" );
610
596
611
- MCSymbol *Symbol = getContext ().getOrCreateSymbol (SymbolID);
612
-
613
597
Lex ();
614
598
getStreamer ().emitCOFFSecNumber (Symbol);
615
599
return false ;
616
600
}
617
601
618
602
bool COFFAsmParser::parseDirectiveSecOffset (StringRef, SMLoc) {
619
- StringRef SymbolID ;
620
- if (getParser ().parseIdentifier (SymbolID ))
603
+ MCSymbol *Symbol ;
604
+ if (getParser ().parseSymbol (Symbol ))
621
605
return TokError (" expected identifier in directive" );
622
606
623
607
if (getLexer ().isNot (AsmToken::EndOfStatement))
624
608
return TokError (" unexpected token in directive" );
625
609
626
- MCSymbol *Symbol = getContext ().getOrCreateSymbol (SymbolID);
627
-
628
610
Lex ();
629
611
getStreamer ().emitCOFFSecOffset (Symbol);
630
612
return false ;
@@ -679,15 +661,13 @@ bool COFFAsmParser::parseDirectiveLinkOnce(StringRef, SMLoc Loc) {
679
661
}
680
662
681
663
bool COFFAsmParser::parseSEHDirectiveStartProc (StringRef, SMLoc Loc) {
682
- StringRef SymbolID ;
683
- if (getParser ().parseIdentifier (SymbolID ))
664
+ MCSymbol *Symbol ;
665
+ if (getParser ().parseSymbol (Symbol ))
684
666
return true ;
685
667
686
668
if (getLexer ().isNot (AsmToken::EndOfStatement))
687
669
return TokError (" unexpected token in directive" );
688
670
689
- MCSymbol *Symbol = getContext ().getOrCreateSymbol (SymbolID);
690
-
691
671
Lex ();
692
672
getStreamer ().emitWinCFIStartProc (Symbol, Loc);
693
673
return false ;
@@ -718,8 +698,8 @@ bool COFFAsmParser::parseSEHDirectiveEndChained(StringRef, SMLoc Loc) {
718
698
}
719
699
720
700
bool COFFAsmParser::parseSEHDirectiveHandler (StringRef, SMLoc Loc) {
721
- StringRef SymbolID ;
722
- if (getParser ().parseIdentifier (SymbolID ))
701
+ MCSymbol *handler ;
702
+ if (getParser ().parseSymbol (handler ))
723
703
return true ;
724
704
725
705
if (getLexer ().isNot (AsmToken::Comma))
@@ -736,8 +716,6 @@ bool COFFAsmParser::parseSEHDirectiveHandler(StringRef, SMLoc Loc) {
736
716
if (getLexer ().isNot (AsmToken::EndOfStatement))
737
717
return TokError (" unexpected token in directive" );
738
718
739
- MCSymbol *handler = getContext ().getOrCreateSymbol (SymbolID);
740
-
741
719
Lex ();
742
720
getStreamer ().emitWinEHHandler (handler, unwind, except, Loc);
743
721
return false ;
0 commit comments