[PATCH] D64098: [NFC][clang] Refactor getCompilationPhases step 1: Move list of phases into Types.def table.

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 2 14:23:22 PDT 2019


compnerd added inline comments.


================
Comment at: clang/lib/Driver/Types.cpp:29
+  { NAME, FLAGS, TEMP_SUFFIX, TY_##PP_TYPE, PHASES, },
+#define PHASES llvm::SmallVector<phases::ID, phases::MaxNumberOfPhases>
 #include "clang/Driver/Types.def"
----------------
I think that we can abuse the preprocessor a bit and get something that is nicer to read.  Lets make the last parameter a variadic and pass along the phases to the list.  Something like:

```
ENTRY('a', "std::string")
ENTRY('b', "std::string", "std::vector<std::string>")
ENTRY('c', "std::string", "std::vector<std::string>", "int")

const struct {
  unsigned int id;
  std::vector<std::string> strings;
} array[] = {
#define ENTRY(id, strings...) { id, { strings } },
#include "reduced.def"
#undef ENTRY
};
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64098





More information about the cfe-commits mailing list