From fe4d2c12a1647dbcbff46d2821f5d58df0f18e86 Mon Sep 17 00:00:00 2001 From: foreman Date: Mon, 4 Aug 2014 09:55:45 -0400 Subject: [PATCH] P4 to Git Change 1062532 by shivara@shivaram_llvmmerge_dt on 2014/08/04 09:50:20 ECR #333753 - Fix for 1.2 conformance compiler options_include_directory test. Added code to pass -I option to clang. Affected files ... ... //depot/stg/opencl/drivers/opencl/compiler/lib/utils/options.cpp#28 edit --- rocclr/compiler/lib/utils/options.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/rocclr/compiler/lib/utils/options.cpp b/rocclr/compiler/lib/utils/options.cpp index c18b9ace09..c413566b86 100644 --- a/rocclr/compiler/lib/utils/options.cpp +++ b/rocclr/compiler/lib/utils/options.cpp @@ -1047,9 +1047,22 @@ parseAllOptions(std::string& options, Options& Opts, bool linkOptsOnly) size_t sPos1 = (isShortName ? sPos - 1 : sPos - 2); std::string oStr = options.substr(sPos1, pos - sPos1); if (OPTION_info(od) & OA_CLC) { - Opts.clcOptions.append(" " + oStr); - if (!oStr.compare(0, 2, "-D")) - Opts.clangOptions.push_back(oStr); + Opts.clcOptions.append(" " + oStr); + if (!oStr.compare(0, 2, "-D") || + !oStr.compare(0, 2, "-I")) { + // strip off the leading whitespaces in macro + // definition and include path. Clang treats + // whitespaces as part of macro and include paths. + size_t vPos1 = oStr.find_first_not_of(" ", 2); + if (vPos1 == std::string::npos) { + // Do not allow blank macro and include directories + logInvalidOption(options, bpos, Opts.optionsLog(), + " (expected value)"); + return false; + } + std::string vStr = oStr.substr(vPos1, std::string::npos); + Opts.clangOptions.push_back(oStr.substr(0,2) + vStr); + } } }