diff options
author | Nate Begeman <natebegeman@mac.com> | 2009-01-18 02:01:21 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2009-01-18 02:01:21 +0000 |
commit | 7e5185b2649f1f5c95e01be3570c0edb529480fe (patch) | |
tree | f915284212cc06d4ac4aa8495288a6486be97425 /clang/lib/AST/Expr.cpp | |
parent | eb09754a9de51289a2c0987c94792fa5f53bbce5 (diff) | |
download | bcm5719-llvm-7e5185b2649f1f5c95e01be3570c0edb529480fe.tar.gz bcm5719-llvm-7e5185b2649f1f5c95e01be3570c0edb529480fe.zip |
A couple more vector component access fixes.
llvm-svn: 62443
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 6540b2ccc36..4dd06b924a2 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1160,6 +1160,17 @@ unsigned ExtVectorElementExpr::getNumElements() const { bool ExtVectorElementExpr::containsDuplicateElements() const { const char *compStr = Accessor.getName(); unsigned length = Accessor.getLength(); + + // Halving swizzles do not contain duplicate elements. + if (!strcmp(compStr, "hi") || !strcmp(compStr, "lo") || + !strcmp(compStr, "even") || !strcmp(compStr, "odd")) + return false; + + // Advance past s-char prefix on hex swizzles. + if (*compStr == 's') { + compStr++; + length--; + } for (unsigned i = 0; i != length-1; i++) { const char *s = compStr+i; |