summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2013-06-24 17:09:24 +0200
committerEike Ziller <eike.ziller@digia.com>2013-06-25 13:41:36 +0200
commit14cca9e94ea0105af03ad2bfab7b9f3858cffdbd (patch)
tree157ba25ad8fc6b6774c8279646039af671b7935b /src
parenta88599aee24e25316ce8d6cbd5724c628948daee (diff)
downloadqt-creator-14cca9e94ea0105af03ad2bfab7b9f3858cffdbd.tar.gz
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: Daniel Teske <daniel.teske@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.cpp10
-rw-r--r--src/plugins/projectexplorer/gcctoolchain.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp
index 31f4a47fe1..b06c91cd7a 100644
--- a/src/plugins/projectexplorer/gcctoolchain.cpp
+++ b/src/plugins/projectexplorer/gcctoolchain.cpp
@@ -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);
diff --git a/src/plugins/projectexplorer/gcctoolchain.h b/src/plugins/projectexplorer/gcctoolchain.h
index 4027453b46..e445d74b7e 100644
--- a/src/plugins/projectexplorer/gcctoolchain.h
+++ b/src/plugins/projectexplorer/gcctoolchain.h
@@ -158,6 +158,7 @@ public:
ToolChain *clone() const;
QList<Utils::FileName> suggestedMkspecList() const;
+ void addToEnvironment(Utils::Environment &env) const;
protected:
virtual CompilerFlags defaultCompilerFlags() const;