Commit 14cca9e9 authored by Eike Ziller's avatar Eike Ziller

Workaround for Clang generating wrong debug info

Clang obviously takes PWD as a basis for source paths in debug
information (AT_comp_dir) if it is set. Since the build tools are not
executed in a shell that would set PWD to a sensible value, debug
information with Clang is broken if the build environment got a wrong
PWD to start with, for example by starting Qt Creator from a shell
(which sets PWD).

Workaround is to explicitly unset PWD for the build environment used for
the Clang tool chain.

Task-number: QTCREATORBUG-8825

Change-Id: Ia3e47693121edd61b0ea43bddbb1fcaaac9eb390
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
parent a88599ae
......@@ -1059,6 +1059,16 @@ QList<FileName> ClangToolChain::suggestedMkspecList() const
return QList<FileName>(); // Note: Not supported by Qt yet, so default to the mkspec the Qt was build with
}
void ClangToolChain::addToEnvironment(Environment &env) const
{
GccToolChain::addToEnvironment(env);
// Clang takes PWD as basis for debug info, if set.
// When running Qt Creator from a shell, PWD is initially set to an "arbitrary" value.
// Since the tools are not called through a shell, PWD is never changed to the actual cwd,
// so we better make sure PWD is empty to begin with
env.unset(QLatin1String("PWD"));
}
ToolChain::CompilerFlags ClangToolChain::defaultCompilerFlags() const
{
return CompilerFlags(GnuExtensions | StandardC99 | StandardCxx11);
......
......@@ -158,6 +158,7 @@ public:
ToolChain *clone() const;
QList<Utils::FileName> suggestedMkspecList() const;
void addToEnvironment(Utils::Environment &env) const;
protected:
virtual CompilerFlags defaultCompilerFlags() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment