[PATCH] D45815: [libclang] Allow skipping function bodies in preamble only

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 4 06:22:57 PDT 2018


ilya-biryukov added inline comments.


================
Comment at: include/clang/Frontend/ASTUnit.h:104
 
+  enum class SkipFunctionBodiesScope { None, MainFileAndPreamble, Preamble };
+
----------------
Maybe move this out of `ASTUnit`? Would allow removing the first qualifier in usages outside the class itself (i.e. `ASTUnit::SkipFunctionBodiesScope::Preamble` will be shorter!)


================
Comment at: include/clang/Frontend/ASTUnit.h:370
+      IntrusiveRefCntPtr<vfs::FileSystem> VFS,
+      SkipFunctionBodiesScope SkipFunctionBodiesScp =
+          SkipFunctionBodiesScope::None,
----------------
NIT: Maybe keep the name `SkipFunctionBodies`? It seems that putting `Scp` at the end does not add any clarity.


================
Comment at: include/clang/Frontend/ASTUnit.h:831
                ArrayRef<RemappedFile> RemappedFiles = None,
+               SkipFunctionBodiesScope SkipFunctionBodiesScp =
+                   SkipFunctionBodiesScope::None,
----------------
This parameter seems slightly out of place.
The scope of skipped function bodies should be a property of the whole `ASTUnit`, changing it on every reparse would mean more complexity and wouldn't be used anyway.

I suggest storing a field of type `SkipFunctionBodiesScope` instead of adding parameters to `Reparse` and `LoadFromCompilerInvocation`.


Repository:
  rC Clang

https://reviews.llvm.org/D45815





More information about the cfe-commits mailing list