@@ -121,20 +121,6 @@ namespace platform {
121121    return  Lib;
122122  }
123123
124-   void * DLSym (const  std::string& Name, std::string* Err /*  = nullptr*/ 
125-     if  (void * Self = ::dlopen (nullptr , RTLD_GLOBAL)) {
126-       //  get dlopen error if there is one
127-       DLErr (Err);
128-       void * Sym = ::dlsym (Self, Name.c_str ());
129-       //  overwrite error if dlsym caused one
130-       DLErr (Err);
131-       //  only get dlclose error if dlopen & dlsym haven't emited one
132-       DLClose (Self, Err && Err->empty () ? Err : nullptr );
133-       return  Sym;
134-     }
135-     DLErr (Err);
136-     return  nullptr ;
137-   }
138124
139125  void  DLClose (void * Lib, std::string* Err /*  = nullptr*/ 
140126    ::dlclose (Lib);
@@ -158,27 +144,6 @@ namespace platform {
158144
159145} //  namespace platform
160146
161- bool  ExpandEnvVars (std::string& Str, bool  Path) {
162-   std::size_t  DPos = Str.find (" $" 
163-   while  (DPos != std::string::npos) {
164-     std::size_t  SPos = Str.find (" /" 1 );
165-     std::size_t  Length = Str.length ();
166- 
167-     if  (SPos != std::string::npos) //  if we found a "/"
168-       Length = SPos - DPos;
169- 
170-     std::string EnvVar = Str.substr (DPos + 1 , Length -1 ); // "HOME"
171-     std::string FullPath;
172-     if  (const  char * Tok = GetEnv (EnvVar.c_str ()))
173-       FullPath = Tok;
174- 
175-     Str.replace (DPos, Length, FullPath);
176-     DPos = Str.find (" $" 1 ); //  search for next env variable
177-   }
178-   if  (!Path)
179-     return  true ;
180-   return  llvm::sys::fs::exists (Str.c_str ());
181- }
182147
183148using  namespace  llvm ; 
184149using  namespace  clang ; 
@@ -268,84 +233,12 @@ void CopyIncludePaths(const clang::HeaderSearchOptions& Opts,
268233    incpaths.push_back (" -v" 
269234}
270235
271- void  DumpIncludePaths (const  clang::HeaderSearchOptions& Opts,
272-                       llvm::raw_ostream& Out,
273-                       bool  WithSystem, bool  WithFlags) {
274-   llvm::SmallVector<std::string, 100 > IncPaths;
275-   CopyIncludePaths (Opts, IncPaths, WithSystem, WithFlags);
276-   //  print'em all
277-   for  (unsigned  i = 0 ; i < IncPaths.size (); ++i) {
278-     Out << IncPaths[i] <<" \n " 
279-   }
280- }
281- 
282236void  LogNonExistantDirectory (llvm::StringRef Path) {
283237#define  DEBUG_TYPE  " LogNonExistantDirectory" 
284238  LLVM_DEBUG (dbgs () << "   ignoring nonexistent directory \" " " \"\n " 
285239#undef   DEBUG_TYPE
286240}
287241
288- static  void  LogFileStatus (const  char * Prefix, const  char * FileType,
289-                           llvm::StringRef Path) {
290- #define  DEBUG_TYPE  " LogFileStatus" 
291-   LLVM_DEBUG (dbgs () << Prefix << "  " "  '" " '\n " 
292- #undef   DEBUG_TYPE
293- }
294- 
295- bool  LookForFile (const  std::vector<const  char *>& Args, std::string& Path,
296-                  const  clang::FileManager* FM, const  char * FileType) {
297-   if  (llvm::sys::fs::is_regular_file (Path)) {
298-     if  (FileType)
299-       LogFileStatus (" Using" 
300-     return  true ;
301-   }
302-   if  (FileType)
303-     LogFileStatus (" Ignoring" 
304- 
305-   SmallString<1024 > FilePath;
306-   if  (FM) {
307-     FilePath.assign (Path);
308-     if  (FM->FixupRelativePath (FilePath) &&
309-         llvm::sys::fs::is_regular_file (FilePath)) {
310-       if  (FileType)
311-         LogFileStatus (" Using" str ());
312-       Path = FilePath.str ().str ();
313-       return  true ;
314-     }
315-     //  Don't write same same log entry twice when FilePath == Path
316-     if  (FileType && FilePath.str () != Path)
317-       LogFileStatus (" Ignoring" 
318-   }
319-   else  if  (llvm::sys::path::is_absolute (Path))
320-     return  false ;
321- 
322-   for  (std::vector<const  char *>::const_iterator It = Args.begin (),
323-        End = Args.end (); It < End; ++It) {
324-     const  char * Arg = *It;
325-     //  TODO: Suppport '-iquote' and MSVC equivalent
326-     if  (!::strncmp (" -I" 2 ) || !::strncmp (" /I" 2 )) {
327-       if  (!Arg[2 ]) {
328-         if  (++It >= End)
329-           break ;
330-         FilePath.assign (*It);
331-       }
332-       else 
333-         FilePath.assign (Arg + 2 );
334- 
335-       llvm::sys::path::append (FilePath, Path.c_str ());
336-       if  (llvm::sys::fs::is_regular_file (FilePath)) {
337-         if  (FileType)
338-           LogFileStatus (" Using" str ());
339-         Path = FilePath.str ().str ();
340-         return  true ;
341-       }
342-       if  (FileType)
343-         LogFileStatus (" Ignoring" 
344-     }
345-   }
346-   return  false ;
347- }
348- 
349242bool  SplitPaths (llvm::StringRef PathStr,
350243                llvm::SmallVectorImpl<llvm::StringRef>& Paths,
351244                SplitMode Mode, llvm::StringRef Delim, bool  Verbose) {
@@ -433,6 +326,7 @@ bool SplitPaths(llvm::StringRef PathStr,
433326#undef   DEBUG_TYPE
434327}
435328
329+ 
436330void  AddIncludePaths (llvm::StringRef PathStr,
437331                         clang::HeaderSearchOptions& HOpts,
438332                         const  char * Delim /*  = Cpp::utils::platform::kEnvDelim */ 
0 commit comments