Skip to content

Commit 0f4723a

Browse files
authored
Merge pull request github#3520 from dbartol/github/codeql-c-analysis-team/79
C++: Mark deprecated overrides as deprecated
2 parents 8df7b7c + 5641b2c commit 0f4723a

File tree

2 files changed

+5
-63
lines changed

2 files changed

+5
-63
lines changed

cpp/ql/src/semmle/code/cpp/File.qll

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,6 @@ class File extends Container, @file {
261261
/** Holds if this file was compiled as C++ (at any point). */
262262
predicate compiledAsCpp() { fileannotations(underlyingElement(this), 1, "compiled as c++", "1") }
263263

264-
/**
265-
* DEPRECATED: Objective-C is no longer supported.
266-
* Holds if this file was compiled as Objective C (at any point).
267-
*/
268-
deprecated predicate compiledAsObjC() { none() }
269-
270-
/**
271-
* DEPRECATED: Objective-C is no longer supported.
272-
* Holds if this file was compiled as Objective C++ (at any point).
273-
*/
274-
deprecated predicate compiledAsObjCpp() { none() }
275-
276264
/**
277265
* Holds if this file was compiled by a Microsoft compiler (at any point).
278266
*
@@ -316,14 +304,6 @@ class File extends Container, @file {
316304
exists(Include i | i.getFile() = this and i.getIncludedFile() = result)
317305
}
318306

319-
/**
320-
* DEPRECATED: use `getParentContainer` instead.
321-
* Gets the folder which contains this file.
322-
*/
323-
deprecated Folder getParent() {
324-
containerparent(unresolveElement(result), underlyingElement(this))
325-
}
326-
327307
/**
328308
* Holds if this file may be from source. This predicate holds for all files
329309
* except the dummy file, whose name is the empty string, which contains
@@ -341,28 +321,6 @@ class File extends Container, @file {
341321
/** Gets the metric file. */
342322
MetricFile getMetrics() { result = this }
343323

344-
/**
345-
* DEPRECATED: Use `getAbsolutePath` instead.
346-
* Gets the full name of this file, for example:
347-
* "/usr/home/me/myprogram.c".
348-
*/
349-
deprecated string getName() { files(underlyingElement(this), result, _, _, _) }
350-
351-
/**
352-
* DEPRECATED: Use `getAbsolutePath` instead.
353-
* Holds if this file has the specified full name.
354-
*
355-
* Example usage: `f.hasName("/usr/home/me/myprogram.c")`.
356-
*/
357-
deprecated predicate hasName(string name) { name = this.getName() }
358-
359-
/**
360-
* DEPRECATED: Use `getAbsolutePath` instead.
361-
* Gets the full name of this file, for example
362-
* "/usr/home/me/myprogram.c".
363-
*/
364-
deprecated string getFullName() { result = this.getName() }
365-
366324
/**
367325
* Gets the remainder of the base name after the first dot character. Note
368326
* that the name of this predicate is in plural form, unlike `getExtension`,
@@ -377,22 +335,6 @@ class File extends Container, @file {
377335
*/
378336
string getExtensions() { files(underlyingElement(this), _, _, result, _) }
379337

380-
/**
381-
* DEPRECATED: Use `getBaseName` instead.
382-
* Gets the name and extension(s), but not path, of a file. For example,
383-
* if the full name is "/path/to/filename.a.bcd" then the filename is
384-
* "filename.a.bcd".
385-
*/
386-
deprecated string getFileName() {
387-
// [a/b.c/d/]fileName
388-
// ^ beginAfter
389-
exists(string fullName, int beginAfter |
390-
fullName = this.getName() and
391-
beginAfter = max(int i | i = -1 or fullName.charAt(i) = "/" | i) and
392-
result = fullName.suffix(beginAfter + 1)
393-
)
394-
}
395-
396338
/**
397339
* Gets the short name of this file, that is, the prefix of its base name up
398340
* to (but not including) the first dot character if there is one, or the

cpp/ql/src/semmle/code/cpp/models/implementations/Printf.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Printf extends FormattingFunction, AliasFunction {
1919

2020
override int getFormatParameterIndex() { result = 0 }
2121

22-
override predicate isWideCharDefault() {
22+
deprecated override predicate isWideCharDefault() {
2323
hasGlobalOrStdName("wprintf") or
2424
hasGlobalName("wprintf_s")
2525
}
@@ -47,7 +47,7 @@ class Fprintf extends FormattingFunction {
4747

4848
override int getFormatParameterIndex() { result = 1 }
4949

50-
override predicate isWideCharDefault() { hasGlobalOrStdName("fwprintf") }
50+
deprecated override predicate isWideCharDefault() { hasGlobalOrStdName("fwprintf") }
5151

5252
override int getOutputParameterIndex() { result = 0 }
5353
}
@@ -70,7 +70,7 @@ class Sprintf extends FormattingFunction {
7070
not exists(getDefinition().getFile().getRelativePath())
7171
}
7272

73-
override predicate isWideCharDefault() {
73+
deprecated override predicate isWideCharDefault() {
7474
getParameter(getFormatParameterIndex())
7575
.getType()
7676
.getUnspecifiedType()
@@ -136,7 +136,7 @@ class Snprintf extends FormattingFunction {
136136
else result = getFirstFormatArgumentIndex() - 1
137137
}
138138

139-
override predicate isWideCharDefault() {
139+
deprecated override predicate isWideCharDefault() {
140140
getParameter(getFormatParameterIndex())
141141
.getType()
142142
.getUnspecifiedType()
@@ -201,7 +201,7 @@ class StringCchPrintf extends FormattingFunction {
201201
if getName().matches("%Ex") then result = 5 else result = 2
202202
}
203203

204-
override predicate isWideCharDefault() {
204+
deprecated override predicate isWideCharDefault() {
205205
getParameter(getFormatParameterIndex())
206206
.getType()
207207
.getUnspecifiedType()

0 commit comments

Comments
 (0)