MASM allows arbitrary whitespace around the Intel dot operator, especially when used for struct field lookup
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This code is already so convoluted that I don't feel like I can provide very good code review for it. More tech debt can't hurt here, this codepath is already overleveraged with tech debt and needs to be rewritten. But if you want to push on through and add the functionality, it has good tests, so go for it.
llvm/lib/MC/MCParser/MasmParser.cpp | ||
---|---|---|
1383 | Please remote the stray whitespace change. | |
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | ||
1706 | My suggestion to try to simplify this code would be to use .slice to build two StringRefs, then check if they are non-empty, and unlex them if needed: StringRef LHS = Identifer.slice(0, dotOffset); StringRef RHS = Identifer.slice(dotOffset+1, Identifer.size()); if (LHS.empty()) .. UnLex LHS .. Unlex dot if (RHS.empty()) .. UnLex RHS That keeps all the index math closer together, less spread out. | |
1707 | Truly, breaking up identifiers into small chunks is the job of the lexer, but here we are anyway, breaking things up and "unlexing" them. |
Please remote the stray whitespace change.