[cfe-dev] Using the Lexer...

Alexei Svitkine alexei.svitkine at gmail.com
Wed Feb 11 19:59:56 PST 2009


I guess I meant to send this reply to the list...


---------- Forwarded message ----------
From: Alexei Svitkine <alexei.svitkine at gmail.com>
Date: Wed, Feb 11, 2009 at 10:58 PM
Subject: Re: [cfe-dev] Using the Lexer...
To: Nico Weber <nicolasweber at gmx.de>


I got it to work, thanks.

But I think the source code headers should be more information and
should contain enough documentation to use the APIs - and it shouldn't
be necessary to go out to find some random tutorial on the web to get
simple things to work (like using the Lexer).

For example, before I was working from just looking at the header from
something like this:

 /// Lexer constructor - Create a new lexer object for the specified buffer
 /// with the specified preprocessor managing the lexing process.  This lexer
 /// assumes that the associated file buffer and Preprocessor objects will
 /// outlive it, so it doesn't take ownership of either of them.
 Lexer(FileID FID, Preprocessor &PP);

Notice how it says nothing about the Preprocessor having to own the
Lexer and the other details Chris Lattner mentioned. Good headers
should contain all the necessary information for users of a class.
(Don't take this too harshly - I understand that the current priority
is to make clang useful as a tool - and other things like source code
documentation for users of the API are not as important right now, I'm
just saying that it would be good if this kind of thing would be
improved in the future.)

-Alexei

On Wed, Feb 11, 2009 at 10:45 PM, Nico Weber <nicolasweber at gmx.de> wrote:
> Hi Alexei,
>
> http://amnoid.de/tmp/clangtut/tut.html might be useful to you. It's not yet
> done, and it's currently a bit out of date, but it explains how to use the
> preprocessor (if i remember correclty).
>
> Nico
>
>



More information about the cfe-dev mailing list