Skip to content

Commit 0aa1945

Browse files
committed
C++: Comments.
1 parent 8a32c17 commit 0aa1945

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cpp/ql/lib/semmle/code/cpp/AutogeneratedFile.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ private int fileHeaderLimit(File f) {
8484
fc = fileFirstComment(f) and
8585
result =
8686
min(int line |
87+
// code ending the initial comments
8788
exists(DeclarationEntry de, Location l |
8889
l = de.getLocation() and
8990
l.getFile() = f and
@@ -105,8 +106,12 @@ private int fileHeaderLimit(File f) {
105106
line > fc
106107
)
107108
or
109+
// end of the file
108110
line = f.getMetrics().getNumberOfLines()
109111
or
112+
// rarely, we've seen extremely long sequences of initial comments
113+
// (and/or limitations in the above constraints) cause an overflow of
114+
// the maximum string length. So don't look past 1000 lines regardless.
110115
line = 1000
111116
)
112117
)

0 commit comments

Comments
 (0)