summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaInit.cpp
diff options
context:
space:
mode:
authorMatthias Gehre <M.Gehre@gmx.de>2019-08-21 22:08:59 +0000
committerMatthias Gehre <M.Gehre@gmx.de>2019-08-21 22:08:59 +0000
commitb1c78012900ba43cf0a636b8392ee84d7122122a (patch)
treed8faa89dbb989a3cff7e8d6a2df40b9b1836efd9 /clang/lib/Sema/SemaInit.cpp
parentf7cdff4ffdc34226d85727e00bf66b3a6001e915 (diff)
downloadbcm5719-llvm-b1c78012900ba43cf0a636b8392ee84d7122122a.tar.gz
bcm5719-llvm-b1c78012900ba43cf0a636b8392ee84d7122122a.zip
[LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)
Summary: This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator on the template is a DependentNameType - we can only put the gsl::Pointer attribute on the underlaying record after instantiation) inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared, we added the gsl::Pointer on the canonical decl (the forward decl), and later when the template was instantiated, there was no attribute on the definition so it was not instantiated). and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to a incomplete instantiation, and then another was copied from the template definition when the instantiation was completed). We now add the attributes to all redeclarations to fix thos issues and make their usage easier. Reviewers: gribozavr Subscribers: Szelethus, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66179 llvm-svn: 369591
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r--clang/lib/Sema/SemaInit.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 289a1403cd8..ee9963fca77 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -6561,7 +6561,7 @@ static void visitLocalsRetainedByReferenceBinding(IndirectLocalPath &Path,
template <typename T> static bool isRecordWithAttr(QualType Type) {
if (auto *RD = Type->getAsCXXRecordDecl())
- return RD->getCanonicalDecl()->hasAttr<T>();
+ return RD->hasAttr<T>();
return false;
}
@@ -6672,7 +6672,7 @@ static void handleGslAnnotatedTypes(IndirectLocalPath &Path, Expr *Call,
if (auto *CCE = dyn_cast<CXXConstructExpr>(Call)) {
const auto *Ctor = CCE->getConstructor();
- const CXXRecordDecl *RD = Ctor->getParent()->getCanonicalDecl();
+ const CXXRecordDecl *RD = Ctor->getParent();
if (CCE->getNumArgs() > 0 && RD->hasAttr<PointerAttr>())
VisitPointerArg(Ctor->getParamDecl(0), CCE->getArgs()[0]);
}
OpenPOWER on IntegriCloud