diff options
Diffstat (limited to 'tools/clang-format/ClangFormat.cpp')
-rw-r--r-- | tools/clang-format/ClangFormat.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/clang-format/ClangFormat.cpp b/tools/clang-format/ClangFormat.cpp index ce9324e304..3d6fef0d09 100644 --- a/tools/clang-format/ClangFormat.cpp +++ b/tools/clang-format/ClangFormat.cpp @@ -73,7 +73,7 @@ FallbackStyle("fallback-style", cl::init("LLVM"), cl::cat(ClangFormatCategory)); static cl::opt<std::string> -AssumeFilename("assume-filename", +AssumeFileName("assume-filename", cl::desc("When reading from stdin, clang-format assumes this\n" "filename to look for a style config file (with\n" "-style=file) and to determine the language."), @@ -239,13 +239,13 @@ static bool format(StringRef FileName) { std::vector<tooling::Range> Ranges; if (fillRanges(Code.get(), Ranges)) return true; - FormatStyle FormatStyle = getStyle( - Style, (FileName == "-") ? AssumeFilename : FileName, FallbackStyle); + StringRef AssumedFileName = (FileName == "-") ? AssumeFileName : FileName; + FormatStyle FormatStyle = getStyle(Style, AssumedFileName, FallbackStyle); Replacements Replaces; std::string ChangedCode; if (SortIncludes) { Replaces = - sortIncludes(FormatStyle, Code->getBuffer(), Ranges, FileName); + sortIncludes(FormatStyle, Code->getBuffer(), Ranges, AssumedFileName); ChangedCode = tooling::applyAllReplacements(Code->getBuffer(), Replaces); for (const auto &R : Replaces) Ranges.push_back({R.getOffset(), R.getLength()}); @@ -324,7 +324,7 @@ int main(int argc, const char **argv) { if (DumpConfig) { std::string Config = clang::format::configurationAsText(clang::format::getStyle( - Style, FileNames.empty() ? AssumeFilename : FileNames[0], + Style, FileNames.empty() ? AssumeFileName : FileNames[0], FallbackStyle)); llvm::outs() << Config << "\n"; return 0; |