mgehre created this revision.
mgehre added a reviewer: gribozavr.
Herald added a subscriber: Szelethus.
Herald added a project: clang.
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 g
gribozavr added inline comments.
Comment at: clang/lib/Sema/SemaAttr.cpp:102
+ dyn_cast_or_null(Record->getDescribedTemplate()))
{
+if (auto *Def = Record->getDefinition())
+ addGslOwnerPointerAttributeIfNotExisting(Context, Def);
I wonder why
mgehre marked 6 inline comments as done.
mgehre added inline comments.
Comment at: clang/lib/Sema/SemaAttr.cpp:102
+ dyn_cast_or_null(Record->getDescribedTemplate()))
{
+if (auto *Def = Record->getDefinition())
+ addGslOwnerPointerAttributeIfNotExisting(Context
gribozavr added inline comments.
Comment at: clang/lib/Sema/SemaAttr.cpp:200
CXXRecordDecl *Canonical = Record->getCanonicalDecl();
if (Canonical->hasAttr() || Canonical->hasAttr())
return;
mgehre wrote:
> gribozavr wrote:
> > Should this code no
mgehre marked 4 inline comments as done.
mgehre added a comment.
I now start to wonder if we should instead put the attribute on all
declarations (instead of just the canonical). Later redeclarations
automatically inherit the attributes.
This would make both the checking easier (just check any d
gribozavr added inline comments.
Comment at: clang/lib/Sema/SemaAttr.cpp:200
CXXRecordDecl *Canonical = Record->getCanonicalDecl();
if (Canonical->hasAttr() || Canonical->hasAttr())
return;
mgehre wrote:
> gribozavr wrote:
> > mgehre wrote:
> > >
xazax.hun added inline comments.
Comment at: clang/lib/Sema/SemaAttr.cpp:94
- Canonical->addAttr(::new (Context) Attribute(SourceRange{}, Context,
- /*DerefType*/ nullptr,
- /*Spelling=
mgehre added a comment.
I now add the attributes to all redeclarations to make the logic a bit easier
to follow.
Comment at: clang/lib/Sema/SemaAttr.cpp:94
- Canonical->addAttr(::new (Context) Attribute(SourceRange{}, Context,
-
mgehre updated this revision to Diff 216247.
mgehre marked 6 inline comments as done.
mgehre added a comment.
Herald added a subscriber: mgorny.
- Put OwnerAttr/PointerAttr on all redeclarations
- clang/lib/Sema/SemaAttr.cpp: Use Attribute::CreateImplicit as requested in
review
Repository:
rG
gribozavr accepted this revision.
gribozavr added inline comments.
This revision is now accepted and ready to land.
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4596
+for (Decl *Redecl : D->redecls()) {
+ Redecl->addAttr(::new (S.Context)
+ OwnerA
xazax.hun added inline comments.
Comment at: clang/lib/Sema/SemaInit.cpp:6627
const auto *Ctor = CCE->getConstructor();
const CXXRecordDecl *RD = Ctor->getParent()->getCanonicalDecl();
if (CCE->getNumArgs() > 0 && RD->hasAttr())
You can also remove
mgehre marked 3 inline comments as done.
mgehre added inline comments.
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4596
+for (Decl *Redecl : D->redecls()) {
+ Redecl->addAttr(::new (S.Context)
+ OwnerAttr(AL.getRange(), S.Context, DerefTypeLoc,
-
This revision was automatically updated to reflect the committed changes.
mgehre marked an inline comment as done.
Closed by commit rL369591: [LifetimeAnalysis] Support more STL idioms (template
forward declaration and… (authored by mgehre, committed by ).
Herald added a project: LLVM.
Herald adde
thakis added a comment.
Similar to
Comment at: cfe/trunk/unittests/Sema/CMakeLists.txt:14
clangAST
+ clangASTMatchers
clangBasic
Is it necessary to use ASTMachers to test this? It'd be good if SemaTests
wouldn't have to depend on ASTMatchers (for linkin
mgehre marked an inline comment as done.
mgehre added inline comments.
Comment at: cfe/trunk/unittests/Sema/GslOwnerPointerInference.cpp:9
+
+#include "../ASTMatchers/ASTMatchersTest.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
thakis wrote:
> This weird relati
thakis added inline comments.
Comment at: cfe/trunk/unittests/Sema/GslOwnerPointerInference.cpp:9
+
+#include "../ASTMatchers/ASTMatchersTest.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
mgehre wrote:
> thakis wrote:
> > This weird relative include path is a hi
thakis added a comment.
And, unrelatedly, for libc++, shouldn't we just add the attribute to the libc++
source instead of trying to infer it in the compiler?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66179/new/
https://reviews.llvm.org/D66179
_
mgehre marked 2 inline comments as done.
mgehre added inline comments.
Comment at: cfe/trunk/unittests/Sema/GslOwnerPointerInference.cpp:9
+
+#include "../ASTMatchers/ASTMatchersTest.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
thakis wrote:
> mgehre wrote:
> >
mgehre marked an inline comment as done.
mgehre added a comment.
Yes, for libc++ we could add the annotations to its source code, and
eventually this would be the cleaner solution.
Currently, that is neither sufficient (because one could use libstdc++, MSVC or
an older libc++ version) nor neces
19 matches
Mail list logo