From: Erik Pilkington Date: Thu, 20 Sep 2018 19:00:03 +0000 (+0000) Subject: Fix an assert in -Wquoted-include-in-framework-header X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4426c04a24f3f37369101f3a92898dd2e2d5044;p=clang Fix an assert in -Wquoted-include-in-framework-header 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 --- diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index 99b9cce7f4..c475336ca5 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -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 index 0000000000..96212a03a1 --- /dev/null +++ b/test/Modules/Inputs/double-quotes/NotAFramework/Headers/Headers/Thing1.h @@ -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 index 0000000000..7d1fe26edb --- /dev/null +++ b/test/Modules/Inputs/double-quotes/NotAFramework/Headers/Headers/Thing2.h @@ -0,0 +1 @@ +// Empty file! diff --git a/test/Modules/double-quotes.m b/test/Modules/double-quotes.m index a21f12fa5e..8eec365747 100644 --- a/test/Modules/double-quotes.m +++ b/test/Modules/double-quotes.m @@ -32,6 +32,9 @@ #import "A.h" #import +// 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}}