r183902 - libclang: Remove clang::RemapFiles, it's dead code.

Benjamin Kramer benny.kra at googlemail.com
Thu Jun 13 06:57:48 PDT 2013


Author: d0k
Date: Thu Jun 13 08:57:48 2013
New Revision: 183902

URL: http://llvm.org/viewvc/llvm-project?rev=183902&view=rev
Log:
libclang: Remove clang::RemapFiles, it's dead code.

Modified:
    cfe/trunk/tools/libclang/CIndexer.cpp
    cfe/trunk/tools/libclang/CIndexer.h

Modified: cfe/trunk/tools/libclang/CIndexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexer.cpp?rev=183902&r1=183901&r2=183902&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexer.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexer.cpp Thu Jun 13 08:57:48 2013
@@ -85,64 +85,3 @@ const std::string &CIndexer::getClangRes
   ResourcesPath = LibClangPath.str();
   return ResourcesPath;
 }
-
-static llvm::sys::Path GetTemporaryPath() {
-  // FIXME: This is lame; sys::Path should provide this function (in particular,
-  // it should know how to find the temporary files dir).
-  std::string Error;
-  const char *TmpDir = ::getenv("TMPDIR");
-  if (!TmpDir)
-    TmpDir = ::getenv("TEMP");
-  if (!TmpDir)
-    TmpDir = ::getenv("TMP");
-  if (!TmpDir)
-    TmpDir = "/tmp";
-  llvm::sys::Path P(TmpDir);
-  P.appendComponent("remap");
-  if (P.makeUnique(false, &Error))
-    return llvm::sys::Path("");
-
-  // FIXME: Grumble, makeUnique sometimes leaves the file around!?  PR3837.
-  P.eraseFromDisk(false, 0);
-
-  return P;
-}
-
-bool clang::RemapFiles(unsigned num_unsaved_files,
-                       struct CXUnsavedFile *unsaved_files,
-                       std::vector<std::string> &RemapArgs,
-                       std::vector<llvm::sys::Path> &TemporaryFiles) {
-  for (unsigned i = 0; i != num_unsaved_files; ++i) {
-    // Write the contents of this unsaved file into the temporary file.
-    llvm::sys::Path SavedFile(GetTemporaryPath());
-    if (SavedFile.empty())
-      return true;
-
-    std::string ErrorInfo;
-    llvm::raw_fd_ostream OS(SavedFile.c_str(), ErrorInfo,
-                            llvm::raw_fd_ostream::F_Binary);
-    if (!ErrorInfo.empty())
-      return true;
-    
-    OS.write(unsaved_files[i].Contents, unsaved_files[i].Length);
-    OS.close();
-    if (OS.has_error()) {
-      SavedFile.eraseFromDisk();
-      OS.clear_error();
-      return true;
-    }
-    
-    // Remap the file.
-    std::string RemapArg = unsaved_files[i].Filename;
-    RemapArg += ';';
-    RemapArg += SavedFile.str();
-    RemapArgs.push_back("-Xclang");
-    RemapArgs.push_back("-remap-file");
-    RemapArgs.push_back("-Xclang");
-    RemapArgs.push_back(RemapArg);
-    TemporaryFiles.push_back(SavedFile);
-  }
-  
-  return false;
-}
-

Modified: cfe/trunk/tools/libclang/CIndexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexer.h?rev=183902&r1=183901&r2=183902&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexer.h (original)
+++ cfe/trunk/tools/libclang/CIndexer.h Thu Jun 13 08:57:48 2013
@@ -18,7 +18,6 @@
 #include "clang-c/Index.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/PathV1.h"
 #include <vector>
 
 namespace llvm {
@@ -66,17 +65,6 @@ public:
   const std::string &getClangResourcesPath();
 };
 
-  /**
-   * \brief Given a set of "unsaved" files, create temporary files and 
-   * construct the clang -cc1 argument list needed to perform the remapping.
-   *
-   * \returns true if an error occurred.
-   */
-  bool RemapFiles(unsigned num_unsaved_files,
-                  struct CXUnsavedFile *unsaved_files,
-                  std::vector<std::string> &RemapArgs,
-                  std::vector<llvm::sys::Path> &TemporaryFiles);
-
   /// \brief Return the current size to request for "safety".
   unsigned GetSafetyThreadStackSize();
 





More information about the cfe-commits mailing list