llvm.org GIT mirror llvm / 9035f6b
MS asm: The initial dot in struct access is optional Fixes PR18994. Tests, once again, in that other repository. =P git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203146 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Kleckner 6 years ago
2 changed file(s) with 21 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
45824582 break;
45834583 }
45844584 case AOK_DotOperator:
4585 // Insert the dot if the user omitted it.
4586 OS.flush();
4587 if (AsmStringIR.back() != '.')
4588 OS << '.';
45854589 OS << (*I).Val;
45864590 break;
45874591 }
10741074 if (getParser().parsePrimaryExpr(Val, End))
10751075 return Error(Tok.getLoc(), "Unexpected identifier!");
10761076 } else {
1077 InlineAsmIdentifierInfo &Info = SM.getIdentifierInfo();
1078 if (ParseIntelIdentifier(Val, Identifier, Info,
1079 /*Unevaluated=*/false, End))
1080 return true;
1077 // This is a dot operator, not an adjacent identifier.
1078 if (Identifier.find('.') != StringRef::npos) {
1079 return false;
1080 } else {
1081 InlineAsmIdentifierInfo &Info = SM.getIdentifierInfo();
1082 if (ParseIntelIdentifier(Val, Identifier, Info,
1083 /*Unevaluated=*/false, End))
1084 return true;
1085 }
10811086 }
10821087 SM.onIdentifierExpr(Val, Identifier);
10831088 UpdateLocLex = false;
11781183 Disp = Imm; // An immediate displacement only.
11791184 }
11801185
1181 // Parse the dot operator (e.g., [ebx].foo.bar).
1182 if (Tok.getString().startswith(".")) {
1186 // Parse struct field access. Intel requires a dot, but MSVC doesn't. MSVC
1187 // will in fact do global lookup the field name inside all global typedefs,
1188 // but we don't emulate that.
1189 if (Tok.getString().find('.') != StringRef::npos) {
11831190 const MCExpr *NewDisp;
11841191 if (ParseIntelDotOperator(Disp, NewDisp))
11851192 return 0;
13681375 else
13691376 return Error(Tok.getLoc(), "Non-constant offsets are not supported!");
13701377
1371 // Drop the '.'.
1372 StringRef DotDispStr = Tok.getString().drop_front(1);
1378 // Drop the optional '.'.
1379 StringRef DotDispStr = Tok.getString();
1380 if (DotDispStr.startswith("."))
1381 DotDispStr = DotDispStr.drop_front(1);
13731382
13741383 // .Imm gets lexed as a real.
13751384 if (Tok.is(AsmToken::Real)) {