Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2014 00:51:24 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r265477 - in head/contrib/llvm/tools/clang: include/clang/Driver include/clang/Frontend lib/CodeGen lib/Driver lib/Frontend
Message-ID:  <201405070051.s470pOLA036694@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Wed May  7 00:51:24 2014
New Revision: 265477
URL: http://svnweb.freebsd.org/changeset/base/265477

Log:
  Merge -fstandalone-debug from Clang r198655:
  
    Implement a new -fstandalone-debug option. rdar://problem/15685848
    It controls everything that -flimit-debug-info used to, plus the
    vtable type optimization. The old -fno-limit-debug-info option is now an
    alias to -fstandalone-debug and vice versa.
  
    Standalone is the default on Darwin until dtrace is updated to work with
    non-standalone debug info (rdar://problem/15758808).
  
    Note: I kept the LimitedDebugInfo name in CodeGenOptions::DebugInfoKind
    because NoStandaloneDebugInfo sounded even more confusing.

Modified:
  head/contrib/llvm/tools/clang/include/clang/Driver/Options.td
  head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h
  head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
  head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
  head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp

Modified: head/contrib/llvm/tools/clang/include/clang/Driver/Options.td
==============================================================================
--- head/contrib/llvm/tools/clang/include/clang/Driver/Options.td	Wed May  7 00:32:49 2014	(r265476)
+++ head/contrib/llvm/tools/clang/include/clang/Driver/Options.td	Wed May  7 00:51:24 2014	(r265477)
@@ -549,8 +549,6 @@ def finstrument_functions : Flag<["-"], 
 def fkeep_inline_functions : Flag<["-"], "fkeep-inline-functions">, Group<clang_ignored_f_Group>;
 def flat__namespace : Flag<["-"], "flat_namespace">;
 def flax_vector_conversions : Flag<["-"], "flax-vector-conversions">, Group<f_Group>;
-def flimit_debug_info : Flag<["-"], "flimit-debug-info">, Group<f_Group>, Flags<[CC1Option]>,
-  HelpText<"Limit debug information produced to reduce size of debug binary">;
 def flimited_precision_EQ : Joined<["-"], "flimited-precision=">, Group<f_Group>;
 def flto : Flag<["-"], "flto">, Group<f_Group>;
 def fno_lto : Flag<["-"], "fno-lto">, Group<f_Group>;
@@ -645,8 +643,6 @@ def fno_inline : Flag<["-"], "fno-inline
 def fno_keep_inline_functions : Flag<["-"], "fno-keep-inline-functions">, Group<clang_ignored_f_Group>;
 def fno_lax_vector_conversions : Flag<["-"], "fno-lax-vector-conversions">, Group<f_Group>,
   HelpText<"Disallow implicit conversions between vectors with a different number of elements or different element types">, Flags<[CC1Option]>;
-def fno_limit_debug_info : Flag<["-"], "fno-limit-debug-info">, Group<f_Group>, Flags<[CC1Option]>,
-  HelpText<"Do not limit debug information produced to reduce size of debug binary">;
 def fno_merge_all_constants : Flag<["-"], "fno-merge-all-constants">, Group<f_Group>,
     Flags<[CC1Option]>, HelpText<"Disallow merging of constants">;
 def fno_modules : Flag <["-"], "fno-modules">, Group<f_Group>,
@@ -774,6 +770,12 @@ def fno_signed_char : Flag<["-"], "fno-s
 def fsplit_stack : Flag<["-"], "fsplit-stack">, Group<f_Group>;
 def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group<f_Group>;
 def fstack_protector : Flag<["-"], "fstack-protector">, Group<f_Group>;
+def fstandalone_debug : Flag<["-"], "fstandalone-debug">, Group<f_Group>, Flags<[CC1Option]>,
+  HelpText<"Emit full debug info for all types used by the program">;
+def fno_standalone_debug : Flag<["-"], "fno-standalone-debug">, Group<f_Group>, Flags<[CC1Option]>,
+  HelpText<"Limit debug information produced to reduce size of debug binary">;
+def flimit_debug_info : Flag<["-"], "flimit-debug-info">, Alias<fno_standalone_debug>;
+def fno_limit_debug_info : Flag<["-"], "fno-limit-debug-info">, Alias<fstandalone_debug>;
 def fstrict_aliasing : Flag<["-"], "fstrict-aliasing">, Group<f_Group>;
 def fstrict_enums : Flag<["-"], "fstrict-enums">, Group<f_Group>, Flags<[CC1Option]>,
   HelpText<"Enable optimizations based on the strict definition of an enum's "

Modified: head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h
==============================================================================
--- head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h	Wed May  7 00:32:49 2014	(r265476)
+++ head/contrib/llvm/tools/clang/include/clang/Frontend/CodeGenOptions.h	Wed May  7 00:51:24 2014	(r265477)
@@ -50,12 +50,20 @@ public:
   };
 
   enum DebugInfoKind {
-    NoDebugInfo,          // Don't generate debug info.
-    DebugLineTablesOnly,  // Emit only debug info necessary for generating
-                          // line number tables (-gline-tables-only).
-    LimitedDebugInfo,     // Limit generated debug info to reduce size
-                          // (-flimit-debug-info).
-    FullDebugInfo         // Generate complete debug info.
+    NoDebugInfo,          /// Don't generate debug info.
+
+    DebugLineTablesOnly,  /// Emit only debug info necessary for generating
+                          /// line number tables (-gline-tables-only).
+
+    LimitedDebugInfo,     /// Limit generated debug info to reduce size
+                          /// (-fno-standalone-debug). This emits
+                          /// forward decls for types that could be
+                          /// replaced with forward decls in the source
+                          /// code. For dynamic C++ classes type info
+                          /// is only emitted int the module that
+                          /// contains the classe's vtable.
+
+    FullDebugInfo         /// Generate complete debug info.
   };
 
   enum TLSModel {

Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Wed May  7 00:32:49 2014	(r265476)
+++ head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Wed May  7 00:51:24 2014	(r265477)
@@ -1456,13 +1456,13 @@ llvm::DIType CGDebugInfo::CreateType(con
   // declaration. The completeType, completeRequiredType, and completeClassData
   // callbacks will handle promoting the declaration to a definition.
   if (T ||
+      // Under -flimit-debug-info:
       (DebugKind <= CodeGenOptions::LimitedDebugInfo &&
-       // Under -flimit-debug-info, emit only a declaration unless the type is
-       // required to be complete.
-       !RD->isCompleteDefinitionRequired() && CGM.getLangOpts().CPlusPlus) ||
-      // If the class is dynamic, only emit a declaration. A definition will be
-      // emitted whenever the vtable is emitted.
-      (CXXDecl && CXXDecl->hasDefinition() && CXXDecl->isDynamicClass()) || T) {
+       // Emit only a forward declaration unless the type is required.
+       ((!RD->isCompleteDefinitionRequired() && CGM.getLangOpts().CPlusPlus) ||
+        // If the class is dynamic, only emit a declaration. A definition will be
+        // emitted whenever the vtable is emitted.
+        (CXXDecl && CXXDecl->hasDefinition() && CXXDecl->isDynamicClass())))) {
     llvm::DIDescriptor FDContext =
       getContextDescriptor(cast<Decl>(RD->getDeclContext()));
     if (!T)

Modified: head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp	Wed May  7 00:32:49 2014	(r265476)
+++ head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp	Wed May  7 00:51:24 2014	(r265477)
@@ -3002,8 +3002,8 @@ void Clang::ConstructJob(Compilation &C,
   Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls);
   Args.AddLastArg(CmdArgs, options::OPT_fformat_extensions);
   Args.AddLastArg(CmdArgs, options::OPT_fheinous_gnu_extensions);
-  Args.AddLastArg(CmdArgs, options::OPT_flimit_debug_info);
-  Args.AddLastArg(CmdArgs, options::OPT_fno_limit_debug_info);
+  Args.AddLastArg(CmdArgs, options::OPT_fstandalone_debug);
+  Args.AddLastArg(CmdArgs, options::OPT_fno_standalone_debug);
   Args.AddLastArg(CmdArgs, options::OPT_fno_operator_names);
   // AltiVec language extensions aren't relevant for assembling.
   if (!isa<PreprocessJobAction>(JA) || 

Modified: head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp
==============================================================================
--- head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp	Wed May  7 00:32:49 2014	(r265476)
+++ head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp	Wed May  7 00:51:24 2014	(r265477)
@@ -295,7 +295,8 @@ static void ParseCommentArgs(CommentOpti
 }
 
 static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
-                             DiagnosticsEngine &Diags) {
+                             DiagnosticsEngine &Diags,
+                             const TargetOptions &TargetOpts) {
   using namespace options;
   bool Success = true;
 
@@ -322,10 +323,16 @@ static bool ParseCodeGenArgs(CodeGenOpti
     Opts.setDebugInfo(CodeGenOptions::DebugLineTablesOnly);
   } else if (Args.hasArg(OPT_g_Flag) || Args.hasArg(OPT_gdwarf_2) ||
              Args.hasArg(OPT_gdwarf_3) || Args.hasArg(OPT_gdwarf_4)) {
-    if (Args.hasFlag(OPT_flimit_debug_info, OPT_fno_limit_debug_info, true))
-      Opts.setDebugInfo(CodeGenOptions::LimitedDebugInfo);
-    else
+    bool Default = false;
+    // Until dtrace (via CTF) can deal with distributed debug info,
+    // Darwin defaults to standalone/full debug info.
+    if (llvm::Triple(TargetOpts.Triple).isOSDarwin())
+      Default = true;
+
+    if (Args.hasFlag(OPT_fstandalone_debug, OPT_fno_standalone_debug, Default))
       Opts.setDebugInfo(CodeGenOptions::FullDebugInfo);
+    else
+      Opts.setDebugInfo(CodeGenOptions::LimitedDebugInfo);
   }
   Opts.DebugColumnInfo = Args.hasArg(OPT_dwarf_column_info);
   Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file);
@@ -1657,8 +1664,9 @@ bool CompilerInvocation::CreateFromArgs(
   ParseFileSystemArgs(Res.getFileSystemOpts(), *Args);
   // FIXME: We shouldn't have to pass the DashX option around here
   InputKind DashX = ParseFrontendArgs(Res.getFrontendOpts(), *Args, Diags);
-  Success = ParseCodeGenArgs(Res.getCodeGenOpts(), *Args, DashX, Diags)
-            && Success;
+  ParseTargetArgs(Res.getTargetOpts(), *Args);
+  Success = ParseCodeGenArgs(Res.getCodeGenOpts(), *Args, DashX, Diags,
+                             Res.getTargetOpts()) && Success;
   ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), *Args);
   if (DashX != IK_AST && DashX != IK_LLVM_IR) {
     ParseLangArgs(*Res.getLangOpts(), *Args, DashX, Diags);
@@ -1673,8 +1681,6 @@ bool CompilerInvocation::CreateFromArgs(
   ParsePreprocessorArgs(Res.getPreprocessorOpts(), *Args, FileMgr, Diags);
   ParsePreprocessorOutputArgs(Res.getPreprocessorOutputOpts(), *Args,
                               Res.getFrontendOpts().ProgramAction);
-  ParseTargetArgs(Res.getTargetOpts(), *Args);
-
   return Success;
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405070051.s470pOLA036694>