File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
cpp/ql/src/semmle/code/cpp/exprs Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -87,13 +87,23 @@ class Expr extends StmtParent, @expr {
8787 /** Gets the value of this expression, if it is a constant. */
8888 string getValue ( ) { exists ( @value v | values ( v , result ) and valuebind ( v , underlyingElement ( this ) ) ) }
8989
90+ private string getValueTextFollowingConversions ( Expr e ) {
91+ e .getValue ( ) = this .getValue ( )
92+ and
93+ ( if exists ( @value v |
94+ valuebind ( v , underlyingElement ( e ) ) and
95+ valuetext ( v , _) )
96+ then exists ( @value v |
97+ valuebind ( v , underlyingElement ( e ) ) and
98+ valuetext ( v , result ) )
99+ else result = this .getValueTextFollowingConversions ( e .getConversion ( ) ) )
100+ }
101+
90102 /** Gets the source text for the value of this expression, if it is a constant. */
91103 string getValueText ( ) {
92- exists ( @value v |
93- valuebind ( v , underlyingElement ( this ) ) and
94- if valuetext ( v , _)
95- then valuetext ( v , result )
96- else values ( v , result ) )
104+ if exists ( this .getValueTextFollowingConversions ( this ) )
105+ then result = this .getValueTextFollowingConversions ( this )
106+ else result = this .getValue ( )
97107 }
98108
99109 /** Holds if this expression has a value that can be determined at compile time. */
You can’t perform that action at this time.
0 commit comments