[PATCH] Adding SmallString support to Twine
Yaron Keren
yaron.keren at gmail.com
Sat Mar 14 09:31:13 PDT 2015
================
Comment at: include/llvm/MC/MCContext.h:236-238
@@ -235,4 +235,5 @@
/// @param Name - The symbol name, which must be unique across all symbols.
MCSymbol *GetOrCreateSymbol(StringRef Name);
+ MCSymbol *GetOrCreateSymbol(const SmallVectorImpl<char> &Name);
MCSymbol *GetOrCreateSymbol(const Twine &Name);
----------------
chfast wrote:
> If Twine can handle SmallString now, wouldn't it be better to reduce the number of overloads in this case?
The preferred function is GetOrCreateSymbol(StringRef) in which Name directly indexes Symbols[]. GetOrCreateSymbol(Twine) is a slower convenience function, using a temporary buffer to print out the Twine into a SmallString and then call the StringRef version.
With MakeArgString the (StringRef) function is virtual and all other versions defer work to it.
I did notice MakeArgString(std::string Str) should take Str by reference and will update this.
http://reviews.llvm.org/D6372
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list