diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-09-11 10:48:12 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-09-11 10:48:12 +0200 |
commit | b4c9c0d137a9157b4efef213267fc3a6b75ed4b0 (patch) | |
tree | e9c158c2af85bdeeba25044756c435be697d7308 /compilerplugins | |
parent | 5bbfa7ab8ded08d73dcb86c5e9fa3692b629e5bf (diff) |
More clang::*Type vs. llvm::*Type ambiguities
Change-Id: I21133976793ab018c633dda077029666308526db
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/cstylecast.cxx | 6 | ||||
-rw-r--r-- | compilerplugins/clang/dyncastvisibility.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/faileddyncast.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/implicitboolconversion.cxx | 8 | ||||
-rw-r--r-- | compilerplugins/clang/refcounting.cxx | 20 | ||||
-rw-r--r-- | compilerplugins/clang/salbool.cxx | 10 | ||||
-rw-r--r-- | compilerplugins/clang/useuniqueptr.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/vclwidgets.cxx | 22 |
8 files changed, 40 insertions, 36 deletions
diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx index 8504ca573dcb..b428b1d1503f 100644 --- a/compilerplugins/clang/cstylecast.cxx +++ b/compilerplugins/clang/cstylecast.cxx @@ -26,8 +26,8 @@ bool areSimilar(QualType type1, QualType type2) { if (!t2->isPointerType()) { return false; } - auto t1a = t1->getAs<PointerType>(); - auto t2a = t2->getAs<PointerType>(); + auto t1a = t1->getAs<clang::PointerType>(); + auto t2a = t2->getAs<clang::PointerType>(); t1 = t1a->getPointeeType().getTypePtr(); t2 = t2a->getPointeeType().getTypePtr(); } else if (t1->isMemberPointerType()) { @@ -77,7 +77,7 @@ bool areSimilar(QualType type1, QualType type2) { QualType resolvePointers(QualType type) { while (type->isPointerType()) { - type = type->getAs<PointerType>()->getPointeeType(); + type = type->getAs<clang::PointerType>()->getPointeeType(); } return type; } diff --git a/compilerplugins/clang/dyncastvisibility.cxx b/compilerplugins/clang/dyncastvisibility.cxx index 31d20fba80d7..8cae22fbe534 100644 --- a/compilerplugins/clang/dyncastvisibility.cxx +++ b/compilerplugins/clang/dyncastvisibility.cxx @@ -91,7 +91,7 @@ public: if (auto const t = td->getAs<ReferenceType>()) { td = t->getPointeeType(); } - while (auto const t = td->getAs<PointerType>()) { + while (auto const t = td->getAs<clang::PointerType>()) { td = t->getPointeeType(); } auto const rtd = td->getAs<RecordType>(); @@ -104,7 +104,7 @@ public: return true; } auto ts = expr->getSubExpr()->getType(); - while (auto const t = ts->getAs<PointerType>()) { + while (auto const t = ts->getAs<clang::PointerType>()) { ts = t->getPointeeType(); } auto const rts = ts->getAs<RecordType>(); diff --git a/compilerplugins/clang/faileddyncast.cxx b/compilerplugins/clang/faileddyncast.cxx index 9be28f0a9f88..bdc9ce6e5fad 100644 --- a/compilerplugins/clang/faileddyncast.cxx +++ b/compilerplugins/clang/faileddyncast.cxx @@ -22,12 +22,12 @@ bool isAlwaysNull(CXXDynamicCastExpr const * expr) { QualType SrcType = expr->getSubExpr()->getType(); QualType DestType = expr->getType(); - if (const PointerType *SrcPTy = SrcType->getAs<PointerType>()) { + if (const clang::PointerType *SrcPTy = SrcType->getAs<clang::PointerType>()) { SrcType = SrcPTy->getPointeeType(); #if 0 DestType = DestType->castAs<PointerType>()->getPointeeType(); #else - auto DstPTy = DestType->getAs<PointerType>(); + auto DstPTy = DestType->getAs<clang::PointerType>(); if (!DstPTy) return false; DestType = DstPTy->getPointeeType(); diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx index 9bb8be2182c0..1151a78f4384 100644 --- a/compilerplugins/clang/implicitboolconversion.cxx +++ b/compilerplugins/clang/implicitboolconversion.cxx @@ -412,7 +412,7 @@ bool ImplicitBoolConversion::TraverseCXXMemberCallExpr(CXXMemberCallExpr * expr) = ignoreParenImpCastAndComma(expr->getImplicitObjectArgument()) ->getType(); if (dyn_cast<MemberExpr>(expr->getCallee())->isArrow()) { - ty = ty->getAs<PointerType>()->getPointeeType(); + ty = ty->getAs<clang::PointerType>()->getPointeeType(); } TemplateSpecializationType const * ct = ty->getAs<TemplateSpecializationType>(); @@ -913,7 +913,8 @@ bool ImplicitBoolConversion::isExternCFunctionCall( if (d != nullptr) { FunctionDecl const * fd = dyn_cast<FunctionDecl>(d); if (fd != nullptr) { - PointerType const * pt = fd->getType()->getAs<PointerType>(); + clang::PointerType const * pt = fd->getType() + ->getAs<clang::PointerType>(); QualType t2(pt == nullptr ? fd->getType() : pt->getPointeeType()); *functionType = t2->getAs<FunctionProtoType>(); assert( @@ -927,7 +928,8 @@ bool ImplicitBoolConversion::isExternCFunctionCall( } VarDecl const * vd = dyn_cast<VarDecl>(d); if (vd != nullptr) { - PointerType const * pt = vd->getType()->getAs<PointerType>(); + clang::PointerType const * pt = vd->getType() + ->getAs<clang::PointerType>(); *functionType = ((pt == nullptr ? vd->getType() : pt->getPointeeType()) ->getAs<FunctionProtoType>()); diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index 7585858db85f..05d7fe943b62 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -110,16 +110,16 @@ bool isDerivedFrom(const CXXRecordDecl *decl, DeclChecker base) { } -bool containsXInterfaceSubclass(const Type* pType0); +bool containsXInterfaceSubclass(const clang::Type* pType0); bool containsXInterfaceSubclass(const QualType& qType) { return containsXInterfaceSubclass(qType.getTypePtr()); } -bool containsXInterfaceSubclass(const Type* pType0) { +bool containsXInterfaceSubclass(const clang::Type* pType0) { if (!pType0) return false; - const Type* pType = pType0->getUnqualifiedDesugaredType(); + const clang::Type* pType = pType0->getUnqualifiedDesugaredType(); if (!pType) return false; const CXXRecordDecl* pRecordDecl = pType->getAsCXXRecordDecl(); @@ -229,7 +229,7 @@ bool containsXInterfaceSubclass(const Type* pType0) { // ignore return false; } else if (pType->isArrayType()) { - const ArrayType* pArrayType = dyn_cast<ArrayType>(pType); + const clang::ArrayType* pArrayType = dyn_cast<clang::ArrayType>(pType); QualType elementType = pArrayType->getElementType(); return containsXInterfaceSubclass(elementType); } else { @@ -237,10 +237,10 @@ bool containsXInterfaceSubclass(const Type* pType0) { } } -bool containsSvRefBaseSubclass(const Type* pType0) { +bool containsSvRefBaseSubclass(const clang::Type* pType0) { if (!pType0) return false; - const Type* pType = pType0->getUnqualifiedDesugaredType(); + const clang::Type* pType = pType0->getUnqualifiedDesugaredType(); if (!pType) return false; const CXXRecordDecl* pRecordDecl = pType->getAsCXXRecordDecl(); @@ -269,7 +269,7 @@ bool containsSvRefBaseSubclass(const Type* pType0) { // ignore return false; } else if (pType->isArrayType()) { - const ArrayType* pArrayType = dyn_cast<ArrayType>(pType); + const clang::ArrayType* pArrayType = dyn_cast<clang::ArrayType>(pType); QualType elementType = pArrayType->getElementType(); return containsSvRefBaseSubclass(elementType.getTypePtr()); } else { @@ -277,10 +277,10 @@ bool containsSvRefBaseSubclass(const Type* pType0) { } } -bool containsSalhelperReferenceObjectSubclass(const Type* pType0) { +bool containsSalhelperReferenceObjectSubclass(const clang::Type* pType0) { if (!pType0) return false; - const Type* pType = pType0->getUnqualifiedDesugaredType(); + const clang::Type* pType = pType0->getUnqualifiedDesugaredType(); if (!pType) return false; const CXXRecordDecl* pRecordDecl = pType->getAsCXXRecordDecl(); @@ -311,7 +311,7 @@ bool containsSalhelperReferenceObjectSubclass(const Type* pType0) { // ignore return false; } else if (pType->isArrayType()) { - const ArrayType* pArrayType = dyn_cast<ArrayType>(pType); + const clang::ArrayType* pArrayType = dyn_cast<clang::ArrayType>(pType); QualType elementType = pArrayType->getElementType(); return containsSalhelperReferenceObjectSubclass(elementType.getTypePtr()); } else { diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx index 8f42ef9e2b0f..19c715e13f9b 100644 --- a/compilerplugins/clang/salbool.cxx +++ b/compilerplugins/clang/salbool.cxx @@ -262,7 +262,8 @@ bool SalBool::VisitCallExpr(CallExpr * expr) { FunctionDecl const * fd = dyn_cast<FunctionDecl>(d); if (fd != nullptr) { if (!hasBoolOverload(fd, false)) { - PointerType const * pt = fd->getType()->getAs<PointerType>(); + clang::PointerType const * pt = fd->getType() + ->getAs<clang::PointerType>(); QualType t2( pt == nullptr ? fd->getType() : pt->getPointeeType()); ft = t2->getAs<FunctionProtoType>(); @@ -275,7 +276,8 @@ bool SalBool::VisitCallExpr(CallExpr * expr) { } else { VarDecl const * vd = dyn_cast<VarDecl>(d); if (vd != nullptr) { - PointerType const * pt = vd->getType()->getAs<PointerType>(); + clang::PointerType const * pt = vd->getType() + ->getAs<clang::PointerType>(); ft = (pt == nullptr ? vd->getType() : pt->getPointeeType()) ->getAs<FunctionProtoType>(); } @@ -290,7 +292,7 @@ bool SalBool::VisitCallExpr(CallExpr * expr) { b = !t.isConstQualified() && isSalBool(t); } else if (t->isPointerType()) { for (;;) { - auto t2 = t->getAs<PointerType>(); + auto t2 = t->getAs<clang::PointerType>(); if (t2 == nullptr) { break; } @@ -479,7 +481,7 @@ bool SalBool::VisitReturnStmt(ReturnStmt const * stmt) { return true; } for (;;) { - auto t2 = t->getAs<PointerType>(); + auto t2 = t->getAs<clang::PointerType>(); if (t2 == nullptr) { break; } diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index 0f6937f182b2..05b9dad2c801 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -337,7 +337,7 @@ void UseUniquePtr::CheckForDeleteOfPOD(const CompoundStmt* compoundStmt) if (tagDecl->isUnion()) continue; - auto pointerType = dyn_cast<PointerType>(fieldDecl->getType()->getUnqualifiedDesugaredType()); + auto pointerType = dyn_cast<clang::PointerType>(fieldDecl->getType()->getUnqualifiedDesugaredType()); QualType elementType = pointerType->getPointeeType(); auto tc = loplugin::TypeCheck(elementType); if (!elementType.isPODType(compiler.getASTContext()) diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index 29a4a891037c..c7695cfb5722 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -47,7 +47,7 @@ public: bool VisitCXXConstructExpr(const CXXConstructExpr *); bool VisitBinaryOperator(const BinaryOperator *); private: - void checkAssignmentForVclPtrToRawConversion(const SourceLocation& sourceLoc, const Type* lhsType, const Expr* rhs); + void checkAssignmentForVclPtrToRawConversion(const SourceLocation& sourceLoc, const clang::Type* lhsType, const Expr* rhs); bool isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl); bool mbCheckingMemcpy = false; }; @@ -85,7 +85,7 @@ bool isDerivedFromVclReferenceBase(const CXXRecordDecl *decl) { return false; } -bool containsVclReferenceBaseSubclass(const Type* pType0); +bool containsVclReferenceBaseSubclass(const clang::Type* pType0); bool containsVclReferenceBaseSubclass(const QualType& qType) { auto check = loplugin::TypeCheck(qType); @@ -99,10 +99,10 @@ bool containsVclReferenceBaseSubclass(const QualType& qType) { return containsVclReferenceBaseSubclass(qType.getTypePtr()); } -bool containsVclReferenceBaseSubclass(const Type* pType0) { +bool containsVclReferenceBaseSubclass(const clang::Type* pType0) { if (!pType0) return false; - const Type* pType = pType0->getUnqualifiedDesugaredType(); + const clang::Type* pType = pType0->getUnqualifiedDesugaredType(); if (!pType) return false; const CXXRecordDecl* pRecordDecl = pType->getAsCXXRecordDecl(); @@ -132,7 +132,7 @@ bool containsVclReferenceBaseSubclass(const Type* pType0) { QualType pointeeType = pType->getPointeeType(); return containsVclReferenceBaseSubclass(pointeeType); } else if (pType->isArrayType()) { - const ArrayType* pArrayType = dyn_cast<ArrayType>(pType); + const clang::ArrayType* pArrayType = dyn_cast<clang::ArrayType>(pType); QualType elementType = pArrayType->getElementType(); return containsVclReferenceBaseSubclass(elementType); } else { @@ -276,9 +276,9 @@ bool VCLWidgets::VisitBinaryOperator(const BinaryOperator * binaryOperator) // Look for places where we are accidentally assigning a returned-by-value VclPtr<T> to a T*, which generally // ends up in a use-after-free. -void VCLWidgets::checkAssignmentForVclPtrToRawConversion(const SourceLocation& spellingLocation, const Type* lhsType, const Expr* rhs) +void VCLWidgets::checkAssignmentForVclPtrToRawConversion(const SourceLocation& spellingLocation, const clang::Type* lhsType, const Expr* rhs) { - if (!lhsType || !isa<PointerType>(lhsType)) { + if (!lhsType || !isa<clang::PointerType>(lhsType)) { return; } if (!rhs) { @@ -736,7 +736,7 @@ bool VCLWidgets::isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodD return true; } -bool containsVclPtr(const Type* pType0); +bool containsVclPtr(const clang::Type* pType0); bool containsVclPtr(const QualType& qType) { auto check = loplugin::TypeCheck(qType); @@ -750,16 +750,16 @@ bool containsVclPtr(const QualType& qType) { return containsVclPtr(qType.getTypePtr()); } -bool containsVclPtr(const Type* pType0) { +bool containsVclPtr(const clang::Type* pType0) { if (!pType0) return false; - const Type* pType = pType0->getUnqualifiedDesugaredType(); + const clang::Type* pType = pType0->getUnqualifiedDesugaredType(); if (!pType) return false; if (pType->isPointerType()) { return false; } else if (pType->isArrayType()) { - const ArrayType* pArrayType = dyn_cast<ArrayType>(pType); + const clang::ArrayType* pArrayType = dyn_cast<clang::ArrayType>(pType); QualType elementType = pArrayType->getElementType(); return containsVclPtr(elementType); } else { |