[cfe-commits] r146261 - /cfe/trunk/lib/Lex/HeaderSearch.cpp

Douglas Gregor dgregor at apple.com
Fri Dec 9 08:48:01 PST 2011


Author: dgregor
Date: Fri Dec  9 10:48:01 2011
New Revision: 146261

URL: http://llvm.org/viewvc/llvm-project?rev=146261&view=rev
Log:
When performing subframework header lookup, don't search for
".framework/" in the path name, because it could be ".framework\" on
Windows. This whole function needs to be rewritten with PathV2.

Modified:
    cfe/trunk/lib/Lex/HeaderSearch.cpp

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=146261&r1=146260&r2=146261&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Fri Dec  9 10:48:01 2011
@@ -535,6 +535,7 @@
   assert(ContextFileEnt && "No context file?");
 
   // Framework names must have a '/' in the filename.  Find it.
+  // FIXME: Should we permit '\' on Windows?
   size_t SlashPos = Filename.find('/');
   if (SlashPos == StringRef::npos) return 0;
 
@@ -542,12 +543,15 @@
   const char *ContextName = ContextFileEnt->getName();
 
   // If the context info wasn't a framework, couldn't be a subframework.
-  const char *FrameworkPos = strstr(ContextName, ".framework/");
-  if (FrameworkPos == 0)
+  const unsigned DotFrameworkLen = 10;
+  const char *FrameworkPos = strstr(ContextName, ".framework");
+  if (FrameworkPos == 0 || 
+      (FrameworkPos[DotFrameworkLen] != '/' && 
+       FrameworkPos[DotFrameworkLen] != '\\'))
     return 0;
 
   llvm::SmallString<1024> FrameworkName(ContextName,
-                                        FrameworkPos+strlen(".framework/"));
+                                        FrameworkPos+DotFrameworkLen+1);
 
   // Append Frameworks/HIToolbox.framework/
   FrameworkName += "Frameworks/";





More information about the cfe-commits mailing list