[Lldb-commits] [PATCH] D76002: [lldb] Add YAML traits for ConstString and FileSpec

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 12 03:03:26 PDT 2020


labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Looks fine, we just need to avoid ODR violations



================
Comment at: lldb/include/lldb/Utility/FileSpec.h:444
+namespace yaml {
+template <> struct ScalarEnumerationTraits<lldb_private::FileSpec::Style> {
+  static void enumeration(IO &io, lldb_private::FileSpec::Style &style);
----------------
FileSpec::Style is a typedef for `llvm::sys::path::Style`. Typedefs are not separate types so this code is defining a specialization for a type it does not own.

I think the simplest solution for that is to define a `LLVM_YAML_STRONG_TYPEDEF(FileSpec::Style, MyStyle)`
and then do something like
```
MyStyle style = f.m_style;
io.mapRequired("style", style);
f.m_style = style
```
in `MappingTraits<FileSpec>`


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D76002





More information about the lldb-commits mailing list