Nico Weber [Fri, 4 Dec 2015 19:14:14 +0000 (19:14 +0000)]
Fix debug info for Objective-C properties from class extensions after r251874
After r251874, properties from class extensions no longer show up in
ObjCInterfaceDecl::properties(). Make debug info emission explicitly
look for properties in class extensions before looking at direct properties.
Also add a test that checks for this. There are three interesting cases:
1. A property is only declared in a class extension, and the @implementation
is in a different file. This used to generated a DIObjcProperty before
r251874 and does again with this fix.
2. A property is declared as readonly in the class itself and redeclared as
readwrite in a class extension. clang before r251874 put the DIObjcProperty
on the first declaration. clang after r251874 didn't emit any DIObjcProperty,
and clang with this fix puts it on the readwrite redeclaration (which is
what lookup finds). This seems like a progression.
3. Like 2, but with an @implementation in the same file. In this case,
the property debug info gets generated a second time through the ivar
from the definition. In this case, lookup and declaration code need
to agree on the line number so that the DIObjcProperty isn't emitted
twice. In this case, clang before r251874 emitted one DIObjcProperty
on the first declaration, clang with r251874 emitted one on the second
declaration, and clang with this patch still does the latter.
Alexey Samsonov [Fri, 4 Dec 2015 17:30:29 +0000 (17:30 +0000)]
Clang documentation for UBSan.
Summary:
Create a separate page describing UBSan tool, move the description of
fine-grained checks there, provide extra information about supported
platforms, symbolization etc. This text is compiled from four parts:
* Existing documentation copied from User's Manual
* Layout used in documentation for another sanitizers (ASan, MSan etc.)
* Text written from scratch
* Small parts taken from Michael Morrison's attempt at creating UBSan
page:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20141215/249503.html
Devin Coughlin [Fri, 4 Dec 2015 05:00:36 +0000 (05:00 +0000)]
[analyzer] Support inlining lambda-converted blocks.
clang converts C++ lambdas to blocks with an implicit user-defined conversion
operator method on the lambda record. This method returns a block that captures a copy
of the lambda. To inline a lambda-converted block, the analyzer now calls the lambda
records's call operator method on the lambda captured by the block.
Richard Smith [Fri, 4 Dec 2015 03:00:44 +0000 (03:00 +0000)]
Don't assert if evaluation of an expression that we're syntactically required
to treat as an ICE results in undefined behavior. Instead, return the "natural"
result of the operation (signed wraparound / inf / nan).
Stephen Hines [Fri, 4 Dec 2015 01:39:30 +0000 (01:39 +0000)]
LLDB JIT needs android vector passing rules.
Summary:
Looking into some recent issues with LLDBs expression parser highlighted that upstream clang passes vectors types differently to Android Open Source Project's clang for Arm Android targets.
This patch reflects the changes present in the AOSP and allows LLDB's JIT expression evaluation to work correctly for Arm Android targets when passing vectors.
This is submitted with consent of the original author Stephen Hines.
Richard Smith [Thu, 3 Dec 2015 23:24:04 +0000 (23:24 +0000)]
PR25731: namespace alias declarations can appear at block scope; ensure that we
do scope-based lookup when looking for redeclarations of them. Add some related
missing checks for the scope-based redeclaration lookup: properly filter the
list of found declarations to match the scope, and diagnose shadowing of a
template parameter name.
The tests were failing because the types of some member functions, when
printed, unexpectedly had "__attribute__((thiscall))" at the end. The
types in question were relatively unimportant to begin with, so they
were removed/replaced with regexes.
The introduction of pass_object_size fixed a few bugs related to taking
the address of a function with enable_if attributes. This patch adds
tests for the cases that were fixed.
Devin Coughlin [Thu, 3 Dec 2015 19:41:24 +0000 (19:41 +0000)]
[analyzer] Suppress stack address escape on CK_CopyAndAutoreleaseBlockObject.
Don't warn about addresses of stack-allocated blocks escaping if the block
region was cast with CK_CopyAndAutoreleaseBlockObject. These casts, which
are introduced in the implicit conversion operator for lambda-to-block
conversions, cause the block to be copied to the heap -- so the warning is
spurious.
These additions were meant to go in as a part of r254554; while it's
certainly nice to have new functionality, it's nicer if we have tests to
go with it. :)
Nico Weber [Thu, 3 Dec 2015 17:44:51 +0000 (17:44 +0000)]
Fix Objective-C metadata for properties from class extensions after r251874
After, properties from class extensions no longer show up in
ObjCInterfaceDecl::properties(). Make ObjCCommonMac::EmitPropertyList()
explicitly look for properties in class extensions before looking at
direct properties.
Also add a test that passes both with clang before r251874 and after this
patch (but fails with r251874 and without this patch).
Nico Weber [Thu, 3 Dec 2015 15:40:23 +0000 (15:40 +0000)]
Make check-clang depend on LTO.
r249143 added test/Driver/darwin-ld-lto.c which requires libLTO.dylib
to pass, but when running `ninja check-clang` in a fresh build directory
nothing caused libLTO.dylib to be built and the test would fail.
Revert "Fix for merging decls in pragma weak Calling CheckFunctionDeclaration so that 2 decls for the 'weak' are merged. Differential Revision: http://reviews.llvm.org/D13048"
This reverts commit r254143 which introduces a crash on the following input:
f(char *);
g(char *);
#pragma weak f = g
int g(char *p) {}
Alexey Bataev [Thu, 3 Dec 2015 09:34:49 +0000 (09:34 +0000)]
PR25575: Make GCC 4.4+ comatible layout for packed bit-fileds of char type, patch by D. Polukhin
This CL is for discussion how to better fix bit-filed layout compatibility issue with GCC (see PR25575 for test case and more details). Current clang behavior is compatible with GCC 4.1-4.3 series but it was fixed in 4.4+. Ignoring packed attribute looks very odd and because it was also fixed in GCC 4.4+, it makes sense also fix it in clang.
Differential Revision: http://reviews.llvm.org/D14872
Simon Pilgrim [Thu, 3 Dec 2015 08:45:21 +0000 (08:45 +0000)]
[X86] Stripped backend codegen tests
As discussed on the ml, backend tests need to be put in llvm/test/CodeGen/X86 as fast-isel tests using IR that is as close to what is generated here as possible.
Richard Smith [Thu, 3 Dec 2015 01:36:22 +0000 (01:36 +0000)]
PR17381: Treat undefined behavior during expression evaluation as an unmodeled
side-effect, so that we don't allow speculative evaluation of such expressions
during code generation.
This caused a diagnostic quality regression, so fix constant expression
diagnostics to prefer either the first "can't be constant folded" diagnostic or
the first "not a constant expression" diagnostic depending on the kind of
evaluation we're doing. This was always the intent, but didn't quite work
correctly before.
This results in certain initializers that used to be constant initializers to
no longer be; in particular, things like:
float f = 1e100;
are no longer accepted in C. This seems appropriate, as such constructs would
lead to code being executed if sanitizers are enabled.
This patch is a fix to r252901 which changed the behavior of
clang driver. In the presence of "-nostdlib" none of the standard
libraries should be passed to link line.
Samuel Antao [Wed, 2 Dec 2015 17:44:43 +0000 (17:44 +0000)]
[OpenMP] Update target directive codegen to use 4.5 implicit data mappings.
Summary:
This patch implements the 4.5 specification for the implicit data maps. OpenMP 4.5 specification changes the default way data is captured into a target region. All the non-aggregate kinds are passed by value by default. This required activating the capturing by value during SEMA for the target region. All the non-aggregate values that can be encoded in the size of a pointer are properly casted and forwarded to the runtime library. On top of fixing the previous weird behavior for mapping pointers in nested data regions (an explicit map was always required), this also improves performance as the number of allocations/transactions to the device per non-aggregate map are reduced from two to only one - instead of passing a reference and the value, only the value passed.
Explicit maps will be added later on once firstprivate, private, and map clauses' SEMA and parsing are available.
Aaron Ballman [Wed, 2 Dec 2015 15:05:47 +0000 (15:05 +0000)]
Amending r254423 by deleting the copy constructor and adding a move constructor instead; NFC as neither of these constructors are currently called, but this is a safer design.
Alexey Bataev [Tue, 1 Dec 2015 10:17:31 +0000 (10:17 +0000)]
[OPENMP 4.5] Parsing/sema analysis for 'priority' clause.
OpenMP 4.5 defines new clause 'priority' for 'task', 'taskloop' and 'taskloop simd' directives. Added parsing and sema analysis for 'priority' clause in 'task' and 'taskloop' directives.
Craig Topper [Tue, 1 Dec 2015 07:12:59 +0000 (07:12 +0000)]
[X86] Improve codegen for AVX2 gather with an all 1s mask.
Use undefined instead of setzero as the pass through input since its going to be fully overwritten. Use cmpeq of two zero vectors to produce the all 1s vector. Casting -1 to a double and vectorizing causes a constant load of a -1.0 floating point value.
Richard Smith [Tue, 1 Dec 2015 01:10:48 +0000 (01:10 +0000)]
Fix use-after-free when a C++ thread_local variable gets replaced (because its
type changes when the initializer is attached). Don't hold onto the
GlobalVariable*; recompute it from the VarDecl* instead.
Samuel Antao [Mon, 30 Nov 2015 17:26:28 +0000 (17:26 +0000)]
Add --gcc-toolchain= to one of the libclang unitests to fix issue related to
the gcc libraries clang picks for when it was configures with a user defined
path.
Revert Sparc and SparcV9 to external assembler. Now that the CPU
handling is corrected, the primary reason for forcing IAS as default is
gone and the remaining issues are still somewhat problematic in common
situations.
Oliver Stannard [Thu, 26 Nov 2015 15:38:54 +0000 (15:38 +0000)]
[AArch64] Add command-line options for Statistical Profiling Extension
This adds the "+profile" and +noprofile" suffixes for the -march and
-mcpu options, to allow enabling or disabling the options Statistical
Profiling Extension to ARMv8.2-A.
Oliver Stannard [Thu, 26 Nov 2015 15:36:42 +0000 (15:36 +0000)]
[AArch64] Add command-line options for ARMv8.2-A
This adds new values for the -march option (armv8.2a and armv8.2-a,
which are aliases of each other), and new suffixes for the -march and
-mcpu options (+fp16 and +nofp16), to allow targeting the ARMv8.2-A
architecture and it's optional half-precision floating-point extension.
Alexander Musman [Thu, 26 Nov 2015 09:34:30 +0000 (09:34 +0000)]
Fix for merging decls in pragma weak
Calling CheckFunctionDeclaration so that 2 decls for the 'weak' are merged.
Differential Revision: http://reviews.llvm.org/D13048
Alexey Bataev [Thu, 26 Nov 2015 07:50:39 +0000 (07:50 +0000)]
[OPENMP 4.5] Fixed rules for 'ordered' clause.
According to OpenMP 4.5 the parameter of 'ordered' clause must be greater than or equal to the parameter of 'collapse' clause. Patch adds this rule.
Richard Smith [Thu, 26 Nov 2015 02:04:16 +0000 (02:04 +0000)]
[modules] Refactor handling of -fmodules-embed-*. Track this properly rather
than reusing the "overridden buffer" mechanism. This will allow us to make
embedded files and overridden files behave differently in future.
Devin Coughlin [Thu, 26 Nov 2015 00:11:23 +0000 (00:11 +0000)]
[analyzer] Add tests for generalized lambda capture (C++14). NFC.
Add tests demonstrating that the analyzer supports generalized lambda capture. This
support falls out naturally from the work Gábor Horváth did adding C++11 lambdas to
the analyzer.