diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2015-08-30 07:51:04 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2015-08-30 07:51:04 +0000 |
commit | 3309ef6f02854949f9d64d69f82504c362fe3fd1 (patch) | |
tree | 7513d23f4fab9ad1a95aaa1d3bb23d0a5c83e3d9 /llvm/lib/Support/Triple.cpp | |
parent | 2d55698ed7509c3b0bccf898e120a713b4ebcd34 (diff) | |
download | llvm-3309ef6f02854949f9d64d69f82504c362fe3fd1.zip llvm-3309ef6f02854949f9d64d69f82504c362fe3fd1.tar.gz llvm-3309ef6f02854949f9d64d69f82504c362fe3fd1.tar.bz2 |
Teach the target parsing framework to directly compute the length of all
of its strings when expanding the string literals from the macros, and
push all of the APIs to be StringRef instead of C-string APIs.
This (remarkably) removes a very non-trivial number of strlen calls. It
even deletes code and complexity from one of the primary users -- Clang.
llvm-svn: 246374
Diffstat (limited to 'llvm/lib/Support/Triple.cpp')
-rw-r--r-- | llvm/lib/Support/Triple.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index 86b2d31..00a8f61 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -1290,7 +1290,7 @@ Triple Triple::getLittleEndianArchVariant() const { return T; } -const char *Triple::getARMCPUForArch(StringRef MArch) const { +StringRef Triple::getARMCPUForArch(StringRef MArch) const { if (MArch.empty()) MArch = getArchName(); MArch = ARM::getCanonicalArchName(MArch); @@ -1310,10 +1310,10 @@ const char *Triple::getARMCPUForArch(StringRef MArch) const { } if (MArch.empty()) - return nullptr; + return StringRef(); - const char *CPU = ARM::getDefaultCPU(MArch); - if (CPU) + StringRef CPU = ARM::getDefaultCPU(MArch); + if (!CPU.empty()) return CPU; // If no specific architecture version is requested, return the minimum CPU |