Author: arphaman Date: Thu Jun 28 16:23:45 2018 New Revision: 335940 URL: http://llvm.org/viewvc/llvm-project?rev=335940&view=rev Log: [frontend] Don't include the C++ stdlib for -x assembler-with-cpp
The new C++ stdlib warning added in r335081 gets triggered when compiling an assembly file with -x assembler-with-cpp. This commit ensures that the C++ stdlib is not included when compiling assembly. In general, it's not really useful to include the C++ stdlib search path when compiling assembly source. rdar://41359632 Differential Revision: https://reviews.llvm.org/D48736 Added: cfe/trunk/test/Frontend/nostdlib-for-asmpp.s Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Modified: cfe/trunk/lib/Frontend/InitHeaderSearch.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitHeaderSearch.cpp?rev=335940&r1=335939&r2=335940&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/InitHeaderSearch.cpp (original) +++ cfe/trunk/lib/Frontend/InitHeaderSearch.cpp Thu Jun 28 16:23:45 2018 @@ -470,8 +470,8 @@ void InitHeaderSearch::AddDefaultInclude break; } - if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes && - HSOpts.UseStandardSystemIncludes) { + if (Lang.CPlusPlus && !Lang.AsmPreprocessor && + HSOpts.UseStandardCXXIncludes && HSOpts.UseStandardSystemIncludes) { if (HSOpts.UseLibcxx) { if (triple.isOSDarwin()) { // On Darwin, libc++ may be installed alongside the compiler in Added: cfe/trunk/test/Frontend/nostdlib-for-asmpp.s URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/nostdlib-for-asmpp.s?rev=335940&view=auto ============================================================================== --- cfe/trunk/test/Frontend/nostdlib-for-asmpp.s (added) +++ cfe/trunk/test/Frontend/nostdlib-for-asmpp.s Thu Jun 28 16:23:45 2018 @@ -0,0 +1,5 @@ +// RUN: %clang -cc1 -x assembler-with-cpp -triple arm64-apple-ios6.0.0 -isysroot %S/doesnotexist -std=c++11 -v %s 2>&1 | FileCheck %s +// The C++ stdlib path should not be included for an assembly source. + +// CHECK-NOT: usr/include/c++/ +// CHECK-NOT: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits