[cfe-commits] r84392 - /cfe/trunk/lib/AST/Expr.cpp
Daniel Dunbar
daniel at zuster.org
Sat Oct 17 19:09:31 PDT 2009
Author: ddunbar
Date: Sat Oct 17 21:09:31 2009
New Revision: 84392
URL: http://llvm.org/viewvc/llvm-project?rev=84392&view=rev
Log:
Switch ExtVectorElementExpr::getEncodedElementAccess to use StringRef.
- Really this should be simplified by the FIXME above, but I'm too deep in DFS.
Modified:
cfe/trunk/lib/AST/Expr.cpp
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=84392&r1=84391&r2=84392&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sat Oct 17 21:09:31 2009
@@ -1766,14 +1766,14 @@
/// getEncodedElementAccess - We encode the fields as a llvm ConstantArray.
void ExtVectorElementExpr::getEncodedElementAccess(
llvm::SmallVectorImpl<unsigned> &Elts) const {
- const char *compStr = Accessor->getName();
- if (*compStr == 's' || *compStr == 'S')
- compStr++;
-
- bool isHi = !strcmp(compStr, "hi");
- bool isLo = !strcmp(compStr, "lo");
- bool isEven = !strcmp(compStr, "even");
- bool isOdd = !strcmp(compStr, "odd");
+ llvm::StringRef Comp = Accessor->getName();
+ if (Comp[0] == 's' || Comp[0] == 'S')
+ Comp = Comp.substr(1);
+
+ bool isHi = Comp == "hi";
+ bool isLo = Comp == "lo";
+ bool isEven = Comp == "even";
+ bool isOdd = Comp == "odd";
for (unsigned i = 0, e = getNumElements(); i != e; ++i) {
uint64_t Index;
@@ -1787,7 +1787,7 @@
else if (isOdd)
Index = 2 * i + 1;
else
- Index = ExtVectorType::getAccessorIdx(compStr[i]);
+ Index = ExtVectorType::getAccessorIdx(Comp[i]);
Elts.push_back(Index);
}
More information about the cfe-commits
mailing list