Keyboard Shortcuts

File
u :up to issue
m :publish + mail comments
M :edit review message
j / k :jump to file after / before current file
J / K :jump to next file with a comment after / before current file
Side-by-side diff
i :toggle intra-line diffs
e :expand all comments
c :collapse all comments
s :toggle showing all comments
n / p :next / previous diff chunk or comment
N / P :next / previous comment
<Up> / <Down> :next / previous line
<Enter> :respond to / edit current comment
d :mark current comment as done
Issue
u :up to list of issues
m :publish + mail comments
j / k :jump to patch after / before current patch
o / <Enter> :open current patch in side-by-side view
i :open current patch in unified diff view
Issue List
j / k :jump to issue after / before current issue
o / <Enter> :open current issue
# : close issue
Comment/message editing
<Ctrl> + s or <Ctrl> + Enter :save comment
<Esc> :cancel edit
Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(297)
Issues Repositories Search
Open Issues | Closed Issues | All Issues | Sign in with your Google Account to create issues and add comments

Issue 4893047: Adding support for guardedby/ptguardedby

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 4 months ago by supertri
Modified:
14 years, 4 months ago
Visibility:
Public.

Patch Set 1 #

Total comments: 42

Patch Set 2 : Incorporating reviews and fixing bugs #

Total comments: 1
Created: 14 years, 4 months ago
Download [raw] [tar.bz2]
Unified diffs Side-by-side diffs Delta from patch set Stats (+252 lines, -4 lines) Patch
M include/clang/Basic/DiagnosticSemaKinds.td View 1 1 chunk +13 lines, -0 lines 0 comments Download
M lib/Sema/AnalysisBasedWarnings.cpp View 1 3 chunks +124 lines, -4 lines 1 comment Download
M test/SemaCXX/warn-thread-safety-analysis.cpp View 1 1 chunk +115 lines, -0 lines 0 comments Download
Total messages: 4
|
Jeffrey Yasskin (google)
http://codereview.appspot.com/4893047/diff/1/include/clang/Basic/DiagnosticSemaKinds.td File include/clang/Basic/DiagnosticSemaKinds.td (right): http://codereview.appspot.com/4893047/diff/1/include/clang/Basic/DiagnosticSemaKinds.td#newcode1340 include/clang/Basic/DiagnosticSemaKinds.td:1340: "accessing variable '%0' requires lock '%1'">, Perhaps, "... requires ...
14 years, 4 months ago (2011年08月19日 23:16:51 UTC) #1
http://codereview.appspot.com/4893047/diff/1/include/clang/Basic/DiagnosticSe...
File include/clang/Basic/DiagnosticSemaKinds.td (right):
http://codereview.appspot.com/4893047/diff/1/include/clang/Basic/DiagnosticSe...
include/clang/Basic/DiagnosticSemaKinds.td:1340: "accessing variable '%0'
requires lock '%1'">,
Perhaps, "... requires mutex '%1' held exclusively" or "... requires exclusive
lock on '%1'"?
http://codereview.appspot.com/4893047/diff/1/include/clang/Basic/DiagnosticSe...
include/clang/Basic/DiagnosticSemaKinds.td:1346: "dereferencing variable '%0'
requires lock '%1'">,
This is more technically correct as "accessing dereferenced variable...", but
probably the wording you have is sufficient.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.cpp
File lib/Sema/AnalysisBasedWarnings.cpp (right):
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:795: /// add a very coarse-grained value
analysis to track some easy examples of
What do you mean here? Give an example in the comment?
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:811: CheckDeclRefExprAccess(DR, /*Deref =
*/true);
I hate boolean parameters. Make this an enum?
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:814: default: break;
Comment that variable reads are handled in VisitCastExpr.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:830: if (CE->getCastKind() !=
CK_LValueToRValue)
Does this catch reads of class types, or just primitives?
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:836: /// Whenever we identify an access (read
or right) of a DeclRefExpr, we need to
s/right/write/
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:839: /// also check for pt_guarded_by and
guarded_var annotations.
Do you mean "pt_guarded_var"?
Sign in to reply to this message.
chandlerc
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.cpp File lib/Sema/AnalysisBasedWarnings.cpp (right): http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.cpp#newcode755 lib/Sema/AnalysisBasedWarnings.cpp:755: void CheckDeclRefExprAccess(DeclRefExpr *Exp, bool Deref = false); A followup ...
14 years, 4 months ago (2011年08月23日 21:58:18 UTC) #2
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.cpp
File lib/Sema/AnalysisBasedWarnings.cpp (right):
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:755: void CheckDeclRefExprAccess(DeclRefExpr
*Exp, bool Deref = false);
A followup change should rename all of these to start with a lower case letter.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:794: /// need to check for pt_guarded_by
annotations. In future, we may eventually
In *the* future
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:809: DeclRefExpr *DR
I usually attach the = to this line...
However, why bother with the variable? Then you don't even need {}s
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:814: default: break;
On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> Comment that variable reads are handled in VisitCastExpr.
Also, break on the next line.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:840: void
BuildLockset::CheckDeclRefExprAccess(DeclRefExpr *Exp,
E or DRE is more consistent...
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:845: ValueDecl *D = Exp->getDecl();
const?
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:846: SourceLocation ExpLocation =
Exp->getExprLoc();
What's the value of the variable?
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:848: if(!D || !D->hasAttrs())
I would do this immediately after the variable its checking.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:851: AttrVec &ArgAttrs = D->getAttrs();
const?
Also, sink this until right before its actually used.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:859: for(unsigned int i = 0; i <
ArgAttrs.size(); ++i) {
s/unsigned int/unsigned/, and pull the size out
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:870: if(PtGuardedByAttr *PGB =
dyn_cast<PtGuardedByAttr>(ArgAttrs[i])) {
PGBAttr.
http://codereview.appspot.com/4893047/diff/1/test/SemaCXX/warn-thread-safety-...
File test/SemaCXX/warn-thread-safety-analysis.cpp (right):
http://codereview.appspot.com/4893047/diff/1/test/SemaCXX/warn-thread-safety-...
test/SemaCXX/warn-thread-safety-analysis.cpp:4:
/**************************************
These didn't get fixed?
http://codereview.appspot.com/4893047/diff/1/test/SemaCXX/warn-thread-safety-...
test/SemaCXX/warn-thread-safety-analysis.cpp:323: expected-warning {{accessing
variable 'sls_guard_var' requires some lock}}
please apply my style comments from the previous review.
Sign in to reply to this message.
supertri
Here is an updated patch set for guarded_by annotations. I need to talk to Chandler ...
14 years, 4 months ago (2011年08月24日 17:57:10 UTC) #3
Here is an updated patch set for guarded_by annotations. I need to talk to
Chandler a bit about identifying reads and writes of non-primitive types, but
otherwise I am hoping to commit this patch today, if possible.
http://codereview.appspot.com/4893047/diff/1/include/clang/Basic/DiagnosticSe...
File include/clang/Basic/DiagnosticSemaKinds.td (right):
http://codereview.appspot.com/4893047/diff/1/include/clang/Basic/DiagnosticSe...
include/clang/Basic/DiagnosticSemaKinds.td:1340: "accessing variable '%0'
requires lock '%1'">,
On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> Perhaps, "... requires mutex '%1' held exclusively" or "... requires exclusive
> lock on '%1'"?
Changed to accessing variable '%0' requires mutex '%1' to be held
http://codereview.appspot.com/4893047/diff/1/include/clang/Basic/DiagnosticSe...
include/clang/Basic/DiagnosticSemaKinds.td:1346: "dereferencing variable '%0'
requires lock '%1'">,
On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> This is more technically correct as "accessing dereferenced variable...", but
> probably the wording you have is sufficient.
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.cpp
File lib/Sema/AnalysisBasedWarnings.cpp (right):
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:755: void CheckDeclRefExprAccess(DeclRefExpr
*Exp, bool Deref = false);
On 2011年08月23日 21:58:18, chandlerc wrote:
> A followup change should rename all of these to start with a lower case
letter.
Ok.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:794: /// need to check for pt_guarded_by
annotations. In future, we may eventually
On 2011年08月23日 21:58:18, chandlerc wrote:
> In *the* future
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:795: /// add a very coarse-grained value
analysis to track some easy examples of
On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> What do you mean here? Give an example in the comment?
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:809: DeclRefExpr *DR
Ah, ok. This section was refactored anyway due to an unrelated bug.
On 2011年08月23日 21:58:18, chandlerc wrote:
> I usually attach the = to this line...
> 
> However, why bother with the variable? Then you don't even need {}s
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:811: CheckDeclRefExprAccess(DR, /*Deref =
*/true);
After discussion, we rearranged when pt_guarded_by annotations are checked and
this became two methods.
On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> I hate boolean parameters. Make this an enum?
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:814: default: break;
On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> Comment that variable reads are handled in VisitCastExpr.
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:814: default: break;
On 2011年08月23日 21:58:18, chandlerc wrote:
> On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> > Comment that variable reads are handled in VisitCastExpr.
> 
> Also, break on the next line.
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:830: if (CE->getCastKind() !=
CK_LValueToRValue)
It does not catch reads of class types. For now, I added a FIXME, although I may
know how to deal with this problem.
On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> Does this catch reads of class types, or just primitives?
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:836: /// Whenever we identify an access (read
or right) of a DeclRefExpr, we need to
On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> s/right/write/
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:839: /// also check for pt_guarded_by and
guarded_var annotations.
On 2011年08月19日 23:16:51, Jeffrey Yasskin (google) wrote:
> Do you mean "pt_guarded_var"?
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:840: void
BuildLockset::CheckDeclRefExprAccess(DeclRefExpr *Exp,
On 2011年08月23日 21:58:18, chandlerc wrote:
> E or DRE is more consistent...
Refactored to take Expr *.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:845: ValueDecl *D = Exp->getDecl();
On 2011年08月23日 21:58:18, chandlerc wrote:
> const?
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:846: SourceLocation ExpLocation =
Exp->getExprLoc();
On 2011年08月23日 21:58:18, chandlerc wrote:
> What's the value of the variable?
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:848: if(!D || !D->hasAttrs())
On 2011年08月23日 21:58:18, chandlerc wrote:
> I would do this immediately after the variable its checking.
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:851: AttrVec &ArgAttrs = D->getAttrs();
On 2011年08月23日 21:58:18, chandlerc wrote:
> const?
> 
> Also, sink this until right before its actually used.
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:859: for(unsigned int i = 0; i <
ArgAttrs.size(); ++i) {
On 2011年08月23日 21:58:18, chandlerc wrote:
> s/unsigned int/unsigned/, and pull the size out
Done.
http://codereview.appspot.com/4893047/diff/1/lib/Sema/AnalysisBasedWarnings.c...
lib/Sema/AnalysisBasedWarnings.cpp:870: if(PtGuardedByAttr *PGB =
dyn_cast<PtGuardedByAttr>(ArgAttrs[i])) {
On 2011年08月23日 21:58:18, chandlerc wrote:
> PGBAttr.
Done.
http://codereview.appspot.com/4893047/diff/1/test/SemaCXX/warn-thread-safety-...
File test/SemaCXX/warn-thread-safety-analysis.cpp (right):
http://codereview.appspot.com/4893047/diff/1/test/SemaCXX/warn-thread-safety-...
test/SemaCXX/warn-thread-safety-analysis.cpp:4:
/**************************************
On 2011年08月23日 21:58:18, chandlerc wrote:
> These didn't get fixed?
They did. This review was sent out a week ago.
http://codereview.appspot.com/4893047/diff/1/test/SemaCXX/warn-thread-safety-...
test/SemaCXX/warn-thread-safety-analysis.cpp:323: expected-warning {{accessing
variable 'sls_guard_var' requires some lock}}
Will send out a separate patch that mass-applies to all committed tests.
On 2011年08月23日 21:58:18, chandlerc wrote:
> please apply my style comments from the previous review.
Sign in to reply to this message.
supertri
http://codereview.appspot.com/4893047/diff/7001/lib/Sema/AnalysisBasedWarnings.cpp File lib/Sema/AnalysisBasedWarnings.cpp (right): http://codereview.appspot.com/4893047/diff/7001/lib/Sema/AnalysisBasedWarnings.cpp#newcode926 lib/Sema/AnalysisBasedWarnings.cpp:926: /// \brief For unary operations which read and write ...
14 years, 4 months ago (2011年08月24日 18:06:11 UTC) #4
http://codereview.appspot.com/4893047/diff/7001/lib/Sema/AnalysisBasedWarning...
File lib/Sema/AnalysisBasedWarnings.cpp (right):
http://codereview.appspot.com/4893047/diff/7001/lib/Sema/AnalysisBasedWarning...
lib/Sema/AnalysisBasedWarnings.cpp:926: /// \brief For unary operations which
read and write a variable, we need to check
Whoops, over 80 char. Fixed in my local copy.
Sign in to reply to this message.
|
Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b

AltStyle によって変換されたページ (->オリジナル) /