[lld] r193486 - Use equals_lower() rather than creating a temporary string with lower().
Chandler Carruth
chandlerc at gmail.com
Sat Oct 26 16:53:07 PDT 2013
Author: chandlerc
Date: Sat Oct 26 18:53:06 2013
New Revision: 193486
URL: http://llvm.org/viewvc/llvm-project?rev=193486&view=rev
Log:
Use equals_lower() rather than creating a temporary string with lower().
More important than any performance concerns, the code was dropping the
temporary string on the floor after assigning it to a StringRef, and
then used the StringRef later. Caught by running the LLD tests under
ASan.
Modified:
lld/trunk/include/lld/Core/LinkingContext.h
Modified: lld/trunk/include/lld/Core/LinkingContext.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=193486&r1=193485&r2=193486&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/LinkingContext.h (original)
+++ lld/trunk/include/lld/Core/LinkingContext.h Sat Oct 26 18:53:06 2013
@@ -265,10 +265,9 @@ public:
/// Set the various output file types that the linker would
/// create
bool setOutputFileType(StringRef outputFileType) {
- StringRef lowerOutputFileType = outputFileType.lower();
- if (lowerOutputFileType == "yaml")
+ if (outputFileType.equals_lower("yaml"))
_outputFileType = OutputFileType::YAML;
- else if (lowerOutputFileType == "native")
+ else if (outputFileType.equals_lower("native"))
_outputFileType = OutputFileType::YAML;
else
return false;
More information about the llvm-commits
mailing list