[clang] [clang-format][NFC] Clean up the driver and getStyle() in Format.cpp (PR #74794)

Ben Hamilton via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 22 12:33:57 PST 2024


================
@@ -544,28 +544,23 @@ static void PrintVersion(raw_ostream &OS) {
 }
 
 // Dump the configuration.
-static int dumpConfig() {
-  StringRef FileName;
+static int dumpConfig(bool IsSTDIN) {
   std::unique_ptr<llvm::MemoryBuffer> Code;
-  if (FileNames.empty()) {
-    // We can't read the code to detect the language if there's no
-    // file name, so leave Code empty here.
-    FileName = AssumeFileName;
-  } else {
-    // Read in the code in case the filename alone isn't enough to
-    // detect the language.
+  // We can't read the code to detect the language if there's no file name.
+  if (!IsSTDIN) {
+    // Read in the code in case the filename alone isn't enough to detect the
+    // language.
     ErrorOr<std::unique_ptr<MemoryBuffer>> CodeOrErr =
         MemoryBuffer::getFileOrSTDIN(FileNames[0]);
----------------
bhamiltoncx wrote:

Sent #79051 with a fix.

https://github.com/llvm/llvm-project/pull/74794


More information about the cfe-commits mailing list