From: Alex Lorenz Date: Tue, 19 Jun 2018 19:43:07 +0000 (+0000) Subject: Revert r335063 as it causes bot failures X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e85e01664ee5e402a1f4c1300e5218def9d6800;p=clang Revert r335063 as it causes bot failures git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335073 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticFrontendKinds.td b/include/clang/Basic/DiagnosticFrontendKinds.td index 6add448871..2211a92574 100644 --- a/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/include/clang/Basic/DiagnosticFrontendKinds.td @@ -236,9 +236,4 @@ def err_invalid_vfs_overlay : Error< def warn_option_invalid_ocl_version : Warning< "OpenCL version %0 does not support the option '%1'">, InGroup; - -def warn_stdlibcxx_not_found : Warning< - "include path for stdlibc++ headers not found; pass '-std=libc++' on the " - "command line to use the libc++ standard library instead">, - InGroup>; } diff --git a/include/clang/Lex/HeaderSearch.h b/include/clang/Lex/HeaderSearch.h index fd52000954..3d13162da7 100644 --- a/include/clang/Lex/HeaderSearch.h +++ b/include/clang/Lex/HeaderSearch.h @@ -272,8 +272,6 @@ public: FileManager &getFileMgr() const { return FileMgr; } - DiagnosticsEngine &getDiags() const { return Diags; } - /// Interface for setting the file search paths. void SetSearchPaths(const std::vector &dirs, unsigned angledDirIdx, unsigned systemDirIdx, diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp index 85aeec461b..d2fcc9a994 100644 --- a/lib/Frontend/InitHeaderSearch.cpp +++ b/lib/Frontend/InitHeaderSearch.cpp @@ -14,7 +14,6 @@ #include "clang/Basic/FileManager.h" #include "clang/Basic/LangOptions.h" #include "clang/Config/config.h" // C_INCLUDE_DIRS -#include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/Utils.h" #include "clang/Lex/HeaderMap.h" #include "clang/Lex/HeaderSearch.h" @@ -56,13 +55,11 @@ public: /// AddPath - Add the specified path to the specified group list, prefixing /// the sysroot if used. - /// Returns true if the path exists, false if it was ignored. - bool AddPath(const Twine &Path, IncludeDirGroup Group, bool isFramework); + void AddPath(const Twine &Path, IncludeDirGroup Group, bool isFramework); /// AddUnmappedPath - Add the specified path to the specified group list, /// without performing any sysroot remapping. - /// Returns true if the path exists, false if it was ignored. - bool AddUnmappedPath(const Twine &Path, IncludeDirGroup Group, + void AddUnmappedPath(const Twine &Path, IncludeDirGroup Group, bool isFramework); /// AddSystemHeaderPrefix - Add the specified prefix to the system header @@ -73,9 +70,10 @@ public: /// AddGnuCPlusPlusIncludePaths - Add the necessary paths to support a gnu /// libstdc++. - /// Returns true if the \p Base path was found, false if it does not exist. - bool AddGnuCPlusPlusIncludePaths(StringRef Base, StringRef ArchDir, - StringRef Dir32, StringRef Dir64, + void AddGnuCPlusPlusIncludePaths(StringRef Base, + StringRef ArchDir, + StringRef Dir32, + StringRef Dir64, const llvm::Triple &triple); /// AddMinGWCPlusPlusIncludePaths - Add the necessary paths to support a MinGW @@ -90,8 +88,7 @@ public: // AddDefaultCPlusPlusIncludePaths - Add paths that should be searched when // compiling c++. - void AddDefaultCPlusPlusIncludePaths(const LangOptions &LangOpts, - const llvm::Triple &triple, + void AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts); /// AddDefaultSystemIncludePaths - Adds the default system include paths so @@ -115,7 +112,7 @@ static bool CanPrefixSysroot(StringRef Path) { #endif } -bool InitHeaderSearch::AddPath(const Twine &Path, IncludeDirGroup Group, +void InitHeaderSearch::AddPath(const Twine &Path, IncludeDirGroup Group, bool isFramework) { // Add the path with sysroot prepended, if desired and this is a system header // group. @@ -123,14 +120,15 @@ bool InitHeaderSearch::AddPath(const Twine &Path, IncludeDirGroup Group, SmallString<256> MappedPathStorage; StringRef MappedPathStr = Path.toStringRef(MappedPathStorage); if (CanPrefixSysroot(MappedPathStr)) { - return AddUnmappedPath(IncludeSysroot + Path, Group, isFramework); + AddUnmappedPath(IncludeSysroot + Path, Group, isFramework); + return; } } - return AddUnmappedPath(Path, Group, isFramework); + AddUnmappedPath(Path, Group, isFramework); } -bool InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group, +void InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group, bool isFramework) { assert(!Path.isTriviallyEmpty() && "can't handle empty path here"); @@ -152,7 +150,7 @@ bool InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group, if (const DirectoryEntry *DE = FM.getDirectory(MappedPathStr)) { IncludePath.push_back( std::make_pair(Group, DirectoryLookup(DE, Type, isFramework))); - return true; + return; } // Check to see if this is an apple-style headermap (which are not allowed to @@ -164,7 +162,7 @@ bool InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group, IncludePath.push_back( std::make_pair(Group, DirectoryLookup(HM, Type, Group == IndexHeaderMap))); - return true; + return; } } } @@ -172,16 +170,15 @@ bool InitHeaderSearch::AddUnmappedPath(const Twine &Path, IncludeDirGroup Group, if (Verbose) llvm::errs() << "ignoring nonexistent directory \"" << MappedPathStr << "\"\n"; - return false; } -bool InitHeaderSearch::AddGnuCPlusPlusIncludePaths(StringRef Base, +void InitHeaderSearch::AddGnuCPlusPlusIncludePaths(StringRef Base, StringRef ArchDir, StringRef Dir32, StringRef Dir64, const llvm::Triple &triple) { // Add the base dir - bool IsBaseFound = AddPath(Base, CXXSystem, false); + AddPath(Base, CXXSystem, false); // Add the multilib dirs llvm::Triple::ArchType arch = triple.getArch(); @@ -193,7 +190,6 @@ bool InitHeaderSearch::AddGnuCPlusPlusIncludePaths(StringRef Base, // Add the backward dir AddPath(Base + "/backward", CXXSystem, false); - return IsBaseFound; } void InitHeaderSearch::AddMinGWCPlusPlusIncludePaths(StringRef Base, @@ -358,55 +354,46 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple, } } -void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths( - const LangOptions &LangOpts, const llvm::Triple &triple, - const HeaderSearchOptions &HSOpts) { +void InitHeaderSearch:: +AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) { llvm::Triple::OSType os = triple.getOS(); // FIXME: temporary hack: hard-coded paths. if (triple.isOSDarwin()) { - bool IsBaseFound = true; switch (triple.getArch()) { default: break; case llvm::Triple::ppc: case llvm::Triple::ppc64: - IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", - "powerpc-apple-darwin10", "", - "ppc64", triple); - IsBaseFound |= AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0", - "powerpc-apple-darwin10", "", - "ppc64", triple); + AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", + "powerpc-apple-darwin10", "", "ppc64", + triple); + AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0", + "powerpc-apple-darwin10", "", "ppc64", + triple); break; case llvm::Triple::x86: case llvm::Triple::x86_64: - IsBaseFound = AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", - "i686-apple-darwin10", "", - "x86_64", triple); - IsBaseFound |= AddGnuCPlusPlusIncludePaths( - "/usr/include/c++/4.0.0", "i686-apple-darwin8", "", "", triple); + AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", + "i686-apple-darwin10", "", "x86_64", triple); + AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.0.0", + "i686-apple-darwin8", "", "", triple); break; case llvm::Triple::arm: case llvm::Triple::thumb: - IsBaseFound = AddGnuCPlusPlusIncludePaths( - "/usr/include/c++/4.2.1", "arm-apple-darwin10", "v7", "", triple); - IsBaseFound |= AddGnuCPlusPlusIncludePaths( - "/usr/include/c++/4.2.1", "arm-apple-darwin10", "v6", "", triple); + AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", + "arm-apple-darwin10", "v7", "", triple); + AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", + "arm-apple-darwin10", "v6", "", triple); break; case llvm::Triple::aarch64: - IsBaseFound = AddGnuCPlusPlusIncludePaths( - "/usr/include/c++/4.2.1", "arm64-apple-darwin10", "", "", triple); + AddGnuCPlusPlusIncludePaths("/usr/include/c++/4.2.1", + "arm64-apple-darwin10", "", "", triple); break; } - // Warn when compiling pure C++ / Objective-C++ only. - if (!IsBaseFound && - !(LangOpts.CUDA || LangOpts.OpenCL || LangOpts.RenderScript)) { - Headers.getDiags().Report(SourceLocation(), - diag::warn_stdlibcxx_not_found); - } return; } @@ -491,7 +478,7 @@ void InitHeaderSearch::AddDefaultIncludePaths(const LangOptions &Lang, } AddPath("/usr/include/c++/v1", CXXSystem, false); } else { - AddDefaultCPlusPlusIncludePaths(Lang, triple, HSOpts); + AddDefaultCPlusPlusIncludePaths(triple, HSOpts); } } diff --git a/test/Frontend/warning-stdlibcxx-darwin.cpp b/test/Frontend/warning-stdlibcxx-darwin.cpp deleted file mode 100644 index 3c132b6a83..0000000000 --- a/test/Frontend/warning-stdlibcxx-darwin.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: %clang -cc1 -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist %s 2>&1 | FileCheck %s -// RUN: %clang -cc1 -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist -stdlib=libc++ %s -verify -// CHECK: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead - -// expected-no-diagnostics