]> granicus.if.org Git - clang/commitdiff
Switch ExtVectorElementExpr::getEncodedElementAccess to use StringRef.
authorDaniel Dunbar <daniel@zuster.org>
Sun, 18 Oct 2009 02:09:31 +0000 (02:09 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sun, 18 Oct 2009 02:09:31 +0000 (02:09 +0000)
 - Really this should be simplified by the FIXME above, but I'm too deep in DFS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84392 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Expr.cpp

index c3cc4bd7412d5bbe466013e5e70a79c310bdffaf..83120d2c1c2ef4da5b4d230cb74c2736a3f86977 100644 (file)
@@ -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);
   }