[llvm-commits] [patch] universally transition to non-const llvm::Type

David Blaikie dblaikie at gmail.com
Sat Jul 16 18:57:31 PDT 2011


If I've understood recent conversations on llvm-dev/commits, there is a
desire to transition all const llvm::Type references to non-const llvm::Type
references - I'm assuming this is because llvm::Type is now immutable anyway
it's just simpler to refer by non-const.

To that end I've attached a patch to do this universally (for verficiation I
did this with the following sed:
 sed -ie 's/const
\(llvm::\)\?\(Integer\|Function\|Composite\|Sequential\|Struct\|Array\|Pointer\|Vector\|\)\?Type\(\W\|$\)/\1\2Type\3/g'
Except in clang I only used the fully qualified name (removing the
optionality of the llvm:: group in the above regex) since there's a
clang::Type too) & made manual changes to Types.h, DerivedTypes.h, and
Types.cpp. Some functions that could be const are not - but would require
const overloads of other functions. Any functions returning Type* had to be
non-const so that users would get the non-const Type* they require.

Everything seems to build (debug+asserts, x86-32) and check-lit passes.

If I've misunderstood the goal here, or there's some other way this should
be approached, that's ok - I just thought I'd put this out there in case
it'd be useful.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110716/c6819b56/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nonconst_type.diff
Type: text/x-patch
Size: 696486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110716/c6819b56/attachment.bin>


More information about the llvm-commits mailing list