summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-05-14 17:11:05 +0000
committerZachary Turner <zturner@google.com>2017-05-14 17:11:05 +0000
commit7d186b016a18fd3421015b274e98b2fc7fdebe76 (patch)
treed2af18bae7003880486836defc8c43a152ea7cde /llvm/lib/Target/X86/X86TargetTransformInfo.cpp
parent4599eaa09a4cf3fff85bb099ba3c041b87b6305e (diff)
downloadbcm5719-llvm-7d186b016a18fd3421015b274e98b2fc7fdebe76.tar.gz
bcm5719-llvm-7d186b016a18fd3421015b274e98b2fc7fdebe76.zip
[StringExtras] Add llvm::to_integer.
This is a very thin wrapper around StringRef::getAsInteger. It serves three purposes. 1) It allows a cleaner syntax when you have something other than a StringRef - for example, a std::string or an llvm::SmallString. Previously, in this case you would have to write something like: StringRef(MyStr).getAsInteger(0, Result) by explicitly constructing a temporary StringRef. This can be done implicitly however with the new function by just writing: to_integer(MyStr, ...). 2) Correcting the travesty that is getAsInteger's return value. This function returns true on success, and false on failure. While this may cause confusion with people familiar with the getAsInteger API, there seems to be widespread agreement that the return semantics of getAsInteger was a mistake. 3) It allows the Radix to be deduced as a default argument by putting it last in the parameter list. Most uses of getAsInteger pass 0 for the first argument. With this syntax it can just be omitted. llvm-svn: 303011
Diffstat (limited to 'llvm/lib/Target/X86/X86TargetTransformInfo.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud