Skip to content

Commit c483299

Browse files
committed
Undo renaming of getConstCharTPointer
1 parent cf2be9b commit c483299

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

cpp/common/src/codingstandards/cpp/Dereferenced.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BasicStringMemberFunctionDereferencedExpr extends BasicStringDereferencedE
4646
// basic_string::basic_string(const charT *, const Allocator &)
4747
f instanceof Constructor and
4848
f.getNumberOfParameters() <= 2 and
49-
f.getParameter(0).getType() = stringType.getValueType() and
49+
f.getParameter(0).getType() = stringType.getConstCharTPointer() and
5050
(
5151
f.getNumberOfParameters() = 2
5252
implies
@@ -58,14 +58,14 @@ class BasicStringMemberFunctionDereferencedExpr extends BasicStringDereferencedE
5858
// basic_string &basic_string::assign(const charT *)
5959
f.hasName(["append", "assign"]) and
6060
f.getNumberOfParameters() = 1 and
61-
f.getParameter(0).getType() = stringType.getValueType() and
61+
f.getParameter(0).getType() = stringType.getConstCharTPointer() and
6262
this = fc.getArgument(0)
6363
or
6464
// basic_string &basic_string::insert(size_type, const charT *)
6565
f.hasName("insert") and
6666
f.getNumberOfParameters() = 2 and
6767
f.getParameter(0).getType() = stringType.getSizeType() and
68-
f.getParameter(1).getType() = stringType.getValueType() and
68+
f.getParameter(1).getType() = stringType.getConstCharTPointer() and
6969
this = fc.getArgument(1)
7070
or
7171
// basic_string &basic_string::replace(size_type, size_type, const charT *)
@@ -74,7 +74,7 @@ class BasicStringMemberFunctionDereferencedExpr extends BasicStringDereferencedE
7474
f.getNumberOfParameters() = 3 and
7575
f.getParameter(0).getType() = [stringType.getSizeType(), stringType.getConstIteratorType()] and
7676
f.getParameter(1).getType() = [stringType.getSizeType(), stringType.getConstIteratorType()] and
77-
f.getParameter(2).getType() = stringType.getValueType() and
77+
f.getParameter(2).getType() = stringType.getConstCharTPointer() and
7878
this = fc.getArgument(2)
7979
or
8080
// size_type basic_string::find(const charT *, size_type)
@@ -87,7 +87,7 @@ class BasicStringMemberFunctionDereferencedExpr extends BasicStringDereferencedE
8787
"find", "rfind", "find_first_of", "find_last_of", "find_first_not_of", "find_last_not_of"
8888
]) and
8989
f.getNumberOfParameters() = 2 and
90-
f.getParameter(0).getType() = stringType.getValueType() and
90+
f.getParameter(0).getType() = stringType.getConstCharTPointer() and
9191
f.getParameter(1).getType() = stringType.getSizeType() and
9292
this = fc.getArgument(0)
9393
or
@@ -96,15 +96,15 @@ class BasicStringMemberFunctionDereferencedExpr extends BasicStringDereferencedE
9696
// basic_string &basic_string::operator+=(const charT *)
9797
f.hasName(["compare", "operator=", "operator+="]) and
9898
f.getNumberOfParameters() = 1 and
99-
f.getParameter(0).getType() = stringType.getValueType() and
99+
f.getParameter(0).getType() = stringType.getConstCharTPointer() and
100100
this = fc.getArgument(0)
101101
or
102102
// int basic_string::compare(size_type, size_type, const charT *)
103103
f.hasName("compare") and
104104
f.getNumberOfParameters() = 3 and
105105
f.getParameter(0).getType() = stringType.getSizeType() and
106106
f.getParameter(1).getType() = stringType.getSizeType() and
107-
f.getParameter(2).getType() = stringType.getValueType() and
107+
f.getParameter(2).getType() = stringType.getConstCharTPointer() and
108108
this = fc.getArgument(2)
109109
)
110110
}
@@ -136,7 +136,7 @@ class BasicStringNonMemberFunctionDereferencedExpr extends BasicStringDereferenc
136136
]) and
137137
f.getAParameter().getType().(ReferenceType).getBaseType().getUnspecifiedType() = stringType and
138138
exists(int param |
139-
f.getParameter(param).getType() = stringType.getValueType() and
139+
f.getParameter(param).getType() = stringType.getConstCharTPointer() and
140140
this = fc.getArgument(param)
141141
)
142142
)

cpp/common/src/codingstandards/cpp/rules/containeraccesswithoutrangecheck/ContainerAccessWithoutRangeCheck.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class StringContainerConstructorCall extends ContainerConstructorCall {
159159
override Expr getInitialContainerSizeExpr() {
160160
// from buffer
161161
c.getNumberOfParameters() = 3 and
162-
c.getParameter(0).getType() = stringInstantiation.getValueType() and
162+
c.getParameter(0).getType() = stringInstantiation.getConstCharTPointer() and
163163
c.getParameter(1).getType() = stringInstantiation.getSizeType() and
164164
c.getParameter(2).getType() = stringInstantiation.getConstAllocatorReferenceType() and
165165
// copies `n` items from the buffer
@@ -181,11 +181,11 @@ class StringContainerConstructorCall extends ContainerConstructorCall {
181181
or
182182
// from c-string constructors
183183
c.getNumberOfParameters() = 1 and
184-
c.getParameter(0).getType() = stringInstantiation.getValueType() and
184+
c.getParameter(0).getType() = stringInstantiation.getConstCharTPointer() and
185185
result = getArgument(0).getValue().length()
186186
or
187187
c.getNumberOfParameters() = 2 and
188-
c.getParameter(0).getType() = stringInstantiation.getValueType() and
188+
c.getParameter(0).getType() = stringInstantiation.getConstCharTPointer() and
189189
c.getParameter(1).getType() = stringInstantiation.getSizeType() and
190190
result = getArgument(1).getValue().toFloat()
191191
or
@@ -195,7 +195,7 @@ class StringContainerConstructorCall extends ContainerConstructorCall {
195195
result = getArgument(0).getValue().toFloat()
196196
or
197197
c.getNumberOfParameters() = 2 and
198-
c.getParameter(0).getType() = stringInstantiation.getValueType() and
198+
c.getParameter(0).getType() = stringInstantiation.getConstCharTPointer() and
199199
c.getParameter(1).getType() = stringInstantiation.getConstAllocatorReferenceType() and
200200
result = getArgument(0).getValue().length()
201201
or

cpp/common/src/codingstandards/cpp/standardlibrary/String.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class StdBasicString extends ClassTemplateInstantiation {
1313
Type getAllocator() { result = getTemplateArgument(2) }
1414

1515
/** Gets the `const charT*` type for this `basic_string` instantiation. */
16-
PointerType getValueType() {
16+
PointerType getConstCharTPointer() {
1717
exists(SpecifiedType specType |
1818
specType = result.getBaseType() and
1919
specType.isConst() and

0 commit comments

Comments
 (0)