diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2018-06-21 01:23:51 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2018-06-21 01:23:51 +0000 |
commit | 6a0a6d8a8bcf4954f59728e98b00b3f5bd0c63a0 (patch) | |
tree | a141a7560dedc5e126e63ca037604a15f9d6a2e3 /clang/lib/Lex/HeaderSearch.cpp | |
parent | 17d52f65d8acd175ee513613238f51a6200d2e45 (diff) | |
download | bcm5719-llvm-6a0a6d8a8bcf4954f59728e98b00b3f5bd0c63a0.tar.gz bcm5719-llvm-6a0a6d8a8bcf4954f59728e98b00b3f5bd0c63a0.zip |
Revert "Warning for framework headers using double quote includes"
This reverts commit 9b5ff2db7e31c4bb11a7d468260b068b41c7c285.
Broke bots:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio
llvm-svn: 335195
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 65 |
1 files changed, 1 insertions, 64 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 757cd097e4e..1f2c339ea3c 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -621,59 +621,6 @@ static const char *copyString(StringRef Str, llvm::BumpPtrAllocator &Alloc) { return CopyStr; } -static bool isFrameworkStylePath(StringRef Path, - SmallVectorImpl<char> &FrameworkName) { - using namespace llvm::sys; - path::const_iterator I = path::begin(Path); - path::const_iterator E = path::end(Path); - - // Detect different types of framework style paths: - // - // ...Foo.framework/{Headers,PrivateHeaders} - // ...Foo.framework/Versions/{A,Current}/{Headers,PrivateHeaders} - // ...Foo.framework/Frameworks/Nested.framework/{Headers,PrivateHeaders} - // ...<other variations with 'Versions' like in the above path> - // - // and some other variations among these lines. - int FoundComp = 0; - while (I != E) { - if (I->endswith(".framework")) { - FrameworkName.append(I->begin(), I->end()); - ++FoundComp; - } - if (*I == "Headers" || *I == "PrivateHeaders") - ++FoundComp; - ++I; - } - - return FoundComp >= 2; -} - -static void -diagnoseFrameworkInclude(DiagnosticsEngine &Diags, SourceLocation IncludeLoc, - StringRef Includer, StringRef IncludeFilename, - const FileEntry *IncludeFE, bool isAngled = false, - bool FoundByHeaderMap = false) { - SmallString<128> FromFramework, ToFramework; - if (!isFrameworkStylePath(Includer, FromFramework)) - return; - bool IsIncludeeInFramework = - isFrameworkStylePath(IncludeFE->getName(), ToFramework); - - if (!isAngled && !FoundByHeaderMap) { - SmallString<128> NewInclude("<"); - if (IsIncludeeInFramework) { - NewInclude += StringRef(ToFramework).drop_back(10); // drop .framework - NewInclude += "/"; - } - NewInclude += IncludeFilename; - NewInclude += ">"; - Diags.Report(IncludeLoc, diag::warn_quoted_include_in_framework_header) - << IncludeFilename - << FixItHint::CreateReplacement(IncludeLoc, NewInclude); - } -} - /// LookupFile - Given a "foo" or \<foo> reference, look up the indicated file, /// return null on failure. isAngled indicates whether the file reference is /// for system \#include's or not (i.e. using <> instead of ""). Includers, if @@ -775,12 +722,8 @@ const FileEntry *HeaderSearch::LookupFile( RelativePath->clear(); RelativePath->append(Filename.begin(), Filename.end()); } - if (First) { - diagnoseFrameworkInclude(Diags, IncludeLoc, - IncluderAndDir.second->getName(), Filename, - FE); + if (First) return FE; - } // Otherwise, we found the path via MSVC header search rules. If // -Wmsvc-include is enabled, we have to keep searching to see if we @@ -891,12 +834,6 @@ const FileEntry *HeaderSearch::LookupFile( return MSFE; } - bool FoundByHeaderMap = !IsMapped ? false : *IsMapped; - if (!Includers.empty()) - diagnoseFrameworkInclude(Diags, IncludeLoc, - Includers.front().second->getName(), Filename, - FE, isAngled, FoundByHeaderMap); - // Remember this location for the next lookup we do. CacheLookup.HitIdx = i; return FE; |