[PATCH] D121092: [pseudo] Strip comments for TokenStream.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 7 05:19:29 PST 2022


hokein added inline comments.


================
Comment at: clang/include/clang/Tooling/Syntax/Pseudo/Preprocess.h:144
 
+/// Drops comment tokens.
+TokenStream stripComments(const TokenStream &);
----------------
sammccall wrote:
> I think this fits more naturally into Token.h next to cook().
> 
> It produces and consumes a token stream, and its implementation is a trivial use of those APIs.
> 
> While formally we might see comment stripping as part of the preprocessor, this file is more to do with directive structure. (Maybe it should be renamed?)
moving to Token.h sounds good to me -- I'd treat this is a trivial implementation (I just wrote it to test the GLR parser). And yeah, stripping comment is just part of preprocessing the code. 

> Maybe it should be renamed?

The current `Preprocess.h` file name indicates that everything about  preprocessing of TokenStream should live in it.

Since this file defines PPStructure, just call it `PPStructure.h/cpp` for better fine grained granularity?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121092/new/

https://reviews.llvm.org/D121092



More information about the cfe-commits mailing list