diff --git a/tools/clang/lib/CodeGen/CGDebugInfo.cpp b/tools/clang/lib/CodeGen/CGDebugInfo.cpp index c859ddaeb..11c3337ee 100644 --- a/tools/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/tools/clang/lib/CodeGen/CGDebugInfo.cpp @@ -292,7 +292,8 @@ unsigned CGDebugInfo::getColumnNumber(SourceLocation Loc, bool Force) { } StringRef CGDebugInfo::getCurrentDirname() { - if (!CGM.getCodeGenOpts().DebugCompilationDir.empty()) + if (!CGM.getCodeGenOpts().DebugCompilationDir.empty() + || CGM.getLangOpts().HLSL) // HLSL Change return CGM.getCodeGenOpts().DebugCompilationDir; if (!CWDName.empty()) diff --git a/tools/clang/unittests/HLSL/CompilerTest.cpp b/tools/clang/unittests/HLSL/CompilerTest.cpp index 23a2cbe3c..b879008e0 100644 --- a/tools/clang/unittests/HLSL/CompilerTest.cpp +++ b/tools/clang/unittests/HLSL/CompilerTest.cpp @@ -61,21 +61,6 @@ using namespace std; using namespace hlsl_test; -// Examines a virtual filename to determine if it looks like a dir -// Based on whether the final path segment contains a dot -// Not ironclad, but good enough for testing -static bool LooksLikeDir(std::wstring fileName) { - for(int i = fileName.size() - 1; i > -1; i--) { - wchar_t ch = fileName[i]; - if (ch == L'\\' || ch == L'/') - return true; - if (ch == L'.') - return false; - } - // No divider, no dot, assume file - return false; -} - class TestIncludeHandler : public IDxcIncludeHandler { DXC_MICROCOM_REF_FIELD(m_dwRef) public: @@ -117,15 +102,7 @@ public: _In_ LPCWSTR pFilename, // Filename as written in #include statement _COM_Outptr_ IDxcBlob **ppIncludeSource // Resultant source object for included file ) override { - - LoadSourceCallInfo callInfo = LoadSourceCallInfo(pFilename); - - // *nix will call stat() on dirs, which attempts to find it here - // This loader isn't meant for dirs, so return failure - if (LooksLikeDir(callInfo.Filename)) - return m_defaultErrorCode; - - CallInfos.push_back(callInfo); + CallInfos.push_back(LoadSourceCallInfo(pFilename)); *ppIncludeSource = nullptr; if (callIndex >= CallResults.size()) {