diff options
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp index 828b6f91d81c..c0727ae5dc8b 100644 --- a/clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp @@ -27,7 +27,7 @@ using namespace ento; //===----------------------------------------------------------------------===// static bool IsLLVMStringRef(QualType T) { - const RecordType *RT = T->getAs<RecordType>(); + const RecordType *RT = T->getAsCanonical<RecordType>(); if (!RT) return false; @@ -195,14 +195,10 @@ static bool IsPartOfAST(const CXXRecordDecl *R) { if (IsClangStmt(R) || IsClangType(R) || IsClangDecl(R) || IsClangAttr(R)) return true; - for (const auto &BS : R->bases()) { - QualType T = BS.getType(); - if (const RecordType *baseT = T->getAs<RecordType>()) { - CXXRecordDecl *baseD = cast<CXXRecordDecl>(baseT->getOriginalDecl()); - if (IsPartOfAST(baseD)) - return true; - } - } + for (const auto &BS : R->bases()) + if (const auto *baseD = BS.getType()->getAsCXXRecordDecl(); + baseD && IsPartOfAST(baseD)) + return true; return false; } @@ -243,11 +239,9 @@ void ASTFieldVisitor::Visit(FieldDecl *D) { if (AllocatesMemory(T)) ReportError(T); - if (const RecordType *RT = T->getAs<RecordType>()) { - const RecordDecl *RD = RT->getOriginalDecl()->getDefinition(); + if (const auto *RD = T->getAsRecordDecl()) for (auto *I : RD->fields()) Visit(I); - } FieldChain.pop_back(); } |
