<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/110380>110380</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang frontend hangs when compiling for unknown-windows with the Itanium ABI
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          amyspark
      </td>
    </tr>
</table>

<pre>
    Hi all,

The following MWE causes the Clang frontend to hang when compiling to `x86_64-unknown-windows` (e.g. for UEFI) but setting `-fc++-abi=itanium`.

```c++
namespace foo {
    struct bar{
 int a;
        int b;

        bar() {
            a = 1;
            b = 2;
        }
    };
}

int main() noexcept {
    foo::bar baz{};
    
    return 0;
}
```

Stacktrace looks like this:

```
[Inline Frame] clang.exe!llvm::Value::addUse(llvm::Use &) Line 505 (f:\Projects\llvm-project\llvm\include\llvm\IR\Value.h:505)
[Inline Frame] clang.exe!llvm::Use::set(llvm::Value *) Line 885 (f:\Projects\llvm-project\llvm\include\llvm\IR\Value.h:885)
clang.exe!llvm::Value::doRAUW(llvm::Value * New, llvm::Value::ReplaceMetadataUses ReplaceMetaUses) Line 527 (f:\Projects\llvm-project\llvm\lib\IR\Value.cpp:527)
clang.exe!clang::CodeGen::CodeGenModule::applyReplacements() Line 538 (f:\Projects\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp:538)
clang.exe!clang::CodeGen::CodeGenModule::Release() Line 860 (f:\Projects\llvm-project\clang\lib\CodeGen\CodeGenModule.cpp:860)
clang.exe!`anonymous namespace'::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext & Ctx) Line 287 (f:\Projects\llvm-project\clang\lib\CodeGen\ModuleBuilder.cpp:287)
clang.exe!clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext & C) Line 278 (f:\Projects\llvm-project\clang\lib\CodeGen\CodeGenAction.cpp:278)
clang.exe!clang::ParseAST(clang::Sema & S, bool PrintStats, bool SkipFunctionBodies) Line 191 (f:\Projects\llvm-project\clang\lib\Parse\ParseAST.cpp:191)
clang.exe!clang::ASTFrontendAction::ExecuteAction() Line 1192 (f:\Projects\llvm-project\clang\lib\Frontend\FrontendAction.cpp:1192)
clang.exe!clang::CodeGenAction::ExecuteAction() Line 1143 (f:\Projects\llvm-project\clang\lib\CodeGen\CodeGenAction.cpp:1143)
clang.exe!clang::FrontendAction::Execute() Line 1082 (f:\Projects\llvm-project\clang\lib\Frontend\FrontendAction.cpp:1082)
clang.exe!clang::CompilerInstance::ExecuteAction(clang::FrontendAction & Act) Line 1060 (f:\Projects\llvm-project\clang\lib\Frontend\CompilerInstance.cpp:1060)
clang.exe!clang::ExecuteCompilerInvocation(clang::CompilerInstance * Clang) Line 280 (f:\Projects\llvm-project\clang\lib\FrontendTool\ExecuteCompilerInvocation.cpp:280)
clang.exe!cc1_main(llvm::ArrayRef<char const *> Argv, const char * Argv0, void * MainAddr) Line 285 (f:\Projects\llvm-project\clang\tools\driver\cc1_main.cpp:285)
clang.exe!ExecuteCC1Tool(llvm::SmallVectorImpl<char const *> & ArgV, const llvm::ToolContext & ToolContext) Line 217 (f:\Projects\llvm-project\clang\tools\driver\driver.cpp:217)
clang.exe!clang_main(int Argc, char * * Argv, const llvm::ToolContext & ToolContext) Line 258 (f:\Projects\llvm-project\clang\tools\driver\driver.cpp:258)
clang.exe!main(int argc, char * * argv) Line 17 (f:\Projects\llvm-project\build\tools\clang\tools\driver\clang-driver.cpp:17)
[Inline Frame] clang.exe!invoke_main() Line 78 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78)
clang.exe!__scrt_common_main_seh() Line 288 (d:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288)
kernel32.dll!00007ffb129e7374() (Origen desconocido:0)
```

Clang version:
```
clang version 20.0.0git (https://github.com/llvm/llvm-project.git bbe79a803c84f4193c39566c9b0189ecadf5d8b4)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: F:\Projects\llvm-project\build\bin
```

Command line (CLI): `clang --target=x86_64-unknown-windows   -Xclang=-fc++-abi=itanium  -x c++ foo.cpp -o foo.o`

<details><summary>Command line (frontend)</summary>

```
clang.exe -cc1 -triple x86_64-unknown-windows-msvc19.42.34321 -emit-obj -mincremental-linker-compatible -dumpdir foo.o- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -fms-volatile -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -fdebug-compilation-dir=F:\Projects\llvm-project\build\bin -fcoverage-compilation-dir=F:\Projects\llvm-project\build\bin -resource-dir lib\clang\20 -internal-isystem lib\clang\20\include -internal-isystem "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34321\include" -internal-isystem "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.42.34321\atlmfc\include" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt" -O2 -fdeprecated-macro -ferror-limit 19 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.42.34321 -std=c++14 -fskip-odr-check-in-gmf -fdelayed-template-parsing -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -fc++-abi=itanium -faddrsig -o C:\Users\Amalia\AppData\Local\Temp\test-07744d.o -x c++ test.cpp
```
</details>

cc @lethalbit
</pre>
<img width="1px" height="1px"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