This is an archive of the discontinued LLVM Phabricator instance.

[clang-format] Support breaking consecutive string literals for TableGen
ClosedPublic

Authored by rupprecht on Oct 31 2018, 2:56 PM.

Details

Summary

clang-format can get confused by string literals in TableGen: it knows that strings can be broken up, but doesn't seem to understand how that can be indented across line breaks, and arranges them in a weird triangular pattern. Take this output example from clang-format tools/llvm-objcopy/ObjcopyOpts.td (which has now been formatted in rL345896 with this patch applied):

defm keep_global_symbols
: Eq<
      "keep-global-symbols", "Reads a list of symbols from <filename> and "
                             "runs as if " "--keep-global-symbol=<symbol> "
                                           "is set for each one. "
                                           "<filename> " "contains one "
                                                         "symbol per line "
                                                         "and may contain "
                                                         "comments "
                                                         "beginning " "with"
                                                                      " '#'"
                                                                      ". "
                                                                      "Lead"
                                                                      "ing "

Diff Detail

Event Timeline

rupprecht created this revision.Oct 31 2018, 2:56 PM
MaskRay accepted this revision.Nov 2 2018, 1:03 PM
This revision is now accepted and ready to land.Nov 2 2018, 1:03 PM
rupprecht edited reviewers, added: djasper; removed: krasimir.Nov 5 2018, 9:14 AM
rupprecht added a subscriber: krasimir.
rupprecht edited the summary of this revision. (Show Details)Nov 5 2018, 9:20 AM
This revision was automatically updated to reflect the committed changes.