[cfe-commits] r40760 - in /cfe/trunk: AST/Expr.cpp include/clang/AST/Expr.h

Chris Lattner sabre at nondot.org
Thu Aug 2 14:47:28 PDT 2007


Author: lattner
Date: Thu Aug  2 16:47:28 2007
New Revision: 40760

URL: http://llvm.org/viewvc/llvm-project?rev=40760&view=rev
Log:
Minor comment improvements.

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=40760&r1=40759&r2=40760&view=diff

==============================================================================
--- cfe/trunk/AST/Expr.cpp (original)
+++ cfe/trunk/AST/Expr.cpp Thu Aug  2 16:47:28 2007
@@ -583,6 +583,8 @@
   return isIntegerConstantExpr(Val, Ctx, 0, true) && Val == 0;
 }
 
+/// getComponentType - Determine whether the components of this access are
+/// "point" "color" or "texture" elements.
 OCUVectorComponent::ComponentType OCUVectorComponent::getComponentType() const {
   // derive the component type, no need to waste space.
   const char *compStr = Accessor.getName();
@@ -593,6 +595,8 @@
   assert(0 && "getComponentType(): Illegal accessor");
 }
 
+/// containsDuplicateComponents - Return true if any element access is
+/// repeated.
 bool OCUVectorComponent::containsDuplicateComponents() const {
   const char *compStr = Accessor.getName();
   unsigned length = strlen(compStr);

Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=40760&r1=40759&r2=40760&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Thu Aug  2 16:47:28 2007
@@ -463,7 +463,9 @@
   static bool classof(const MemberExpr *) { return true; }
 };
 
-/// OCUVectorComponent
+/// OCUVectorComponent - This represents access to specific components of a
+/// vector, and may occur on the left hand side or right hand side.  For example
+/// the following is legal:  "V.xy = V.zw" if V is a 4 element ocu vector.
 ///
 class OCUVectorComponent : public Expr {
   Expr *Base;
@@ -471,18 +473,25 @@
   SourceLocation AccessorLoc;
 public:
   enum ComponentType {
-    Point,
-    Color,
-    Texture
+    Point,   // xywz
+    Color,   // rgba
+    Texture  // uv
   };
   OCUVectorComponent(QualType ty, Expr *base, IdentifierInfo &accessor,
                      SourceLocation loc) : Expr(OCUVectorComponentClass, ty), 
                      Base(base), Accessor(accessor), AccessorLoc(loc) {}
                      
-  Expr *getBase() const { return Base; }
-  IdentifierInfo & getAccessor() const { return Accessor; }
+  const Expr *getBase() const { return Base; }
+  Expr *getBase() { return Base; }
+  
+  IdentifierInfo &getAccessor() const { return Accessor; }
+  
+  /// getComponentType - Determine whether the components of this access are
+  /// "point" "color" or "texture" elements.
   ComponentType getComponentType() const;
 
+  /// containsDuplicateComponents - Return true if any element access is
+  /// repeated.
   bool containsDuplicateComponents() const;
   
   virtual SourceRange getSourceRange() const {





More information about the cfe-commits mailing list