Hi Doug, To support custom commands in comments we need some mechanism to tell inline and block commands apart, because command kind (inline/block) affects comment parsing. This patch adds CommentOptions inside LangOptions to store a list of block commands that are registered dynamically.
The final issue is CommentOptions serialization and PCH. It looks like ASTContext can be created with empty LangOpts -- it will be deserialized later. But block commands from CommentOptions should be registered in CommandTraits... Can you please take a look at http://llvm-reviews.chandlerc.com/D272?vs=879&id=882&whitespace=ignore-all#toc ? Dmitri On Tue, Feb 5, 2013 at 5:45 PM, Dmitri Gribenko <[email protected]> wrote: > > Please also update `checkLanguageOptions` in ASTReader.cpp to compare > CommentOptions, too. > > > ================ > Comment at: lib/AST/CommentCommandTraits.cpp:24 > @@ +23,3 @@ > + > +void CommandTraits::RegisterCommentOptions( > + const CommentOptions &CommentOptions) { > ---------------- > Functions' names start with a lowercase letter. > > ================ > Comment at: lib/AST/CommentCommandTraits.cpp:25 > @@ +24,3 @@ > +void CommandTraits::RegisterCommentOptions( > + const CommentOptions &CommentOptions) { > + for (CommentOptions::BlockCommandNamesTy::const_iterator I = > ---------------- > 'const' should be indented by at least 4 spaces. > > ================ > Comment at: lib/Frontend/ASTUnit.cpp:579-580 > @@ -576,1 +578,4 @@ > + // constructed, so register them now. > + Context.getCommentCommandTraits().RegisterCommentOptions( > + LangOpt.CommentOpts); > } > ---------------- > As far as I see, updated() can be called multiple times. We will get > multiple commands with the same name registered. > > I'm not sure that this is the correct place to put this, though. Not all PCH > loading is done through ASTUnit. > CompilerInstance::createPCHExternalASTSource might be the correct one, but > I'm not sure. I'll ask Doug. > > > http://llvm-reviews.chandlerc.com/D272 -- main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if (j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/ _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
