C++: respond to more PR comments

This commit is contained in:
Robert Marsh
2019-10-07 14:16:21 -07:00
parent 4018ed67a6
commit 5c084f8b39
3 changed files with 4 additions and 10 deletions

View File

@@ -34,10 +34,10 @@ class FileFunction extends FunctionWithWrappers {
nme.matches("CreateFile%")
)
or
this.hasStdName("fopen")
this.hasQualifiedName("std", "fopen")
or
// on any of the fstream classes, or filebuf
exists(string nme | this.getDeclaringType().hasStdName(nme) |
exists(string nme | this.getDeclaringType().hasQualifiedName("std", nme) |
nme = "basic_fstream" or
nme = "basic_ifstream" or
nme = "basic_ofstream" or

View File

@@ -119,17 +119,11 @@ abstract class Declaration extends Locatable, @declaration {
/** Holds if this declaration has the given name in the global namespace. */
predicate hasGlobalName(string name) { this.hasQualifiedName("", "", name) }
/** Holds if this declaration has the given name in the `std` namespace. */
predicate hasStdName(string name) {
this.hasQualifiedName("std", "", name)
}
/** Holds if this declaration has the given name in the global namespace or the `std` namespace. */
predicate hasGlobalOrStdName(string name) {
this.hasGlobalName(name)
or
this.hasStdName(name)
this.hasQualifiedName("std", "", name)
}
/** Gets a specifier of this declaration. */

View File

@@ -6,7 +6,7 @@ import cpp
predicate fopenCall(FunctionCall fc) {
exists(Function f | f = fc.getTarget() |
f.hasGlobalOrStdName("fopen") or
f.hasGlobalOrStdName("open") or
f.hasGlobalName("open") or
f.hasGlobalName("_open") or
f.hasGlobalName("_wopen") or
f.hasGlobalName("CreateFile") or