<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>It looks like this is causing the Valgrind bot failures:</div><div><br></div><div><a href="http://google1.osuosl.org:8011/builders/llvm-x86_64-linux-vg_leak/builds/1387">http://google1.osuosl.org:8011/builders/llvm-x86_64-linux-vg_leak/builds/1387</a></div><div><br></div><div>Cameron</div><br><div><div>On 2011-06-30, at 5:23 PM, Evan Cheng wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Author: evancheng<br>Date: Thu Jun 30 19:23:10 2011<br>New Revision: 134219<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=134219&view=rev">http://llvm.org/viewvc/llvm-project?rev=134219&view=rev</a><br>Log:<br>Switch SubtargetFeatures from std::string to StringRef.<br><br>Modified:<br> llvm/trunk/include/llvm/MC/SubtargetFeature.h<br> llvm/trunk/lib/MC/SubtargetFeature.cpp<br><br>Modified: llvm/trunk/include/llvm/MC/SubtargetFeature.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/SubtargetFeature.h?rev=134219&r1=134218&r2=134219&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/SubtargetFeature.h?rev=134219&r1=134218&r2=134219&view=diff</a><br>==============================================================================<br>--- llvm/trunk/include/llvm/MC/SubtargetFeature.h (original)<br>+++ llvm/trunk/include/llvm/MC/SubtargetFeature.h Thu Jun 30 19:23:10 2011<br>@@ -18,13 +18,13 @@<br> #ifndef LLVM_MC_SUBTARGETFEATURE_H<br> #define LLVM_MC_SUBTARGETFEATURE_H<br><br>-#include <string><br> #include <vector><br> #include "llvm/ADT/Triple.h"<br> #include "llvm/Support/DataTypes.h"<br><br> namespace llvm {<br> class raw_ostream;<br>+ class StringRef;<br><br> //===----------------------------------------------------------------------===//<br> ///<br>@@ -74,24 +74,23 @@<br> class SubtargetFeatures {<br> std::vector<std::string> Features; // Subtarget features as a vector<br> public:<br>- explicit SubtargetFeatures(const std::string &Initial = std::string());<br>+ explicit SubtargetFeatures(const StringRef Initial = "");<br><br> /// Features string accessors.<br>- std::string getString() const;<br>- void setString(const std::string &Initial);<br>+ StringRef getString() const;<br><br> /// Adding Features.<br>- void AddFeature(const std::string &String, bool IsEnabled = true);<br>+ void AddFeature(const StringRef String, bool IsEnabled = true);<br><br> /// Get feature bits of a CPU.<br>- uint64_t getFeatureBits(const std::string &CPU,<br>+ uint64_t getFeatureBits(const StringRef CPU,<br> const SubtargetFeatureKV *CPUTable,<br> size_t CPUTableSize,<br> const SubtargetFeatureKV *FeatureTable,<br> size_t FeatureTableSize);<br><br> /// Get scheduling itinerary of a CPU.<br>- void *getItinerary(const std::string &CPU,<br>+ void *getItinerary(const StringRef CPU,<br> const SubtargetInfoKV *Table, size_t TableSize);<br><br> /// Print feature string.<br><br>Modified: llvm/trunk/lib/MC/SubtargetFeature.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/SubtargetFeature.cpp?rev=134219&r1=134218&r2=134219&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/SubtargetFeature.cpp?rev=134219&r1=134218&r2=134219&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/MC/SubtargetFeature.cpp (original)<br>+++ llvm/trunk/lib/MC/SubtargetFeature.cpp Thu Jun 30 19:23:10 2011<br>@@ -27,7 +27,7 @@<br><br> /// hasFlag - Determine if a feature has a flag; '+' or '-'<br> ///<br>-static inline bool hasFlag(const std::string &Feature) {<br>+static inline bool hasFlag(const StringRef Feature) {<br> assert(!Feature.empty() && "Empty string");<br> // Get first character<br> char Ch = Feature[0];<br>@@ -37,13 +37,13 @@<br><br> /// StripFlag - Return string stripped of flag.<br> ///<br>-static inline std::string StripFlag(const std::string &Feature) {<br>+static inline std::string StripFlag(const StringRef Feature) {<br> return hasFlag(Feature) ? Feature.substr(1) : Feature;<br> }<br><br> /// isEnabled - Return true if enable flag; '+'.<br> ///<br>-static inline bool isEnabled(const std::string &Feature) {<br>+static inline bool isEnabled(const StringRef Feature) {<br> assert(!Feature.empty() && "Empty string");<br> // Get first character<br> char Ch = Feature[0];<br>@@ -53,16 +53,19 @@<br><br> /// PrependFlag - Return a string with a prepended flag; '+' or '-'.<br> ///<br>-static inline std::string PrependFlag(const std::string &Feature,<br>- bool IsEnabled) {<br>+static inline StringRef PrependFlag(const StringRef Feature,<br>+ bool IsEnabled) {<br> assert(!Feature.empty() && "Empty string");<br>- if (hasFlag(Feature)) return Feature;<br>- return std::string(IsEnabled ? "+" : "-") + Feature;<br>+ if (hasFlag(Feature))<br>+ return Feature;<br>+ std::string Prefix = IsEnabled ? "+" : "-";<br>+ Prefix += Feature;<br>+ return StringRef(Prefix);<br> }<br><br> /// Split - Splits a string of comma separated items in to a vector of strings.<br> ///<br>-static void Split(std::vector<std::string> &V, const std::string &S) {<br>+static void Split(std::vector<std::string> &V, const StringRef S) {<br> if (S.empty())<br> return;<br><br>@@ -106,7 +109,7 @@<br> }<br><br> /// Adding features.<br>-void SubtargetFeatures::AddFeature(const std::string &String,<br>+void SubtargetFeatures::AddFeature(const StringRef String,<br> bool IsEnabled) {<br> // Don't add empty features<br> if (!String.empty()) {<br>@@ -116,10 +119,10 @@<br> }<br><br> /// Find KV in array using binary search.<br>-template<typename T> const T *Find(const std::string &S, const T *A, size_t L) {<br>+template<typename T> const T *Find(const StringRef S, const T *A, size_t L) {<br> // Make the lower bound element we're looking for<br> T KV;<br>- KV.Key = S.c_str();<br>+ KV.Key = S.data();<br> // Determine the end of the array<br> const T *Hi = A + L;<br> // Binary search the array<br>@@ -173,21 +176,15 @@<br> // SubtargetFeatures Implementation<br> //===----------------------------------------------------------------------===//<br><br>-SubtargetFeatures::SubtargetFeatures(const std::string &Initial) {<br>+SubtargetFeatures::SubtargetFeatures(const StringRef Initial) {<br> // Break up string into separate features<br> Split(Features, Initial);<br> }<br><br><br>-std::string SubtargetFeatures::getString() const {<br>+StringRef SubtargetFeatures::getString() const {<br> return Join(Features);<br> }<br>-void SubtargetFeatures::setString(const std::string &Initial) {<br>- // Throw out old features<br>- Features.clear();<br>- // Break up string into separate features<br>- Split(Features, LowercaseString(Initial));<br>-}<br><br> /// SetImpliedBits - For each feature that is (transitively) implied by this<br> /// feature, set it.<br>@@ -229,7 +226,7 @@<br><br> /// getFeatureBits - Get feature bits a CPU.<br> ///<br>-uint64_t SubtargetFeatures::getFeatureBits(const std::string &CPU,<br>+uint64_t SubtargetFeatures::getFeatureBits(const StringRef CPU,<br> const SubtargetFeatureKV *CPUTable,<br> size_t CPUTableSize,<br> const SubtargetFeatureKV *FeatureTable,<br>@@ -272,7 +269,7 @@<br> }<br> // Iterate through each feature<br> for (size_t i = 0, E = Features.size(); i < E; i++) {<br>- const std::string &Feature = Features[i];<br>+ const StringRef Feature = Features[i];<br><br> // Check for help<br> if (Feature == "+help")<br>@@ -306,7 +303,7 @@<br> }<br><br> /// Get scheduling itinerary of a CPU.<br>-void *SubtargetFeatures::getItinerary(const std::string &CPU,<br>+void *SubtargetFeatures::getItinerary(const StringRef CPU,<br> const SubtargetInfoKV *Table,<br> size_t TableSize) {<br> assert(Table && "missing table");<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></div></blockquote></div><br></body></html>