Skip to content

Commit 818f339

Browse files
committed
C++ front-end: store typedef names
This is already supported in the C front-end, and we should not unnecessarily deviate in behaviour between the C and C++ front-ends.
1 parent 35c31bb commit 818f339

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

regression/cbmc-cpp/typedef1/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
typedef int XYZ;
2+
3+
int main(int argc, char *argv[])
4+
{
5+
XYZ a;
6+
return a;
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.cpp
3+
--show-symbol-table
4+
activate-multi-line-match
5+
Symbol......: main::1::a\nPretty name.: main::1::a\nModule......: main\nBase name...: a\nMode........: cpp\nType........: XYZ\n
6+
^EXIT=0$
7+
^SIGNAL=0$
8+
--
9+
^warning: ignoring

src/cpp/cpp_declarator_converter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ symbolt &cpp_declarator_convertert::convert(
9090

9191
get_final_identifier();
9292

93+
if(is_typedef)
94+
final_type.set(ID_C_typedef, final_identifier);
95+
9396
// first see if it is a member
9497
if(scope->id_class == cpp_idt::id_classt::CLASS)
9598
{

0 commit comments

Comments
 (0)