Browse Source

Fix issue for use demangled name when add function.

Xiang Li 7 years ago
parent
commit
32d1bb7f78
2 changed files with 3 additions and 3 deletions
  1. 2 2
      lib/HLSL/DxilLinker.cpp
  2. 1 1
      tools/clang/unittests/HLSL/LinkerTest.cpp

+ 2 - 2
lib/HLSL/DxilLinker.cpp

@@ -1131,9 +1131,9 @@ DxilLinkerImpl::Link(StringRef entry, StringRef profile,
       // Only add exported functions.
       for (auto &it : m_functionNameMap) {
         StringRef name = it.getKey();
-        name = dxilutil::DemangleFunctionName(name);
+        StringRef demangledName = dxilutil::DemangleFunctionName(name);
         // Only add names exist in exportMap.
-        if (exportMap.find(name) != exportMap.end())
+        if (exportMap.find(demangledName) != exportMap.end())
           workList.emplace_back(name);
       }
 

+ 1 - 1
tools/clang/unittests/HLSL/LinkerTest.cpp

@@ -371,7 +371,7 @@ TEST_F(LinkerTest, RunLinkToLibExport) {
   LPCWSTR libName2 = L"test";
   RegisterDxcModule(libName2, pLib, pLinker);
   DxcDefine exports[] = { {L"test", L""} };
-  LinkWithExports(pLinker, {libName, libName2}, exports, {"test"}, {"@\"\01?GetBuf"});
+  LinkWithExports(pLinker, {libName, libName2}, exports, {"@\"\\01?test@@","@test"}, {"@\"\\01?GetBuf"});
 }
 
 TEST_F(LinkerTest, RunLinkFailSelectRes) {