[clang] [llvm] [clang][MBD] set up module build daemon infrastructure (PR #67562)

Michael Spencer via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 10 13:11:07 PDT 2024


================
@@ -237,18 +251,24 @@ int cc1modbuildd_main(ArrayRef<const char *> Argv) {
   if (!validBasePathLength(BasePath)) {
     errs() << "BasePath '" << BasePath << "' is longer then the max length of "
            << std::to_string(BASEPATH_MAX_LENGTH) << '\n';
-    return 1;
+    return EXIT_FAILURE;
   }
 
   llvm::sys::fs::create_directories(BasePath);
-  ModuleBuildDaemonServer Daemon(BasePath);
 
-  // Used to handle signals
-  DaemonPtr = &Daemon;
+  {
+    ModuleBuildDaemonServer Daemon(BasePath);
+
+    // Used to handle signals
+    DaemonPtr = &Daemon;
+
+    Daemon.setupDaemonEnv();
+    Daemon.createDaemonSocket();
+    Daemon.listenForClients();
+  }
 
-  Daemon.setupDaemonEnv();
-  Daemon.createDaemonSocket();
-  Daemon.listenForClients();
+  // Prevents handleSignal from being called after ServerListener is destructed
+  setupSignals(SIG_DFL);
----------------
Bigcheese wrote:

This should just be `SIG_IGN`, you're just about to shut down anyway.

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


More information about the cfe-commits mailing list