Commit Graph

160060 Commits

Author SHA1 Message Date
Silviu Baranga e5690463e2 Set the default hardware division features for ARM cpus. Also set it as default for A32 armv8.
llvm-svn: 193075
2013-10-21 10:59:33 +00:00
Silviu Baranga f9671dd09d Add the __ARM_ARCH_EXT_IDIV__ predefine. It is set to 1 if we have hardware divide in the mode that we are compiling in (depending on the target features), not defined if we don't. Should be compatible with the GCC conterpart. Also adding a -hwdiv option to overide the default behavior.
llvm-svn: 193074
2013-10-21 10:54:53 +00:00
Serge Pavlov 6652921d5a Fix to PR8880 (clang dies processing a for loop).
Due to statement expressions supported as GCC extension, it is possible
to put 'break' or 'continue' into a loop/switch statement but outside its
body, for example:

    for ( ; ({ if (first) { first = 0; continue; } 0; }); )

Such usage must be diagnosed as an error, GCC rejects it. To recognize
this and similar patterns the flags BreakScope and ContinueScope are
temporarily turned off while parsing condition expression.

Differential Revision: http://llvm-reviews.chandlerc.com/D1762

llvm-svn: 193073
2013-10-21 09:34:44 +00:00
Kostya Serebryany b773785a59 [asan] count the size of QuarantineBatch in the total Quarantine size; make QuarantineBatch fit into 8K, fix a MSVC compile warning
llvm-svn: 193072
2013-10-21 08:36:10 +00:00
Manuel Klimek 88033d7a97 Fixes PR17617: Crash on joining short if statements.
Now that we iterate on the formatting multiple times when we
have chains of preprocessor branches, we need to correctly reset
the token's previous and next pointer for the first / last token.

llvm-svn: 193071
2013-10-21 08:11:15 +00:00
Dmitry Vyukov 1e995d4f3e tsan: fix strerror interceptor (eliminate false positives)
llvm-svn: 193070
2013-10-21 07:40:19 +00:00
Daniel Jasper ac42b75195 Expose -fmodule-name and -fmodule-map-file as driver options.
Review: http://llvm-reviews.chandlerc.com/D1974
llvm-svn: 193069
2013-10-21 06:34:34 +00:00
Michael Gottesman 63c63ac21e Fix the predecessor removal logic in r193045.
Additionally some small comment/stylistic fixes are included as well.

llvm-svn: 193068
2013-10-21 05:20:11 +00:00
Justin Bogner 5353513058 Lex: Don't restrict legal UCNs when preprocessing assembly
The C and C++ standards disallow using universal character names to
refer to some characters, such as basic ascii and control characters,
so we reject these sequences in the lexer. However, when the
preprocessor isn't being used on C or C++, it doesn't make sense to
apply these restrictions.

Notably, accepting these characters avoids issues with unicode escapes
when GHC uses the compiler as a preprocessor on haskell sources.

Fixes rdar://problem/14742289

llvm-svn: 193067
2013-10-21 05:02:28 +00:00
Richard Smith 1483143e7a Avoid using the name 'bzero' for an enumerator in global scope. <strings.h> might declare this as a function.
llvm-svn: 193066
2013-10-21 04:59:37 +00:00
David Majnemer 67900f0c63 [-fms-extensions] __is_interface_class was miscategorized
We claimed that the __is_interface_class keyword was KEYCXX even though
the __interface keyword was KEYMS.

llvm-svn: 193065
2013-10-21 04:55:56 +00:00
Bill Wendling 90dd90afcb Don't eliminate a partially redundant load if it's in a landing pad.
A landing pad can be jumped to only by the unwind edge of an invoke
instruction. If we eliminate a partially redundant load in a landing pad, it
will create a basic block that violates this constraint. It then leads to other
problems down the line if it tries to merge that basic block with the landing
pad. Avoid this by not eliminating the load in a landing pad.

PR17621

llvm-svn: 193064
2013-10-21 04:09:17 +00:00
Nick Lewycky f8c68da7a9 Fix typo in test's XFAIL line. Patch by Dimitry Andric!
llvm-svn: 193063
2013-10-21 00:46:21 +00:00
David Majnemer 2b2512141f Sema: Explain our deviation from the standard by referencing the, now open, LWG issue.
llvm-svn: 193062
2013-10-21 00:25:32 +00:00
David Majnemer e29296e48c Be more precise when diagnosing 'inline' on global replacement functions
llvm-svn: 193061
2013-10-21 00:22:03 +00:00
Peter Collingbourne 90a0876ae7 Runtime support for the indirect function call checker.
Differential Revision: http://llvm-reviews.chandlerc.com/D1339

llvm-svn: 193060
2013-10-20 21:29:46 +00:00
Peter Collingbourne b714e7e12a [ubsan] Introduce %clangxx substitution for all C++ tests.
llvm-svn: 193059
2013-10-20 21:29:32 +00:00
Peter Collingbourne b453cd64a7 Implement function type checker for the undefined behavior sanitizer.
This uses function prefix data to store function type information at the
function pointer.

Differential Revision: http://llvm-reviews.chandlerc.com/D1338

llvm-svn: 193058
2013-10-20 21:29:19 +00:00
Peter Collingbourne f7ef3fd810 Revert r193022 and r193048. They broke the ubsan test suite.
llvm-svn: 193057
2013-10-20 21:29:13 +00:00
Alp Toker e11bd86a98 Switch attribute test line endings from CRLF
The convention is LF unless specifically testing line endings.

llvm-svn: 193056
2013-10-20 19:04:19 +00:00
Alp Toker 67b47ac0a7 Fix crash in cleanup attr handling
ResolveSingleFunctionTemplateSpecialization() returns 0 and doesn't emit diags
unless the expression has template-ids, so we must null check the result.

Also add a better diag noting which overloads are causing the problem.

Reviewed by Aaron Ballman.

llvm-svn: 193055
2013-10-20 18:48:56 +00:00
Daniel Jasper d46e07e26e clang-format: Better understand Lambda poarameters.
Before:
  auto PointerBinding = [](const char * S) {};

After:
  auto PointerBinding = [](const char *S) {};

This fixes llvm.org/PR17618.

llvm-svn: 193054
2013-10-20 18:15:30 +00:00
Joerg Sonnenberger e77b0424fd Fix python-free build.
llvm-svn: 193053
2013-10-20 17:36:05 +00:00
Joerg Sonnenberger c5e53bd14a Make sure switch covers all values.
llvm-svn: 193052
2013-10-20 17:35:46 +00:00
Daniel Jasper dcd5da1fd9 clang-format: Fix formatting of nested blocks after comment.
Before:
  DEBUG({ // Comment that used to confuse clang-format.
  fdafas();
  });
Before:
  DEBUG({ // Comments are now fine.
    fdafas();
  });

This fixed llvm.org/PR17619.

llvm-svn: 193051
2013-10-20 17:28:32 +00:00
Daniel Jasper 2d0cd49787 clang-format: Support case ranges.
Before (note the missing space before "..." which can lead to compile
errors):
  switch (x) {
    case 'A'... 'Z':
    case 1... 5:
        break;
  }

After:
  switch (x) {
    case 'A' ... 'Z':
    case 1 ... 5:
        break;
  }

llvm-svn: 193050
2013-10-20 16:56:16 +00:00
Daniel Jasper d489dd342b clang-format: Improve formatting of ObjC dict literals.
Before:
  NSDictionary *d = @{ @"nam" : NSUserNam(), @"dte" : [NSDate date],
                       @"processInfo" : [NSProcessInfo processInfo]
  };

After:
  NSDictionary *d = @{
    @"nam" : NSUserNam(),
    @"dte" : [NSDate date],
    @"processInfo" : [NSProcessInfo processInfo]
  };

llvm-svn: 193049
2013-10-20 16:45:46 +00:00
Benjamin Kramer 80b5a9d2d0 Driver: libubsan_cxx depends on libubsan. Preserve the topological ordering, some linkers depend on it.
llvm-svn: 193048
2013-10-20 12:34:18 +00:00
Benjamin Kramer 1d5d634c82 Forgot some references to misspelled enums.
llvm-svn: 193047
2013-10-20 11:53:20 +00:00
Benjamin Kramer 2501f14197 Miscellaneous speling fixes.
llvm-svn: 193046
2013-10-20 11:47:15 +00:00
Michael Gottesman c024f3258a Teach simplify-cfg how to correctly create covered lookup tables for switches on iN with N >= 3.
One optimization simplify-cfg performs is the converting of switches to
lookup tables if the switch has > 4 cases. This is done by:

1. Finding the max/min case value and calculating the switch case range.
2. Create a lookup table basic block.
3. Perform a check in the switch's BB to see if the input value is in
the switch's case range. If the input value satisfies said predicate
branch to the lookup table BB, otherwise branch to the switch's default
destination BB using the default value as the result.

The conditional check consists of subtracting the min case value of the
table from any input iN value and then ensuring that said value is
unsigned less than the size of the lookup table represented as an iN
value.

If the lookup table is a covered lookup table, the size of the table will be N
which is 0 as an iN value. Thus the comparison will be an `icmp ult` of an iN
value against 0 which is always false yielding the incorrect result.

This patch fixes this problem by recognizing if we have a covered lookup table
and if we do, unconditionally jumps to the lookup table BB since the covering
property of the lookup table implies no input values could not be handled by
said BB.

rdar://15268442

llvm-svn: 193045
2013-10-20 07:04:37 +00:00
David Majnemer ad51f1bc70 Sema: Diagnose global replacement functions declared as inline
This fixes PR17591.

N.B. This actually goes beyond what the standard mandates by requiring
the restriction to hold for declarations instead of definitions.  This
is believed to be a defect in the standard and an LWG issue has been
submitted.

llvm-svn: 193044
2013-10-20 05:40:29 +00:00
Peter Collingbourne a5906f06aa Typo.
llvm-svn: 193043
2013-10-20 03:19:25 +00:00
Peter Collingbourne e9f45e25f9 Emit prefix data after debug and EH directives.
This ensures that the prefix data is treated as part of the function for
the purpose of debug info.  This provides a better debugging experience,
among other things by allowing a debug info client to correctly look up
a function in debug info given a function pointer.

llvm-svn: 193042
2013-10-20 02:16:21 +00:00
Peter Collingbourne 588009e484 Emit DWARF line entries for all data in the instruction stream.
r182712 attempted to do this, but it failed to handle data emitted via
EmitBytes.

llvm-svn: 193041
2013-10-20 02:16:18 +00:00
Rafael Espindola ed452a0629 Add a missing getMostRecentDecl to ClassTemplateDecl.
llvm-svn: 193040
2013-10-19 21:06:31 +00:00
Rafael Espindola 7b56f6c3c2 Simplify some implementations of get*Decl.
* NamedDecl and CXXMethodDecl were missing getMostRecentDecl.
* The const version can just forward to the non const.
* getMostRecentDecl can use cast instead of cast_or_null.

This then removes some casts from the callers.

llvm-svn: 193039
2013-10-19 16:55:03 +00:00
Benjamin Kramer 6ddca57327 Remove unused variable.
llvm-svn: 193038
2013-10-19 16:32:15 +00:00
Rafael Espindola bfd5dea2d9 This should use the possessive adjective.
Thanks to David Blaikie for noticing it.

llvm-svn: 193037
2013-10-19 16:14:07 +00:00
Rafael Espindola f8c4f371d9 Comment improvement.
Thanks to Sean Silva for the suggestion.

llvm-svn: 193036
2013-10-19 13:08:51 +00:00
Bill Wendling 4fea22c63b Perform an intelligent splice of the predecessor with the single successor.
If the predecessor's being spliced into a landing pad, then we need the PHIs to
come first and the rest of the predecessor's code to come *after* the landing
pad instruction.

llvm-svn: 193035
2013-10-19 11:27:12 +00:00
Yaron Keren c98028896d Avoid duplicate search by reusing the iterator.
llvm-svn: 193034
2013-10-19 09:04:26 +00:00
Yaron Keren fb95582bf1 Added comments from Andrew Kaylor.
llvm-svn: 193033
2013-10-19 09:03:20 +00:00
Bill Wendling 83da4dae3d Add irreader to the component list, because ParseIR is called.
llvm-svn: 193032
2013-10-19 08:33:11 +00:00
Yaron Keren 9ea4ea56d1 Remove NDBEUG from all release types compile flags.
llvm-svn: 193031
2013-10-19 07:30:37 +00:00
Rui Ueyama 9b759d9fa2 Simplify WinLinkDriver. No functionality change.
llvm-svn: 193030
2013-10-19 03:34:00 +00:00
Rui Ueyama 46bf8286db Fix bug that CompareAtoms::compare is not transitive.
This patch fixes a bug in r190608. The results of a comparison function
passed to std::sort must be transitive, which is, if a < b and b < c, and if
a != b, a < c must be also true. CompareAtoms::compare did not actually
guarantee the transitivity. As a result the sort results were sometimes just
wrong.

Consider there are three atoms, X, Y, and Z, whose file ordinals are 1, 2, 3,
respectively. Z has a property "layout-after X". In this case, all the
following conditionals become true:

  X < Y because X's ordinal is less than Y's
  Y < Z because Y's ordinal is less than Z's
  Z < X because of the layout-after relationship

This is not of course transitive. The reason why this happened is because
we used follow-on relationships for comparison if two atoms falls in the same
follow-on chain, but we used each atom's properties if they did not. This patch
fixes the issue by using follow-on root atoms for comparison to get consistent
results.

Differential Revision: http://llvm-reviews.chandlerc.com/D1980

llvm-svn: 193029
2013-10-19 03:18:18 +00:00
Rafael Espindola cb444fe739 Reduce indentation with an early exit.
llvm-svn: 193028
2013-10-19 02:28:17 +00:00
Rafael Espindola 3f9e4442c8 Add isFirstDecl to DecBase too and use it instead of getPreviousDecl() == 0.
Redeclarable already had a isFirstDecl, but it was missing from DeclBase.

llvm-svn: 193027
2013-10-19 02:13:21 +00:00
Rafael Espindola 0d3da83c12 Fix typo.
llvm-svn: 193026
2013-10-19 02:06:23 +00:00