[PATCH] D56345: [clang-format] Assert that filenames are not empty

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 6 09:31:54 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG7681435de148: [clang-format] Assert that filenames are not empty (authored by MyDeveloperDay).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56345/new/

https://reviews.llvm.org/D56345

Files:
  clang/tools/clang-format/ClangFormat.cpp


Index: clang/tools/clang-format/ClangFormat.cpp
===================================================================
--- clang/tools/clang-format/ClangFormat.cpp
+++ clang/tools/clang-format/ClangFormat.cpp
@@ -390,6 +390,10 @@
   if (fillRanges(Code.get(), Ranges))
     return true;
   StringRef AssumedFileName = (FileName == "-") ? AssumeFileName : FileName;
+  if (AssumedFileName.empty()) {
+    llvm::errs() << "error: empty filenames are not allowed\n";
+    return true;
+  }
 
   llvm::Expected<FormatStyle> FormatStyle =
       getStyle(Style, AssumedFileName, FallbackStyle, Code->getBuffer());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56345.228084.patch
Type: text/x-patch
Size: 606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191106/816a9dd7/attachment.bin>


More information about the cfe-commits mailing list