mirror of
https://github.com/github/codeql.git
synced 2025-12-22 03:36:30 +01:00
C++: Print print nontype template params
This commit is contained in:
@@ -35,6 +35,14 @@ private string getParameterTypeString(Type parameterType) {
|
||||
else result = parameterType.(DumpType).getTypeIdentityString()
|
||||
}
|
||||
|
||||
private string getTemplateArgumentString(Declaration d, int i) {
|
||||
if exists(d.getTemplateArgumentValue(i))
|
||||
then
|
||||
result = d.getTemplateArgument(i).(DumpType).getTypeIdentityString() + " " + d.getTemplateArgumentValue(i)
|
||||
else
|
||||
result = d.getTemplateArgument(i).(DumpType).getTypeIdentityString()
|
||||
}
|
||||
|
||||
/**
|
||||
* A `Declaration` extended to add methods for generating strings useful only for dumps and debugging.
|
||||
*/
|
||||
@@ -56,7 +64,7 @@ abstract private class DumpDeclaration extends Declaration {
|
||||
strictconcat(int i |
|
||||
exists(this.getTemplateArgument(i))
|
||||
|
|
||||
this.getTemplateArgument(i).(DumpType).getTypeIdentityString(), ", " order by i
|
||||
getTemplateArgumentString(this, i), ", " order by i
|
||||
) + ">"
|
||||
else result = ""
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ bad_asts.cpp:
|
||||
# 5| params:
|
||||
#-----| 0: [Parameter] p#0
|
||||
#-----| Type = [RValueReferenceType] S &&
|
||||
# 9| [FunctionTemplateInstantiation,MemberFunction] int Bad::S::MemberFunction<int>(int)
|
||||
# 9| [FunctionTemplateInstantiation,MemberFunction] int Bad::S::MemberFunction<int 6>(int)
|
||||
# 9| params:
|
||||
# 9| 0: [Parameter] y
|
||||
# 9| Type = [IntType] int
|
||||
@@ -92,7 +92,7 @@ bad_asts.cpp:
|
||||
# 10| 1: [VariableAccess] y
|
||||
# 10| Type = [IntType] int
|
||||
# 10| ValueCategory = prvalue(load)
|
||||
# 9| [MemberFunction,TemplateFunction] int Bad::S::MemberFunction<int>(int)
|
||||
# 9| [MemberFunction,TemplateFunction] int Bad::S::MemberFunction<int t>(int)
|
||||
# 9| params:
|
||||
# 9| 0: [Parameter] y
|
||||
# 9| Type = [IntType] int
|
||||
@@ -104,8 +104,9 @@ bad_asts.cpp:
|
||||
# 10| 0: [AddExpr] ... + ...
|
||||
# 10| Type = [IntType] int
|
||||
# 10| ValueCategory = prvalue
|
||||
# 10| 0: [Literal] Unknown literal
|
||||
# 10| 0: [Literal] t
|
||||
# 10| Type = [IntType] int
|
||||
# 10| Value = [Literal] t
|
||||
# 10| ValueCategory = prvalue
|
||||
# 10| 1: [PointerFieldAccess] x
|
||||
# 10| Type = [IntType] int
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
bad_asts.cpp:
|
||||
# 9| int Bad::S::MemberFunction<int>(int)
|
||||
# 9| int Bad::S::MemberFunction<int 6>(int)
|
||||
# 9| Block 0
|
||||
# 9| v0_0(void) = EnterFunction :
|
||||
# 9| mu0_1(unknown) = AliasedDefinition :
|
||||
|
||||
Reference in New Issue
Block a user