[cfe-commits] r126767 - in /cfe/trunk: include/clang/Driver/ToolChain.h lib/Driver/ToolChains.cpp lib/Driver/ToolChains.h lib/Driver/Tools.cpp
Daniel Dunbar
daniel at zuster.org
Tue Mar 1 10:49:30 PST 2011
Author: ddunbar
Date: Tue Mar 1 12:49:30 2011
New Revision: 126767
URL: http://llvm.org/viewvc/llvm-project?rev=126767&view=rev
Log:
Driver/Darwin: Be bug compatible with GCC and ignore -pg on ARM.
Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=126767&r1=126766&r2=126767&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Tue Mar 1 12:49:30 2011
@@ -151,6 +151,9 @@
/// particular PIC mode.
virtual const char *GetForcedPicModel() const = 0;
+ /// SupportsProfiling - Does this tool chain support -pg.
+ virtual bool SupportsProfiling() const { return true; }
+
/// Does this tool chain support Objective-C garbage collection.
virtual bool SupportsObjCGC() const { return false; }
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=126767&r1=126766&r2=126767&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Tue Mar 1 12:49:30 2011
@@ -918,6 +918,11 @@
return 0;
}
+bool Darwin::SupportsProfiling() const {
+ // Profiling instrumentation is only supported on x86.
+ return getArchName() == "i386" || getArchName() == "x86_64";
+}
+
bool Darwin::SupportsObjCGC() const {
// Garbage collection is supported everywhere except on iPhone OS.
return !isTargetIPhoneOS();
Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=126767&r1=126766&r2=126767&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Tue Mar 1 12:49:30 2011
@@ -212,6 +212,8 @@
virtual const char *GetDefaultRelocationModel() const;
virtual const char *GetForcedPicModel() const;
+ virtual bool SupportsProfiling() const;
+
virtual bool SupportsObjCGC() const;
virtual bool UseDwarfDebugFlags() const;
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=126767&r1=126766&r2=126767&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar 1 12:49:30 2011
@@ -1385,7 +1385,8 @@
Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls);
Args.AddLastArg(CmdArgs, options::OPT_fheinous_gnu_extensions);
Args.AddLastArg(CmdArgs, options::OPT_flimit_debug_info);
- Args.AddLastArg(CmdArgs, options::OPT_pg);
+ if (getToolChain().SupportsProfiling())
+ Args.AddLastArg(CmdArgs, options::OPT_pg);
// -flax-vector-conversions is default.
if (!Args.hasFlag(options::OPT_flax_vector_conversions,
@@ -2184,7 +2185,8 @@
if (Args.hasArg(options::OPT_v))
CmdArgs.push_back("-version");
- if (Args.hasArg(options::OPT_pg))
+ if (Args.hasArg(options::OPT_pg) &&
+ getToolChain().SupportsProfiling())
CmdArgs.push_back("-p");
Args.AddLastArg(CmdArgs, options::OPT_p);
@@ -2817,7 +2819,8 @@
}
}
} else {
- if (Args.hasArg(options::OPT_pg)) {
+ if (Args.hasArg(options::OPT_pg) &&
+ getToolChain().SupportsProfiling()) {
if (Args.hasArg(options::OPT_static) ||
Args.hasArg(options::OPT_object) ||
Args.hasArg(options::OPT_preload)) {
More information about the cfe-commits
mailing list