mirror of
https://github.com/github/codeql.git
synced 2026-04-29 02:35:15 +02:00
C++: Handle ProxyClass in getIdentityString()
This commit is contained in:
@@ -346,8 +346,13 @@ private class UserDumpType extends DumpType, DumpDeclaration, UserType {
|
||||
override string getIdentityString() {
|
||||
exists(string simpleName |
|
||||
(
|
||||
if this instanceof Closure then
|
||||
simpleName = "(" + getSimpleName() + ")"
|
||||
if this instanceof Closure then (
|
||||
// Parenthesize the name of the lambda because it's freeform text similar to
|
||||
// "lambda [] type at line 12, col. 40"
|
||||
// Use `min(getSimpleName())` to work around an extractor bug where a lambda can have different names
|
||||
// from different compilation units.
|
||||
simpleName = "(" + min(getSimpleName()) + ")"
|
||||
)
|
||||
else
|
||||
simpleName = getSimpleName()
|
||||
) and
|
||||
@@ -360,6 +365,12 @@ private class UserDumpType extends DumpType, DumpDeclaration, UserType {
|
||||
}
|
||||
}
|
||||
|
||||
private class DumpProxyClass extends UserDumpType, ProxyClass {
|
||||
override string getIdentityString() {
|
||||
result = getName()
|
||||
}
|
||||
}
|
||||
|
||||
private class DumpVariable extends DumpDeclaration, Variable {
|
||||
override string getIdentityString() {
|
||||
exists(DumpType type |
|
||||
|
||||
@@ -9,6 +9,12 @@ void check_var(TVar var, const char* expected);
|
||||
|
||||
struct S
|
||||
{
|
||||
enum NestedEnum
|
||||
{
|
||||
Blah,
|
||||
Bluh
|
||||
};
|
||||
|
||||
int i;
|
||||
float f;
|
||||
};
|
||||
@@ -18,6 +24,13 @@ struct T
|
||||
bool b;
|
||||
};
|
||||
|
||||
enum E
|
||||
{
|
||||
One,
|
||||
Two,
|
||||
Three
|
||||
};
|
||||
|
||||
void checks()
|
||||
{
|
||||
// Primitive types
|
||||
@@ -120,6 +133,9 @@ void checks()
|
||||
check_type<AI>("int[10]");
|
||||
check_type<CAI>("int const[10]");
|
||||
check_type<int const[10]>("int const[10]");
|
||||
|
||||
check_type<E>("E");
|
||||
check_type<S::NestedEnum>("S::NestedEnum");
|
||||
}
|
||||
|
||||
int globalVariable;
|
||||
|
||||
Reference in New Issue
Block a user