This is an archive of the discontinued LLVM Phabricator instance.

[AsmParser]Emit an error if a macro has two (or more) parameters sharing the same name
ClosedPublic

Authored by coby on Apr 4 2017, 11:25 AM.

Details

Summary

Introducing a new error to macro parameters' parsing:
currently, llvm-mc won't complain if a macro have two (or more) named params with the same name.
this behavior is false, as there's no merit in having some params sharing a name.
now, instead of tolerate such a phenomena - emit an appropriate error.

Diff Detail

Repository
rL LLVM

Event Timeline

coby created this revision.Apr 4 2017, 11:25 AM

please add any other reviewers you may see as fitting here

rengolin added inline comments.
test/MC/AsmParser/macro-duplicate-params-names-err.s
1

This will fail on bots that don't build x86. Either remove the triple or move the test to an x86-specific test.

compnerd accepted this revision.Apr 5 2017, 10:19 AM

Please address the issue that @rengolin pointed out. There is no reason to have an explicit triple here, as the test is agnostic. Just drop the nop in the macro.

lib/MC/MCParser/AsmParser.cpp
3880

I think I would prefer multiple rather than at least two.

This revision is now accepted and ready to land.Apr 5 2017, 10:19 AM
coby added a comment.Apr 8 2017, 1:09 PM

thanks for the detailed and prompt response
commited version will reflect requested modifications

This revision was automatically updated to reflect the committed changes.