8000 Improve invalidation scheme. This should fix #53. · victor-smirnov/jenny@d8497f2 · GitHub
[go: up one dir, main page]

Skip to content

Commit d8497f2

Browse files
committed
Improve invalidation scheme. This should fix llvm#53.
1 parent 5eb7821 commit d8497f2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

clang/lib/Analysis/LifetimePsetBuilder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ class PSetsBuilder : public ConstStmtVisitor<PSetsBuilder, void> {
692692
PSet ArgPS = derefPSet(getPSet(ObjExpr));
693693
for (Variable V : ArgPS.vars())
694694
invalidateVar(
695-
V, 1, InvalidationReason::Modified(ObjExpr->getSourceRange()));
695+
V, V.getOrder(),
696+
InvalidationReason::Modified(ObjExpr->getSourceRange()));
696697
});
697698

698699
// Bind Pointer return value.

clang/test/Sema/attr-psets.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ struct basic_string_view {
7171

7272
using string_view = basic_string_view<char>;
7373

74+
template <typename T>
75+
struct basic_string {
76+
basic_string(const char*);
77+
basic_string &operator +=(const basic_string& other);
78+
};
79+
7480
template <class T>
7581
struct remove_reference { typedef T type; };
7682
template <class T>
@@ -956,6 +962,13 @@ void cast(int *p) {
956962
__lifetime_pset(q); // expected-warning {{pset(q) = ((unknown))}}
957963
}
958964

965+
void doNotInvalidateReference(std::vector<std::basic_string<char>> v) {
966+
std::basic_string<char> &r = v[0];
967+
__lifetime_pset_ref(r); // expected-warning {{(*v)}}
968+
r += "aa";
969+
__lifetime_pset_ref(r); // expected-warning {{(*v)}}
970+
}
971+
959972
// Support CXXOperatorCallExpr on non-member function
960973
struct S3;
961974
void operator==(const S3 &A, const S3 &B) { A == B; }

0 commit comments

Comments
 (0)
0