[cfe-commits] r40639 - in /cfe/trunk: AST/Type.cpp Sema/SemaExpr.cpp clang.xcodeproj/project.pbxproj include/clang/AST/Type.h

Chris Lattner sabre at nondot.org
Tue Jul 31 09:53:04 PDT 2007


Author: lattner
Date: Tue Jul 31 11:53:04 2007
New Revision: 40639

URL: http://llvm.org/viewvc/llvm-project?rev=40639&view=rev
Log:
make isPointerType() a pure predicate, rename the
existing one to getAsPointerType()

Modified:
    cfe/trunk/AST/Type.cpp
    cfe/trunk/Sema/SemaExpr.cpp
    cfe/trunk/clang.xcodeproj/project.pbxproj
    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=40639&r1=40638&r2=40639&view=diff

==============================================================================
--- cfe/trunk/AST/Type.cpp (original)
+++ cfe/trunk/AST/Type.cpp Tue Jul 31 11:53:04 2007
@@ -68,7 +68,10 @@
   return 0;
 }
 
-const PointerType *Type::isPointerType() const {
+// FIXME: move inline
+bool Type::isPointerType() const { return isa<PointerType>(CanonicalType); }
+
+const PointerType *Type::getAsPointerType() const {
   // If this is directly a pointer type, return it.
   if (const PointerType *PTy = dyn_cast<PointerType>(this))
     return PTy;

Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=40639&r1=40638&r2=40639&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Tue Jul 31 11:53:04 2007
@@ -303,12 +303,12 @@
   // and index from the expression types.
   Expr *BaseExpr, *IndexExpr;
   QualType ResultType;
-  if (const PointerType *PTy = LHSTy->isPointerType()) {
+  if (const PointerType *PTy = LHSTy->getAsPointerType()) {
     BaseExpr = LHSExp;
     IndexExpr = RHSExp;
     // FIXME: need to deal with const...
     ResultType = PTy->getPointeeType();
-  } else if (const PointerType *PTy = RHSTy->isPointerType()) {
+  } else if (const PointerType *PTy = RHSTy->getAsPointerType()) {
      // Handle the uncommon case of "123[Ptr]".
     BaseExpr = RHSExp;
     IndexExpr = LHSExp;
@@ -409,7 +409,7 @@
   assert(!BaseType.isNull() && "no type for member expression");
   
   if (OpKind == tok::arrow) {
-    if (const PointerType *PT = BaseType->isPointerType())
+    if (const PointerType *PT = BaseType->getAsPointerType())
       BaseType = PT->getPointeeType();
     else
       return Diag(OpLoc, diag::err_typecheck_member_reference_arrow,
@@ -1290,7 +1290,7 @@
   UsualUnaryConversions(op);
   QualType qType = op->getType();
   
-  if (const PointerType *PT = qType->isPointerType()) {
+  if (const PointerType *PT = qType->getAsPointerType()) {
     QualType ptype = PT->getPointeeType();
     // C99 6.5.3.2p4. "if it points to an object,...".
     if (ptype->isIncompleteType()) { // An incomplete type is not an object

Modified: cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=40639&r1=40638&r2=40639&view=diff

==============================================================================
--- cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/trunk/clang.xcodeproj/project.pbxproj Tue Jul 31 11:53:04 2007
@@ -191,7 +191,7 @@
 		1A869AA70BA21ABA008DA07A /* LiteralSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LiteralSupport.cpp; sourceTree = "<group>"; };
 		84D9A8870C1A57E100AC7ABC /* AttributeList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = AttributeList.cpp; path = Parse/AttributeList.cpp; sourceTree = "<group>"; };
 		84D9A88B0C1A581300AC7ABC /* AttributeList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AttributeList.h; path = clang/Parse/AttributeList.h; sourceTree = "<group>"; };
-		8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
+		8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
 		DE01DA480B12ADA300AC22CE /* PPCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PPCallbacks.h; sourceTree = "<group>"; };
 		DE06756B0C051CFE00EBBFD8 /* ParseExprCXX.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ParseExprCXX.cpp; path = Parse/ParseExprCXX.cpp; sourceTree = "<group>"; };
 		DE06B73D0A8307640050E87E /* LangOptions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = LangOptions.h; sourceTree = "<group>"; };

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

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Jul 31 11:53:04 2007
@@ -240,7 +240,8 @@
   /// Derived types (C99 6.2.5p20).
   bool isDerivedType() const;
   const FunctionType *isFunctionType() const;   
-  const PointerType *isPointerType() const;
+  bool isPointerType() const;
+  const PointerType *getAsPointerType() const;
   const ReferenceType *isReferenceType() const;
   const ArrayType *isArrayType() const;
   const RecordType *isRecordType() const;





More information about the cfe-commits mailing list