[cfe-commits] [Patch 5 of 7] -verify fixes and enhancement

Jordan Rose jordan_rose at apple.com
Mon Jul 2 14:15:03 PDT 2012


On Jun 30, 2012, at 14:12 , Andy Gibbs <andyg1001 at hotmail.co.uk> wrote:

> Part 5: Renamed Seen and Unseen to FilesWithDirectives and FilesWithDiagnostics as requested; moved changes specific to part 6 into part 6 patch; added FIXME on post-process loop.
> 
> This patch must be combined with part 7 which includes the test-cases. 
> <verify-part5.diff>

   // FIXME: Const hack, we screw up the preprocessor but in practice its ok
   // because it doesn't get reused. It would be better if we could make a copy
   // though.
   CurrentPreprocessor = const_cast<Preprocessor*>(PP);
+  if (CurrentPreprocessor) CurrentPreprocessor->addCommentHandler(this);
 
   PrimaryClient->BeginSourceFile(LangOpts, PP);
 }
 
 void VerifyDiagnosticConsumer::EndSourceFile() {
+  if (CurrentPreprocessor) CurrentPreprocessor->removeCommentHandler(this);

The "const hack" isn't actually being used in current code, but would be necessary to add and remove your comment handler. However, we'll be able to take this out completely after the tests are updated, right?


+  std::string C(SM.getCharacterData(Comment.getBegin()),
+                SM.getCharacterData(Comment.getEnd()));

StringRef :-) But I'm wondering now if this can share any code with Dmitri's doc-comment-parsing work, at least for \<EOL> folding.



More information about the cfe-commits mailing list