[cfe-commits] r41795 - /cfe/trunk/include/clang/AST/Type.h

Ted Kremenek kremenek at apple.com
Mon Sep 10 10:20:54 PDT 2007


Author: kremenek
Date: Mon Sep 10 12:20:54 2007
New Revision: 41795

URL: http://llvm.org/viewvc/llvm-project?rev=41795&view=rev
Log:
Added "isFunctionPointerType()" so that we can readily see if a DeclRefExpr
refers to a function.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Mon Sep 10 12:20:54 2007
@@ -265,11 +265,12 @@
   // type, ignoring typedefs.
   bool isFunctionType() const;
   bool isPointerType() const;
+  bool isFunctionPointerType() const;
   bool isReferenceType() const;
   bool isArrayType() const;
   bool isRecordType() const;
   bool isStructureType() const;   
-  bool isUnionType() const;
+  bool isUnionType() const;  
   bool isVectorType() const; // GCC vector type.
   bool isOCUVectorType() const; // OCU vector type.
   
@@ -868,6 +869,12 @@
 inline bool Type::isPointerType() const {
   return isa<PointerType>(CanonicalType);
 }
+inline bool Type::isFunctionPointerType() const {
+  if (const PointerType* T = dyn_cast<PointerType>(this))
+    return T->getPointeeType()->isFunctionType();
+  else
+    return false;
+}
 inline bool Type::isReferenceType() const {
   return isa<ReferenceType>(CanonicalType);
 }





More information about the cfe-commits mailing list