Skip to content

Commit 26428d5

Browse files
lamb-jsearlmc1
authored andcommitted
[Comgr] Specify clang exe path in Driver creation
Manually specifying ClangIncludePath is not needed if the driver is created with the correct clang binary path as first argument. This allows the driver to get the correct clang resource directory. Fixes ROCm/ROCm-CompilerSupport#48 Submitting on behalf of github user @littlewu2508 Change-Id: I381e76d82f8acb3a1dd2969e837723554d6ff2ed
1 parent 9396814 commit 26428d5

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

amd/comgr/src/comgr-compiler.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,8 @@ AMDGPUCompiler::executeInProcessDriver(ArrayRef<const char *> Args) {
667667
IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs);
668668
DiagnosticsEngine Diags(DiagID, &*DiagOpts, DiagClient);
669669
ProcessWarningOptions(Diags, *DiagOpts, /*ReportDiags=*/false);
670-
Driver TheDriver("", "", Diags);
670+
671+
Driver TheDriver((Twine(env::getLLVMPath()) + "/bin/clang").str(), "", Diags);
671672
TheDriver.setTitle("AMDGPU Code Object Manager");
672673
TheDriver.setCheckInputsExist(false);
673674

@@ -1030,11 +1031,6 @@ amd_comgr_status_t AMDGPUCompiler::addCompilationFlags() {
10301031
HIPIncludePath = (Twine(env::getHIPPath()) + "/include").str();
10311032
// HIP headers depend on hsa.h which is in ROCM_DIR/include.
10321033
ROCMIncludePath = (Twine(env::getROCMPath()) + "/include").str();
1033-
ClangIncludePath =
1034-
(Twine(env::getLLVMPath()) + "/lib/clang/" + CLANG_VERSION_STRING).str();
1035-
ClangIncludePath2 = (Twine(env::getLLVMPath()) + "/lib/clang/" +
1036-
CLANG_VERSION_STRING + "/include")
1037-
.str();
10381034

10391035
Args.push_back("-x");
10401036

@@ -1062,10 +1058,6 @@ amd_comgr_status_t AMDGPUCompiler::addCompilationFlags() {
10621058
Args.push_back(ROCMIncludePath.c_str());
10631059
Args.push_back("-isystem");
10641060
Args.push_back(HIPIncludePath.c_str());
1065-
Args.push_back("-isystem");
1066-
Args.push_back(ClangIncludePath.c_str());
1067-
Args.push_back("-isystem");
1068-
Args.push_back(ClangIncludePath2.c_str());
10691061
break;
10701062
default:
10711063
return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT;

0 commit comments

Comments
 (0)