Commit Graph

23967 Commits

Author SHA1 Message Date
David Blaikie 0b7fad656b DebugInfo: Ensure the store for an assignment is attributed to the beginning of the assignment expression
llvm-svn: 223699
2014-12-08 21:48:57 +00:00
Justin Bogner 970ac60573 InstrProf: Use LLVM's -instrprof pass for profiling
The logic for lowering profiling counters has been moved to an LLVM
pass. Emit the intrinsics rather than duplicating the whole pass in
clang.

llvm-svn: 223683
2014-12-08 19:04:51 +00:00
NAKAMURA Takumi ead8915459 clang/test/Index/usrs.cpp: Appease targeting msvc.
llvm-svn: 223649
2014-12-08 10:20:33 +00:00
Argyrios Kyrtzidis 1d5e542fb2 [libclang] Encode InjectedClassNameType in the USR.
llvm-svn: 223634
2014-12-08 08:48:43 +00:00
Argyrios Kyrtzidis 80537a4146 [libclang] Encode location info for anonymous embedded tag decls.
Otherwise the USR will conflict with different embedded tag decls.

llvm-svn: 223633
2014-12-08 08:48:37 +00:00
Argyrios Kyrtzidis f66cef7575 [libclang] Use same USR encoding for 'class' as 'struct'.
'class' and 'struct' can be used interchangebly for forward references.
Use the same encoding otherwise we may get into a weird situation where the USR for the same
declaration is different based on whether the definition of the tag reference is visible or not.

llvm-svn: 223632
2014-12-08 08:48:33 +00:00
Argyrios Kyrtzidis 0e387dc330 [libclang] Encode C++11 rvalue reference types in the USR.
llvm-svn: 223631
2014-12-08 08:48:27 +00:00
Argyrios Kyrtzidis f581909b3b [libclang] Encode the C++11 method reference qualifier in the USR.
llvm-svn: 223630
2014-12-08 08:48:21 +00:00
Argyrios Kyrtzidis ca044547d2 [libclang] Reflect in USR generation that 'signed char' and 'unsigned char' can overload a 'char' in C++, by giving them distinct encodings.
llvm-svn: 223629
2014-12-08 08:48:17 +00:00
Argyrios Kyrtzidis d06ce400c2 [libclang] Function templates can be 'overloaded' by return type, so encode the return type in the USR
and handle DependentNameType in order to be able to distinguish them.

llvm-svn: 223628
2014-12-08 08:48:11 +00:00
Richard Smith 6ae60e70c6 Add some file content to avoid test failures on content-addressed file systems.
llvm-svn: 223596
2014-12-06 22:12:07 +00:00
Richard Smith 7ddf5f147f Add test file missed from r223561.
llvm-svn: 223595
2014-12-06 22:11:06 +00:00
Richard Smith 223d3f2e4d [modules] If we import a module, and we've seen a module map that describes the
module, use the path from the module map file in preference to the path from
the .pcm file when resolving relative paths in the .pcm file. This allows
diagnostics (and .d output) to give relative paths if the module was found via
a relative path.

llvm-svn: 223577
2014-12-06 03:21:08 +00:00
Kostya Serebryany 597dcc7a8d No memcpy for copy ctor with -fsanitize-address-field-padding=1
Summary:
When -fsanitize-address-field-padding=1 is present
don't emit memcpy for copy constructor.
Thanks Nico for the extra test case.

Test Plan: regression tests

Reviewers: thakis, rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

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

llvm-svn: 223563
2014-12-06 01:23:08 +00:00
Hans Wennborg 76b005398d ASTDumper: print whether a function is constexpr
llvm-svn: 223538
2014-12-05 22:38:57 +00:00
Matt Arsenault b9e9dc5e89 Workaround attribute ordering issue with kernel only attributes
Placing the attribute after the kernel keyword would incorrectly
reject the attribute, so use the smae workaround that other
kernel only attributes use.

Also add a FIXME because there are two different phrasings now
for the same error, althoug amdgpu_num_[sv]gpr uses a consistent one.

llvm-svn: 223490
2014-12-05 18:03:58 +00:00
Aaron Ballman a6f759e423 Modify __has_attribute so that it only looks for GNU-style attributes. Removes the ability to look for generic attributes and keywords via this macro, which has the potential to be a breaking change. However, since there is __has_cpp_attribute and __has_declspec_attribute, and given the limited usefulness of querying a generic attribute name regardless of syntax, this seems like the correct path forward.
llvm-svn: 223468
2014-12-05 15:24:55 +00:00
Aaron Ballman 3c0f9b4a7d Added a new preprocessor macro: __has_declspec_attribute. This can be used as a way to determine whether Clang supports a __declspec spelling for a given attribute, similar to __has_attribute and __has_cpp_attribute.
llvm-svn: 223467
2014-12-05 15:05:29 +00:00
David Majnemer 153c3948f1 Driver: Objective-C should respect -fno-exceptions
Clang attempted to replicate a GCC bug: -fobjc-exceptions forces
-fexceptions to be enabled.  However, this has unintended effects and
other awkard side effects that Clang doesn't "correctly" ape (e.g. it's
impossible to turn off C++ exceptions in ObjC++ mode).

Instead, -f[no]objc-exceptions and -f[no]cxx-exceptions now have an
identical relationship with -f[no]exceptions.

llvm-svn: 223455
2014-12-05 08:56:55 +00:00
Alexey Bataev 39bd119842 [OPENMP] Test for 'omp barrier' directive
llvm-svn: 223445
2014-12-05 04:10:27 +00:00
Alexey Bataev 8f7c1b0b9d [OPENMP] Codegen for 'omp barrier' directive.
Adds generation of call to "i32 kmpc_cancel_barrier(ident_t *, i32)" libcall for explicitly specified barriers (OMP_IDENT_BARRIER_EXPL flag is added to "flags" field of "ident_t" structure).
Also this patch replaces all calls to "kmpc_barrier" function by calls of "__kmpc_cancel_barrier" function which provides additional functionality for OpenMP 4.0.
Also, library specific enum OpenMPLocationFlags moved to private section of CGOpenMPRuntime class to make it more independent from library implementation.
Differential Revision: http://reviews.llvm.org/D6447

llvm-svn: 223444
2014-12-05 04:09:23 +00:00
Eric Christopher 0e2618857c Have the driver and the target code agree on what the default ABI
is for each machine. Fix up darwin tests that were testing for
aapcs on armv7-ios when the actual ABI is apcs.

Should be no user visible change without -cc1.

llvm-svn: 223429
2014-12-05 01:06:59 +00:00
Nico Rieck eaaae27bc5 Parse qualifiers after comma in declarator lists as a Microsoft extension
MSVC parses and ignores these with a warning.

llvm-svn: 223413
2014-12-04 23:31:08 +00:00
Nico Rieck 3e1ee83626 Recognize __unaligned keyword after type specifier
The __unaligned keyword can appear after a struct definition:

  struct foo {...} __unaligned *x;

llvm-svn: 223412
2014-12-04 23:30:25 +00:00
Matt Arsenault 43fae6c855 Add attributes for AMDGPU register limits.
This is a performance hint that can be applied to kernels
to attempt to limit the number of used registers.

llvm-svn: 223384
2014-12-04 20:38:18 +00:00
Faisal Vali 8435a6938d Fix PR21684 - Ellipsis following an 'auto' parameter sans name/ID
should indicate a c++ parameter pack not a c-variadic.

int i = [](auto...) { return 0; }(); // OK now.

llvm-svn: 223357
2014-12-04 12:40:21 +00:00
Alexey Bataev 8d690650e8 [OPENMP] Codegen for 'omp master' directive
Patch adds 2 library functions to OpenMPRuntime class - int32 kmpc_master(ident_t *, int32 gtid) and void kmpc_end_master(ident_t *, int32 gtid);
For 'omp master' directive the next code is generated:

if (__kmpc_master(loc, gtid)) {
    <Associated structured block>;
      __kmpc_end_master(log, gtid);
}

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

llvm-svn: 223342
2014-12-04 07:23:53 +00:00
Sameer Sahasrabuddhe c6093fea03 Always emit kernel arg info for SPIR.
http://llvm.org/bugs/show_bug.cgi?id=21555

Currently, kernel argument metadata is omitted unless the
"-cl-kernel-arg-info" option is specified. But the SPIR 1.2 spec
requires that all metadata except kernel_arg_name should always be
emitted, and kernel_arg_name is only emitted when
"-cl-kernel-arg-info" is specified.

Patch ported by Ryan Burn from the Khronos SPIR generator.
https://github.com/KhronosGroup/SPIR

llvm-svn: 223340
2014-12-04 05:30:58 +00:00
Reid Kleckner 2c8d86ca05 Add test for __umulh
llvm-svn: 223319
2014-12-03 23:52:26 +00:00
Kostya Serebryany bed8da2e3b [msan] allow -fsanitize-coverage=N together with -fsanitize=memory, clang part
llvm-svn: 223311
2014-12-03 23:27:45 +00:00
Reid Kleckner bbc0178518 CUDA host device code with two code paths
Summary:
Allow CUDA host device functions with two code paths using __CUDA_ARCH__
to differentiate between code path being compiled.

For example:
  __host__ __device__ void host_device_function(void) {
  #ifdef __CUDA_ARCH__
    device_only_function();
  #else
    host_only_function();
  #endif
  }

Patch by Jacques Pienaar.

Reviewed By: rnk

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

llvm-svn: 223271
2014-12-03 21:53:36 +00:00
Reid Kleckner 8d58513da4 Cast vtable address points to i32 (...)** to enable more globalopt
We currently use i32 (...)** as the type of the vptr field in the LLVM
struct type. LLVM's GlobalOpt prefers any bitcasts to be on the side of
the data being stored rather than on the pointer being stored to.

Reviewers: majnemer

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

llvm-svn: 223267
2014-12-03 21:00:21 +00:00
Richard Smith 1780d82f35 Teach EvaluatedExprVisitor that the condition and unselected branches of a
_Generic expression are unevaluated.

llvm-svn: 223266
2014-12-03 21:00:20 +00:00
Hal Finkel 7c0d61eaaf Preserve LD_LIBRARY_PATH when using the 'env' command
In many Linux environments (and similar), just-built applications won't run
correctly without making use of the current LD_LIBRARY_PATH environmental
variable in order to find dynamic libraries. Propagate it through the 'env'
command (hopefully this works on all platforms).

llvm-svn: 223219
2014-12-03 08:19:17 +00:00
Kaelyn Takata 53ac6a04eb Handle delayed corrections in a couple more error paths in ParsePostfixExpressionSuffix.
llvm-svn: 223209
2014-12-03 05:30:54 +00:00
Peter Collingbourne 6b46e381e6 Update test to check for prologue instead of prefix
llvm-svn: 223191
2014-12-03 02:37:10 +00:00
Nico Weber 736a993828 Add support for has_feature(cxx_alignof) and has_feature(c_alignof).
r142020 added support for has_feature(cxx_alignas). This does the same for
alignof.

llvm-svn: 223186
2014-12-03 01:25:49 +00:00
Nico Weber aad4af6d50 Fix incorrect codegen for devirtualized calls to virtual overloaded operators.
Consider this program:

    struct A {
      virtual void operator-() { printf("base\n"); }
    };
    struct B final : public A {
      virtual void operator-() override { printf("derived\n"); }
    };

    int main() {
      B* b = new B;
      -static_cast<A&>(*b);
    }

Before this patch, clang saw the virtual call to A::operator-(), figured out
that it can be devirtualized, and then just called A::operator-() directly,
without going through the vtable.  Instead, it should've looked up which
operator-() the call devirtualizes to and should've called that.

For regular virtual member calls, clang gets all this right already. So
instead of giving EmitCXXOperatorMemberCallee() all the logic that
EmitCXXMemberCallExpr() already has, cut the latter function into two pieces,
call the second piece EmitCXXMemberOrOperatorMemberCallExpr(), and use it also
to generate code for calls to virtual member operators.

This way, virtual overloaded operators automatically don't get devirtualized
if they have covariant returns (like it was done for regular calls in r218602),
etc.

This also happens to fix (or at least improve) codegen for explicit constructor
calls (`A a; a.A::A()`) in MS mode with -fsanitize-address-field-padding=1.

(This adjustment for virtual operator calls seems still wrong with the MS ABI.)

llvm-svn: 223185
2014-12-03 01:21:41 +00:00
Richard Smith e8efd99b24 PR21706: -Wunsequenced was missing warnings when leaving a sequenced region that contained side effects.
llvm-svn: 223184
2014-12-03 01:05:50 +00:00
Kaelyn Takata 999dd85e16 Ensure typos in the default values of template parameters get diagnosed.
llvm-svn: 223177
2014-12-02 23:32:20 +00:00
Justin Bogner 111c6533c2 InstrProf: Use the same names for variables as we use in the profile
There's no need to use different names for the local variables than we
use in the profile itself, and it's a bit simpler and easier to debug
if we're consistent.

llvm-svn: 223173
2014-12-02 23:15:30 +00:00
Fariborz Jahanian 334becf46a Another warning with no group name bites the dust.
rdar://19116886

llvm-svn: 223168
2014-12-02 22:42:52 +00:00
Fariborz Jahanian 05834e2d5b This patch fixes a crash involving use of predefined
expressions. It fixes crash when mangling name for block's helper
function used inside a constructor/destructor. 
rdar://19065361.

llvm-svn: 223136
2014-12-02 18:42:51 +00:00
Anton Korobeynikov d90dd7977e Fix invalid calling convention used for libcalls on ARM.
ARM ABI specifies that all the libcalls use soft FP ABI 
(even hard FP binaries). These days clang emits _mulsc3 / _muldc3
calls with default (C) calling convention which would be translated
into AAPCS_VFP LLVM calling and thus the result of complex
multiplication will be bogus.

Introduce a way for a target to specify explicitly calling
convention for libcalls. Right now this is temporary correctness
fix. Ultimately, we'll end with intrinsic for complex 
multiplication and all calling convention decisions for libcalls
will be put into backend.

llvm-svn: 223123
2014-12-02 16:04:58 +00:00
Serge Pavlov 376aee9ae7 Reverted r223114, it caused failure on on clang-native-arm-cortex-a9.
llvm-svn: 223120
2014-12-02 14:52:20 +00:00
Justin Holewinski 6e9bfa344c [NVPTX] Fix type error for some builtins in BuiltinsNVPTX.def
llvm-svn: 223116
2014-12-02 12:58:24 +00:00
Serge Pavlov 1ecb41c09b Emit warning if define or undef reserved identifier or keyword.
Summary:
This change implements warnings if macro name is identical to a keyword or
reserved identifier. The warnings are different depending on the "danger"
of the operation. Defining macro that replaces a keyword is on by default.
Other cases produce warning that is off by default but can be turned on
using option -Wreserved-id-macro.

This change fixes PR11488.

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, cfe-commits

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

llvm-svn: 223114
2014-12-02 11:06:09 +00:00
Bob Wilson ec2580dec0 Re-apply "Revert r166370 and r166540 now that Xcode 4.6 has been available for a while."
This reverts commit r176892.

I had reverted this a while back to give Chromium more time to update, and
Nico says it should be OK now.

llvm-svn: 223108
2014-12-02 05:17:21 +00:00
NAKAMURA Takumi 8ca1b5a294 clang/test/Modules/malformed.cpp REQUIRES shell due to "cd".
llvm-svn: 223107
2014-12-02 03:55:16 +00:00
Chandler Carruth bdf7e1dd4b Rely on fewer features of the 'env' command. Darwin only supports '-i'.
I'm explicitly setting LC_ALL=C somewhat for documentation, but
hopefully this also removes some host variation from the test results.

llvm-svn: 223102
2014-12-02 01:24:52 +00:00
Chandler Carruth c2f9ea7847 Add a test that ensures the Clang driver behaves itself when the PATH
environment variable is changed to strange things out from under it.
Prior to r223099 in LLVM, these test cases would crash in various ways
(assert fails, stack exhaustion, etc.).

llvm-svn: 223100
2014-12-02 00:53:20 +00:00
Bob Wilson 5f4346d538 Remove special case for aarch64 static vs. PIC code in iOS kernel code.
I added this check a while back but then made a note to myself that it
should be completely unnecessary since iOS always uses PIC code-gen for
aarch64. Since I could never come up with any reason why it would be
necessary, I'm just going to remove it and we'll see if anything breaks.
rdar://problem/13627985

llvm-svn: 223097
2014-12-02 00:27:35 +00:00
Richard Smith 3c1a41ad99 [modules] Track how 'header' directives were written in module map files,
rather than trying to extract this information from the FileEntry after the
fact.

This has a number of beneficial effects. For instance, diagnostic messages for
failed module builds give a path relative to the "module root" rather than an
absolute file path, and the contents of the module includes file is no longer
dependent on what files the including TU happened to inspect prior to
triggering the module build.

llvm-svn: 223095
2014-12-02 00:08:08 +00:00
Nikola Smiljanic fce370eb52 Perform correct lookup when '__super' is used in class with dependent base.
llvm-svn: 223090
2014-12-01 23:15:01 +00:00
Nico Weber 4af55faa19 Add a test for devirtualization of virtual operator calls.
There was no test coverage for this before: Modifiying
EmitCXXOperatorMemberCallee() to not call CanDevirtualizeMemberFunctionCall()
didn't make any test fail.

llvm-svn: 223056
2014-12-01 17:48:04 +00:00
Arnaud A. de Grandmaison f3470cc979 Revert "Remove threshold for lifetime marker insertion of named temporaries"
Revert r222993 while I investigate some MemorySanitizer failures.

llvm-svn: 222995
2014-12-01 09:30:16 +00:00
Arnaud A. de Grandmaison f2730e2d22 Remove threshold for lifetime marker insertion of named temporaries
Now that TailRecursionElimination has been fixed with r222354, the
threshold on size for lifetime marker insertion can be removed. This
only affects named temporary though, as the patch for unnamed temporaries
is still in progress.

llvm-svn: 222993
2014-12-01 09:13:54 +00:00
NAKAMURA Takumi ddd125a3f9 clang/test/CodeGenOpenCL/opencl_types.cl: Appease i686-msvc.
llvm-svn: 222969
2014-11-30 00:32:02 +00:00
NAKAMURA Takumi c3ee2c5a77 Tweak clang/test/CodeGenOpenCL/opencl_types.cl to appease msvc since r222941.
llvm-svn: 222956
2014-11-29 17:27:07 +00:00
David Majnemer eea02eefe7 AST: Consider pseudo-struct builtin types as substitutable
We didn't consider types like ObjCSel as a substitution candidate.

This fixes PR21688.

llvm-svn: 222941
2014-11-28 22:22:46 +00:00
Richard Barton 3b0dcc160a Add additional arguments for -mfpu options
Add neon-vfpv3 to allow specifying both at the same time. This is not an
option that GCC supports, but follows the same track and should be
non-controversial.

Change-Id: Id9ec157c835937d7d11ad0f49dbe5171fac17658
llvm-svn: 222933
2014-11-28 20:39:59 +00:00
Richard Barton 09b60b2a63 Add -mfpu=neon-vfpv4
This enables user to architecturally specify ARMv7A + VFPv4 + NEON.

Change-Id: I779b01fef5c47e5e4ac702ae24ed2f76a0e4c63f
llvm-svn: 222932
2014-11-28 20:39:54 +00:00
Alexey Bataev f33eba6573 [OPENMP] Additional processing of 'omp atomic write' directive.
According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic write' is allowed to be used only for expression statements of form 'x = expr;', where x is a lvalue expression and expr is an expression with scalar type. Patch adds checks for it.

llvm-svn: 222913
2014-11-28 07:21:40 +00:00
Alexis Hunt 724f14e75c Create a new 'flag_enum' attribute.
This attribute serves as a hint to improve warnings about the ranges of
enumerators used as flag types. It currently has no working C++ implementation
due to different semantics for enums in C++. For more explanation, see the docs
and testcases.

Reviewed by Aaron Ballman.

llvm-svn: 222906
2014-11-28 00:53:20 +00:00
Tim Northover b047bfae32 AArch64: simplify PCS mapping.
Now that LLVM can count the registers needed to implement AAPCS rules, we don't
need to duplicate that logic here. This means we can drop the explicit padding
and also use more natural types in many cases (e.g. "struct { float arr[3]; }"
used to end up as "[2 x double]" to avoid holes on the stack.

The one wrinkle is that AAPCS va_arg was also using the register counting
machinery. But the local replacement isn't too bad.

llvm-svn: 222904
2014-11-27 21:02:49 +00:00
Richard Smith 83d3f150c8 [c++1z] Remove terse range-based for loops; they've been removed from
consideration for C++17 for now. Update C++ status page to match.

llvm-svn: 222865
2014-11-27 01:54:27 +00:00
Richard Trieu c321b931c0 When checking for uninitialized values, do not confuse "std::move" with every
other function named "move".

llvm-svn: 222863
2014-11-27 01:29:32 +00:00
Tim Northover 8603941057 OpenCL: fix test for lack of names in release builds
llvm-svn: 222853
2014-11-26 22:33:04 +00:00
Richard Smith 42ea81f655 Fix buildbot failure on LLP64 platforms like MSVC x86_64.
llvm-svn: 222848
2014-11-26 19:37:39 +00:00
Aaron Ballman eda0373900 Adding an explicit triple to this test to get it to pass all build bots.
llvm-svn: 222837
2014-11-26 16:17:20 +00:00
Anastasia Stulova 5d8ad8a7b8 [OpenCL] Implemented restrictions for pointer conversions specified in OpenCL v2.0.
OpenCL v2.0 s6.5.5 restricts conversion of pointers to different address spaces:
- the named address spaces (__global, __local, and __private) => __generic - implicitly converted;
- __generic => named - with an explicit cast;
- named <=> named - disallowed;
- __constant <=> any other - disallowed.

llvm-svn: 222834
2014-11-26 15:36:41 +00:00
Anastasia Stulova 248f1e5156 [OpenCL] Generic address space parsing and diagnostics test (forgotten previously)
llvm-svn: 222832
2014-11-26 14:14:05 +00:00
Richard Smith 410cc89374 [c++1z] Most of N4268 (allow constant evaluation for non-type template arguments).
We don't yet support pointer-to-member template arguments that have undergone
pointer-to-member conversions, mostly because we don't have a mangling for them yet.

llvm-svn: 222807
2014-11-26 03:26:53 +00:00
David Majnemer 659be55daa CodeGen: Fix emission of __atomic_compare_exchange
We (wrongly) discarded the return value of the call.

llvm-svn: 222798
2014-11-25 23:44:32 +00:00
Kaelyn Takata 443d61d62a Ensure that any TypoExprs in the arguments to bultins with custom type
checking are handled before the custom type checking is performed.

Fixes PR21669.

llvm-svn: 222797
2014-11-25 23:04:09 +00:00
Paul Robinson 18bc77f66c Try to fix a ppc64 bot. What is this 'signext' stuff anyway?
No wonder most people use specific triples.

llvm-svn: 222769
2014-11-25 17:28:54 +00:00
Chandler Carruth cc75b75b9d Update Clang tests that run the LLVM optimizer to reflect the changed
canonicalization in r222748. No interesting functionality changed here.

llvm-svn: 222749
2014-11-25 10:10:37 +00:00
Daniel Jasper 21a0f55755 Add flag -f(no-)modules-implicit-maps.
This suppresses the implicit search for files called 'module.modulemap' and
similar.

llvm-svn: 222745
2014-11-25 09:45:48 +00:00
Sergey Dmitrouk 745f530446 [ARM] Define __ARM_FEATURE_DSP macro for CPUs that have DSP instructions
Summary:
This resolves [[ http://llvm.org/bugs/show_bug.cgi?id=17391 | PR17391 ]].

GCC's sources were used as a guide (couldn't find much information in ARM documentation).

Reviewers: doug.gregor, asl

Reviewed By: asl

Subscribers: asl, aemerson, cfe-commits

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

llvm-svn: 222741
2014-11-25 08:57:36 +00:00
Paul Robinson 4e21001bac See if this fixes Mips bot; ignore contents of parameter lists.
llvm-svn: 222708
2014-11-24 23:30:12 +00:00
Kaelyn Takata 13da33fdfe Force the correction of delayed typos in casts in non-C++ code.
Fixes PR21656, which is fallout from r222551 caused by an untested/missed
code path.

llvm-svn: 222694
2014-11-24 21:46:59 +00:00
Tim Northover bdcc1ed66d testing: make test use FileCheck
The "grep internal | count" was fragile when your source or remote paths could
contain the word "internal".

llvm-svn: 222685
2014-11-24 21:03:34 +00:00
Paul Robinson 4ece682586 Correctly remove OptimizeForSize from functions marked OptimizeNone.
This allows using __attribute__((optnone)) and the -Os/-Oz options.
Fixes PR21604.

llvm-svn: 222683
2014-11-24 20:51:42 +00:00
Saleem Abdulrasool aca550fdb5 CodeGen: make i686-windows-itanium more similar to msvc
The itanium environment follows the system calling convention for structures.
Pass small aggregates via registers.

llvm-svn: 222680
2014-11-24 20:14:29 +00:00
Nico Rieck dfff5d22e6 Fix crash when using __if_exists in C mode
llvm-svn: 222665
2014-11-24 17:29:35 +00:00
Saleem Abdulrasool ec5c624550 CodeGen: tweak struct ABI handling
Cygwin and MinGW fail to conform to the underlying system's structure passing
ABI.  Make the check more precise to ensure that we correctly generate code for
the itanium environment.

llvm-svn: 222626
2014-11-23 02:16:24 +00:00
Daniel Sanders 1f07d06d61 Support matching signext attribute in the parallel_num_threads_codegen test to appease clang-cmake-mips builder.
The Mips target adds the signext attribute to signed 32-bit integers in order
to support the N32/N64 correctly. Integers must be promoted to 64-bit bit on
these ABI's.

llvm-svn: 222618
2014-11-22 16:21:18 +00:00
Daniel Sanders 8ff9e737af Support matching signext attribute in vla-lambda-capturing test to appease clang-cmake-mips builder.
The Mips target adds the signext attribute to signed 32-bit integers in order
to support the N32/N64 correctly. Integers must be promoted to 64-bit bit on
these ABI's.

llvm-svn: 222617
2014-11-22 16:08:56 +00:00
David Majnemer d8cd8f7b6e CodeGen: Make atomic operations play nice with address spaces
We were being a little sloppy with our pointer/address space casts.

This fixes PR21643.

llvm-svn: 222615
2014-11-22 10:44:12 +00:00
Richard Smith 88f45490a0 Delay checking overrides for exception specifications if the overridden
specification has not yet been parsed.

llvm-svn: 222603
2014-11-22 03:09:05 +00:00
David Majnemer 125efd8d4f MS ABI: Mangle u8 string literals
UTF8 string literals are mangled just like ASCII string literals.

llvm-svn: 222591
2014-11-21 23:56:50 +00:00
Fariborz Jahanian ac1c5120c6 Objective-C ARC. Fixes a crash when checking for 'weak' propery
whose base is not an expression. rdar://19053620

llvm-svn: 222570
2014-11-21 21:12:11 +00:00
David Majnemer 6f3150a7d2 Sema: Don't permit variably modified types in typeid
GCC and ICC both reject this and the 'Runtime-sized arrays with
automatic storage duration' (N3639) paper forbade this as well.
Previously, we would crash on our way to mangling.

This fixes PR21632.

llvm-svn: 222569
2014-11-21 21:09:12 +00:00
Roman Divacky d517801493 Implement -Wcast-qual, fixing #13772.
Many thanks to dblaikie for his advices and suggestions!

llvm-svn: 222568
2014-11-21 21:03:10 +00:00
David Majnemer 98e77a2512 MS ABI: Mangle char16_t and char32_t string literals
We previously had support for char and wchar_t string literals.  VS 2015
added support for char16_t and char32_t.

String literals must be mangled in the MS ABI in order for them to be
deduplicated across translation units: their linker has no notion of
mergeable section.  Instead, they use the mangled name to make a COMDAT
for the string literal; the COMDAT will merge with other COMDATs in
other object files.

This allows strings in object files generated by clang to get merged
with strings in object files generated by MSVC.

llvm-svn: 222564
2014-11-21 19:57:25 +00:00
Kaelyn Takata 1586782767 Enable ActOnIdExpression to use delayed typo correction for non-C++ code
when calling DiagnoseEmptyLookup.

llvm-svn: 222551
2014-11-21 18:48:04 +00:00
Kaelyn Takata 4c3ffc4fef Properly correct initializer expressions based on whether they would be valid.
llvm-svn: 222550
2014-11-21 18:48:00 +00:00
Kaelyn Takata 5ca2ecd2b2 Use the full-Expr filter to disambiguate equidistant correction
candidates.

llvm-svn: 222549
2014-11-21 18:47:58 +00:00
Dmitry Vyukov 45bac8d4e8 Fix test after r222526.
llvm-svn: 222530
2014-11-21 12:48:43 +00:00
David Majnemer eca5a201f4 MS ABI: Mangle char16_t and char32_t types
These mangling make clang more compatible with MSVC 2015.
Correctly mangling char16_t and char32_t will take a little more work.

llvm-svn: 222515
2014-11-21 09:06:49 +00:00
Bob Wilson d8f4165b0d Fix missing diagnostic for unsupported TLS for some thread_local variables.
Clang r181627 moved a check for block-scope variables into this code for
handling thread storage class specifiers, but in the process, it broke the
logic for checking if the target supports TLS. Fix this with some simple
restructuring of the code. rdar://problem/18796883

llvm-svn: 222512
2014-11-21 06:52:52 +00:00
Richard Smith 5b39075668 [modules] When explicitly importing a module, it's fine for the imported module
to be newer than we were expecting. That happens if .pcm's get moved between
file systems during a distributed build. (It's still not OK for them to actually
be different, though, so we still check the size and signature matches.)

llvm-svn: 222507
2014-11-21 05:37:20 +00:00
Richard Trieu 3630c39972 Extend -Wuninitialized to warn when accessing uninitialized base classes in a
constructor.

llvm-svn: 222503
2014-11-21 03:10:30 +00:00
Adrian Prantl ebd1ef82ad relax this testcase to not depend on a specific alignment.
llvm-svn: 222490
2014-11-21 00:48:22 +00:00
Adrian Prantl 88eec39460 Debug info for blocks: Fix a bug caught by the Verifier.
When emitting nested block definitions, the insert-at-point variant of
DIBuilder::insertDeclare() could be called with the insertion point set
to the end-of-BasicBlock sentinel, causing the parent pointer of the
CallInst to be set to the intentionally bogus value of the sentinel.

Fixed by conditionally invoking the correct version of insertDeclare().
rdar://problem/19034882

llvm-svn: 222487
2014-11-21 00:35:25 +00:00
David Blaikie af08085c86 DebugInfo: Fix another case of r222377 when we do have a definition of the variable, but we might not be emitting it (such as templates)
llvm-svn: 222485
2014-11-21 00:20:58 +00:00
Richard Smith 01014cee76 Remove code that tries to avoid transforming non-dependent call operator types
for lambda expressions. That can't ever work; we need to transform the
parameters in order to create new ones in the new call operator context.

Fixes a rejects-valid when transforming a context containing a
lambda-expression that uses its function parameters in C++14 mode.

llvm-svn: 222482
2014-11-20 23:53:14 +00:00
Richard Smith 4764e9bf79 Move test from r222476 to a better place; this was reduced to the point that it
no longer contained a generic lambda.

llvm-svn: 222477
2014-11-20 23:00:25 +00:00
Richard Smith 069ecf65e5 Fix crash-on-valid if a lambda-expression appears lexically directly within a
local class inside a template.

llvm-svn: 222476
2014-11-20 22:56:34 +00:00
Richard Smith 3ef3e899a9 PR21565: Further refine the conditions for enabling eager parsing of
std::X::swap exception specifications (allowing parsing of non-conforming code
in libstdc++). The old conditions also matched the functions in MSVC's STL,
which were relying on deferred parsing here.

llvm-svn: 222471
2014-11-20 22:32:11 +00:00
Kaelyn Takata 57e07c950d Ensure all TypoExprs are diagnosed by the tree transform.
If there is more than one TypoExpr within the expr being transformed and
any but the last TypoExpr seen don't have any viable candidates, the
tree transform will be aborted early and the remaining TypoExprs are
never seen and hence never diagnosed. This adds a simple
RecursiveASTVisitor to find all of the TypoExprs to be diagnosed in the
case where typo correction of the entire expr fails (and the result of
the tree transform is an ExprError).

llvm-svn: 222465
2014-11-20 22:06:44 +00:00
Kaelyn Takata b16e632c64 Wire up delayed typo correction to DiagnoseEmptyLookup and set up
Sema::ActOnIdExpression to use the new functionality.

Among other things, this allows recovery in several cases where it
wasn't possible before (e.g. correcting a mistyped static_cast<>).

llvm-svn: 222464
2014-11-20 22:06:40 +00:00
Anastasia Stulova 561e0aa180 Extended list of valid frontend options with '-cl-std=CL2.0'.
This option sets language mode for the compilation of a source file to be OpenCL v2.0.

Example: clang -cc1 -cl-std=CL2.0 myfile.cl
llvm-svn: 222444
2014-11-20 19:25:00 +00:00
Timur Iskhodzhanov f0934fa708 Convert CR+LF -> LF in a test file
llvm-svn: 222429
2014-11-20 12:59:14 +00:00
Alexey Bataev cc37cc1db2 [OPENMP] Codegen for "omp flush" directive.
For each "omp flush" directive a call to "void kmpc_flush(ident_t *, ...)" function is generated.
Directive "omp flush" may have an associated list of variables to flush, but currently runtime function ignores them. So the patch generates just "call kmpc_flush(ident_t *<loc>, i32 0)".
Differential Revision: http://reviews.llvm.org/D6292

llvm-svn: 222409
2014-11-20 04:34:54 +00:00
Richard Smith 30ef77a780 Fix buildbots.
llvm-svn: 222408
2014-11-20 04:09:55 +00:00
Richard Smith e9f130cfdf Preserve numeric literal suffixes during type canonicalization.
Patch by Pierre Gousseau! Test cases altered significantly by me.

llvm-svn: 222404
2014-11-20 03:37:32 +00:00
Richard Smith c8b9badef7 Avoid earlier test interfering with later one.
llvm-svn: 222403
2014-11-20 01:50:37 +00:00
Richard Smith 6adb42e1ac When mangling member-expressions, skip implicit accesses of anonymous union
objects. This is consistent with GCC's behavior. Patch by Tomasz Miąsko!

llvm-svn: 222402
2014-11-20 01:35:11 +00:00
Alexey Samsonov cfb97aa620 Remove support for undocumented SpecialCaseList entries.
"global-init", "global-init-src" and "global-init-type" were originally
used to blacklist entities in ASan init-order checker. However, they
were never documented, and later were replaced by "=init" category.

Old blacklist entries should be converted as follows:
  * global-init:foo -> global:foo=init
  * global-init-src:bar -> src:bar=init
  * global-init-type:baz -> type:baz=init

llvm-svn: 222401
2014-11-20 01:27:19 +00:00
Richard Smith 5b555da775 PR21531: fix crash on invalid with unexpanded pack in case value.
llvm-svn: 222400
2014-11-20 01:24:12 +00:00
Chad Rosier 36577d037f Revert "[Reassociate] Update test cases due to r222142."
This reverts commit r222144.  Commit r222142 is being reverted due to
a spec2006/gcc execution-time regression.

Update mips-varargs test as well.

llvm-svn: 222397
2014-11-19 23:20:35 +00:00
Richard Smith be6dd818fb Fix bug where a trivial constexpr copy/move operation couldn't copy from an
empty non-constexpr object. Such a copy doesn't break any of the constexpr
rules.

llvm-svn: 222387
2014-11-19 21:27:17 +00:00
David Blaikie 423eb5a6a5 DebugInfo: Don't emit a 'global variable' when a static member declaration is referenced without a definition, just ensure the enclosing class (with the static member declaration) is emitted.
Addresses PR21511 by emitting appropriate metadata rather than
faux-global definitions for a variable that doesn't have a definition.

llvm-svn: 222377
2014-11-19 19:42:40 +00:00
Saleem Abdulrasool 4325aaa6d9 Driver: correct typo
Fix a typo in the search path identified by Justin Bogner.

llvm-svn: 222371
2014-11-19 17:59:00 +00:00
Daniel Sanders 59229dcb29 Allow EmitVAArg() to promote types and use this to fix some N32/N64 vararg issues for Mips.
Summary:
With this patch, passing a va_list to another function and reading 10 int's from
it works correctly on a big-endian target.

Based on a pair of patches by David Chisnall, one of which I've reworked
for the current trunk.

Reviewers: theraven, atanasyan

Reviewed By: theraven, atanasyan

Subscribers: cfe-commits

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

llvm-svn: 222339
2014-11-19 10:01:35 +00:00
Richard Trieu 791b86ec55 Add the exception for strings in logical and expressions to -Wstring-conversion
for C code.

llvm-svn: 222327
2014-11-19 06:08:18 +00:00
Eric Christopher 8be702dbaa This test also requires an aarch64 target.
llvm-svn: 222268
2014-11-18 22:36:11 +00:00
Fariborz Jahanian ef202d96c7 [Sema] Patch to issue warning on comparing parameters with
nonnull attribute when comparison is always true/false. 
Original patch by Steven Wu. I have added extra code to prevent issuing of
warning  when the nonnull parameter is modified prior to the comparison.
This addition prevents false positives in the most obvious cases.
There may still be false positive warnings in some cases (as one of my tests
indicates), but benefit far outweighs such cases. rdar://18712242

llvm-svn: 222264
2014-11-18 21:57:54 +00:00
Alexey Bataev 62cec44ca4 [OPENMP] Additional processing of 'omp atomic read' directive.
According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic read' is allowed to be used only for expression statements of form 'v = x;', where x and v (as applicable) are both l-value expressions with scalar type. Patch adds checks for it.

llvm-svn: 222231
2014-11-18 10:14:22 +00:00
Justin Hibbits 90ca05e5e5 Add PIC-level support to Clang.
Summary:
This distinguishes between -fpic and -fPIC now, with the additions in LLVM for
PIC level support.

Test Plan: No regressions

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rnk, emaste, llvm-commits

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

llvm-svn: 222227
2014-11-18 06:17:20 +00:00
Frederic Riss d253ed6565 Fully handle globals and functions in CGDebugInfo::getDeclarationOrDefinition()
Currently this function would return nothing for functions or globals that
haven't seen a definition yet. Make it return a forward declaration that will
get RAUWed with the definition if one is seen at a later point. The strategy
used to implement this is similar to what's done for types: the forward
declarations are stored in a vector and post processed upon finilization to
perform the required RAUWs.

For now the only user of getDeclarationOrDefinition() is EmitUsingDecl(), thus
this patch allows to emit correct imported declarations even in the absence of
an actual definition of the imported entity.

(Another user will be the debug info generation for argument default values
that I need to resurect).

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

llvm-svn: 222220
2014-11-18 03:40:51 +00:00
Justin Bogner 94d384e423 InstrProf: Don't emit coverage for uninstantiated templates
We include unused functions and methods in -fcoverage-mapping so that
we can differentiate between uninstrumented and unused. This can cause
problems for uninstantiated templates though, since they may involve
an incomplete type that can't be mangled. This shows up in things like
libc++'s <unordered_map> and makes coverage unusable.

Avoid the issue by skipping uninstantiated methods of a templated
class.

llvm-svn: 222204
2014-11-18 00:34:46 +00:00
Manman Ren 408549644d Debug Info: context field of a global variable is DIScopeRef.
Paired commit with r222195.

llvm-svn: 222196
2014-11-18 00:29:32 +00:00
John McCall 0d8d6c094f Fix an assertion when ending a function definition.
The bug is that ExprCleanupObjects isn't always empty
in a fresh evaluation context.  New evaluation contexts just
track the current depth of the stack.

The assertion will misfire whenever we finish processing
a function body inside an expression that contained an earlier
block literal with non-trivial captures.  That's actually
a lot less likely than you'd think, though, because it has
to be a real function declaration, not just another block.
Mixed block/lambda code would work, as would a template
instantiation or a local class definition.

The code works correctly if the assertion is disabled.

rdar://16356628

llvm-svn: 222194
2014-11-18 00:19:01 +00:00
Reid Kleckner d60b82f93e Handle use of default member initializers before end of outermost class
Specifically, when we have this situation:
  struct A {
    template <typename T> struct B {
      int m1 = sizeof(A);
    };
    B<int> m2;
  };

We can't parse m1's initializer eagerly because we need A to be
complete.  Therefore we wait until the end of A's class scope to parse
it. However, we can trigger instantiation of B before the end of A,
which will attempt to instantiate the field decls eagerly, and it would
build a bad field decl instantiation that said it had an initializer but
actually lacked one.

Fixed by deferring instantiation of default member initializers until
they are needed during constructor analysis. This addresses a long
standing FIXME in the code.

Fixes PR19195.

Reviewed By: rsmith

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

llvm-svn: 222192
2014-11-17 23:36:45 +00:00
Hans Wennborg 6164753e81 clang-cl: Allow /Fo without an argument (PR21589)
When it's used without an argument, the default file name is
used. The same goes for /Fe.

Also, allow using /Fo, /Fa and /Fe with multiple inputs if they
don't have an argument.

llvm-svn: 222164
2014-11-17 19:16:36 +00:00
Hans Wennborg 767e6a4333 test/Driver/cl-outputs.c: tweak some check prefixes; NFC.
These tests deal with the /o option; rename to better reflect that.

llvm-svn: 222157
2014-11-17 18:40:45 +00:00
Chad Rosier 0837f63fd2 [Reassociate] Update test cases due to r222142.
llvm-svn: 222144
2014-11-17 16:34:47 +00:00
Alexey Samsonov 1e715a66d7 [Sanitizer] Parse and produce all sanitizer-relevant arguments in SanitizerArgs.
In particular, make SanitizerArgs responsible for parsing
and passing down to frontend -fsanitize-recover and
-fsanitize-undefined-trap-on-error flags.

Simplify parsing -f(no-)sanitize= flags parsing: get rid of
too complex filterUnsupportedKinds function.

No functionality change.

llvm-svn: 222105
2014-11-16 20:53:53 +00:00
Reid Kleckner b1be683074 Fix IRGen for passing transparent unions
We have had a test for this for a long time with a FIXME saying what we
should be doing. This just does it.

Fixes PR21573.

llvm-svn: 222074
2014-11-15 01:41:41 +00:00
Fariborz Jahanian 68e7938361 This patch fixes couple of bugs for predefined expression
used inside blocks. It fixes a crash in naming code
for __func__ etc. when used in a block declared globally.
It also brings back old naming convention for
predefined expression which was broken. rdar://18961148

llvm-svn: 222065
2014-11-14 23:55:27 +00:00
Aaron Ballman 43f40103f0 [c++1z] Support [[deprecated]] attributes on namespaces. Note that it only applies to situations where the namespace is mentioned. Thus, use on anonymous namespaces is diagnosed.
llvm-svn: 222054
2014-11-14 22:34:56 +00:00
Anton Korobeynikov 5f951ee8bd Recommit r222044 with a test fix - it does not make sense to hunt
for a typedef before arithmetic conversion in all rare corner cases.

llvm-svn: 222049
2014-11-14 22:09:15 +00:00
Anton Korobeynikov 50fc68f2d9 Again revert r222044 to resolve darwin objc test fails.
llvm-svn: 222047
2014-11-14 21:54:46 +00:00
Anton Korobeynikov dc12b367bc Follow-up to D6217
Summary:
Ok, here is somewhat addition to D6217 aiming to preserve old darwin behavior wrt the typedefed types. The actual change to SemaChecking turned out to be pretty gross, in particular:
  1. We need to extract the typedef'ed type for proper diagnostics
  2. We need to walk over paren expressions as well

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 222044
2014-11-14 21:41:07 +00:00
Hans Wennborg 05d50a9645 clang-cl: Ignore the new /Zo[-] option (PR21571)
Also fix the ignored options test which didn't fail properly on
unknown options.

llvm-svn: 222013
2014-11-14 18:24:08 +00:00
Fariborz Jahanian b7859ddf9b [Sema]. Warn when logical expression is a pointer
which evaluates to true. rdar://18716393.
Reviewed by Richard Trieu

llvm-svn: 222009
2014-11-14 17:12:50 +00:00
Aaron Ballman a0344c5d7b Complete support for the SD-6 standing document (based off N4200) with support for __has_cpp_attribute.
llvm-svn: 221991
2014-11-14 13:44:02 +00:00
Bill Schmidt 8ff672d397 [PowerPC] Enable vec_perm for long long and double vector types for VSX
VSX makes the "vector long long" and "vector double" types available.
This patch enables the vec_perm interface for these types.  The same
builtin is generated regardless of the specified type, so no
additional work or testing is needed in the back end.  Tests are added
to ensure this builtin is generated by the front end.

llvm-svn: 221988
2014-11-14 13:10:13 +00:00