apple / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Apple’s stable releases of Clang as well as support the Swift project.
https://llvm.org
Other
1.1k stars 320 forks source link

[lldb] Prefer triple from module in precise invocations #8941

Open kastiglione opened 6 days ago

kastiglione commented 6 days ago

When using precise compiler invocations, prefer the triple of the dylib/framework (aka image/module), and not the target binary. This is particularly vital for explicitly built modules, where the pcms for the dylib target can differ from the main target. The difference in pcms can cause expression evaluation to fail.

rdar://130284825

kastiglione commented 6 days ago

@swift-ci test

kastiglione commented 5 days ago

@swift-ci test

fredriss commented 4 days ago

Should playgrounds just turn off precise compiler invocations rather than threading this as a different dimension in the API?

kastiglione commented 4 days ago

@fredriss here's the new commit, which disables precise compiler invocation for playgrounds https://github.com/apple/llvm-project/pull/8941/commits/9ec444b043e3017abbbb0a670ad22e96dfc2ec24

The tests in TestSwiftPlaygrounds.py expect the semantics that the target's triple is used to evaluate Swift code, not the current module.

kastiglione commented 4 days ago

Should playgrounds just turn off precise compiler invocations rather than threading this as a different dimension in the API?

@fredriss let me look into that.

kastiglione commented 4 days ago

@fredriss it turns out that the existing SymbolContext parameter itself controls whether a precise compiler invocation is used. I've changed the code to pass nullptr for the symbol context, whenever the expression is run from a playground (or repl). This avoids risks that could come with unprotected temporary mutation of a global (the swift-precise-compiler-invocation setting).

Thoughts?

kastiglione commented 4 days ago

@swift-ci test

fredriss commented 4 days ago

LGTM

kastiglione commented 3 days ago

@swift-ci test linux

kastiglione commented 3 days ago

The linux test failures need investigation.

kastiglione commented 2 days ago

@swift-ci test linux

kastiglione commented 2 days ago

@swift-ci test linux

kastiglione commented 2 days ago

@swift-ci test linux

kastiglione commented 1 day ago

@swift-ci test linux

kastiglione commented 1 day ago

@swift-ci test linux