@@ -7954,56 +7954,58 @@ MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
7954
7954
bool ARMAsmParser::ParseDirective (AsmToken DirectiveID) {
7955
7955
StringRef IDVal = DirectiveID.getIdentifier ();
7956
7956
if (IDVal == " .word" )
7957
- return parseDirectiveWord (4 , DirectiveID.getLoc ());
7957
+ parseDirectiveWord (4 , DirectiveID.getLoc ());
7958
7958
else if (IDVal == " .thumb" )
7959
- return parseDirectiveThumb (DirectiveID.getLoc ());
7959
+ parseDirectiveThumb (DirectiveID.getLoc ());
7960
7960
else if (IDVal == " .arm" )
7961
- return parseDirectiveARM (DirectiveID.getLoc ());
7961
+ parseDirectiveARM (DirectiveID.getLoc ());
7962
7962
else if (IDVal == " .thumb_func" )
7963
- return parseDirectiveThumbFunc (DirectiveID.getLoc ());
7963
+ parseDirectiveThumbFunc (DirectiveID.getLoc ());
7964
7964
else if (IDVal == " .code" )
7965
- return parseDirectiveCode (DirectiveID.getLoc ());
7965
+ parseDirectiveCode (DirectiveID.getLoc ());
7966
7966
else if (IDVal == " .syntax" )
7967
- return parseDirectiveSyntax (DirectiveID.getLoc ());
7967
+ parseDirectiveSyntax (DirectiveID.getLoc ());
7968
7968
else if (IDVal == " .unreq" )
7969
- return parseDirectiveUnreq (DirectiveID.getLoc ());
7969
+ parseDirectiveUnreq (DirectiveID.getLoc ());
7970
7970
else if (IDVal == " .arch" )
7971
- return parseDirectiveArch (DirectiveID.getLoc ());
7971
+ parseDirectiveArch (DirectiveID.getLoc ());
7972
7972
else if (IDVal == " .eabi_attribute" )
7973
- return parseDirectiveEabiAttr (DirectiveID.getLoc ());
7973
+ parseDirectiveEabiAttr (DirectiveID.getLoc ());
7974
7974
else if (IDVal == " .cpu" )
7975
- return parseDirectiveCPU (DirectiveID.getLoc ());
7975
+ parseDirectiveCPU (DirectiveID.getLoc ());
7976
7976
else if (IDVal == " .fpu" )
7977
- return parseDirectiveFPU (DirectiveID.getLoc ());
7977
+ parseDirectiveFPU (DirectiveID.getLoc ());
7978
7978
else if (IDVal == " .fnstart" )
7979
- return parseDirectiveFnStart (DirectiveID.getLoc ());
7979
+ parseDirectiveFnStart (DirectiveID.getLoc ());
7980
7980
else if (IDVal == " .fnend" )
7981
- return parseDirectiveFnEnd (DirectiveID.getLoc ());
7981
+ parseDirectiveFnEnd (DirectiveID.getLoc ());
7982
7982
else if (IDVal == " .cantunwind" )
7983
- return parseDirectiveCantUnwind (DirectiveID.getLoc ());
7983
+ parseDirectiveCantUnwind (DirectiveID.getLoc ());
7984
7984
else if (IDVal == " .personality" )
7985
- return parseDirectivePersonality (DirectiveID.getLoc ());
7985
+ parseDirectivePersonality (DirectiveID.getLoc ());
7986
7986
else if (IDVal == " .handlerdata" )
7987
- return parseDirectiveHandlerData (DirectiveID.getLoc ());
7987
+ parseDirectiveHandlerData (DirectiveID.getLoc ());
7988
7988
else if (IDVal == " .setfp" )
7989
- return parseDirectiveSetFP (DirectiveID.getLoc ());
7989
+ parseDirectiveSetFP (DirectiveID.getLoc ());
7990
7990
else if (IDVal == " .pad" )
7991
- return parseDirectivePad (DirectiveID.getLoc ());
7991
+ parseDirectivePad (DirectiveID.getLoc ());
7992
7992
else if (IDVal == " .save" )
7993
- return parseDirectiveRegSave (DirectiveID.getLoc (), false );
7993
+ parseDirectiveRegSave (DirectiveID.getLoc (), false );
7994
7994
else if (IDVal == " .vsave" )
7995
- return parseDirectiveRegSave (DirectiveID.getLoc (), true );
7995
+ parseDirectiveRegSave (DirectiveID.getLoc (), true );
7996
7996
else if (IDVal == " .inst" )
7997
- return parseDirectiveInst (DirectiveID.getLoc ());
7997
+ parseDirectiveInst (DirectiveID.getLoc ());
7998
7998
else if (IDVal == " .inst.n" )
7999
- return parseDirectiveInst (DirectiveID.getLoc (), ' n' );
7999
+ parseDirectiveInst (DirectiveID.getLoc (), ' n' );
8000
8000
else if (IDVal == " .inst.w" )
8001
- return parseDirectiveInst (DirectiveID.getLoc (), ' w' );
8001
+ parseDirectiveInst (DirectiveID.getLoc (), ' w' );
8002
8002
else if (IDVal == " .ltorg" || IDVal == " .pool" )
8003
- return parseDirectiveLtorg (DirectiveID.getLoc ());
8003
+ parseDirectiveLtorg (DirectiveID.getLoc ());
8004
8004
else if (IDVal == " .even" )
8005
- return parseDirectiveEven (DirectiveID.getLoc ());
8006
- return true ;
8005
+ parseDirectiveEven (DirectiveID.getLoc ());
8006
+ else
8007
+ return true ;
8008
+ return false ;
8007
8009
}
8008
8010
8009
8011
// / parseDirectiveWord
@@ -8013,16 +8015,18 @@ bool ARMAsmParser::parseDirectiveWord(unsigned Size, SMLoc L) {
8013
8015
for (;;) {
8014
8016
const MCExpr *Value;
8015
8017
if (getParser ().parseExpression (Value))
8016
- return true ;
8018
+ return false ;
8017
8019
8018
8020
getParser ().getStreamer ().EmitValue (Value, Size);
8019
8021
8020
8022
if (getLexer ().is (AsmToken::EndOfStatement))
8021
8023
break ;
8022
8024
8023
8025
// FIXME: Improve diagnostic.
8024
- if (getLexer ().isNot (AsmToken::Comma))
8025
- return Error (L, " unexpected token in directive" );
8026
+ if (getLexer ().isNot (AsmToken::Comma)) {
8027
+ Error (L, " unexpected token in directive" );
8028
+ return false ;
8029
+ }
8026
8030
Parser.Lex ();
8027
8031
}
8028
8032
}
@@ -8034,12 +8038,16 @@ bool ARMAsmParser::parseDirectiveWord(unsigned Size, SMLoc L) {
8034
8038
// / parseDirectiveThumb
8035
8039
// / ::= .thumb
8036
8040
bool ARMAsmParser::parseDirectiveThumb (SMLoc L) {
8037
- if (getLexer ().isNot (AsmToken::EndOfStatement))
8038
- return Error (L, " unexpected token in directive" );
8041
+ if (getLexer ().isNot (AsmToken::EndOfStatement)) {
8042
+ Error (L, " unexpected token in directive" );
8043
+ return false ;
8044
+ }
8039
8045
Parser.Lex ();
8040
8046
8041
- if (!hasThumb ())
8042
- return Error (L, " target does not support Thumb mode" );
8047
+ if (!hasThumb ()) {
8048
+ Error (L, " target does not support Thumb mode" );
8049
+ return false ;
8050
+ }
8043
8051
8044
8052
if (!isThumb ())
8045
8053
SwitchMode ();
@@ -8050,12 +8058,16 @@ bool ARMAsmParser::parseDirectiveThumb(SMLoc L) {
8050
8058
// / parseDirectiveARM
8051
8059
// / ::= .arm
8052
8060
bool ARMAsmParser::parseDirectiveARM (SMLoc L) {
8053
- if (getLexer ().isNot (AsmToken::EndOfStatement))
8054
- return Error (L, " unexpected token in directive" );
8061
+ if (getLexer ().isNot (AsmToken::EndOfStatement)) {
8062
+ Error (L, " unexpected token in directive" );
8063
+ return false ;
8064
+ }
8055
8065
Parser.Lex ();
8056
8066
8057
- if (!hasARM ())
8058
- return Error (L, " target does not support ARM mode" );
8067
+ if (!hasARM ()) {
8068
+ Error (L, " target does not support ARM mode" );
8069
+ return false ;
8070
+ }
8059
8071
8060
8072
if (isThumb ())
8061
8073
SwitchMode ();
@@ -8081,8 +8093,10 @@ bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) {
8081
8093
if (isMachO) {
8082
8094
const AsmToken &Tok = Parser.getTok ();
8083
8095
if (Tok.isNot (AsmToken::EndOfStatement)) {
8084
- if (Tok.isNot (AsmToken::Identifier) && Tok.isNot (AsmToken::String))
8085
- return Error (L, " unexpected token in .thumb_func directive" );
8096
+ if (Tok.isNot (AsmToken::Identifier) && Tok.isNot (AsmToken::String)) {
8097
+ Error (L, " unexpected token in .thumb_func directive" );
8098
+ return false ;
8099
+ }
8086
8100
MCSymbol *Func =
8087
8101
getParser ().getContext ().GetOrCreateSymbol (Tok.getIdentifier ());
8088
8102
getParser ().getStreamer ().EmitThumbFunc (Func);
@@ -8091,8 +8105,10 @@ bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) {
8091
8105
}
8092
8106
}
8093
8107
8094
- if (getLexer ().isNot (AsmToken::EndOfStatement))
8095
- return Error (L, " unexpected token in directive" );
8108
+ if (getLexer ().isNot (AsmToken::EndOfStatement)) {
8109
+ Error (L, " unexpected token in directive" );
8110
+ return false ;
8111
+ }
8096
8112
8097
8113
NextSymbolIsThumb = true ;
8098
8114
@@ -8103,15 +8119,21 @@ bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) {
8103
8119
// / ::= .syntax unified | divided
8104
8120
bool ARMAsmParser::parseDirectiveSyntax (SMLoc L) {
8105
8121
const AsmToken &Tok = Parser.getTok ();
8106
- if (Tok.isNot (AsmToken::Identifier))
8107
- return Error (L, " unexpected token in .syntax directive" );
8122
+ if (Tok.isNot (AsmToken::Identifier)) {
8123
+ Error (L, " unexpected token in .syntax directive" );
8124
+ return false ;
8125
+ }
8108
8126
StringRef Mode = Tok.getString ();
8109
8127
if (Mode == " unified" || Mode == " UNIFIED" )
8110
8128
Parser.Lex ();
8111
- else if (Mode == " divided" || Mode == " DIVIDED" )
8112
- return Error (L, " '.syntax divided' arm asssembly not supported" );
8113
- else
8114
- return Error (L, " unrecognized syntax mode in .syntax directive" );
8129
+ else if (Mode == " divided" || Mode == " DIVIDED" ) {
8130
+ Error (L, " '.syntax divided' arm asssembly not supported" );
8131
+ return false ;
8132
+ }
8133
+ else {
8134
+ Error (L, " unrecognized syntax mode in .syntax directive" );
8135
+ return false ;
8136
+ }
8115
8137
8116
8138
if (getLexer ().isNot (AsmToken::EndOfStatement)) {
8117
8139
Error (Parser.getTok ().getLoc (), " unexpected token in directive" );
0 commit comments