Commit Graph

26924 Commits

Author SHA1 Message Date
Reid Kleckner da30cff9ef [diagnostics] Avoid crashes while printing macro backtraces
When attempting to map a source into a given level of macro expansion,
this code was ignoring the possibility that the start and end of the
range might take wildly different paths through the tree of macro
expansions. It was assuming that the begin spelling location would
always precede the end spelling location, which is false. A macro can
easily transpose its arguments.

This also fixes a related issue where there are extra macro arguments
between the begin location and the end location. In this situation, we
now highlight the entire macro invocation.

Pair programmed with Richard Smith.

Fixes PR12818.

llvm-svn: 254981
2015-12-08 01:08:09 +00:00
Devin Coughlin 7bdca8b24f [analyzer] Fix crash when lambda captures a variable-length array.
When a C++ lambda captures a variable-length array, it creates a capture
field to store the size of the array. The initialization expression for this
capture is null, which led the analyzer to crash when initializing the field.
To avoid this, use the size expression from the VLA type to determine the
initialization value.

rdar://problem/23748072

llvm-svn: 254962
2015-12-07 23:01:53 +00:00
Teresa Johnson ecc8038571 Remove target specifier from new tests
Hopefully fix the remaining bot failure from r254927. Remove
target specification since it shouldn't be needed, and this causes
an error when trying to check the pass execution structure in
test/CodeGen/thinlto_backend.c on non-x86 arches.

llvm-svn: 254940
2015-12-07 20:40:36 +00:00
Teresa Johnson f5ae87d70d Adjust test to fix bot error from r254927.
Remove the part of the error message that may vary across systems.

llvm-svn: 254938
2015-12-07 20:26:57 +00:00
Teresa Johnson aff223278c [ThinLTO] Option to invoke ThinLTO backend passes and importing
Summary:
Adds new option -fthinlto-index=<file> to invoke the LTO pipeline
along with function importing via clang using the supplied function
summary index file. This supports invoking the parallel ThinLTO
backend processes in a distributed build environment via clang.

Additionally, this causes the module linker to be invoked on the bitcode
file being compiled to perform any necessary promotion and renaming of
locals that are exported via the function summary index file.

Add a couple tests that confirm we get expected errors when we try to
use the new option on a file that isn't bitcode, or specify an invalid
index file. The tests also confirm that we trigger the expected function
import pass.

Depends on D15024

Reviewers: joker.eph, dexonsmith

Subscribers: joker.eph, davidxl, cfe-commits

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

llvm-svn: 254927
2015-12-07 19:21:34 +00:00
Alexey Bataev 1fd4aed26b [OPENMP 4.5] parsing/sema support for 'grainsize' clause.
OpenMP 4.5 adds 'taksloop' and 'taskloop simd' directives, which have 'grainsize' clause. Patch adds parsing/sema analysis of this clause.

llvm-svn: 254903
2015-12-07 12:52:51 +00:00
Alexey Bataev b825de17b7 [OPENMP 4.5] parsing/sema support for 'nogroup' clause.
OpenMP 4.5 adds 'taskloop' and 'taskloop simd' directives. These directives have new 'nogroup' clause. Patch adds basic parsing/sema support for this clause.

llvm-svn: 254899
2015-12-07 10:51:44 +00:00
Faisal Vali 30622bb6a5 Fix PR20334: invalid assertion while diagnosing list initialization failure
https://llvm.org/bugs/show_bug.cgi?id=20334

Unfortunately, clang currently checks for a certain brokenness of implementations of std::initializer_list in CodeGen (void 
AggExprEmitter::VisitCXXStdInitializerListExpr), not in SemaInit.  Until that is fixed, make sure we don't let broken attempts that are aggregates leak through into sema, which allows maintenance of expected invariants, and avoids triggering an assertion.



 

llvm-svn: 254889
2015-12-07 02:37:44 +00:00
Serge Pavlov 3a5614599a [PGO] Instrument only base constructors and destructors.
Constructors and destructors may be represented by several functions
in IR. Only base structors correspond to source code, others are
small pieces of code and eventually call the base variant. In this
case instrumentation of non-base structors has little sense, this
fix remove it. Now profile data of a declaration corresponds to
exactly one function in IR, it agrees with the current logic of the
profile data loading.

This change fixes PR24996.

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

llvm-svn: 254876
2015-12-06 14:32:39 +00:00
Simon Pilgrim 474f24cc5e [X86][3DNow!] 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.

The llvm tests will (re)added in a future commit

llvm-svn: 254849
2015-12-05 11:12:23 +00:00
Simon Pilgrim dfd2cf3f89 Updated test names to match the intrinsics being tested
llvm-svn: 254848
2015-12-05 11:08:51 +00:00
Simon Pilgrim efc2e45b77 [X86][F16C] 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.

The llvm tests will (re)added in a future commit

I will update PR24580 on this new plan

llvm-svn: 254847
2015-12-05 10:37:35 +00:00
Devin Coughlin 46089867de [analyzer] Fix MemRegion crash casting non-struct to derived struct (PR25426).
This commit prevents MemRegion::getAsOffset() from crashing when the analyzed
program casts a symbolic region of a non-record type to some derived type and
then attempts to access a field of the base type.

rdar://problem/23458069

llvm-svn: 254806
2015-12-05 00:22:36 +00:00
Nico Weber 7123bca7fb 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.

llvm-svn: 254750
2015-12-04 19:14:14 +00:00
Filipe Cabecinhas 3e127d984f [PS4] Add an additional test for ASan+UBSan
llvm-svn: 254723
2015-12-04 16:18:03 +00:00
Gabor Horvath e86cb2e822 [analyzer] Improve modelling of nullptr_t in the analyzer. Fix PR25414.
Differential Revision: http://reviews.llvm.org/D15007

llvm-svn: 254718
2015-12-04 15:02:30 +00:00
Devin Coughlin ebeed88078 [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.

llvm-svn: 254702
2015-12-04 05:00:36 +00:00
Richard Smith 5c40f09b3d 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).

llvm-svn: 254699
2015-12-04 03:00:44 +00:00
Stephen Hines 8267e7d456 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.

Reviewers: asl, rsmith, ADodds, rnk

Subscribers: rnk, aemerson, tberghammer, danalbert, srhines, cfe-commits, pirama

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

llvm-svn: 254682
2015-12-04 01:39:30 +00:00
Petar Jovanovic 402257b84e [PowerPC] Fix calculating address of arguments on stack for variadic func
Fix calculating address of arguments larger than 32 bit on stack for
variadic functions (rounding up address to alignment) on ppc32 architecture.

Patch by Strahinja Petrovic.

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

llvm-svn: 254670
2015-12-04 00:26:47 +00:00
Richard Smith 2b2a176752 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.

llvm-svn: 254663
2015-12-03 23:24:04 +00:00
George Burgess IV 5e8701c356 Fix pass_object_size test on Windows.
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.

llvm-svn: 254650
2015-12-03 21:15:22 +00:00
George Burgess IV c3ec9508ea Add tests for `&enable_if_function` diagnostics.
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.

llvm-svn: 254646
2015-12-03 20:54:58 +00:00
Devin Coughlin dfde655461 [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.

llvm-svn: 254639
2015-12-03 19:41:24 +00:00
George Burgess IV 08a4a8c389 Add tests for pass_object_size.
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. :)

llvm-svn: 254632
2015-12-03 19:19:09 +00:00
Nico Weber 08c9333df2 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).

llvm-svn: 254622
2015-12-03 17:44:51 +00:00
NAKAMURA Takumi 66389e8ff2 Fix clang/test/Sema/struct-packed-align.c. "Windows" is not MS compiler.
llvm-svn: 254614
2015-12-03 16:03:34 +00:00
Nico Weber ae92083d72 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.

llvm-svn: 254612
2015-12-03 15:40:23 +00:00
Krzysztof Parzyszek fceb4e7cb4 Unxfail passing test: test/CodeGenCXX/crash.cpp
llvm-svn: 254606
2015-12-03 12:03:56 +00:00
Alexander Kornienko 061900fea8 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) {}

llvm-svn: 254605
2015-12-03 11:37:28 +00:00
Alexey Bataev 0a6ed84a0d [OPENMP 4.5] Parsing/sema support for 'omp taskloop simd' directive.
OpenMP 4.5 adds directive 'taskloop simd'. Patch adds parsing/sema analysis for 'taskloop simd' directive and its clauses.

llvm-svn: 254597
2015-12-03 09:40:15 +00:00
Alexey Bataev 830dfccfb2 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

llvm-svn: 254596
2015-12-03 09:34:49 +00:00
Simon Pilgrim 068c2ce836 [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.

The llvm tests will (re)added in a future commit

I will update PR24580 on this new plan

llvm-svn: 254594
2015-12-03 08:45:21 +00:00
Sanjay Patel 4994956f1a generalize CHECK lines to make buildbot happy
llvm-svn: 254576
2015-12-03 01:51:39 +00:00
Richard Smith 0c6124ba82 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.

llvm-svn: 254574
2015-12-03 01:36:22 +00:00
Sanjay Patel a30cee6272 change an assert when generating fmuladd to an ordinary 'if' check (PR25719)
We don't want to generate fmuladd if there's a use of the fmul expression, but this shouldn't be an assert.

The test case is derived from the commit message for r253337:
http://reviews.llvm.org/rL253337

That commit reverted r253269:
http://reviews.llvm.org/rL253269

...but the bug exists independently of the default fp-contract setting. It just became easier to hit with that change.

PR25719:
https://llvm.org/bugs/show_bug.cgi?id=25719

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

llvm-svn: 254573
2015-12-03 01:25:12 +00:00
Sanjay Patel ef350e6a85 fix typos; NFC
llvm-svn: 254561
2015-12-02 23:06:17 +00:00
George Burgess IV 3e3bb95b69 Add the `pass_object_size` attribute to clang.
`pass_object_size` is our way of enabling `__builtin_object_size` to
produce high quality results without requiring inlining to happen
everywhere.

A link to the design doc for this attribute is available at the
Differential review link below.

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

llvm-svn: 254554
2015-12-02 21:58:08 +00:00
Sumanth Gundapaneni b79fdff9e2 Fix the clang driver when "-nostdlib" is present
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.

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

llvm-svn: 254535
2015-12-02 19:12:41 +00:00
Samuel Antao 4af1b7b693 [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.

Reviewers: hfinkel, rjmccall, ABataev

Subscribers: cfe-commits, carlo.bertolli

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

llvm-svn: 254521
2015-12-02 17:44:43 +00:00
Christof Douma ba13ad58f7 Teaches clang about Cortex-A35.
Adds support for the new Cortex-A35 ARMv8-A core.

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

llvm-svn: 254505
2015-12-02 12:03:42 +00:00
NAKAMURA Takumi 2d91266473 clang/test/Driver/crash-report-modules.m: Avoid using /tmp/.
Temporary directories should be controlled with $LIT_PRESERVES_TMP.

llvm-svn: 254485
2015-12-02 03:13:50 +00:00
David Majnemer f3027177bc [MS ABI] Correctly mangle nullptr member pointers for variable templates
Variable templates behave the same as class templates with regard to
nullptr memeber pointers.

llvm-svn: 254439
2015-12-01 19:13:51 +00:00
Alexey Bataev a056935a2f [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.

llvm-svn: 254398
2015-12-01 10:17:31 +00:00
Gabor Horvath fe2c0ff942 [analyzer] Fix IssueHash generation.
Differential Revision: http://reviews.llvm.org/D14919 

Original patch by: Gyorgy Orban!

llvm-svn: 254394
2015-12-01 09:00:41 +00:00
Alexey Bataev 49f6e78d71 [OPENMP 4.5] Parsing/sema analysis for 'taskloop' directive.
Adds initial parsing and semantic analysis for 'taskloop' directive.

llvm-svn: 254367
2015-12-01 04:18:41 +00:00
Richard Smith 64daf7b1a5 [modules] Don't reject multiple modules providing contents for the same embedded file.
llvm-svn: 254365
2015-12-01 03:32:49 +00:00
Richard Smith 5a99c49d2e 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.

llvm-svn: 254359
2015-12-01 01:10:48 +00:00
NAKAMURA Takumi 58a7577491 [PR25661] Revert part of r217213 according to r254323.
llvm-svn: 254346
2015-11-30 23:46:32 +00:00
David Majnemer a381cda78c [MS Compat] Adjust thiscall to cdecl when deducing template arguments
Function types can be extracted from member pointer types.
However, the type is not appropriate without first adjusting the calling
convention.

This fixes PR25661.

llvm-svn: 254323
2015-11-30 20:34:28 +00:00