Skip to content

Commit ce20dd1

Browse files
author
Simon Moll
committed
clang][ompt] only add target include paths for CXX
1 parent b258ba0 commit ce20dd1

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
#include <unistd.h> // For getuid().
4949
#endif
5050

51+
// FIXME temporary debug flag
52+
#define IF_DEBUG_OMP if (false)
53+
5154
using namespace clang::driver;
5255
using namespace clang::driver::tools;
5356
using namespace clang;
@@ -1320,14 +1323,29 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
13201323
// Add C++ include arguments, if needed.
13211324
if (types::isCXX(Inputs[0].getType())) {
13221325
bool HasStdlibxxIsystem = Args.hasArg(options::OPT_stdlibxx_isystem);
1323-
forAllAssociatedToolChains(
1324-
C, JA, getToolChain(),
1325-
[&Args, &CmdArgs, HasStdlibxxIsystem](const ToolChain &TC) {
1326+
1327+
auto AddSysIncludes = [&Args, &CmdArgs, HasStdlibxxIsystem](const ToolChain &TC) {
13261328
HasStdlibxxIsystem ? TC.AddClangCXXStdlibIsystemArgs(Args, CmdArgs)
13271329
: TC.AddClangCXXStdlibIncludeArgs(Args, CmdArgs);
1328-
});
1330+
IF_DEBUG_OMP {
1331+
llvm::errs() << "With includes (" << HasStdlibxxIsystem << " for TC: " << TC.getArchName() << ") :\n ";
1332+
for (const auto *CA : CmdArgs) {
1333+
llvm::errs() << CA << ", ";
1334+
}
1335+
llvm::errs() << "\n";
1336+
}
1337+
};
1338+
#if 1
1339+
// only consider the host toolchain
1340+
AddSysIncludes(getToolChain());
1341+
#else
1342+
forAllAssociatedToolChains(
1343+
C, JA, getToolChain(), AddSysIncludes);
1344+
#endif
13291345
}
13301346

1347+
1348+
13311349
// Add system include arguments for all targets but IAMCU.
13321350
if (!IsIAMCU)
13331351
forAllAssociatedToolChains(C, JA, getToolChain(),
@@ -3910,6 +3928,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
39103928
const llvm::Triple &Triple = TC.getEffectiveTriple();
39113929
const std::string &TripleStr = Triple.getTriple();
39123930

3931+
IF_DEBUG_OMP { llvm::errs() << "JAK: " << Action::getClassName(JA.getKind()) << " (" << TripleStr << ")\n"; }
3932+
39133933
bool KernelOrKext =
39143934
Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
39153935
const Driver &D = TC.getDriver();

0 commit comments

Comments
 (0)