[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-21 Thread Kristóf Umann via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369574: [analyzer] Mention whether an event is about a 
condition in a bug report part 1 (authored by Szelethus, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D65575?vs=216273=216467#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575

Files:
  cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  cfe/trunk/test/Analysis/track-control-dependency-conditions.cpp

Index: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -298,6 +298,7 @@
   MemRegionManager 
   const SourceManager 
   const PrintingPolicy 
+  bugreporter::TrackingKind TKind;
 
   /// Recursion limit for dereferencing fields when looking for the
   /// region of interest.
@@ -318,10 +319,10 @@
   using RegionVector = SmallVector;
 
 public:
-  NoStoreFuncVisitor(const SubRegion *R)
+  NoStoreFuncVisitor(const SubRegion *R, bugreporter::TrackingKind TKind)
   : RegionOfInterest(R), MmrMgr(*R->getMemRegionManager()),
 SM(MmrMgr.getContext().getSourceManager()),
-PP(MmrMgr.getContext().getPrintingPolicy()) {}
+PP(MmrMgr.getContext().getPrintingPolicy()), TKind(TKind) {}
 
   void Profile(llvm::FoldingSetNodeID ) const override {
 static int Tag = 0;
@@ -612,6 +613,9 @@
   } while (N);
 }
 
+static llvm::StringLiteral WillBeUsedForACondition =
+", which participates in a condition later";
+
 PathDiagnosticPieceRef NoStoreFuncVisitor::maybeEmitNote(
 BugReport , const CallEvent , const ExplodedNode *N,
 const RegionVector , const MemRegion *MatchedRegion,
@@ -658,6 +662,8 @@
 return nullptr;
 
   os << "'";
+  if (TKind == bugreporter::TrackingKind::Condition)
+os << WillBeUsedForACondition;
   return std::make_shared(L, os.str());
 }
 
@@ -1068,6 +1074,9 @@
 if (!L.isValid() || !L.asLocation().isValid())
   return nullptr;
 
+if (TKind == bugreporter::TrackingKind::Condition)
+  Out << WillBeUsedForACondition;
+
 auto EventPiece = std::make_shared(L, Out.str());
 
 // If we determined that the note is meaningless, make it prunable, and
@@ -1450,6 +1459,9 @@
   if (os.str().empty())
 showBRDefaultDiagnostics(os, R, V);
 
+  if (TKind == bugreporter::TrackingKind::Condition)
+os << WillBeUsedForACondition;
+
   // Construct a new PathDiagnosticPiece.
   ProgramPoint P = StoreSite->getLocation();
   PathDiagnosticLocation L;
@@ -1933,7 +1945,7 @@
   // Mark both the variable region and its contents as interesting.
   SVal V = LVState->getRawSVal(loc::MemRegionVal(R));
   report.addVisitor(
-  std::make_unique(cast(R)));
+  std::make_unique(cast(R), TKind));
 
   MacroNullReturnSuppressionVisitor::addMacroVisitorIfNecessary(
   LVNode, R, EnableNullFPSuppression, report, V);
Index: cfe/trunk/test/Analysis/track-control-dependency-conditions.cpp
===
--- cfe/trunk/test/Analysis/track-control-dependency-conditions.cpp
+++ cfe/trunk/test/Analysis/track-control-dependency-conditions.cpp
@@ -29,24 +29,24 @@
 bool coin();
 
 void foo() {
-  flag = coin(); // tracking-note{{Value assigned to 'flag'}}
+  flag = coin(); // tracking-note-re^}}Value assigned to 'flag', which participates in a condition later{{$
 }
 
 void test() {
-  int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+  int *x = 0; // expected-note-re^}}'x' initialized to a null pointer value{{$
   flag = 1;
 
   foo(); // TODO: Add nodes here about flag's value being invalidated.
-  if (flag) // expected-note   {{Assuming 'flag' is 0}}
-// expected-note@-1{{Taking false branch}}
+  if (flag) // expected-note-re   ^}}Assuming 'flag' is 0{{$
+// expected-note-re@-1^}}Taking false branch{{$
 x = new int;
 
-  foo(); // tracking-note{{Calling 'foo'}}
- // tracking-note@-1{{Returning from 'foo'}}
+  foo(); // tracking-note-re^}}Calling 'foo'{{$
+ // tracking-note-re@-1^}}Returning from 'foo'{{$
 
-  if (flag) // expected-note   {{Assuming 'flag' is not equal to 0}}
-// expected-note@-1{{Taking true branch}}
-// debug-note@-2{{Tracking condition 'flag'}}
+  if (flag) // expected-note-re   ^}}Assuming 'flag' is not equal to 0{{$
+// expected-note-re@-1^}}Taking true branch{{$
+// debug-note-re@-2^}}Tracking condition 'flag'{{$
 
 *x = 5; // expected-warning{{Dereference of null pointer}}
 // expected-note@-1{{Dereference of null pointer}}
@@ -58,7 +58,7 @@
 

[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-20 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

In D65575#1638430 , @xazax.hun wrote:

> LGTM! I think the UIs could do better displaying this info in the future but 
> this is not your job :)


https://github.com/Ericsson/codechecker/pull/2279

CodeChecker now indents function calls! Woohoo!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-20 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

LGTM! I think the UIs could do better displaying this info in the future but 
this is not your job :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-20 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.

*actually accepting*


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-20 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

Hmm-hmm, I kinda like the comma, but would happily concede on this. Its been a 
while since my english exam :^)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Thanks!!

I also suspect we don't need the comma.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-20 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus updated this revision to Diff 216273.
Szelethus added a comment.

- Change the condition postfix as discussed
- `expected-note{{...}}` -> `expected-note-re^}}...{{$`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575

Files:
  clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  clang/test/Analysis/track-control-dependency-conditions.cpp

Index: clang/test/Analysis/track-control-dependency-conditions.cpp
===
--- clang/test/Analysis/track-control-dependency-conditions.cpp
+++ clang/test/Analysis/track-control-dependency-conditions.cpp
@@ -29,24 +29,24 @@
 bool coin();
 
 void foo() {
-  flag = coin(); // tracking-note{{Value assigned to 'flag'}}
+  flag = coin(); // tracking-note-re^}}Value assigned to 'flag', which participates in a condition later{{$
 }
 
 void test() {
-  int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+  int *x = 0; // expected-note-re^}}'x' initialized to a null pointer value{{$
   flag = 1;
 
   foo(); // TODO: Add nodes here about flag's value being invalidated.
-  if (flag) // expected-note   {{Assuming 'flag' is 0}}
-// expected-note@-1{{Taking false branch}}
+  if (flag) // expected-note-re   ^}}Assuming 'flag' is 0{{$
+// expected-note-re@-1^}}Taking false branch{{$
 x = new int;
 
-  foo(); // tracking-note{{Calling 'foo'}}
- // tracking-note@-1{{Returning from 'foo'}}
+  foo(); // tracking-note-re^}}Calling 'foo'{{$
+ // tracking-note-re@-1^}}Returning from 'foo'{{$
 
-  if (flag) // expected-note   {{Assuming 'flag' is not equal to 0}}
-// expected-note@-1{{Taking true branch}}
-// debug-note@-2{{Tracking condition 'flag'}}
+  if (flag) // expected-note-re   ^}}Assuming 'flag' is not equal to 0{{$
+// expected-note-re@-1^}}Taking true branch{{$
+// debug-note-re@-2^}}Tracking condition 'flag'{{$
 
 *x = 5; // expected-warning{{Dereference of null pointer}}
 // expected-note@-1{{Dereference of null pointer}}
@@ -58,7 +58,7 @@
 bool coin();
 
 void foo() {
-  flag = coin(); // tracking-note{{Value assigned to 'flag'}}
+  flag = coin(); // tracking-note-re^}}Value assigned to 'flag', which participates in a condition later{{$
 }
 
 void test() {
@@ -66,18 +66,18 @@
   flag = 1;
 
   foo();
-  if (flag) // expected-note   {{Assuming 'flag' is 0}}
-// expected-note@-1{{Taking false branch}}
+  if (flag) // expected-note-re   ^}}Assuming 'flag' is 0{{$
+// expected-note-re@-1^}}Taking false branch{{$
 x = new int;
 
-  x = 0; // expected-note{{Null pointer value stored to 'x'}}
+  x = 0; // expected-note-re^}}Null pointer value stored to 'x'{{$
 
-  foo(); // tracking-note{{Calling 'foo'}}
- // tracking-note@-1{{Returning from 'foo'}}
+  foo(); // tracking-note-re^}}Calling 'foo'{{$
+ // tracking-note-re@-1^}}Returning from 'foo'{{$
 
-  if (flag) // expected-note   {{Assuming 'flag' is not equal to 0}}
-// expected-note@-1{{Taking true branch}}
-// debug-note@-2{{Tracking condition 'flag'}}
+  if (flag) // expected-note-re   ^}}Assuming 'flag' is not equal to 0{{$
+// expected-note-re@-1^}}Taking true branch{{$
+// debug-note-re@-2^}}Tracking condition 'flag'{{$
 
 *x = 5; // expected-warning{{Dereference of null pointer}}
 // expected-note@-1{{Dereference of null pointer}}
@@ -90,25 +90,25 @@
 
 void foo() {
   // coin() could write bar, do it's invalidated.
-  flag = coin(); // tracking-note{{Value assigned to 'flag'}}
- // tracking-note@-1{{Value assigned to 'bar'}}
+  flag = coin(); // tracking-note-re^}}Value assigned to 'flag', which participates in a condition later{{$
+ // tracking-note-re@-1^}}Value assigned to 'bar', which participates in a condition later{{$
 }
 
 int bar;
 
 void test() {
-  int *x = 0; // expected-note{{'x' initialized to a null pointer value}}
+  int *x = 0; // expected-note-re^}}'x' initialized to a null pointer value{{$
   flag = 1;
 
-  foo(); // tracking-note{{Calling 'foo'}}
- // tracking-note@-1{{Returning from 'foo'}}
+  foo(); // tracking-note-re^}}Calling 'foo'{{$
+ // tracking-note-re@-1^}}Returning from 'foo'{{$
 
-  if (bar) // expected-note   {{Assuming 'bar' is not equal to 0}}
-   // expected-note@-1{{Taking true branch}}
-   // debug-note@-2{{Tracking condition 'bar'}}
-if (flag) // expected-note   {{Assuming 'flag' is not equal to 0}}
-  // expected-note@-1{{Taking true branch}}
-  // debug-note@-2{{Tracking condition 'flag'}}
+  if (bar) // expected-note-re   ^}}Assuming 'bar' is not equal 

[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-20 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In D65575#1621425 , @Szelethus wrote:

> I think it isn't crucial of getting rid of the "The" prefix, if we append ", 
> which participates in a condition later" (which sounds so much better than 
> what I added in this patch), so maybe changing `WillBeUsedForACondition` to 
> that would be good enough.


I guess let's just land that variant! I'm also not super worried about "The" 
here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-12 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

In D65575#1625741 , @NoQ wrote:

> In D65575#1625738 , @Szelethus wrote:
>
> > A little early, gentle ping :) I'm getting kinda paranoid with the size of 
> > the stack, and how much I struggled with commiting last time.
>
>
> Mmm, what are your thoughts on my suggestions with wording? I'll also poke 
> Devin more.


Pretty much this:

In D65575#1621425 , @Szelethus wrote:

> I think it isn't crucial of getting rid of the "The" prefix, if we append ", 
> which participates in a condition later" (which sounds so much better than 
> what I added in this patch), so maybe changing `WillBeUsedForACondition` to 
> that would be good enough. However, as I said, I realize that the way I 
> looked at these results was a lot different than how the average user will do 
> so, so I'm totally open on this topic.


I figured we'd have another round on this, but if it sounds good, I'll update 
the patch.

> Also it looks like most of the bottom of the stack is already accepted, you 
> can just commit most of it, right?

Actually yea, I had a good reason to delay but not anymore.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-12 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In D65575#1625738 , @Szelethus wrote:

> A little early, gentle ping :) I'm getting kinda paranoid with the size of 
> the stack, and how much I struggled with commiting last time.


Mmm, what are your thoughts on my suggestions with wording? I'll also poke 
Devin more.

Also it looks like most of the bottom of the stack is already accepted, you can 
just commit most of it, right?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-12 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

A little early, gentle ping :) I'm getting kinda paranoid with the size of the 
stack, and how much I struggled with commiting last time.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-08 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

Yeah, this is important bike-shedding from the user point of view. Otherwise it 
looks good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-08 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

In D65575#1611013 , @NoQ wrote:

> Fantastic! Let's open the wording bikeshed season?
>
> I suspect that a simple "(The) Value -> Condition value" change would have 
> worked better.
>
> Another variant: "Value ..., which participates in a condition later".


Yea, I kinda prefer a more uniform indication as to whether we're explaining a 
condition or "THE value". While I personally took a unique approach in 
evaluating analysis results (my eye was hunting for the changes I made 
specifically), I did find each function call in the bug report super easy to 
understand:
F9758175: image.png 
See how this function call screams what it is about? Now, condition tracking is 
inherently imperfect (like bug report construction as a whole), and whenever I 
feel like the notes added by it provide little value, simply glancing at the 
notes can tell whether I should observe that function call or not.

I think it isn't crucial of getting rid of the "The" prefix, if we append ", 
which participates in a condition later" (which sounds so much better than what 
I added in this patch), so maybe changing `WillBeUsedForACondition` to that 
would be good enough. However, as I said, I realize that the way I looked at 
these results was a lot different than how the average user will do so, so I'm 
totally open on this topic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-01 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Fantastic! Let's open the wording bikeshed season?

I suspect that a simple "(The) Value -> Condition value" change would have 
worked better.

Another variant: "Value ..., which participates in a condition later".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65575/new/

https://reviews.llvm.org/D65575



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D65575: [analyzer] Mention whether an event is about a condition in a bug report part 1

2019-08-01 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus created this revision.
Szelethus added reviewers: NoQ, xazax.hun, Charusso, baloghadamsoftware, 
dcoughlin, rnkovacs.
Szelethus added a project: clang.
Herald added subscribers: cfe-commits, gamesh411, dkrupp, donat.nagy, 
mikhail.ramalho, a.sidorin, szepet, whisperity.

Can't add much more to the title! This is part 1, the case where the collapse 
point isn't in the condition point is the responsibility of 
`ConditionBRVisitor`, which I'm addressing in part 2.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65575

Files:
  clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  clang/test/Analysis/track-control-dependency-conditions.cpp

Index: clang/test/Analysis/track-control-dependency-conditions.cpp
===
--- clang/test/Analysis/track-control-dependency-conditions.cpp
+++ clang/test/Analysis/track-control-dependency-conditions.cpp
@@ -29,7 +29,7 @@
 bool coin();
 
 void foo() {
-  flag = coin(); // tracking-note{{Value assigned to 'flag'}}
+  flag = coin(); // tracking-note{{Value assigned to 'flag', which will be (a part of a) condition}}
 }
 
 void test() {
@@ -58,7 +58,7 @@
 bool coin();
 
 void foo() {
-  flag = coin(); // tracking-note{{Value assigned to 'flag'}}
+  flag = coin(); // tracking-note{{Value assigned to 'flag', which will be (a part of a) condition}}
 }
 
 void test() {
@@ -90,8 +90,8 @@
 
 void foo() {
   // coin() could write bar, do it's invalidated.
-  flag = coin(); // tracking-note{{Value assigned to 'flag'}}
- // tracking-note@-1{{Value assigned to 'bar'}}
+  flag = coin(); // tracking-note{{Value assigned to 'flag', which will be (a part of a) condition}}
+ // tracking-note@-1{{Value assigned to 'bar', which will be (a part of a) condition}}
 }
 
 int bar;
@@ -184,14 +184,14 @@
 int *getIntPtr();
 
 void storeValue(int **i) {
-  *i = getIntPtr(); // tracking-note{{Value assigned to 'i'}}
+  *i = getIntPtr(); // tracking-note{{Value assigned to 'i', which will be (a part of a) condition}}
 }
 
 int *conjurePointer() {
   int *i;
   storeValue(); // tracking-note{{Calling 'storeValue'}}
   // tracking-note@-1{{Returning from 'storeValue'}}
-  return i; // tracking-note{{Returning pointer (loaded from 'i')}}
+  return i; // tracking-note{{Returning pointer (loaded from 'i'), which will be (a part of a) condition}}
 }
 
 void f(int *ptr) {
@@ -280,7 +280,7 @@
   // tracking-note@-1{{Taking false branch}}
   // debug-note@-2{{Tracking condition 'coin()'}}
 return true;
-  return coin(); // tracking-note{{Returning value}}
+  return coin(); // tracking-note{{Returning value, which will be (a part of a) condition}}
 }
 
 void i(int *ptr) {
@@ -366,7 +366,7 @@
 void foo() {
   int y;
   y = 1;
-  flag = y; // tracking-note{{The value 1 is assigned to 'flag'}}
+  flag = y; // tracking-note{{The value 1 is assigned to 'flag', which will be (a part of a) condition}}
 }
 
 void f(int y) {
@@ -388,7 +388,7 @@
 int getInt();
 
 void foo() {
-  flag = getInt(); // tracking-note{{Value assigned to 'flag'}}
+  flag = getInt(); // tracking-note{{Value assigned to 'flag', which will be (a part of a) condition}}
 }
 
 void f() {
@@ -701,7 +701,7 @@
 bool coin();
 
 void bar(int ) {
-  flag = coin(); // tracking-note{{Value assigned to 'flag'}}
+  flag = coin(); // tracking-note{{Value assigned to 'flag', which will be (a part of a) condition}}
 }
 
 void bar2(int ) {
Index: clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
===
--- clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
+++ clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
@@ -297,6 +297,7 @@
   MemRegionManager 
   const SourceManager 
   const PrintingPolicy 
+  bugreporter::TrackingKind TKind;
 
   /// Recursion limit for dereferencing fields when looking for the
   /// region of interest.
@@ -317,10 +318,10 @@
   using RegionVector = SmallVector;
 
 public:
-  NoStoreFuncVisitor(const SubRegion *R)
+  NoStoreFuncVisitor(const SubRegion *R, bugreporter::TrackingKind TKind)
   : RegionOfInterest(R), MmrMgr(*R->getMemRegionManager()),
 SM(MmrMgr.getContext().getSourceManager()),
-PP(MmrMgr.getContext().getPrintingPolicy()) {}
+PP(MmrMgr.getContext().getPrintingPolicy()), TKind(TKind) {}
 
   void Profile(llvm::FoldingSetNodeID ) const override {
 static int Tag = 0;
@@ -611,6 +612,9 @@
   } while (N);
 }
 
+static llvm::StringLiteral WillBeUsedForACondition =
+", which will be (a part of a) condition";
+
 std::shared_ptr NoStoreFuncVisitor::maybeEmitNote(
 BugReport , const CallEvent , const ExplodedNode *N,
 const RegionVector , const MemRegion *MatchedRegion,
@@ -657,6 +661,8 @@
 return nullptr;
 
   os << "'";
+  if (TKind == bugreporter::TrackingKind::Condition)
+os << WillBeUsedForACondition;
   return std::make_shared(L, os.str());
 }