mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
C++: Introduce a new base class for template parameters
This will enable us to support non-type template parameters, which we currently do not support, and error template parameters, which might become relevant in the `build-mode: none` context.
This commit is contained in:
@@ -26,7 +26,7 @@ import cpp
|
||||
*/
|
||||
class TemplateDependentType extends Type {
|
||||
TemplateDependentType() {
|
||||
this instanceof TemplateParameter
|
||||
this instanceof TypeTemplateParameter
|
||||
or
|
||||
exists(TemplateDependentType t |
|
||||
this.refersToDirectly(t) and
|
||||
|
||||
@@ -49,7 +49,7 @@ predicate nanTest(EqualityOperation cmp) {
|
||||
pointlessSelfComparison(cmp) and
|
||||
exists(Type t | t = cmp.getLeftOperand().getUnspecifiedType() |
|
||||
t instanceof FloatingPointType or
|
||||
t instanceof TemplateParameter
|
||||
t instanceof TypeTemplateParameter
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import cpp
|
||||
|
||||
private predicate mightHaveConstMethods(Type t) {
|
||||
t instanceof Class or
|
||||
t instanceof TemplateParameter
|
||||
t instanceof TypeTemplateParameter
|
||||
}
|
||||
|
||||
predicate hasSuperfluousConstReturn(Function f) {
|
||||
|
||||
@@ -26,7 +26,7 @@ predicate functionsMissingReturnStmt(Function f, ControlFlowNode blame) {
|
||||
exists(Type returnType |
|
||||
returnType = f.getUnspecifiedType() and
|
||||
not returnType instanceof VoidType and
|
||||
not returnType instanceof TemplateParameter
|
||||
not returnType instanceof TypeTemplateParameter
|
||||
) and
|
||||
exists(ReturnStmt s |
|
||||
f.getAPredecessor() = s and
|
||||
|
||||
Reference in New Issue
Block a user