]> granicus.if.org Git - clang/commitdiff
Fix an assert in -Wquoted-include-in-framework-header
authorErik Pilkington <erik.pilkington@gmail.com>
Thu, 20 Sep 2018 19:00:03 +0000 (19:00 +0000)
committerErik Pilkington <erik.pilkington@gmail.com>
Thu, 20 Sep 2018 19:00:03 +0000 (19:00 +0000)
Fixes rdar://43692300

Differential revision: https://reviews.llvm.org/D52253

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342679 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/HeaderSearch.cpp
test/Modules/Inputs/double-quotes/NotAFramework/Headers/Headers/Thing1.h [new file with mode: 0644]
test/Modules/Inputs/double-quotes/NotAFramework/Headers/Headers/Thing2.h [new file with mode: 0644]
test/Modules/double-quotes.m

index 99b9cce7f45bf59a3f51e10d439bb892a2564ced..c475336ca5bcebc88d88b3489ffcaf50692ba83e 100644 (file)
@@ -648,7 +648,7 @@ static bool isFrameworkStylePath(StringRef Path, bool &IsPrivateHeader,
     ++I;
   }
 
-  return FoundComp >= 2;
+  return !FrameworkName.empty() && FoundComp >= 2;
 }
 
 static void
diff --git a/test/Modules/Inputs/double-quotes/NotAFramework/Headers/Headers/Thing1.h b/test/Modules/Inputs/double-quotes/NotAFramework/Headers/Headers/Thing1.h
new file mode 100644 (file)
index 0000000..96212a0
--- /dev/null
@@ -0,0 +1 @@
+#include "Thing2.h"
diff --git a/test/Modules/Inputs/double-quotes/NotAFramework/Headers/Headers/Thing2.h b/test/Modules/Inputs/double-quotes/NotAFramework/Headers/Headers/Thing2.h
new file mode 100644 (file)
index 0000000..7d1fe26
--- /dev/null
@@ -0,0 +1 @@
+// Empty file!
index a21f12fa5e5aceb1e56fa3f7c4b27a9bdc06bf22..8eec365747626e3f50c58c2699d9f57afab71cd4 100644 (file)
@@ -32,6 +32,9 @@
 #import "A.h"
 #import <Z/Z.h>
 
+// Make sure we correctly handle paths that resemble frameworks, but aren't.
+#import "NotAFramework/Headers/Headers/Thing1.h"
+
 int bar() { return foo(); }
 
 // expected-warning@Inputs/double-quotes/A.framework/Headers/A.h:1{{double-quoted include "A0.h" in framework header, expected angle-bracketed instead}}