Merge pull request #159 from ian-semmle/EnumConstant

C++: Fix spurious extra qualified names for enum constants within a class
This commit is contained in:
Jonas Jensen
2018-09-08 14:55:33 +02:00
committed by GitHub
3 changed files with 27 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ abstract class Declaration extends Locatable, @declaration {
// MemberFunction, MemberVariable, MemberType
exists (Declaration m
| m = this and
not m instanceof EnumConstant and
result = m.getDeclaringType().getQualifiedName() + "::" + m.getName())
or
exists (EnumConstant c

View File

@@ -0,0 +1,21 @@
| file://:0:0:0:0 | __va_list_tag | __va_list_tag |
| file://:0:0:0:0 | fp_offset | __va_list_tag::fp_offset |
| file://:0:0:0:0 | gp_offset | __va_list_tag::gp_offset |
| file://:0:0:0:0 | operator= | __va_list_tag::operator= |
| file://:0:0:0:0 | operator= | __va_list_tag::operator= |
| file://:0:0:0:0 | overflow_arg_area | __va_list_tag::overflow_arg_area |
| file://:0:0:0:0 | reg_save_area | __va_list_tag::reg_save_area |
| test.cpp:2:7:2:7 | operator= | MyEnumClass::operator= |
| test.cpp:2:7:2:7 | operator= | MyEnumClass::operator= |
| test.cpp:2:7:2:17 | MyEnumClass | MyEnumClass |
| test.cpp:4:10:4:15 | MyEnum | MyEnumClass::MyEnum |
| test.cpp:5:9:5:9 | A | MyEnumClass::MyEnum::A |
| test.cpp:6:9:6:9 | B | MyEnumClass::MyEnum::B |
| test.cpp:10:34:10:34 | v | v |
| test.cpp:12:7:12:7 | MyClass2 | MyClass2::MyClass2 |
| test.cpp:12:7:12:7 | MyClass2 | MyClass2::MyClass2 |
| test.cpp:12:7:12:7 | operator= | MyClass2::operator= |
| test.cpp:12:7:12:7 | operator= | MyClass2::operator= |
| test.cpp:12:7:12:14 | MyClass2 | MyClass2 |
| test.cpp:14:12:14:19 | MyClass2 | MyClass2::MyClass2 |
| test.cpp:17:6:17:6 | f | f |

View File

@@ -0,0 +1,5 @@
import cpp
from Declaration d
select d, d.getQualifiedName()