[cfe-dev] Newby questions

Hartmut Kaiser hartmut.kaiser at gmail.com
Fri Aug 31 18:33:45 PDT 2007

Neil Booth wrote: 

> > 1. I couldn't find any build instructions/project files to 
> build clang 
> > using MSVC8, so I decided to create these. I tried to use similar 
> > build settings as have been used in the corresponding MSVC project 
> > files for LLVM. Almost everything compiled fine, except for 
> a bigger 
> > issue and some really minor platform specific issues, which I have 
> > been able to address. The bigger issue is that the clang::FileEntry 
> > class retrieves the size of the file using stat, but because of the 
> > EOL translation done on Windows the file usually is smaller 
> in memory 
> > than it is on disk. I introduced a hack in the
> > ReadFileFast() function to circumvent an infinite loop 
> there, but this 
> > has other effects I'm not able to resolve ad hoc. How is 
> this solved in LLVM?
> I think we should be reading the files in binary mode.

Ok, this did the trick. If you tell me, how I detect compilation on a
windows platform in LLVM/clang style (i.e. which pp constant to use) I'll
submit a patch.

> > 3. After getting these assertions I moved to the test/Lexer 
> directory 
> > to see, if the preprocessor is working. The tests there 
> seem to pass. 
> > So I started to feed the files from the Boost.Wave 
> testsuite to clang 
> > in pp mode (clang -E). Unfortunately many of these tests 
> fail (produce 
> > wrongly preprocessed output). Is this a known issue? Would there be 
> > any interest in using Boost.Wave as the preprocessor/lexer 
> for clang?
> I doubt it; Chris wrote it for speed and for the interface it 
> provides the front end.  We should just fix whatever the 
> failures are.  Stuff like UCNs aren't yet implemented.

The errors I've seen were because of the problem above. Now everything I
checked (especially wrt macro expansion order and macro parameter
evaluation) looks ok. Good job! There aren't too much preprocessors around
being able to get all the Wave test cases right (so far, actually besides
Wave itself there was only 'gcc -E' doing it correctly).

Regards Hartmut

More information about the cfe-dev mailing list