Commit Graph

56322 Commits

Author SHA1 Message Date
Nathan Sidwell c116802ef3 PR 20146
reject CV void return type on C definitions per 6.9.1/3

llvm-svn: 226178
2015-01-15 16:45:53 +00:00
Chandler Carruth a9711a9aa4 [PM] Track an LLVM API update which separates the TargetLibraryInfo
object from the pass that provides access to it.

We should probably refactor the createTLI code here in Clang in light of
the new structure, but I wanted this patch to be a minimal one that just
patches the behavior back together.

llvm-svn: 226158
2015-01-15 10:42:26 +00:00
David Majnemer 10fd83d11f AST: alignof might be dependent because of alignment attributes
Dependent alignment attributes should make an alignof expression
dependent as well.

llvm-svn: 226156
2015-01-15 10:04:14 +00:00
NAKAMURA Takumi 3a1e1a5424 [CMake] clangCodeGen: Prune a redundant "Target" out of libdeps. It is supplied by Analysis.
llvm-svn: 226152
2015-01-15 08:51:01 +00:00
David Majnemer f8637360e2 AST: Ensure implicit records have default visibility
Types composed with certain implicit record types would have their RTTI
marked as hidden because the implicit record type didn't have any
visibility.

This manifests itself as triggering false positives from tools like
clang's -fsantize=function feature.  The RTTI for a function type's
return type wouldn't match if the return type was an implicit record
type.

Patch by Stephan Bergmann!

llvm-svn: 226148
2015-01-15 08:41:25 +00:00
NAKAMURA Takumi 98501ea07a [CMake] Update libdeps on clangCodeGen, corresponding to r226079.
llvm-svn: 226142
2015-01-15 07:28:53 +00:00
Simon Atanasyan e6694eb245 [Mips] Define macros `__mips_isa_rev` in case of mips32r6/mips64r6 options
llvm-svn: 226136
2015-01-15 07:04:48 +00:00
David Majnemer 8e1a913cfa Sema: Recover when a function template is in an extern "C" block
llvm-svn: 226135
2015-01-15 07:04:38 +00:00
Nico Weber 8afb37e1a1 Remove unused parameter, followup to r179639. No behavior change.
llvm-svn: 226128
2015-01-15 06:00:15 +00:00
Nico Weber b6a5d05a8a Remove ASTConsumer::HandleVTable()'s bool parameter.
Sema calls HandleVTable() with a bool parameter which is then threaded through
three layers.  The only effect of this bool is an early return at the last
layer.

Instead, remove this parameter and call HandleVTable() only if the bool is
true.  No intended behavior change.

llvm-svn: 226096
2015-01-15 04:07:35 +00:00
Richard Smith 6eece29d8f PR13699: Include friend declarations in code completion results if they had a
prior visible declaration. Prefer to take template parameter names from the
first declaration.

Testcase from a patch by Francisco Lopes!

llvm-svn: 226083
2015-01-15 02:27:20 +00:00
Chandler Carruth 418bd1ab30 [PM] Update for LLVM r226078 which moved TargetLibraryInfo to the
Analysis library.

llvm-svn: 226079
2015-01-15 02:16:55 +00:00
Richard Smith 64e033f9c4 Fix crash-on-invalid and name lookup when recovering from ~X::X() typo.
llvm-svn: 226067
2015-01-15 00:48:52 +00:00
Duncan P. N. Exon Smith 8d3ef611ce IR: Move MDLocation into place (clang testcases)
Update testcases to match LLVM change in r226048.

llvm-svn: 226049
2015-01-14 22:28:03 +00:00
Steven Wu 76c508bc9a Revert "More robust deployment target parsing on darwin"
This breaks green-dragon. Revert it and investigate.

llvm-svn: 226011
2015-01-14 18:22:29 +00:00
Hans Wennborg fb8b408ba0 docs/conf.py: update for 3.7
llvm-svn: 226010
2015-01-14 18:14:05 +00:00
Hans Wennborg 0a7ec77ee0 ReleaseNotes.rst: update to 3.7
The 3.6 release notes are in the 3.6 branch.

llvm-svn: 226009
2015-01-14 18:14:03 +00:00
Hans Wennborg a38fb96796 Update cxx_dr_status.html after 3.6 branch
llvm-svn: 226008
2015-01-14 18:14:00 +00:00
Steven Wu faf31e7cc5 More robust deployment target parsing on darwin
Summary:
This is a more robust way of figuring out implicit deployment target
from isysroot. It also handles iphone simulator target.

Reviewers: bob.wilson, t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, cfe-commits

Differential Revision: http://reviews.llvm.org/D6939

llvm-svn: 226005
2015-01-14 18:01:27 +00:00
Daniel Jasper 1cd3c71c01 clang-format: Disable flag for Google's Java and Javascript styles.
Disable AlwaysBreakBeforeMultilineString, as the style guides don't
really say to do so.

llvm-svn: 225982
2015-01-14 12:24:59 +00:00
Daniel Sanders 998c910262 [mips] Handle transparent unions correctly.
Summary:
This fixes MultiSource/Applications/lemon on big-endian N32 by correcting the
handling of the argument to wait(). glibc defines it as a transparent union of
void* and int*. Such unions are passed according to the rules of the first
member so the argument must be passed as if it were a void* (sign extended from
i32 to i64) and not as a union (shifted to the upper bits of an i64).

wait() already behaves correctly on big-endian O32 and N64 since the union is
already the same size as an argument slot.

Reviewers: atanasyan

Reviewed By: atanasyan

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6963

llvm-svn: 225981
2015-01-14 12:00:12 +00:00
Chandler Carruth 0d9593ddec [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.py
Sorry for the noise, I managed to miss a bunch of recent regressions of
include orderings here. This should actually sort all the includes for
Clang. Again, no functionality changed, this is just a mechanical
cleanup that I try to run periodically to keep the #include lines as
regular as possible across the project.

llvm-svn: 225979
2015-01-14 11:29:14 +00:00
Chandler Carruth 575bc3ba62 [cleanup] Re-sort the #include lines using llvm/utils/sort_includes.py
No functionality changed, this is a purely mechanical cleanup to ensure
the #include order remains consistent across the project.

llvm-svn: 225975
2015-01-14 11:23:58 +00:00
Daniel Jasper e189d46512 clang-format: [Java] Support try blocks with resources.
Before:
  try
    (SomeResource rs = someFunction()) {
      Something();
    }

After:
  try (SomeResource rs = someFunction()) {
    Something();
  }

llvm-svn: 225973
2015-01-14 10:48:41 +00:00
Daniel Jasper 190fbda6de clang-format: [Java] Prefer not to break in parameter annotations.
Before:
  boolean someFunction(@Param(aaaaaaaaaaaaaaaa)
                       String aaaaa,
      String bbbbbbbbbbbbbbb) {}

After:
  boolean someFunction(
      @Param(aaaaaaaaaaaaaaaa) String aaaaa,
      String bbbbbbbbbbbbbbb) {}

llvm-svn: 225971
2015-01-14 10:36:31 +00:00
Daniel Jasper 16dbe0bc44 clang-format: [Java] Understand "import static".
llvm-svn: 225965
2015-01-14 10:02:49 +00:00
Daniel Jasper 404658aede clang-format: [Java] Don't let annotations confuse return type analysis.
Before:
  @Test
  ReturnType
  doSomething(String aaaaaaaaaaaaa, String bbbbbbbbbbbbbbb) {}

After:
  @Test
  ReturnType doSomething(
      String aaaaaaaaaaaaa, String bbbbbbbbbbbbbbb) {}

llvm-svn: 225964
2015-01-14 10:00:20 +00:00
Daniel Jasper 3e1bd1407b clang-format: [Java] Don't line-wrap before annotations' l_parens.
Before:
  @SomeAnnotation
  (aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa)
  int i;

After:
  @SomeAnnotation(
      aaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaa)
  int i;

llvm-svn: 225963
2015-01-14 09:51:32 +00:00
Daniel Jasper a831c58e53 clang-format: [Java] Don't get confused by leading annotations.
Before:
  @Test(a)
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = aaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      aaaaaaaaaaaaaaaaaaaaaaa);

After:
  @Test(a)
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =
      aaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 225962
2015-01-14 09:47:57 +00:00
Brad Smith 0ebb309e47 The assembler is now enabled by default.
llvm-svn: 225961
2015-01-14 08:23:49 +00:00
David Majnemer d1091e5e34 Sema: It's cheaper to ask LookupResult::empty than to calculate linkage
llvm-svn: 225960
2015-01-14 08:08:52 +00:00
Brad Smith b7c9aff1bb Use the integrated assembler by default on 32-bit PowerPC and SPARC.
llvm-svn: 225958
2015-01-14 07:55:36 +00:00
David Blaikie 66e4197f07 Reapply r225000 (reverted in r225555): DebugInfo: Generalize debug info location handling (and follow-up commits).
Several pieces of code were relying on implicit debug location setting
which usually lead to incorrect line information anyway. So I've fixed
those (in r225955 and r225845) separately which should pave the way for
this commit to be cleanly reapplied.

The reason these implicit dependencies resulted in crashes with this
patch is that the debug location would no longer implicitly leak from
one place to another, but be set back to invalid. Once a call with
no/invalid location was emitted, if that call was ever inlined it could
produce invalid debugloc chains and assert during LLVM's codegen.

There may be further cases of such bugs in this patch - they're hard to
flush out with regression testing, so I'll keep an eye out for reports
and investigate/fix them ASAP if they come up.

Original commit message:

Reapply "DebugInfo: Generalize debug info location handling"

Originally committed in r224385 and reverted in r224441 due to concerns
this change might've introduced a crash. Turns out this change fixes the
crash introduced by one of my earlier more specific location handling
changes (those specific fixes are reverted by this patch, in favor of
the more general solution).

Recommitted in r224941 and reverted in r224970 after it caused a crash
when building compiler-rt. Looks to be due to this change zeroing out
the debug location when emitting default arguments (which were meant to
inherit their outer expression's location) thus creating call
instructions without locations - these create problems for inlining and
must not be created. That is fixed and tested in this version of the
change.

Original commit message:

This is a more scalable (fixed in mostly one place, rather than many
places that will need constant improvement/maintenance) solution to
several commits I've made recently to increase source fidelity for
subexpressions.

This resetting had to be done at the DebugLoc level (not the
SourceLocation level) to preserve scoping information (if the resetting
was done with CGDebugInfo::EmitLocation, it would've caused the tail end
of an expression's codegen to end up in a potentially different scope
than the start, even though it was at the same source location). The
drawback to this is that it might leave CGDebugInfo out of sync. Ideally
CGDebugInfo shouldn't have a duplicate sense of the current
SourceLocation, but for now it seems it does... - I don't think I'm
going to tackle removing that just now.

I expect this'll probably cause some more buildbot fallout & I'll
investigate that as it comes up.

Also these sort of improvements might be starting to show a weakness/bug
in LLVM's line table handling: we don't correctly emit is_stmt for
statements, we just put it on every line table entry. This means one
statement split over multiple lines appears as multiple 'statements' and
two statements on one line (without column info) are treated as one
statement.

I don't think we have any IR representation of statements that would
help us distinguish these cases and identify the beginning of each
statement - so that might be something we need to add (possibly to the
lexical scope chain - a scope for each statement). This does cause some
problems for GDB and possibly other DWARF consumers.

llvm-svn: 225956
2015-01-14 07:38:27 +00:00
David Blaikie 47d28e07c1 DebugInof: Correct the location of exception cleanups in global ctors/dtors and ObjC methods
Without setting the CurEHLocation these cleanups would be attributed to
whatever the last active debug line location was (the 'fn' call in the
included test cases). By setting CurEHLocation correctly the line
information is improved/corrected.

This quality bug turned into a crasher with r225000 when, instead of
allowing the last location to persist, it would be zero'd out. This
could lead to a function call (such as the dtor) being made without a
debug location - if that call was subsequently inlined (and the caller
and callee had debug info, just not the call instruction) the inliner
would violate important constraints about the debug location chains by
not updating the inlined instructions to chain up to the callee
locations.

So, by fixing this bug, I am addressing the assertion failures
introduced by r225000 and should be able to recommit that patch with
impunity...

llvm-svn: 225955
2015-01-14 07:10:46 +00:00
JF Bastien c7af264486 Revert "Insert random noops to increase security against ROP attacks (clang)"
This reverts commit:
http://reviews.llvm.org/D3393

llvm-svn: 225947
2015-01-14 05:24:11 +00:00
David Majnemer b5d2d45c5c Sema: Relax parsing of '#' in constraints
llvm-svn: 225942
2015-01-14 05:11:09 +00:00
David Majnemer ce12ed20c6 Sema: Check type compatibility with the most recent decl when merging
We would check the type information from the declaration found by lookup
but we would neglect checking compatibility with the most recent
declaration.  This would make it possible for us to not correctly
diagnose inconsistencies with declarations which were made in a
different scope.

llvm-svn: 225934
2015-01-14 02:27:38 +00:00
Adam Nemet 63a951eb1c [AVX512] Add FP unpack intrinsics
These are implemented with __builtin_shufflevector just like AVX.

We have some tests on the LLVM side to assert that these shufflevectors do
indeed generate the corresponding unpck instruction.

Part of <rdar://problem/17688758>

llvm-svn: 225922
2015-01-14 01:31:17 +00:00
JF Bastien 4cb557039d Insert random noops to increase security against ROP attacks (clang)
A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks.

Command line options:
  -noop-insertion // Enable noop insertion.
  -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion)
  -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions.

In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future).
  -fdiversify

This is the clang part of the patch.
llvm part: D3392

http://reviews.llvm.org/D3393
Patch by Stephen Crane (@rinon)

llvm-svn: 225910
2015-01-14 01:07:51 +00:00
Alexey Samsonov 7af6af4225 Update HelpText for -fsanitize= option.
There are too many available sanitizers now - redirect to
user manual instead of listing them all.

llvm-svn: 225894
2015-01-14 00:51:17 +00:00
Eric Christopher 2b8ef99aa8 Update for move in llvm.
llvm-svn: 225892
2015-01-14 00:50:32 +00:00
Richard Smith 43d3f55072 Look through sugar when determining whether a type is a scoped enumeration
type. Patch by Stephan Bergmann!

llvm-svn: 225889
2015-01-14 00:33:10 +00:00
David Majnemer a3b04cea04 Sema: An extern declaration can't be a redeclaration of a parameter
In the following:
void f(int x) { extern int x; }

The second declaration of 'x' shouldn't be considered a redeclaration of
the parameter.

This is a different approach to r225780.

llvm-svn: 225875
2015-01-14 00:31:13 +00:00
David Blaikie f142580dea Sink a parameter into the callee since it's always the same expression in terms of another parameter
llvm-svn: 225856
2015-01-14 00:04:42 +00:00
David Blaikie 1ae04916cc DebugInfo: Correct the location of EH cleanup for blocks
This was previously piggybacking on whatever happened to be the last
location set on CGDebugInfo/DIBuilder, which was wrong (it was often the
current location, such as the 'fn()' call site, not the end of the
block). With my improvements to set/unset the location in a scoped
manner (r225000) this went from a bad quality situation, to a crash.
Fixing this goes part-way to unblocking the recommit of r225000.

It's likely that any call to CodeGenFunction::StartFunction without the
CurEHLocation set represents a similar bug or risk of a bug. Perhaps
there are some callers that know they won't generate EH cleanups, but
I'm not sure.

I considered a generic catch-fix in StartFunction (just fallback to the
GlobalDecl's location) but that seemed like it'd mask bugs where the EH
location shouldn't be the same as the decl's location (& indeed by not
using that stop-gap I found this bug). We'll see how long I can hold out
on the generic catch-all. I might eventually be able to add an assertion
in.

llvm-svn: 225845
2015-01-13 23:06:27 +00:00
Nico Weber ed50166b6b clang-format: [Java] Detect `native` keyword.
Before:
  public native<X> Foo foo();

After:
  public native <X> Foo foo();

llvm-svn: 225839
2015-01-13 22:32:50 +00:00
Ben Langmuir c67a774e17 Add [extern_c] attribute to _Builtin_intrinsics module
This allows users to import this module inside an extern "C" {} block.

llvm-svn: 225835
2015-01-13 21:54:32 +00:00
Roman Divacky ed94e2f455 Mention FreeBSD support.
llvm-svn: 225834
2015-01-13 21:31:03 +00:00
Paul Robinson 080b1f3055 When attribute 'optnone' appears on the same declaration with a
conflicting attribute, warn about the conflict and pick a "winning"
attribute to preserve, instead of emitting an error.  This matches the
behavior when the conflicting attributes are on different declarations.

Along the way I discovered that conflicts involving __forceinline were
reported as 'always_inline' (alternate spelling, same attribute) so
fixed that up to report the attribute as spelled in the source.

llvm-svn: 225813
2015-01-13 18:34:56 +00:00
Ben Langmuir c1d88ea5a7 Inherit attributes when infering a framework module
If a module map contains
framework module * [extern_c] {}

We will now infer [extern_c] on the inferred framework modules (we
already inferred [system] as a special case).

llvm-svn: 225803
2015-01-13 17:47:44 +00:00