File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,15 @@ private module SourceVariables {
1616 ind = [ 0 .. countIndirectionsForCppType ( base .getLanguageType ( ) ) + 1 ]
1717 }
1818
19+ private int maxNumberOfIndirections ( ) { result = max ( SourceVariable sv | | sv .getIndirection ( ) ) }
20+
21+ private string repeatStars ( int n ) {
22+ n = 0 and result = ""
23+ or
24+ n = [ 1 .. maxNumberOfIndirections ( ) ] and
25+ result = "*" + repeatStars ( n - 1 )
26+ }
27+
1928 class SourceVariable extends TSourceVariable {
2029 SsaInternals0:: SourceVariable base ;
2130 int ind ;
@@ -32,13 +41,7 @@ private module SourceVariables {
3241 SsaInternals0:: SourceVariable getBaseVariable ( ) { result = base }
3342
3443 /** Gets a textual representation of this element. */
35- string toString ( ) {
36- ind = 0 and
37- result = this .getBaseVariable ( ) .toString ( )
38- or
39- ind > 0 and
40- result = this .getBaseVariable ( ) .toString ( ) + " indirection"
41- }
44+ string toString ( ) { result = repeatStars ( this .getIndirection ( ) ) }
4245
4346 /**
4447 * Gets the number of loads performed on the base source variable
You can’t perform that action at this time.
0 commit comments