[cfe-commits] r59608 - /cfe/trunk/lib/AST/Expr.cpp
Chris Lattner
sabre at nondot.org
Tue Nov 18 23:55:05 PST 2008
Author: lattner
Date: Wed Nov 19 01:55:04 2008
New Revision: 59608
URL: http://llvm.org/viewvc/llvm-project?rev=59608&view=rev
Log:
simplify some code.
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=59608&r1=59607&r2=59608&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed Nov 19 01:55:04 2008
@@ -1141,9 +1141,9 @@
/// 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 @@
/// 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;
More information about the cfe-commits
mailing list