[cfe-commits] r99805 - in /cfe/trunk: include/clang/AST/Type.h lib/AST/ASTContext.cpp lib/Analysis/CFG.cpp lib/Checker/NoReturnFunctionChecker.cpp lib/Sema/AnalysisBasedWarnings.cpp

Rafael Espindola rafael.espindola at gmail.com
Sun Mar 28 20:39:47 PDT 2010


Author: rafael
Date: Sun Mar 28 22:39:46 2010
New Revision: 99805

URL: http://llvm.org/viewvc/llvm-project?rev=99805&view=rev
Log:
Be a bit more consistent in using operator->

This patch moves some methods from QualType to Type and changes the users to
use -> instead of .


Modified:
    cfe/trunk/include/clang/AST/Type.h
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/Analysis/CFG.cpp
    cfe/trunk/lib/Checker/NoReturnFunctionChecker.cpp
    cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=99805&r1=99804&r2=99805&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Sun Mar 28 22:39:46 2010
@@ -678,14 +678,6 @@
     return getObjCGCAttr() == Qualifiers::Strong;
   }
 
-  /// getNoReturnAttr - Returns true if the type has the noreturn attribute,
-  /// false otherwise.
-  bool getNoReturnAttr() const;
-
-  /// getCallConv - Returns the calling convention of the type if the type
-  /// is a function type, CC_Default otherwise.
-  CallingConv getCallConv() const;
-
 private:
   // These methods are implemented in a separate translation unit;
   // "static"-ize them to avoid creating temporary QualTypes in the
@@ -946,6 +938,14 @@
   /// pointer, this returns the respective pointee.
   QualType getPointeeType() const;
 
+  /// getNoReturnAttr - Returns true if the type has the noreturn attribute,
+  /// false otherwise.
+  bool getNoReturnAttr() const;
+
+  /// getCallConv - Returns the calling convention of the type if the type
+  /// is a function type, CC_Default otherwise.
+  CallingConv getCallConv() const;
+
   /// getUnqualifiedDesugaredType() - Return the specified type with
   /// any "sugar" removed from the type, removing any typedefs,
   /// typeofs, etc., as well as any qualifiers.
@@ -2938,12 +2938,11 @@
 
   /// getNoReturnAttr - Returns true if the type has the noreturn attribute,
   /// false otherwise.
-inline bool QualType::getNoReturnAttr() const {
-  QualType CT = getTypePtr()->getCanonicalTypeInternal();
-  if (const PointerType *PT = getTypePtr()->getAs<PointerType>()) {
+inline bool Type::getNoReturnAttr() const {
+  if (const PointerType *PT = getAs<PointerType>()) {
     if (const FunctionType *FT = PT->getPointeeType()->getAs<FunctionType>())
       return FT->getNoReturnAttr();
-  } else if (const FunctionType *FT = getTypePtr()->getAs<FunctionType>())
+  } else if (const FunctionType *FT = getAs<FunctionType>())
     return FT->getNoReturnAttr();
 
   return false;
@@ -2951,19 +2950,19 @@
 
 /// getCallConv - Returns the calling convention of the type if the type
 /// is a function type, CC_Default otherwise.
-inline CallingConv QualType::getCallConv() const {
-  if (const PointerType *PT = getTypePtr()->getAs<PointerType>())
-    return PT->getPointeeType().getCallConv();
-  else if (const ReferenceType *RT = getTypePtr()->getAs<ReferenceType>())
-    return RT->getPointeeType().getCallConv();
+inline CallingConv Type::getCallConv() const {
+  if (const PointerType *PT = getAs<PointerType>())
+    return PT->getPointeeType()->getCallConv();
+  else if (const ReferenceType *RT = getAs<ReferenceType>())
+    return RT->getPointeeType()->getCallConv();
   else if (const MemberPointerType *MPT =
-           getTypePtr()->getAs<MemberPointerType>())
-    return MPT->getPointeeType().getCallConv();
+           getAs<MemberPointerType>())
+    return MPT->getPointeeType()->getCallConv();
   else if (const BlockPointerType *BPT =
-           getTypePtr()->getAs<BlockPointerType>()) {
+           getAs<BlockPointerType>()) {
     if (const FunctionType *FT = BPT->getPointeeType()->getAs<FunctionType>())
       return FT->getCallConv();
-  } else if (const FunctionType *FT = getTypePtr()->getAs<FunctionType>())
+  } else if (const FunctionType *FT = getAs<FunctionType>())
     return FT->getCallConv();
 
   return CC_Default;

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=99805&r1=99804&r2=99805&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Mar 28 22:39:46 2010
@@ -1144,11 +1144,11 @@
 }
 
 QualType ASTContext::getNoReturnType(QualType T, bool AddNoReturn) {
-  return getNoReturnCallConvType(*this, T, AddNoReturn, T.getCallConv());
+  return getNoReturnCallConvType(*this, T, AddNoReturn, T->getCallConv());
 }
 
 QualType ASTContext::getCallConvType(QualType T, CallingConv CallConv) {
-  return getNoReturnCallConvType(*this, T, T.getNoReturnAttr(), CallConv);
+  return getNoReturnCallConvType(*this, T, T->getNoReturnAttr(), CallConv);
 }
 
 /// getComplexType - Return the uniqued reference to the type for a complex

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=99805&r1=99804&r2=99805&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Sun Mar 28 22:39:46 2010
@@ -571,7 +571,7 @@
 CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, AddStmtChoice asc) {
   // If this is a call to a no-return function, this stops the block here.
   bool NoReturn = false;
-  if (C->getCallee()->getType().getNoReturnAttr()) {
+  if (C->getCallee()->getType()->getNoReturnAttr()) {
     NoReturn = true;
   }
 

Modified: cfe/trunk/lib/Checker/NoReturnFunctionChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/NoReturnFunctionChecker.cpp?rev=99805&r1=99804&r2=99805&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/NoReturnFunctionChecker.cpp (original)
+++ cfe/trunk/lib/Checker/NoReturnFunctionChecker.cpp Sun Mar 28 22:39:46 2010
@@ -37,7 +37,7 @@
   const GRState *state = C.getState();
   const Expr *Callee = CE->getCallee();
 
-  bool BuildSinks = Callee->getType().getNoReturnAttr();
+  bool BuildSinks = Callee->getType()->getNoReturnAttr();
 
   if (!BuildSinks) {
     SVal L = state->getSVal(Callee);

Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=99805&r1=99804&r2=99805&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original)
+++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Sun Mar 28 22:39:46 2010
@@ -154,7 +154,7 @@
         continue;
       }
       Expr *CEE = C->getCallee()->IgnoreParenCasts();
-      if (CEE->getType().getNoReturnAttr()) {
+      if (CEE->getType()->getNoReturnAttr()) {
         NoReturnEdge = true;
         HasFakeEdge = true;
       } else if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(CEE)) {





More information about the cfe-commits mailing list