Improve tracking of source position in the presence of /* */ comments.

Don't let the preprocessor remove comments anymore, so that the rules
in lex.ll can handle them.  Fix lCComment() to update the source
position as it eats characters in comments.
This commit is contained in:
Matt Pharr
2012-02-06 09:40:52 -08:00
parent 977b983771
commit 4e018d0a20
2 changed files with 7 additions and 1 deletions

View File

@@ -1170,6 +1170,10 @@ Module::execPreprocessor(const char* infilename, llvm::raw_string_ostream* ostre
inst.createSourceManager(inst.getFileManager());
inst.InitializeSourceManager(infilename);
// Don't remove comments in the preprocessor, so that we can accurately
// track the source file position by handling them ourselves.
inst.getPreprocessorOutputOpts().ShowComments = 1;
clang::PreprocessorOptions &opts = inst.getPreprocessorOpts();
// Add defs for ISPC and PI