Author: Joseph Huber
Date: 2022-05-13T14:38:39-04:00
New Revision: 5189f634a113b06fc2f2e8c6c021c0083f59bfb8

URL: 
https://github.com/llvm/llvm-project/commit/5189f634a113b06fc2f2e8c6c021c0083f59bfb8
DIFF: 
https://github.com/llvm/llvm-project/commit/5189f634a113b06fc2f2e8c6c021c0083f59bfb8.diff

LOG: [OpenMP] Don't include the device wrappers if -nostdinc is used

OpenMP uses several wrapper hearders to provide the definitions of
needed symbols contained in the host. However, some users may use the
`-nostdinc` option to override these definitions themselves. The OpenMP
wrapper headers are stored in the same location as the clang install. If
the user passes `-nostdinc` then this include directory is never looked
at by default which means that including these wrappers will always
fail. These headers should instead be included manually if they are
needed with a `-nostdinc` build.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D125265

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 80bb7f82209e..0c2de4476b5b 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1308,6 +1308,7 @@ void Clang::AddPreprocessingOptions(Compilation &C, const 
JobAction &JA,
   // If we are offloading to a target via OpenMP we need to include the
   // openmp_wrappers folder which contains alternative system headers.
   if (JA.isDeviceOffloading(Action::OFK_OpenMP) &&
+      !Args.hasArg(options::OPT_nostdinc) &&
       (getToolChain().getTriple().isNVPTX() ||
        getToolChain().getTriple().isAMDGCN())) {
     if (!Args.hasArg(options::OPT_nobuiltininc)) {


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to