[patch] Add namespace aliasing support.
Tom Tromey
tromey@redhat.com
Fri Jan 29 20:23:00 GMT 2010
>>>>> "Sami" == Sami Wagiaalla <swagiaal@redhat.com> writes:
Sami> 2010-01-29 Sami Wagiaalla <swagiaal@redhat.com>
Sami> * cp-support.h: Added char* alias element to using_direct data
Sami> struct.
Sami> (cp_add_using): Added char* alias argument.
Sami> (cp_add_using_directive): Ditto.
Sami> * cp-namespace.c: Updated with the above changes.
Sami> (cp_lookup_symbol_imports): Check for aliases.
Sami> * dwarf2read.c (read_import_statement): Figure out local alias
Sami> for the import and pass it on to cp_add_using.
Sami> (read_namespace): Pass alias argument to cp_add_using.
Sami> 2010-01-29 Sami Wagiaalla <swagiaal@redhat.com>
Lots of formatting nits, plus one slightly more substantial comment.
Sami> +cp_add_using_directive (const char *dest, const char *src, const char* alias)
"char *", not "char*".
Sami> + scope DEST. ALIAS is the name of the imported namespace in the current
Sami> + scope. If ALIAS is an empty string then the namespace is known by its
Sami> + original name.
Two spaces after a period. Only one space between "string then".
Sami> + retval->alias = savestring (alias, strlen(alias));
Space before open paren.
Sami> + else if (strcmp ("", current->alias) == 0)
It is more idiomatic in C to use NULL rather than the empty string as a
special value. Please make this change.
Sami> + {
Sami> + /* If this import statement creates no alias, pass current->inner as
Sami> + NAMESPACE to direct the search towards the imported namespace. */
Sami> + sym = cp_lookup_symbol_imports (current->import_src,
The code here should be indented 2 spaces beyond the open brace, not
lined up with it.
Sami> + namespace IMPORT_DEST. These form a linked list; NEXT is the next element
Sami> + of the list. ALIAS is set to a non empty string if the imported namespace
Sami> + has been aliased.
The period rule again.
Sami> + import_alias = dwarf2_name (die, cu);
Sami> + if (import_alias == NULL)
Sami> + {
Sami> + import_alias = "";
Sami> + }
This code will be going away, but just FYI, don't brace a single
statement.
Tom
More information about the Gdb-patches
mailing list