Move InitializePreprocessor() to lib/Frontend from clang-cc

Hi,

This is a patch for http://llvm.org/bugs/attachment.cgi?bugid=3979.

It moves InitializePreprocessor() functionality to its own file under lib/Frontend from clang-cc.cpp.

This allows users of the clang libraries to properly initialize all the expected macros without copying and pasting 500 lines of code from clang-cc.cpp.

Not included are changes to Makefiles and such to properly add the new InitializePreprocessor.cpp file to the build system, since I do not know what is needed there.

-Alexei

InitPP.diff (42.4 KB)

Hi Alexei,

This looks generally fine, except that we really prefer libfrontend to not use cl::opt at all. We want all the command line option processing stuff to be in clang-cc, not in any lib directories. Can you refactor the code to populate a class from the command line options and pass that in instead?

Thanks,

-Chris

All right, I’ll try.

-Alexei

Here’s an updated patch.

-Alexei

InitPP2.diff (45.1 KB)

Thanks Alexei, getting better. Minor nit picks:

+//===— InitPreprocessor.h - InitializePreprocessor function. –- C++ --===//

Done.

InitPP3.diff (44.9 KB)

Looks great, applied!
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090420/015964.html

Thanks Alexei,

-Chris