[cfe-commits] r40778 - in /cfe/trunk: AST/Expr.cpp include/clang/AST/Expr.h
Chris Lattner
sabre at nondot.org
Fri Aug 3 09:00:23 PDT 2007
Author: lattner
Date: Fri Aug 3 11:00:20 2007
New Revision: 40778
URL: http://llvm.org/viewvc/llvm-project?rev=40778&view=rev
Log:
add OCUVectorComponent::getNumComponents()
Modified:
cfe/trunk/AST/Expr.cpp
cfe/trunk/include/clang/AST/Expr.h
Modified: cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Expr.cpp?rev=40778&r1=40777&r2=40778&view=diff
==============================================================================
--- cfe/trunk/AST/Expr.cpp (original)
+++ cfe/trunk/AST/Expr.cpp Fri Aug 3 11:00:20 2007
@@ -583,6 +583,11 @@
return isIntegerConstantExpr(Val, Ctx, 0, true) && Val == 0;
}
+unsigned OCUVectorComponent::getNumComponents() const {
+ return strlen(Accessor.getName());
+}
+
+
/// getComponentType - Determine whether the components of this access are
/// "point" "color" or "texture" elements.
OCUVectorComponent::ComponentType OCUVectorComponent::getComponentType() const {
@@ -615,7 +620,7 @@
/// getEncodedElementAccess - We encode fields with two bits per component.
unsigned OCUVectorComponent::getEncodedElementAccess() const {
const char *compStr = Accessor.getName();
- unsigned length = strlen(compStr);
+ unsigned length = getNumComponents();
unsigned Result = 0;
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=40778&r1=40777&r2=40778&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Fri Aug 3 11:00:20 2007
@@ -486,6 +486,9 @@
IdentifierInfo &getAccessor() const { return Accessor; }
+ /// getNumComponents - Get the number of components being selected.
+ unsigned getNumComponents() const;
+
/// getComponentType - Determine whether the components of this access are
/// "point" "color" or "texture" elements.
ComponentType getComponentType() const;
More information about the cfe-commits
mailing list