[llvm-commits] Twines

Daniel Dunbar daniel at zuster.org
Thu Jul 23 00:26:27 PDT 2009


Here are the patches to add "Twines" to LLVM, as described on
llvm-dev. The first patch is the Twine data structure, the second
patch changes llvm::Value to use it -- it mostly amounts to a search
and replace of 'const std::string &' to 'const Twine &' over the
relevant APIs.

These are basically the minimal delta to implement and test them, to
verify they are effective. Two features are missing:
 1. llvm::Value does not yet use the 'null' Twine.
 2. There is no direct support for concatenating integers-as-strings.

There are also a number of hacks to make introducing Twines easier,
which should be removed:
 1. Twine shouldn't actually have a conversion operator to std::string.
 2. The patch hacks in support for writing StringRef's to
std::ostream, we should move clients to raw_ostream instead.
 3. We probably don't want Twine.h in Value.h, clients should
explicitly import it if they want to get implicit string
concatenation.

Cheers,
 - Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Twine.0.patch
Type: application/octet-stream
Size: 17643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090723/e5a7d9b1/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Twine.1.patch
Type: application/octet-stream
Size: 97026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090723/e5a7d9b1/attachment-0001.obj>


More information about the llvm-commits mailing list