[PATCH] D37136: [clang-format] Do not format likely xml
Daniel Jasper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 29 05:12:41 PDT 2017
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.
Just a few minor comments, otherwise looks good.
================
Comment at: lib/Format/Format.cpp:1542
+bool likelyXml(StringRef Code) {
+ return Code.ltrim().startswith("<");
----------------
Rename to isLikelyXml.
================
Comment at: lib/Format/Format.cpp:1552
return Replaces;
- if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript &&
- isMpegTS(Code))
+ if (likelyXml(Code) ||
+ (Style.Language == FormatStyle::LanguageKind::LK_JavaScript &&
----------------
Just add a separate if statement. Or merge with previous one, but I think three separate if statements is actually easiest to read.
================
Comment at: lib/Format/Format.cpp:1902
return tooling::Replacements();
- if (Expanded.Language == FormatStyle::LK_JavaScript && isMpegTS(Code))
+ if (likelyXml(Code) ||
+ (Expanded.Language == FormatStyle::LK_JavaScript && isMpegTS(Code)))
----------------
Same here.
https://reviews.llvm.org/D37136
More information about the cfe-commits
mailing list