================ @@ -0,0 +1,99 @@ +#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_MD_PARSER_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_MD_PARSER_H +#include "llvm/ADT/SmallString.h" +#include "llvm/Support/Allocator.h" +#include "llvm/Support/StringSaver.h" +#include <list> + +using namespace llvm; + +namespace clang { +namespace doc { +using llvm::SmallString; +enum class MDState { Emphasis, Strong, None }; + +enum class MDType { + Paragraph, + Emphasis, + Strong, + Text, + Softbreak, +}; + +enum class MDTokenType { LeftDelimiterRun, RightDelimiterRun, Text }; + +struct Node { + SmallVector<Node*> Children; + MDType Type; + Node *Parent; + std::string Content; +}; + +struct DelimiterContext { + bool RightFlanking; + bool LeftFlanking; + bool CanOpen; + bool CanClose; + char DelimChar; + // Since Content is a StringRef, we separately track the length so that we can + // decrement when necessary without modifying the string. + size_t Length; +}; ---------------- ilovepi wrote:
```suggestion struct DelimiterContext { // Since Content is a StringRef, we separately track the length so that we can // decrement when necessary without modifying the string. size_t Length; char DelimChar; bool RightFlanking; bool LeftFlanking; bool CanOpen; bool CanClose; }; ``` lets order the fields by size, so we avoid padding. https://github.com/llvm/llvm-project/pull/155887 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits