This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ lexical analysis rework

On Jan 15, 2005, at 10:41 AM, Zack Weinberg wrote:

Eric Botcazou <> writes:

Here is the foreshadowed patch which speeds up the C++ front end's
lexical analysis phase.  What it does is really quite simple: it has
(almost) all of the work that cpplib and c-lex.c do done at once, and
holds all the translation unit's tokens in a big buffer.

I just discovered that this breaks DBX_USE_BINCL support:
because dbxout.c relies on the ordered invocations of
dbxout_start_source_file, dbxout_symbol and dbxout_end_source_file to
implement it. Now dbxout_start_source_file and dbxout_end_source_file are
invoked by the lexer, while dbxout_symbol is invoked by the parser.
How do you think we can fix this? Should we "replay" the opening/closing of
files in the parser (if this is ever possible)?

Yes. What ought to happen is, the cb_line_change and fe_file_change logic should be completely disabled for C++, and what they do should be moved to cp_lexer_set_source_position_from_token. C++ may want its own versions of those hooks that record file open and close information in the token array - I don't think we have that right now. Matt was working on related issues. Such a change *might* be acceptable for 4.0 if done very very carefully, and I don't have a less-invasive suggestion, sorry.

You mean my email about source location? I wouldn't call that something I was working on; more just some ideas about things that might be a good idea to work on later. I certainly wasn't imagining it for 4.0.

And yes, I agree with you that cp_lexer_set_source_position_from_token is the right place to do this. The only slightly tricky part is making sure that the tests don't slow things down.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]