Hi,
  I am attaching a patch addressing llvm.org/bugs/show_bug.cgi?id=20467
Vassil

Index: include/clang/Basic/DiagnosticFrontendKinds.td
===================================================================
--- include/clang/Basic/DiagnosticFrontendKinds.td	(revision 217432)
+++ include/clang/Basic/DiagnosticFrontendKinds.td	(working copy)
@@ -149,6 +149,9 @@
 def err_missing_module_name : Error<
   "no module name provided; specify one with -fmodule-name=">, 
   DefaultFatal;
+def err_module_cache_path_not_writable : Error<
+  "implicitly generated module cache %0 is not writable">, 
+  DefaultFatal;
 def err_missing_module : Error<
   "no module named '%0' declared in module map file '%1'">, DefaultFatal;
 def err_no_submodule : Error<"no submodule named %0 in module '%1'">;
Index: lib/Frontend/CompilerInstance.cpp
===================================================================
--- lib/Frontend/CompilerInstance.cpp	(revision 217432)
+++ lib/Frontend/CompilerInstance.cpp	(working copy)
@@ -339,6 +339,15 @@
   if (!getHeaderSearchOpts().DisableModuleHash)
     llvm::sys::path::append(SpecificModuleCache,
                             getInvocation().getModuleHash());
+
+  // If the path is not writable we can't do anything but diagnose.
+  if (llvm::sys::fs::exists(SpecificModuleCache.str()) &&
+       !llvm::sys::fs::can_write(SpecificModuleCache.str())) {
+    SourceLocation NoLoc;
+    PP->getDiagnostics().Report(NoLoc, diag::err_module_cache_path_not_writable)
+      << SpecificModuleCache;
+  }
+
   PP->getHeaderSearchInfo().setModuleCachePath(SpecificModuleCache);
 
   // Handle generating dependencies, if requested.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to