aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index b90bd82..3802766 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -3591,13 +3591,12 @@ tooling::Replacements sortIncludes(const FormatStyle &Style, StringRef Code,
return Replaces;
if (isLikelyXml(Code))
return Replaces;
- if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript &&
- isMpegTS(Code)) {
- return Replaces;
- }
- if (Style.Language == FormatStyle::LanguageKind::LK_JavaScript)
+ if (Style.isJavaScript()) {
+ if (isMpegTS(Code))
+ return Replaces;
return sortJavaScriptImports(Style, Code, Ranges, FileName);
- if (Style.Language == FormatStyle::LanguageKind::LK_Java)
+ }
+ if (Style.isJava())
return sortJavaImports(Style, Code, Ranges, FileName, Replaces);
if (Style.isCpp())
sortCppIncludes(Style, Code, Ranges, FileName, Replaces, Cursor);
@@ -3777,7 +3776,7 @@ reformat(const FormatStyle &Style, StringRef Code,
return {tooling::Replacements(), 0};
if (isLikelyXml(Code))
return {tooling::Replacements(), 0};
- if (Expanded.Language == FormatStyle::LK_JavaScript && isMpegTS(Code))
+ if (Expanded.isJavaScript() && isMpegTS(Code))
return {tooling::Replacements(), 0};
// JSON only needs the formatting passing.