Skip to content

Commit d25e575

Browse files
authored
Merge pull request #293 from github/jsinglet/2.16-mergeback
Jsinglet/2.16 mergeback
2 parents 0d68b65 + 8c15baf commit d25e575

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

c/misra/src/rules/RULE-7-4/StringLiteralAssignedToNonConstChar.ql

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ class WideCharPointerType extends PointerType {
2020
override string getAPrimaryQlClass() { result = "WideCharPointerType" }
2121
}
2222

23-
class GenericCharPointerType extends PointerType {
23+
class GenericCharPointerType extends Type {
2424
GenericCharPointerType() {
25-
/* This type resolves to wchar_t* (which is in turn a typedef depending on its implementation) */
26-
this.resolveTypedefs*() instanceof WideCharPointerType
25+
// A wide char pointer type
26+
this instanceof WideCharPointerType
2727
or
28-
/* This type eventually resolves to char* */
29-
this.resolveTypedefs*() instanceof CharPointerType
28+
// A char pointer type
29+
this.getUnspecifiedType() instanceof CharPointerType
30+
or
31+
// A typedef to any such type.
32+
// Note: wchar_t is usually a typedef, so we cannot just use getUnspecifiedType() here.
33+
this.(TypedefType).getBaseType() instanceof GenericCharPointerType
3034
}
3135
}
3236

0 commit comments

Comments
 (0)