diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-03-29 03:39:46 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-03-29 03:39:46 +0000 |
commit | 802c66edc5073991f2315ea84ecace1867c6027f (patch) | |
tree | 7694a103593d857c2fd1b692b4a7d78e995aaaa3 | |
parent | a7cde3bb62eccc087821ee91c4ee4f6fd9a76b44 (diff) |
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 .
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99805 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/Type.h | 41 | ||||
-rw-r--r-- | lib/AST/ASTContext.cpp | 4 | ||||
-rw-r--r-- | lib/Analysis/CFG.cpp | 2 | ||||
-rw-r--r-- | lib/Checker/NoReturnFunctionChecker.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/AnalysisBasedWarnings.cpp | 2 |
5 files changed, 25 insertions, 26 deletions
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index f59456edf8..e9368e8866 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -678,14 +678,6 @@ public: 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 @@ public: /// 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 @@ inline Qualifiers::GC QualType::getObjCGCAttr() const { /// 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 @@ inline bool QualType::getNoReturnAttr() const { /// 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; diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 7f2e35b263..f8f626a1e4 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1144,11 +1144,11 @@ static QualType getNoReturnCallConvType(ASTContext& Context, QualType T, } 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 diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index a4a021f20b..e93ddb34ca 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -571,7 +571,7 @@ static bool CanThrow(Expr *E) { 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; } diff --git a/lib/Checker/NoReturnFunctionChecker.cpp b/lib/Checker/NoReturnFunctionChecker.cpp index 80fea99c36..1a902dc2d8 100644 --- a/lib/Checker/NoReturnFunctionChecker.cpp +++ b/lib/Checker/NoReturnFunctionChecker.cpp @@ -37,7 +37,7 @@ void NoReturnFunctionChecker::PostVisitCallExpr(CheckerContext &C, 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); diff --git a/lib/Sema/AnalysisBasedWarnings.cpp b/lib/Sema/AnalysisBasedWarnings.cpp index 45b08db7e1..8b79e03ea8 100644 --- a/lib/Sema/AnalysisBasedWarnings.cpp +++ b/lib/Sema/AnalysisBasedWarnings.cpp @@ -154,7 +154,7 @@ static ControlFlowKind CheckFallThrough(AnalysisContext &AC) { 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)) { |