[cfe-commits] r44639 - /cfe/trunk/Driver/clang.cpp

Chris Lattner sabre at nondot.org
Wed Dec 5 15:24:18 PST 2007


Author: lattner
Date: Wed Dec  5 17:24:17 2007
New Revision: 44639

URL: http://llvm.org/viewvc/llvm-project?rev=44639&view=rev
Log:
Avoid passing Diags into InitializeIncludePaths.

Modified:
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=44639&r1=44638&r2=44639&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Wed Dec  5 17:24:17 2007
@@ -660,20 +660,14 @@
 /// InitializeIncludePaths - Process the -I options and set them in the
 /// HeaderSearch object.
 static void InitializeIncludePaths(HeaderSearch &Headers, FileManager &FM,
-                                   Diagnostic &Diags, const LangOptions &Lang) {
+                                   const LangOptions &Lang) {
   // Handle -F... options.
   for (unsigned i = 0, e = F_dirs.size(); i != e; ++i)
     AddPath(F_dirs[i], Angled, false, true, true, FM);
   
   // Handle -I... options.
-  for (unsigned i = 0, e = I_dirs.size(); i != e; ++i) {
-    if (I_dirs[i] == "-") {
-      // -I- is a deprecated GCC feature.
-      Diags.Report(SourceLocation(), diag::err_pp_I_dash_not_supported);
-    } else {
-      AddPath(I_dirs[i], Angled, false, true, false, FM);
-    }
-  }
+  for (unsigned i = 0, e = I_dirs.size(); i != e; ++i)
+    AddPath(I_dirs[i], Angled, false, true, false, FM);
   
   // Handle -idirafter... options.
   for (unsigned i = 0, e = idirafter_dirs.size(); i != e; ++i)
@@ -1014,10 +1008,19 @@
     }
   }
   
+  // -I- is a deprecated GCC feature, scan for it and reject it.
+  for (unsigned i = 0, e = I_dirs.size(); i != e; ++i) {
+    if (I_dirs[i] == "-") {
+      Diags.Report(SourceLocation(), diag::err_pp_I_dash_not_supported);
+      I_dirs.erase(I_dirs.begin()+i);
+      --i;
+    }
+  }
+  
   // Process the -I options and set them in the HeaderInfo.
   HeaderSearch HeaderInfo(FileMgr);
   DiagClient->setHeaderSearch(HeaderInfo);
-  InitializeIncludePaths(HeaderInfo, FileMgr, Diags, LangInfo);
+  InitializeIncludePaths(HeaderInfo, FileMgr, LangInfo);
   
   for (unsigned i = 0, e = InputFilenames.size(); i != e; ++i) {
     // Set up the preprocessor with these options.





More information about the cfe-commits mailing list