r348540 - [frontend][darwin] warn_stdlibcxx_not_found: supress warning for preprocessed input
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 6 14:45:59 PST 2018
Author: arphaman
Date: Thu Dec 6 14:45:58 2018
New Revision: 348540
URL: http://llvm.org/viewvc/llvm-project?rev=348540&view=rev
Log:
[frontend][darwin] warn_stdlibcxx_not_found: supress warning for preprocessed input
Addresses second post-commit feedback for r335081 from Nico
Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=348540&r1=348539&r2=348540&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Dec 6 14:45:58 2018
@@ -3240,6 +3240,7 @@ bool CompilerInvocation::CreateFromArgs(
Res.getTargetOpts(), Res.getFrontendOpts());
ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args,
Res.getFileSystemOpts().WorkingDir);
+ llvm::Triple T(Res.getTargetOpts().Triple);
if (DashX.getFormat() == InputKind::Precompiled ||
DashX.getLanguage() == InputKind::LLVM_IR) {
// ObjCAAutoRefCount and Sanitize LangOpts are used to setup the
@@ -3260,6 +3261,12 @@ bool CompilerInvocation::CreateFromArgs(
Res.getPreprocessorOpts(), Diags);
if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC)
LangOpts.ObjCExceptions = 1;
+ if (T.isOSDarwin() && DashX.isPreprocessed()) {
+ // Supress the darwin-specific 'stdlibcxx-not-found' diagnostic for
+ // preprocessed input as we don't expect it to be used with -std=libc++
+ // anyway.
+ Res.getDiagnosticOpts().Warnings.push_back("no-stdlibcxx-not-found");
+ }
}
LangOpts.FunctionAlignment =
@@ -3291,7 +3298,6 @@ bool CompilerInvocation::CreateFromArgs(
Res.getFrontendOpts().ProgramAction);
// Turn on -Wspir-compat for SPIR target.
- llvm::Triple T(Res.getTargetOpts().Triple);
auto Arch = T.getArch();
if (Arch == llvm::Triple::spir || Arch == llvm::Triple::spir64) {
Res.getDiagnosticOpts().Warnings.push_back("spir-compat");
Modified: cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp?rev=348540&r1=348539&r2=348540&view=diff
==============================================================================
--- cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp (original)
+++ cfe/trunk/test/Frontend/warning-stdlibcxx-darwin.cpp Thu Dec 6 14:45:58 2018
@@ -1,5 +1,6 @@
// 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
+// RUN: %clang -cc1 -x c++-cpp-output -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist %s -verify
// CHECK: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead
// expected-no-diagnostics
More information about the cfe-commits
mailing list