diff options
author | Dodji Seketeli <dodji@seketeli.org> | 2013-06-21 17:27:54 +0200 |
---|---|---|
committer | Dodji Seketeli <dodji@seketeli.org> | 2013-06-21 17:27:54 +0200 |
commit | 05ad23348f1e76b1c39ec2cf5a3d72c4df131255 (patch) | |
tree | 01feff05c491de920ecd7833f2b44db058c1b44c | |
parent | 5b5afa7fc5dd867719de282bbd3a619c7594a3f2 (diff) | |
download | gcc-05ad23348f1e76b1c39ec2cf5a3d72c4df131255.tar.gz |
Handle forward declaration of classes
gcc/cp/
* abi-instr.cc (gen_type_in_scope): When a class is a definition
for a forward declaration, mark it as such.
-rw-r--r-- | gcc/cp/abi-instr.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/gcc/cp/abi-instr.cc b/gcc/cp/abi-instr.cc index 2fdcd33a381..4d554f2a232 100644 --- a/gcc/cp/abi-instr.cc +++ b/gcc/cp/abi-instr.cc @@ -789,9 +789,12 @@ gen_type_in_scope (const_tree t, return result; type_map& m = get_tree_2_type_map (); - type_map::const_iterator i = m.find (t); - if (i != m.end ()) - return i->second; + + { + type_map::const_iterator i = m.find (t); + if (i != m.end ()) + return i->second; + } // Handle qualified types. if (int quals = TYPE_QUALS (t)) @@ -931,7 +934,18 @@ gen_type_in_scope (const_tree t, gcc_unreachable (); case RECORD_TYPE: - result = gen_class_type_in_scope (t, scope); + { + shared_ptr <abigail::class_decl> r = + gen_class_type_in_scope (t, scope); + if (r) + { + type_map::const_iterator i = m.find (t); + if (i != m.end ()) + // There was an earlier declaration for this class. + r->set_earlier_declaration (i->second); + result = r; + } + } break; default: |