diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-19 07:55:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-19 07:55:04 +0000 |
commit | 7e3e9b152e06edf329ceb32190d3255f248d4d5f (patch) | |
tree | b86e8a46631a51064d923c9cd0015e7ac2018357 /lib/AST/Expr.cpp | |
parent | 6898e33d0b28346a4dbe9a666e0e4188fea80460 (diff) |
simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59608 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index d2c9ea9573..49a4d77783 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1141,9 +1141,9 @@ unsigned ExtVectorElementExpr::getNumElements() const { /// containsDuplicateElements - Return true if any element access is repeated. bool ExtVectorElementExpr::containsDuplicateElements() const { const char *compStr = Accessor.getName(); - unsigned length = strlen(compStr); + unsigned length = Accessor.getLength(); - for (unsigned i = 0; i < length-1; i++) { + for (unsigned i = 0; i != length-1; i++) { const char *s = compStr+i; for (const char c = *s++; *s; s++) if (c == *s) @@ -1155,13 +1155,12 @@ 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(); - - bool isHi = !strcmp(compStr, "hi"); - bool isLo = !strcmp(compStr, "lo"); - bool isEven = !strcmp(compStr, "e"); - bool isOdd = !strcmp(compStr, "o"); + bool isHi = Accessor.isName("hi"); + bool isLo = Accessor.isName("lo"); + bool isEven = Accessor.isName("e"); + bool isOdd = Accessor.isName("o"); + const char *compStr = Accessor.getName(); for (unsigned i = 0, e = getNumElements(); i != e; ++i) { uint64_t Index; |