summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-10-18 02:09:31 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-10-18 02:09:31 +0000
commitce5a0b3deb85d40584f3007a5a53e4620ba69e4d (patch)
treea4352d9ee99242f616d9f9f6d87f942ce2926714 /clang/lib/AST
parentafff4340d5d00d0c017f028a8875b339db409172 (diff)
downloadbcm5719-llvm-ce5a0b3deb85d40584f3007a5a53e4620ba69e4d.tar.gz
bcm5719-llvm-ce5a0b3deb85d40584f3007a5a53e4620ba69e4d.zip
Switch ExtVectorElementExpr::getEncodedElementAccess to use StringRef.
- Really this should be simplified by the FIXME above, but I'm too deep in DFS. llvm-svn: 84392
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/Expr.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index c3cc4bd7412..83120d2c1c2 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -1766,14 +1766,14 @@ bool ExtVectorElementExpr::containsDuplicateElements() const {
/// 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++;
+ llvm::StringRef Comp = Accessor->getName();
+ if (Comp[0] == 's' || Comp[0] == 'S')
+ Comp = Comp.substr(1);
- bool isHi = !strcmp(compStr, "hi");
- bool isLo = !strcmp(compStr, "lo");
- bool isEven = !strcmp(compStr, "even");
- bool isOdd = !strcmp(compStr, "odd");
+ 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 @@ void ExtVectorElementExpr::getEncodedElementAccess(
else if (isOdd)
Index = 2 * i + 1;
else
- Index = ExtVectorType::getAccessorIdx(compStr[i]);
+ Index = ExtVectorType::getAccessorIdx(Comp[i]);
Elts.push_back(Index);
}
OpenPOWER on IntegriCloud