This is an archive of the discontinued LLVM Phabricator instance.

DRAFT [clang-format] Format raw string proto text literals
AbandonedPublic

Authored by krasimir on Apr 10 2017, 5:44 AM.

Details

Reviewers
djasper
Summary

This is an initial draft adding formatting inside proto text raw strings.

Event Timeline

krasimir created this revision.Apr 10 2017, 5:44 AM
krasimir updated this revision to Diff 94663.Apr 10 2017, 5:46 AM
  • Remove debugging macro
djasper added inline comments.Apr 11 2017, 12:31 AM
include/clang/Format/Format.h
1276

I think what we'd want here is a map from delimiter (also fix spelling) to language.

lib/Format/FormatToken.h
271

I would think that we should set the token types correctly. Fundamentally, this shouldn't be very different from how we handle JavaScript template strings. There we set the token type of the introducers to TT_TemplateString.

lib/Format/FormatTokenLexer.cpp
244

Don't use a regex here (or in the configuration). Matching regular expressions against all raw string literals in a file can be quite expensive. The string has to exactly start with a certain token sequence, so use StringRef::startsWith().

krasimir abandoned this revision.Aug 4 2017, 1:47 AM

Superseded by D35943.