Commit Graph

34378 Commits

Author SHA1 Message Date
Reid Kleckner 588c937228 Use llvm::DeleteContainerSeconds when possible
llvm-svn: 201739
2014-02-19 23:44:52 +00:00
Chandler Carruth 7ce956ded4 Fix two pedantic issues with our builtin headers. The __STDC_VERSION__
for C99 is '199901L' and we shouldn't be comparing it with anything
else.

Neither of these should have had any impact in practice.

llvm-svn: 201738
2014-02-19 23:38:18 +00:00
Warren Hunt 40d6f29ad8 Add _mm_prefetch and some others as MS builtins
This patch adds several built-ins that are required for ms 
compatibility. _mm_prefetch must be a built-in because it takes a 
compile-time constant argument and our prior approach of using a #define 
to the current built-in doesn't work in the presence of re-declaration 
of _mm_prefetch. The others can be obtained by including the windows 
system headers. If a user includes the windows system headers but not 
intrin.h they still need to work and therefore must be built-in because 
we don't get a chance to implement them in intrin.h in this case.

llvm-svn: 201734
2014-02-19 23:20:20 +00:00
Richard Smith 294e59a33b Remove a broken attempt to cope with someone #undef'ing __has_include_next.
This was broken because __has_include_next(...) would not be valid in a
preprocessor condition if __has_include_next is not defined.

llvm-svn: 201731
2014-02-19 22:53:42 +00:00
Joerg Sonnenberger ed3f0693cb Hook up NetBSD/sparc and NetBSD/sparc64 as and ld invocations.
llvm-svn: 201730
2014-02-19 22:40:18 +00:00
Chandler Carruth e813984b43 Teach Clang to provide ::max_align_t in C11 and C++11 modes.
This definition is not chosen idly. There is an unfortunate reality with
max_align_t -- the specific nature of its definition leaks into the ABI
almost immediately. Because it is part of C11 and C++11 it becomes
essential for it to match with other systems on that ABI. There is an
effort to discourage any further use of this construct as a consequence
-- using max_align_t introduces an immediate ABI problem. We can never
update it to have larger alignment even as the microarchitecture changes
to necessitate higher alignment. =/

The particular definition here exactly matches the ABI of GCC's chosen
::max_align_t definition, for better or worse. This was written with the
help of Richard Smith who was decoding the exact ABI implications of the
selected definition in GCC. Notably, in-register arguments are impacted
by the particular definition chosen. =/

No one is under the illusion that this is a "good" or "useful"
definition of max_align_t, and we are working with the standards
committee to specify a more useful interface to address this need.

llvm-svn: 201729
2014-02-19 22:35:01 +00:00
Joerg Sonnenberger bcee91805e GC now unused variable.
llvm-svn: 201728
2014-02-19 22:17:01 +00:00
Joerg Sonnenberger 25e1817787 Use a switch for the architecture specific logic in
netbsd::Assemble::ConstructJob.

llvm-svn: 201725
2014-02-19 22:16:19 +00:00
Reid Kleckner 6701de2abe MS ABI: Let non-virtual method overloads participate in vftable ordering
In the Microsoft ABI, the vftable is laid out as if all methods in every
overload set were declared in reverse order of declaration at the point
of declaration of the first overload in the set.

Previously we only considered virtual methods in an overload set, but
MSVC includes non-virtual methods for ordering purposes.

Fixes PR18902.

llvm-svn: 201722
2014-02-19 22:06:10 +00:00
Reid Kleckner c688dafe31 clang-cl: Pass /Z7 when we fallback to cl with debug info enabled
Clang itself only emits CodeView line tables, so it seems more
consistent to ask cl.exe for the same format.

llvm-svn: 201721
2014-02-19 22:05:59 +00:00
Joerg Sonnenberger c151b024dc Refactor -KPIC handling for as invocation.
llvm-svn: 201719
2014-02-19 21:58:52 +00:00
Yunzhong Gao e3f902c32a Only print the selected multilib when something is actually found on the host.
llvm-svn: 201709
2014-02-19 19:06:58 +00:00
Jordan Rose 94008121fa [analyzer] Extend IdenticalExprChecker to check logical and bitwise expressions.
IdenticalExprChecker now warns if any expressions in a logical or bitwise
chain (&&, ||, &, |, or ^) are the same. Unlike the previous patch, this
actually checks all subexpressions against each other (an O(N^2) operation,
but N is likely to be small).

Patch by Daniel Fahlgren!

llvm-svn: 201702
2014-02-19 17:44:16 +00:00
Jordan Rose 70e7e8718e [analyzer] Extend IdenticalExprChecker to check the two branches of an if.
This extends the checks for identical expressions to handle identical
statements, and compares the consequent and alternative ("then" and "else")
branches of an if-statement to see if they are identical, treating a single
statement surrounded by braces as equivalent to one without braces.

This does /not/ check subsequent branches in an if/else chain, let alone
branches that are not consecutive. This may improve in a future patch, but
it would certainly take more work.

Patch by Daniel Fahlgren!

llvm-svn: 201701
2014-02-19 17:44:11 +00:00
Ben Langmuir 0eb999cacb Reduce verbosity in the virtual file system using LLVM.h
No functional change

llvm-svn: 201696
2014-02-19 16:36:49 +00:00
Ben Langmuir 62edd0a059 Remove typo from r201618
Fixes PR18895

llvm-svn: 201685
2014-02-19 15:36:37 +00:00
Tim Northover db3e5e2408 AArch64: look up EmitAArch64Scalar support before calling.
This fixes one immediate bug where an expression with side-effects
could be emitted twice during a NEON call.

It also prepares the way for folding CodeGen for many of the SISD
intrinsics into a table, reducing code size and hopefully increasing
performance eventually ("binary search + few switch cases" should be
better than "lots of switch cases").

llvm-svn: 201667
2014-02-19 11:55:06 +00:00
Renato Golin f4421f7e28 Add FreeBSD ARM EABI hard-float support
Patch by Andrew Turner.

llvm-svn: 201662
2014-02-19 10:44:07 +00:00
Tim Northover 0f6c9d0a9b ARM NEON: add vcvtX (with rounding mode) intrinsics to v8 ARM.
These instructions (well, the f32 ones) are supported on 32-bit ARMv8, not just
AArch64. Now that the arm_neon.td refactoring is complete, adding them is
surprisingly simple.

rdar://problem/16035743

llvm-svn: 201661
2014-02-19 10:37:13 +00:00
Tim Northover 12670418a3 ARM & AArch64: merge the semantic checking of NEON intrinsics
There are two kinds of automatically generated tests for NEON intrinsics, both
of which can be merged without adversely affecting users.

1. We check that a valid kind of __builtin_neon_XYZ overload is requested (e.g.
   we're not asking for a float32x4_t version when it only accepts integers. Since
   the __builtin_neon_XYZ intrinsics should only be used in arm_neon.h, relaxing
   this test and permitting AArch64 types for AArch32 should not cause a problem.
   The extra arm_neon.h definitions should be #ifdefed out anyway.
2. We check that intrinsics which take immediates are actually given
   compile-time constants within range. Since all NEON intrinsics should be
   backwards compatible, these tests should be identical on AArch64 and AArch32
   anyway.

This patch, therefore, merges the separate AArch64 and 32-bit checks.

rdar://problem/16035743

llvm-svn: 201659
2014-02-19 10:37:05 +00:00
Ted Kremenek 8dd916d6b1 [analyzer] Move checker alpha.osx.cocoa.MissingSuperCall out of alpha category.
llvm-svn: 201640
2014-02-19 05:28:39 +00:00
Ben Langmuir b50b23f9ac Pass VFS from CompilerInstance to FileManager
This change was somehow missed from r201618

llvm-svn: 201636
2014-02-19 03:34:59 +00:00
Ben Langmuir 87ba87bc4d Add an OverlayFileSystem class
Provides a way to merge multiple vfs::FileSystem objects into a single
filesystem.

llvm-svn: 201635
2014-02-19 03:29:17 +00:00
David Majnemer f703b588b8 Implement DR577
DR18 previously forebode typedefs to be used as parameter types if they
were of type 'void'.  DR577 allows 'void' to be used as a function
parameter type regardless from where it came.

llvm-svn: 201631
2014-02-19 03:00:56 +00:00
Rafael Espindola 43e4c52426 Remove dead code.
Clang never produces a linker private object, so this code is dead.

llvm-svn: 201627
2014-02-19 02:14:40 +00:00
Hans Wennborg 897a69b33e clang-cl /fallback: turn the note into a warning
llvm-svn: 201626
2014-02-19 02:10:19 +00:00
Richard Smith b32d009b4f Remove a C++11ism.
llvm-svn: 201621
2014-02-19 01:08:24 +00:00
Richard Smith 4025944307 PR13110: Add a -Wignored-qualifiers warning when ignoring a const, volatile, or
_Atomic qualifier applied to a reference type.

llvm-svn: 201620
2014-02-19 00:13:27 +00:00
Ben Langmuir 090610d37a Initial implementation of virtual file system
This adds the minimum virtual file system support to start migrating
FileManager onto the VFS.

Originally discussed here:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-February/035188.html

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

llvm-svn: 201618
2014-02-19 00:10:30 +00:00
Reid Kleckner a97d4c0679 Fix false positives in -Wmsvc-include by continuing header search
This makes Clang and LLVM -Wmsvc-include clean.

I believe the correct behavior here is to avoid updating the cache when
we find the header via MSVC's search rules.

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

llvm-svn: 201615
2014-02-18 23:49:24 +00:00
Reid Kleckner 0c12b36ebb MS ABI: Remove nv adjustment from direct vdtor calls and prologues
Summary:
Generally the vector deleting dtor, which we model as a vtable thunk,
takes care of non-virtual adjustment and delegates to the other
destructor variants.  The other non-complete destructor variants assume
that 'this' on entry points to the virtual base subobject that first
declared the virtual destructor.

We need to change the adjustment in both the prologue and the vdtor call
setup.

Reviewers: timurrrr

CC: cfe-commits

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

llvm-svn: 201612
2014-02-18 22:51:52 +00:00
Ted Kremenek 5b2c210e65 Experiment with making -Wunreachable-code more immediately useful by restricting warnings to those issued in the main file.
This warning has a whole bunch of known false positives, much of them due
to code that is "sometimes unreachable".  This can caused by code that
is conditionally generated by the preprocessor, branches that are defined
in terms of architecture-specific details (e.g., the size of a type), and
so on.  While these are all good things to address one by one, the reality
is that this warning has received little love lately.  By restricting
its purvue, we can focus on the top issues effecting main files, which
should be smaller, and then gradually widen the scope.

llvm-svn: 201607
2014-02-18 22:12:10 +00:00
Hans Wennborg c5afd06a0d clang-cl /fallback: emit a note when falling back
This makes it a lot easier to see what's going on from the output.

llvm-svn: 201604
2014-02-18 21:42:51 +00:00
David Blaikie 65ec94e348 DebugInfo: Avoid unnecessarily looking up the context when the declaration is already built.
No functional change intended.

llvm-svn: 201602
2014-02-18 20:52:05 +00:00
Aaron Ballman efe348ec44 DeLesley Hutchins (who wrote the original thread-safety attribute functionality) and I have agreed to start migrating from lock-specific terminology to "capability"-specific terminology. This opens the door for future threading-related analysis passes so that a common nomenclature can be used.
The following attributes have been (silently) deprecated, with their replacements listed:

lockable => capability
exclusive_locks_required => requires_capability
shared_locks_required => requires_shared_capability
locks_excluded => requires_capability

There are no functional changes intended.

llvm-svn: 201585
2014-02-18 17:36:50 +00:00
Jordan Rose 97d2c9cae7 [analyzer] Teach CastSizeChecker about flexible array members.
...as well as fake flexible array members: structs that end in arrays with
length 0 or 1.

Patch by Daniel Fahlgren!

llvm-svn: 201583
2014-02-18 17:06:30 +00:00
David Majnemer 8eec58f35e MS ABI: Refactor extended qualifiers
Extended qualifiers can appear in many places, refactor the code so it's
more reusable.  Add tests in areas where we've increased compatibility.

llvm-svn: 201574
2014-02-18 14:20:10 +00:00
David Majnemer 0b6bf8a63a MS ABI: Add support for mangling __restrict
Pointer types in the MSVC ABI are a bit awkward, the width of the
pointer is considered a kind of CVR qualifier.

Restrict is handled similarly to const and volatile but is mangled after
the pointer width qualifier.

This fixes PR18880.

llvm-svn: 201569
2014-02-18 12:58:35 +00:00
Richard Smith 202dc131e7 PR18876: The special-case rule that ignores the destruction of a top-level
temporary in a decltype expression only applies if that temporary was created
by a function call, not by a function-style cast or other flavour of
expression.

llvm-svn: 201542
2014-02-18 03:51:47 +00:00
Richard Smith 7b1573451e Fix a non-error diagnostic that had an err_ name. Also move it from Warning to
ExtWarn, since it's an extension.

llvm-svn: 201540
2014-02-18 00:45:50 +00:00
Richard Smith 03c05038e0 PR18839: 'extern "C++"' also adds an implicit 'extern', not just 'extern "C"'.
llvm-svn: 201537
2014-02-17 23:34:47 +00:00
Richard Smith 4ee696d55c PR18870: Parse language linkage specifiers properly if the string-literal is
spelled in an interesting way.

llvm-svn: 201536
2014-02-17 23:25:27 +00:00
Richard Smith 8b7258bdb3 PR18855: Add support for UCNs and UTF-8 encoding within ud-suffixes.
llvm-svn: 201532
2014-02-17 21:52:30 +00:00
Bob Wilson bf854f0f53 Change PGO instrumentation to compute counts in a separate AST traversal.
Previously, we made one traversal of the AST prior to codegen to assign
counters to the ASTs and then propagated the count values during codegen. This
patch now adds a separate AST traversal prior to codegen for the
-fprofile-instr-use option to propagate the count values. The counts are then
saved in a map from which they can be retrieved during codegen.

This new approach has several advantages:

1. It gets rid of a lot of extra PGO-related code that had previously been
added to codegen.

2. It fixes a serious bug. My original implementation (which was mailed to the
list but never committed) used 3 counters for every loop. Justin improved it to
move 2 of those counters into the less-frequently executed breaks and continues,
but that turned out to produce wrong count values in some cases. The solution
requires visiting a loop body before the condition so that the count for the
condition properly includes the break and continue counts. Changing codegen to
visit a loop body first would be a fairly invasive change, but with a separate
AST traversal, it is easy to control the order of traversal. I've added a
testcase (provided by Justin) to make sure this works correctly.

3. It improves the instrumentation overhead, reducing the number of counters for
a loop from 3 to 1. We no longer need dedicated counters for breaks and
continues, since we can just use the propagated count values when visiting
breaks and continues.

To make this work, I needed to make a change to the way we count case
statements, going back to my original approach of not including the fall-through
in the counter values. This was necessary because there isn't always an AST node
that can be used to record the fall-through count. Now case statements are
handled the same as default statements, with the fall-through paths branching
over the counter increments.  While I was at it, I also went back to using this
approach for do-loops -- omitting the fall-through count into the loop body
simplifies some of the calculations and make them behave the same as other
loops. Whenever we start using this instrumentation for coverage, we'll need
to add the fall-through counts into the counter values.

llvm-svn: 201528
2014-02-17 19:21:09 +00:00
Bob Wilson a7b16e0ffd Some nitpicky comment fixes for "i.e." and "e.g." abbreviations.
llvm-svn: 201527
2014-02-17 19:21:03 +00:00
Bob Wilson 95a27b0e60 Fix some minor whitespace issues.
llvm-svn: 201526
2014-02-17 19:20:59 +00:00
Anton Yartsev 6a61922239 [analyzer] Improved checker naming in CFG dump.
This implements FIXME from Checker.cpp (FIXME: We want to return the package + name of the checker here.) and replaces hardcoded checker names with the new ones obtained via getCheckName().getName().

llvm-svn: 201525
2014-02-17 18:25:34 +00:00
Adrian Prantl 549c514799 Revert "Debug info: Make DWARF4 the default for Darwin, too."
I'm holding this change to give maintainers of Darwin buildbots more time
to update their toolchains.

This reverts commit r201375.

llvm-svn: 201520
2014-02-17 17:40:52 +00:00
Tim Northover da98bb634e Darwin: remove buggy assertion
We later emit a proper error in the situations where this would trigger, so
there's no need to check.

rdar://problem/16040604

llvm-svn: 201508
2014-02-17 11:12:04 +00:00
Daniel Jasper 5550de684f clang-format: Don't wrap "const" etc. of function declarations.
Generally people seem to prefer wrapping the first function parameter
over wrapping the trailing tokens "const", "override" and "final". This
does not extend to function-like annotations and probably not to other
non-standard annotations.

Before:
  void someLongFunction(int SomeLongParameter)
      const { ... }

After:
  void someLongFunction(
      int SomeLongParameter) const { ... }

llvm-svn: 201504
2014-02-17 07:57:46 +00:00