~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to clang/lib/Frontend/CompilerInvocation.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "llvm/Support/Host.h"
31
31
#include "llvm/Support/Path.h"
32
32
#include "llvm/Support/system_error.h"
 
33
#include <sys/stat.h>
33
34
using namespace clang;
34
35
 
35
36
//===----------------------------------------------------------------------===//
100
101
  return 0;
101
102
}
102
103
 
103
 
static bool isOptimizationLevelFast(ArgList &Args) {
104
 
  if (Arg *A = Args.getLastArg(options::OPT_O_Group))
105
 
    if (A->getOption().matches(options::OPT_Ofast))
106
 
      return true;
107
 
  return false;
108
 
}
109
 
 
110
104
static void addWarningArgs(ArgList &Args, std::vector<std::string> &Warnings) {
111
105
  for (arg_iterator I = Args.filtered_begin(OPT_W_Group),
112
106
         E = Args.filtered_end(); I != E; ++I) {
333
327
  Opts.ForbidGuardVariables = Args.hasArg(OPT_fforbid_guard_variables);
334
328
  Opts.UseRegisterSizedBitfieldAccess = Args.hasArg(
335
329
    OPT_fuse_register_sized_bitfield_access);
336
 
  Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing) ||
337
 
    isOptimizationLevelFast(Args);
 
330
  Opts.RelaxedAliasing = Args.hasArg(OPT_relaxed_aliasing);
338
331
  Opts.StructPathTBAA = Args.hasArg(OPT_struct_path_tbaa);
339
332
  Opts.DwarfDebugFlags = Args.getLastArgValue(OPT_dwarf_debug_flags);
340
333
  Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
576
569
  Opts.VerifyDiagnostics = Args.hasArg(OPT_verify);
577
570
  Opts.ElideType = !Args.hasArg(OPT_fno_elide_type);
578
571
  Opts.ShowTemplateTree = Args.hasArg(OPT_fdiagnostics_show_template_tree);
579
 
  Opts.WarnOnSpellCheck = Args.hasArg(OPT_fwarn_on_spellcheck);
580
572
  Opts.ErrorLimit = Args.getLastArgIntValue(OPT_ferror_limit, 0, Diags);
581
573
  Opts.MacroBacktraceLimit
582
574
    = Args.getLastArgIntValue(OPT_fmacro_backtrace_limit,
1260
1252
                                                    Diags);
1261
1253
  Opts.ConstexprCallDepth = Args.getLastArgIntValue(OPT_fconstexpr_depth, 512,
1262
1254
                                                    Diags);
 
1255
  Opts.ConstexprStepLimit = Args.getLastArgIntValue(OPT_fconstexpr_steps,
 
1256
                                                    1048576, Diags);
1263
1257
  Opts.BracketDepth = Args.getLastArgIntValue(OPT_fbracket_depth, 256, Diags);
1264
1258
  Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing);
1265
1259
  Opts.NumLargeByValueCopy = Args.getLastArgIntValue(OPT_Wlarge_by_value_copy_EQ,
1313
1307
  // inlining enabled.
1314
1308
  Opts.NoInlineDefine = !Opt || Args.hasArg(OPT_fno_inline);
1315
1309
 
1316
 
  Opts.FastMath = Args.hasArg(OPT_ffast_math) ||
1317
 
    isOptimizationLevelFast(Args);
 
1310
  Opts.FastMath = Args.hasArg(OPT_ffast_math);
1318
1311
  Opts.FiniteMathOnly = Args.hasArg(OPT_ffinite_math_only);
1319
1312
 
1320
1313
  Opts.RetainCommentsFromSystemHeaders =
1697
1690
                      hsOpts.UseStandardCXXIncludes,
1698
1691
                      hsOpts.UseLibcxx);
1699
1692
 
1700
 
  // Darwin-specific hack: if we have a sysroot, use the contents of
 
1693
  // Darwin-specific hack: if we have a sysroot, use the contents and
 
1694
  // modification time of
1701
1695
  //   $sysroot/System/Library/CoreServices/SystemVersion.plist
1702
1696
  // as part of the module hash.
1703
1697
  if (!hsOpts.Sysroot.empty()) {
1710
1704
    llvm::sys::path::append(systemVersionFile, "SystemVersion.plist");
1711
1705
    if (!llvm::MemoryBuffer::getFile(systemVersionFile, buffer)) {
1712
1706
      code = hash_combine(code, buffer.get()->getBuffer());
 
1707
 
 
1708
      struct stat statBuf;
 
1709
      if (stat(systemVersionFile.c_str(), &statBuf) == 0)
 
1710
        code = hash_combine(code, statBuf.st_mtime);
1713
1711
    }
1714
1712
  }
1715
1713