Correctly parse end-of-statement tokens and handle preprocessor
end-of-line comments in ARM assembly processor.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Changes in this code can break many unrelated (and often untested) things. Let me add a few people that have worked in this area to have a look.
lib/Target/ARM/AsmParser/ARMAsmParser.cpp | ||
---|---|---|
9306 ↗ | (On Diff #76417) | Why are we ignoring the return of all the parsing functions? |
lib/Target/ARM/AsmParser/ARMAsmParser.cpp | ||
---|---|---|
9280 ↗ | (On Diff #76417) | parseDirectiveAlign needed to fail over to the generic align directive parser in AsmParser if it's special case was not encountered, but that violates the pattern here necessitating the return. |
9306 ↗ | (On Diff #76417) | ParseDirective returns false if the Target Parser is relevant and true if we skip it. This is contrary to the return true on error convention of the parser otherwise. As a result a number of directive parse functions violate the convention which is mostly okay because the results are mostly masked, e.g., we parse two statements in a single pass. I've just isolated the non-standard convention to this case function allowing the other parsing functions to be shorter and clearer. I plan on going through all of the parsers to fix the end-of-line parsing consistency and pushing all of the non-standardness into the various ParseDirective defs as well. Once they I'll do a once time change to make ParseDirective return true on error and just introspect on the Parser state to see if the target specific parser handled the result or not and the special case for parseDirectiveAlign to fall through will be obviated. |
To the best of my knowledge, it is a long patch, this looks ok. I couldn't see anything that is changing outside of an existing error condition so this shouldn't affect valid existing code.
Also, the giant directive parsing test case gives me confidence that changing the error return convention didn't break anything.