revert my patch for rdar://7520940 that warns when a published header

is #included with "foo.h" style syntax instead of framework syntax.
It produced too much noise.

llvm-svn: 94120
This commit is contained in:
Chris Lattner 2010-01-22 00:14:44 +00:00
parent 267430f74d
commit fde85356c6
8 changed files with 5 additions and 37 deletions

View File

@ -172,9 +172,6 @@ def err_pp_hash_error : Error<"#error%0">;
def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
def err_pp_error_opening_file : Error<
"error opening file '%0': %1">, DefaultFatal;
def warn_pp_relative_include_from_framework : Warning<
"published framework headers should always #import headers within the "
"framework with framework paths">, InGroup<DiagGroup<"framework-headers">>;
def err_pp_empty_filename : Error<"empty filename">;
def err_pp_include_too_deep : Error<"#include nested too deeply">;
def err_pp_expects_filename : Error<"expected \"FILENAME\" or <FILENAME>">;

View File

@ -697,8 +697,7 @@ public:
/// return null on failure. isAngled indicates whether the file reference is
/// for system #include's or not (i.e. using <> instead of "").
const FileEntry *LookupFile(llvm::StringRef Filename,
SourceLocation FilenameTokLoc, bool isAngled,
const DirectoryLookup *FromDir,
bool isAngled, const DirectoryLookup *FromDir,
const DirectoryLookup *&CurDir);
/// GetCurLookup - The DirectoryLookup structure used to find the current

View File

@ -402,7 +402,6 @@ void Preprocessor::PTHSkipExcludedConditionalBlock() {
/// return null on failure. isAngled indicates whether the file reference is
/// for system #include's or not (i.e. using <> instead of "").
const FileEntry *Preprocessor::LookupFile(llvm::StringRef Filename,
SourceLocation FilenameTokLoc,
bool isAngled,
const DirectoryLookup *FromDir,
const DirectoryLookup *&CurDir) {
@ -429,16 +428,7 @@ const FileEntry *Preprocessor::LookupFile(llvm::StringRef Filename,
CurDir = CurDirLookup;
const FileEntry *FE =
HeaderInfo.LookupFile(Filename, isAngled, FromDir, CurDir, CurFileEnt);
if (FE) {
// Warn about normal quoted #include from framework headers. Since
// framework headers are published (both public and private ones) they
// should not do relative searches, they should do an include with the
// framework path included.
if (!isAngled && CurDir && FilenameTokLoc.isValid() &&
CurDir->isFramework() && CurDir == CurDirLookup)
Diag(FilenameTokLoc, diag::warn_pp_relative_include_from_framework);
return FE;
}
if (FE) return FE;
// Otherwise, see if this is a subframework header. If so, this is relative
// to one of the headers on the #include stack. Walk the list of the current
@ -1079,8 +1069,7 @@ void Preprocessor::HandleIncludeDirective(Token &IncludeTok,
// Search include directories.
const DirectoryLookup *CurDir;
const FileEntry *File = LookupFile(Filename, FilenameTok.getLocation(),
isAngled, LookupFrom, CurDir);
const FileEntry *File = LookupFile(Filename, isAngled, LookupFrom, CurDir);
if (File == 0) {
Diag(FilenameTok, diag::err_pp_file_not_found) << Filename;
return;

View File

@ -567,9 +567,7 @@ static bool EvaluateHasIncludeCommon(bool &Result, Token &Tok,
// Search include directories.
const DirectoryLookup *CurDir;
const FileEntry *File = PP.LookupFile(Filename,
SourceLocation(),// produce no warnings.
isAngled, LookupFrom, CurDir);
const FileEntry *File = PP.LookupFile(Filename, isAngled, LookupFrom, CurDir);
// Get the result value. Result = true means the file exists.
Result = File != 0;

View File

@ -301,8 +301,7 @@ void Preprocessor::HandlePragmaDependency(Token &DependencyTok) {
// Search include directories for this file.
const DirectoryLookup *CurDir;
const FileEntry *File = LookupFile(Filename, FilenameTok.getLocation(),
isAngled, 0, CurDir);
const FileEntry *File = LookupFile(Filename, isAngled, 0, CurDir);
if (File == 0) {
Diag(FilenameTok, diag::err_pp_file_not_found) << Filename;
return;

View File

@ -1,3 +0,0 @@
int y;

View File

@ -1,6 +0,0 @@
// This should warn: published framework headers should always
// #import headers within the framework with framework paths.
#include "bar.h"
int x;

View File

@ -1,5 +0,0 @@
// RUN: %clang -E -F%S %s 2>&1 | grep "published framework headers should always #import headers within the framework with framework paths"
// rdar://7520940
#include <foo/foo.h>