diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-06-13 16:10:10 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-06-13 16:10:10 +0000 |
commit | 50af5481d5feece564c8b03bfb4a647dc7573f3c (patch) | |
tree | 6d434da197be7f970b21ecc8f8f4afc417571b76 /gdb/cp-namespace.c | |
parent | d55637df6923689396e58c3d789e82314f4826ec (diff) | |
download | gdb-50af5481d5feece564c8b03bfb4a647dc7573f3c.zip gdb-50af5481d5feece564c8b03bfb4a647dc7573f3c.tar.gz gdb-50af5481d5feece564c8b03bfb4a647dc7573f3c.tar.bz2 |
gdb/
PR c++/14177 - Fix parsing TYPENAME:: in parentheses.
* c-exp.y (classify_inner_name): Remove caller assumptions in the
function comment. Return ERROR for unresolved cases. Implement
returning proper NAME.
(yylex): Accept also NAME from classify_inner_name.
* cp-namespace.c (cp_lookup_nested_type): Rename to ...
(cp_lookup_nested_symbol): ... here. Return any found symbol, not just
LOC_TYPEDEF type.
* cp-support.h (cp_lookup_nested_type): Update its declaration.
gdb/testsuite/
PR c++/14177 - Fix parsing TYPENAME:: in parentheses.
* gdb.cp/cpexprs.cc (class CV, CV::i, ATTRIBUTE_USED, CV_f): New.
(test_function): Call CV_f.
* gdb.cp/cpexprs.exp (p 'CV::m(int)', p CV::m(int))
(p 'CV::m(int) const', p CV::m(int) const, p 'CV::m(int) volatile')
(p CV::m(int) volatile, p 'CV::m(int) const volatile')
(p CV::m(int) const volatile, p CV_f(int), p CV_f(CV::t))
(p CV_f(CV::i)): New tests.
Diffstat (limited to 'gdb/cp-namespace.c')
-rw-r--r-- | gdb/cp-namespace.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 170dd5f..e2291a9 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -660,14 +660,14 @@ lookup_symbol_file (const char *name, return sym; } -/* Look up a type named NESTED_NAME that is nested inside the C++ +/* Look up a symbol named NESTED_NAME that is nested inside the C++ class or namespace given by PARENT_TYPE, from within the context given by BLOCK. Return NULL if there is no such nested type. */ -struct type * -cp_lookup_nested_type (struct type *parent_type, - const char *nested_name, - const struct block *block) +struct symbol * +cp_lookup_nested_symbol (struct type *parent_type, + const char *nested_name, + const struct block *block) { /* type_name_no_tag_required provides better error reporting using the original type. */ @@ -694,8 +694,8 @@ cp_lookup_nested_type (struct type *parent_type, block, VAR_DOMAIN); char *concatenated_name; - if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF) - return SYMBOL_TYPE (sym); + if (sym != NULL) + return sym; /* Now search all static file-level symbols. Not strictly correct, but more useful than an error. We do not try to @@ -707,16 +707,15 @@ cp_lookup_nested_type (struct type *parent_type, + strlen (nested_name) + 1); sprintf (concatenated_name, "%s::%s", parent_name, nested_name); - sym = lookup_static_symbol_aux (concatenated_name, - VAR_DOMAIN); - if (sym != NULL && SYMBOL_CLASS (sym) == LOC_TYPEDEF) - return SYMBOL_TYPE (sym); + sym = lookup_static_symbol_aux (concatenated_name, VAR_DOMAIN); + if (sym != NULL) + return sym; return NULL; } default: internal_error (__FILE__, __LINE__, - _("cp_lookup_nested_type called " + _("cp_lookup_nested_symbol called " "on a non-aggregate type.")); } } |