[cfe-commits] r45155 - in /cfe/trunk: AST/Type.cpp include/clang/AST/Type.h

Chris Lattner sabre at nondot.org
Mon Dec 17 23:18:16 PST 2007


Author: lattner
Date: Tue Dec 18 01:18:16 2007
New Revision: 45155

URL: http://llvm.org/viewvc/llvm-project?rev=45155&view=rev
Log:
remove the loc argument to Type::isConstantSizeType, which isn't useful.

Modified:
    cfe/trunk/AST/Type.cpp
    cfe/trunk/include/clang/AST/Type.h

Modified: cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/Type.cpp?rev=45155&r1=45154&r2=45155&view=diff

==============================================================================
--- cfe/trunk/AST/Type.cpp (original)
+++ cfe/trunk/AST/Type.cpp Tue Dec 18 01:18:16 2007
@@ -446,17 +446,13 @@
          CanonicalType->getTypeClass() == VariableArray;
 }
 
-// The only variable size types are auto arrays within a function. Structures 
-// cannot contain a VLA member. They can have a flexible array member, however
-// the structure is still constant size (C99 6.7.2.1p16).
-bool Type::isConstantSizeType(ASTContext &Ctx, SourceLocation *Loc) const {
+/// isConstantSizeType - Return true if this is not a variable sized type,
+/// according to the rules of C99 6.7.5p3.  It is not legal to call this on
+/// incomplete types.
+bool Type::isConstantSizeType(ASTContext &Ctx) const {
   assert(!isIncompleteType() && "This doesn't make sense for incomplete types");
-  if (const VariableArrayType *VAT =dyn_cast<VariableArrayType>(CanonicalType)){
-    // The VAT must have a size, as it is known to be complete.
-    if (Loc) *Loc = VAT->getSizeExpr()->getLocStart();
-    return false;
-  }
-  return true;
+  // The VAT must have a size, as it is known to be complete.
+  return !isa<VariableArrayType>(CanonicalType);
 }
 
 /// isIncompleteType - Return true if this is an incomplete type (C99 6.2.5p1)

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

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Dec 18 01:18:16 2007
@@ -338,10 +338,9 @@
   bool isUnsignedIntegerType() const;
 
   /// isConstantSizeType - Return true if this is not a variable sized type,
-  /// according to the rules of C99 6.7.5p3.  If Loc is non-null, it is set to
-  /// the location of the subexpression that makes it a vla type.  It is not
-  /// legal to call this on incomplete types.
-  bool isConstantSizeType(ASTContext &Ctx, SourceLocation *Loc = 0) const;
+  /// according to the rules of C99 6.7.5p3.  It is not legal to call this on
+  /// incomplete types.
+  bool isConstantSizeType(ASTContext &Ctx) const;
 private:  
   QualType getCanonicalTypeInternal() const { return CanonicalType; }
   friend class QualType;





More information about the cfe-commits mailing list