This is an archive of the discontinued LLVM Phabricator instance.

Attributes: Add function getter to parse integer string attributes
ClosedPublic

Authored by arsenm on Dec 8 2022, 8:42 AM.

Details

Summary

The most common case for string attributes parses them as integers. We
don't have a convenient way to do this, and as a result we have
inconsistent missing attribute and invalid attribute handling
scattered around. We also have inconsistent radix usage to
getAsInteger; some places use the default 0 and others use base 10.

Update a few of the uses, but there are quite a lot of these.

Diff Detail

Event Timeline

arsenm created this revision.Dec 8 2022, 8:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2022, 8:42 AM
arsenm requested review of this revision.Dec 8 2022, 8:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2022, 8:43 AM
Herald added a subscriber: wdng. · View Herald Transcript
This revision is now accepted and ready to land.Dec 8 2022, 11:10 AM
aeubanks accepted this revision.Dec 8 2022, 11:11 AM

lg with one nit

llvm/lib/IR/Function.cpp
670

having the attribute name in the error would be helpful

arsenm added inline comments.Dec 8 2022, 11:12 AM
llvm/lib/IR/Function.cpp
670

It is, did you mean the function name?

aeubanks added inline comments.Dec 8 2022, 11:13 AM
llvm/lib/IR/Function.cpp
670

sorry, I meant Str, but function name would also be helpful