Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
clang/lib/Analysis/LifetimeTypeCategory.cpp: Remove redundant classif…
Browse files Browse the repository at this point in the history
…ication of std types
  • Loading branch information
mgehre committed Aug 21, 2019
1 parent 0d59356 commit 6c22919
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions clang/lib/Analysis/LifetimeTypeCategory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,10 @@ static bool IsVectorBoolReference(const CXXRecordDecl *D) {
// to look up the declarations (pointers) by names upfront and look up the
// declarations instead of matching strings populated lazily.
static Optional<TypeCategory> classifyStd(const Type *T) {
// MSVC: _Ptr_base is a base class of shared_ptr, and we only see
// _Ptr_base when calling get() on a shared_ptr.
static std::set<StringRef> StdOwners{"stack", "queue", "priority_queue",
"optional", "_Ptr_base", "array"};
static std::set<StringRef> StdPointers{"basic_regex", "reference_wrapper"};
auto *Decl = T->getAsCXXRecordDecl();
if (!Decl || !Decl->isInStdNamespace() || !Decl->getIdentifier())
return {};

if (StdOwners.count(Decl->getName()))
return TypeCategory::Owner;
if (StdPointers.count(Decl->getName()))
return TypeCategory::Pointer;
if (IsVectorBoolReference(Decl))

This comment has been minimized.

Copy link
@Xazax-hun

Xazax-hun Aug 21, 2019

Collaborator

So this one is not covered when we add annotations automatically? I wonder if we should eventually move this to the same place where we annotate iterators.

This comment has been minimized.

Copy link
@mgehre

mgehre Aug 21, 2019

Author Owner

Yes, this one is missing from the automatic annotations

return TypeCategory::Pointer;

Expand Down

1 comment on commit 6c22919

@Xazax-hun
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great cleanup! :)

Please sign in to comment.