]> granicus.if.org Git - clang/commitdiff
Revert "Warning for framework headers using double quote includes"
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Thu, 21 Jun 2018 01:23:51 +0000 (01:23 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Thu, 21 Jun 2018 01:23:51 +0000 (01:23 +0000)
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

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

15 files changed:
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticLexKinds.td
lib/Lex/HeaderSearch.cpp
test/Modules/Inputs/double-quotes/A.framework/Headers/A.h [deleted file]
test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h [deleted file]
test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap [deleted file]
test/Modules/Inputs/double-quotes/B.h [deleted file]
test/Modules/Inputs/double-quotes/X.framework/Headers/X.h [deleted file]
test/Modules/Inputs/double-quotes/X.framework/Modules/module.modulemap [deleted file]
test/Modules/Inputs/double-quotes/a.hmap.json [deleted file]
test/Modules/Inputs/double-quotes/flat-header-path/Z.h [deleted file]
test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap [deleted file]
test/Modules/Inputs/double-quotes/x.hmap.json [deleted file]
test/Modules/Inputs/double-quotes/z.yaml [deleted file]
test/Modules/double-quotes.m [deleted file]

index 7cc9967738cf2dcde8ac77b499df18ed05e99d00..643c178743ba09c3b92ef70f751c52ff8cf03195 100644 (file)
@@ -31,7 +31,6 @@ def AutoDisableVptrSanitizer : DiagGroup<"auto-disable-vptr-sanitizer">;
 def Availability : DiagGroup<"availability">;
 def Section : DiagGroup<"section">;
 def AutoImport : DiagGroup<"auto-import">;
-def FrameworkHdrQuotedInclude : DiagGroup<"quoted-include-in-framework-header">;
 def CXX14BinaryLiteral : DiagGroup<"c++14-binary-literal">;
 def CXXPre14CompatBinaryLiteral : DiagGroup<"c++98-c++11-compat-binary-literal">;
 def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">;
index de6bffcdcaaaac845d4e3e35742e09d56c76c5e9..9b7f7e677755d41dbe0b89f70d4a736f1fcc1875 100644 (file)
@@ -714,11 +714,6 @@ def warn_mmap_redundant_export_as : Warning<
 def err_mmap_submodule_export_as : Error<
   "only top-level modules can be re-exported as public">;
 
-def warn_quoted_include_in_framework_header : Warning<
-  "double-quoted include \"%0\" in framework header, "
-  "expected angle-bracketed instead"
-  >, InGroup<FrameworkHdrQuotedInclude>, DefaultIgnore;
-
 def warn_auto_module_import : Warning<
   "treating #%select{include|import|include_next|__include_macros}0 as an "
   "import of module '%1'">, InGroup<AutoImport>, DefaultIgnore;
index 757cd097e4e5c6b091c96b231ce35a63145a6bb4..1f2c339ea3c97bdcd7f5907fbcc75401e7e372da 100644 (file)
@@ -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;
diff --git a/test/Modules/Inputs/double-quotes/A.framework/Headers/A.h b/test/Modules/Inputs/double-quotes/A.framework/Headers/A.h
deleted file mode 100644 (file)
index 17ceb83..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "A0.h"
-#include "B.h"
-
-#include "X.h"
-
-int foo();
diff --git a/test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h b/test/Modules/Inputs/double-quotes/A.framework/Headers/A0.h
deleted file mode 100644 (file)
index 79c6b88..0000000
+++ /dev/null
@@ -1 +0,0 @@
-// double-quotes/A.framework/Headers/A0.h
diff --git a/test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap b/test/Modules/Inputs/double-quotes/A.framework/Modules/module.modulemap
deleted file mode 100644 (file)
index 09a887a..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// double-quotes/A.framework/Modules/module.modulemap
-framework module A {
-  header "A.h"
-  header "A0.h"
-}
diff --git a/test/Modules/Inputs/double-quotes/B.h b/test/Modules/Inputs/double-quotes/B.h
deleted file mode 100644 (file)
index 724faae..0000000
+++ /dev/null
@@ -1 +0,0 @@
-// double-quotes/B.h
diff --git a/test/Modules/Inputs/double-quotes/X.framework/Headers/X.h b/test/Modules/Inputs/double-quotes/X.framework/Headers/X.h
deleted file mode 100644 (file)
index 0185751..0000000
+++ /dev/null
@@ -1 +0,0 @@
-// double-quotes/X.framework/Headers/X.h
diff --git a/test/Modules/Inputs/double-quotes/X.framework/Modules/module.modulemap b/test/Modules/Inputs/double-quotes/X.framework/Modules/module.modulemap
deleted file mode 100644 (file)
index 9552470..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// double-quotes/X.framework/Modules/module.modulemap
-framework module X {
-  header "X.h"
-}
diff --git a/test/Modules/Inputs/double-quotes/a.hmap.json b/test/Modules/Inputs/double-quotes/a.hmap.json
deleted file mode 100644 (file)
index bdd383c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  "mappings" :
-    {
-     "A.h" : "A/A.h"
-    }
-}
diff --git a/test/Modules/Inputs/double-quotes/flat-header-path/Z.h b/test/Modules/Inputs/double-quotes/flat-header-path/Z.h
deleted file mode 100644 (file)
index db96b64..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#import "B.h" // Included from Z.h & A.h
diff --git a/test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap b/test/Modules/Inputs/double-quotes/flat-header-path/Z.modulemap
deleted file mode 100644 (file)
index 34441b0..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-// double-quotes/flat-header-path/Z.modulemap
-framework module Z {
-  header "Z.h"
-}
diff --git a/test/Modules/Inputs/double-quotes/x.hmap.json b/test/Modules/Inputs/double-quotes/x.hmap.json
deleted file mode 100644 (file)
index 2b6a059..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-{
-  "mappings" :
-    {
-     "X.h" : "X/X.h"
-    }
-}
diff --git a/test/Modules/Inputs/double-quotes/z.yaml b/test/Modules/Inputs/double-quotes/z.yaml
deleted file mode 100644 (file)
index 242f821..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-{
-  'version': 0,
-  'case-sensitive': 'false',
-  'roots': [
-    {
-      'type': 'directory',
-      'name': "TEST_DIR/Z.framework/Headers",
-      'contents': [
-        {
-          'type': 'file',
-          'name': "Z.h",
-          'external-contents': "TEST_DIR/flat-header-path/Z.h"
-        }
-      ]
-    },
-    {
-      'type': 'directory',
-      'name': "TEST_DIR/Z.framework/Modules",
-      'contents': [
-        {
-          'type': 'file',
-          'name': "module.modulemap",
-          'external-contents': "TEST_DIR/flat-header-path/Z.modulemap"
-        }
-      ]
-    }
-  ]
-}
diff --git a/test/Modules/double-quotes.m b/test/Modules/double-quotes.m
deleted file mode 100644 (file)
index b0dbf66..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// REQUIRES: shell
-
-// RUN: rm -rf %t
-// RUN: mkdir %t
-
-// RUN: hmaptool write %S/Inputs/double-quotes/a.hmap.json %t/a.hmap
-// RUN: hmaptool write %S/Inputs/double-quotes/x.hmap.json %t/x.hmap
-
-// RUN: sed -e "s:TEST_DIR:%S/Inputs/double-quotes:g" \
-// RUN:   %S/Inputs/double-quotes/z.yaml > %t/z.yaml
-
-// The output with and without modules should be the same
-
-// RUN: %clang_cc1 \
-// RUN:   -I %t/x.hmap -iquote %t/a.hmap -ivfsoverlay %t/z.yaml \
-// RUN:   -F%S/Inputs/double-quotes -I%S/Inputs/double-quotes \
-// RUN:   -Wquoted-include-in-framework-header -fsyntax-only %s -verify
-
-// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache \
-// RUN:   -I %t/x.hmap -iquote %t/a.hmap -ivfsoverlay %t/z.yaml \
-// RUN:   -F%S/Inputs/double-quotes -I%S/Inputs/double-quotes \
-// RUN:   -Wquoted-include-in-framework-header -fsyntax-only %s \
-// RUN:   2>%t/stderr
-
-// The same warnings show up when modules is on but -verify doesn't get it
-// because they only show up under the module A building context.
-// RUN: FileCheck --input-file=%t/stderr %s
-// CHECK: double-quoted include "A0.h" in framework header, expected angle-bracketed instead
-// CHECK: double-quoted include "B.h" in framework header, expected angle-bracketed instead
-// CHECK: double-quoted include "B.h" in framework header, expected angle-bracketed instead
-
-#import "A.h"
-#import <Z/Z.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}}
-// expected-warning@Inputs/double-quotes/A.framework/Headers/A.h:2{{double-quoted include "B.h" in framework header, expected angle-bracketed instead}}
-// expected-warning@Inputs/double-quotes/flat-header-path/Z.h:1{{double-quoted include "B.h" in framework header, expected angle-bracketed instead}}