]> granicus.if.org Git - clang/log
clang
8 years agoKeep -fmodule-implementation-of as an alias of -fmodule-name.
Manman Ren [Wed, 6 Apr 2016 23:28:26 +0000 (23:28 +0000)]
Keep -fmodule-implementation-of as an alias of -fmodule-name.

This helps us transitioning to -fmodule-name. Once the transitioning is done,
we can remove this alias.

rdar://24800983

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265616 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "Set the default C standard to C99 when targeting the PS4."
Sean Silva [Wed, 6 Apr 2016 21:06:52 +0000 (21:06 +0000)]
Revert "Set the default C standard to C99 when targeting the PS4."

This reverts r265359.

It breaks
- llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast
- llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast

Failing Tests (5):
    Clang :: FixIt/fixit-errors.c
    Clang :: Preprocessor/init.c
    Clang :: Sema/attr-deprecated.c
    Clang :: Sema/nullability.c
    Clang :: SemaObjC/objcbridge-attribute-arc.m

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265601 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[modules] Add forgotten test case to r265597.
Vassil Vassilev [Wed, 6 Apr 2016 20:58:12 +0000 (20:58 +0000)]
[modules] Add forgotten test case to r265597.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265599 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix order-of-evaluation bug (causing GCC buildbots to fail).
Richard Smith [Wed, 6 Apr 2016 20:57:53 +0000 (20:57 +0000)]
Fix order-of-evaluation bug (causing GCC buildbots to fail).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265598 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[modules] Don't try to add lookup results to non-lookup contexts.
Vassil Vassilev [Wed, 6 Apr 2016 20:56:03 +0000 (20:56 +0000)]
[modules] Don't try to add lookup results to non-lookup contexts.

Fixes https://llvm.org/bugs/show_bug.cgi?id=27186

Patch reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265597 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMinor simplifications.
Richard Smith [Wed, 6 Apr 2016 20:12:34 +0000 (20:12 +0000)]
Minor simplifications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265594 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRestore slightly less dodgy diagnostic handler for inline asm
Tim Northover [Wed, 6 Apr 2016 19:58:07 +0000 (19:58 +0000)]
Restore slightly less dodgy diagnostic handler for inline asm

Turns out it was there mostly to prevent Clang asking people to report a bug.
This time we report something to Clang's real diagnostics handler so that it
exits with something approximating a real error and tidies up after itself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265592 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDiagnose template alias declarations in local classes.
Richard Smith [Wed, 6 Apr 2016 17:38:58 +0000 (17:38 +0000)]
Diagnose template alias declarations in local classes.

Patch by Erik Pilkington!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265571 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoNFC: make AtomicOrdering an enum class
JF Bastien [Wed, 6 Apr 2016 17:26:42 +0000 (17:26 +0000)]
NFC: make AtomicOrdering an enum class

Summary: See LLVM change D18775 for details, this change depends on it.

Reviewers: jyknight, reames

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265569 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRe-commit r265518 ("[modules] Continue factoring encoding of AST records out of
Richard Smith [Wed, 6 Apr 2016 17:06:00 +0000 (17:06 +0000)]
Re-commit r265518 ("[modules] Continue factoring encoding of AST records out of
ASTWriter."), reverted in r265526, with a fix for an iterator invalidation bug
(thanks, MSan!).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265564 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoclang-format: Fix label-in-if statement in macros where it is actually used.
Daniel Jasper [Wed, 6 Apr 2016 16:41:39 +0000 (16:41 +0000)]
clang-format: Fix label-in-if statement in macros where it is actually used.

Before:
  #define A \
    if (a)  \
    label:  \
    f()

After:
  #define A \
    if (a)  \
    label:  \
      f()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265557 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoEnable PIE for CloudABI.
Ed Schouten [Wed, 6 Apr 2016 15:37:06 +0000 (15:37 +0000)]
Enable PIE for CloudABI.

As we're currently working on making CloudABI executables easier to
emulate in userspace (e.g., on OS X and Windows), it makes a whole lot
of sense to build these using PIE. By using PIE, they can simply be
loaded into the existing process address space without clashes.

PIE support got added to CloudABI's C library and seems to work pretty
well. CloudABI does not make use of an ld.so, so the binary's _start()
has all the logic in it to do the relocations.

Now that all but one bug in LLD relating to PIE support have been
squashed (and a patch for that is already in code review), I'd like to
go ahead and force the use of PIE for Clang 3.9. When released, we'll
also switch over to using LLD exclusively.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265546 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoclang-format: Support labels in brace-less ifs.
Daniel Jasper [Wed, 6 Apr 2016 15:02:46 +0000 (15:02 +0000)]
clang-format: Support labels in brace-less ifs.

While I am not personally convinced about the usefulness of this
construct, we should break it.

Before:
  if (a) label:
  f();

After:
  if (a)
  label:
    f();

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265545 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoclang-format: Fix incorrect function annotation detection.
Daniel Jasper [Wed, 6 Apr 2016 13:58:09 +0000 (13:58 +0000)]
clang-format: Fix incorrect function annotation detection.

Before:
  MACRO(
      abc).function() // wrap
      << abc;

After:
  MACRO(abc).function() // wrap
      << abc;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265540 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OPENMP] Parsing and Sema support for 'omp declare target' directive
Dmitry Polukhin [Wed, 6 Apr 2016 11:38:59 +0000 (11:38 +0000)]
[OPENMP] Parsing and Sema support for 'omp declare target' directive

Add parsing, sema analysis for 'declare target' construct for OpenMP 4.0
(4.5 support will be added in separate patch).

The declare target directive specifies that variables, functions (C, C++
and Fortran), and subroutines (Fortran) are mapped to a device. The declare
target directive is a declarative directive. In Clang declare target is
implemented as implicit attribute for the declaration.

The syntax of the declare target directive is as follows:

 #pragma omp declare target
 declarations-definition-seq
 #pragma omp end declare target

Based on patch from Michael Wong http://reviews.llvm.org/D15321

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265530 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "[modules] Continue factoring encoding of AST records out of ASTWriter."
Dmitry Polukhin [Wed, 6 Apr 2016 10:01:46 +0000 (10:01 +0000)]
Revert "[modules] Continue factoring encoding of AST records out of ASTWriter."

This reverts commit r265518.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265526 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[modules] Continue factoring encoding of AST records out of ASTWriter.
Richard Smith [Wed, 6 Apr 2016 06:26:08 +0000 (06:26 +0000)]
[modules] Continue factoring encoding of AST records out of ASTWriter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265518 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUpdate testing cases after backend changes.
Manman Ren [Tue, 5 Apr 2016 23:27:51 +0000 (23:27 +0000)]
Update testing cases after backend changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265488 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix a crash on invalid with template handling
Richard Trieu [Tue, 5 Apr 2016 21:13:54 +0000 (21:13 +0000)]
Fix a crash on invalid with template handling

This is a fix for https://llvm.org/bugs/show_bug.cgi?id=25561 which was a
crash on invalid.  Change the handling of invalid decls to have a catch-all
case to prevent unexpecting decls from triggering an assertion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265467 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix broken tests from no-jump-table commit
Nirav Dave [Tue, 5 Apr 2016 18:59:37 +0000 (18:59 +0000)]
Fix broken tests from no-jump-table commit

Summary: Fix failing tests from no-jump-table flag addition

Reviewers: jyknight

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265439 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CUDA] Show --cuda-gpu-arch option in clang --help.
Justin Lebar [Tue, 5 Apr 2016 18:26:25 +0000 (18:26 +0000)]
[CUDA] Show --cuda-gpu-arch option in clang --help.

For some reason it was hidden.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265436 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CUDA] Add -fcuda-flush-denormals-to-zero.
Justin Lebar [Tue, 5 Apr 2016 18:26:20 +0000 (18:26 +0000)]
[CUDA] Add -fcuda-flush-denormals-to-zero.

Summary:
Setting this flag causes all functions are annotated with the
"nvvm-f32ftz" = "true" attribute.

In addition, we annotate the module with "nvvm-reflect-ftz" set
to 0 or 1, depending on whether -cuda-flush-denormals-to-zero is set.
This is read by the NVVMReflect pass.

Reviewers: tra, rnk

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265435 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix missing period in no-jump-table flag comment. NFC.
Nirav Dave [Tue, 5 Apr 2016 18:11:01 +0000 (18:11 +0000)]
Fix missing period in no-jump-table flag comment. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265432 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd -fno-jump-tables and-fjump-tables flags
Nirav Dave [Tue, 5 Apr 2016 17:50:43 +0000 (17:50 +0000)]
Add -fno-jump-tables and-fjump-tables flags

Add no-jump-tables flag to disable use of jump tables when lowering
switch statements

Reviewers: echristo, hans

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265425 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[X86] Introduction of -march=lakemont.
Andrey Turetskiy [Tue, 5 Apr 2016 15:04:26 +0000 (15:04 +0000)]
[X86] Introduction of -march=lakemont.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265405 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoclang-format: Fix cast detection on "this".
Daniel Jasper [Tue, 5 Apr 2016 11:46:06 +0000 (11:46 +0000)]
clang-format: Fix cast detection on "this".

Before:
  auto x = (X) this;

After:
  auto x = (X)this;

This fixes llvm.org/PR27198.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265385 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoConsolidate and improve the handling of built-in feature-like macros
Andy Gibbs [Tue, 5 Apr 2016 08:36:47 +0000 (08:36 +0000)]
Consolidate and improve the handling of built-in feature-like macros

Summary:
The parsing logic has been separated out from the macro implementation logic, leading to a number of improvements:

* Gracefully handle unexpected/invalid tokens, too few, too many and nested parameters
* Provide consistent behaviour between all built-in feature-like macros
* Simplify the implementation of macro logic
* Fix __is_identifier to correctly return '0' for non-identifiers

Reviewers: doug.gregor, rsmith

Subscribers: rsmith, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265381 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoMove local helper class into anonymous namespace.
Richard Smith [Mon, 4 Apr 2016 23:29:43 +0000 (23:29 +0000)]
Move local helper class into anonymous namespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265364 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix test failure from r265361
Reid Kleckner [Mon, 4 Apr 2016 23:14:14 +0000 (23:14 +0000)]
Fix test failure from r265361

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265362 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSet the default C standard to C99 when targeting the PS4.
Sunil Srivastava [Mon, 4 Apr 2016 22:56:05 +0000 (22:56 +0000)]
Set the default C standard to C99 when targeting the PS4.

Patch by Douglas Yung!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265359 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix "suggest parentheses" warning.
James Y Knight [Mon, 4 Apr 2016 22:35:56 +0000 (22:35 +0000)]
Fix "suggest parentheses" warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265355 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix an unused-variable warning by using the variable in the place
John McCall [Mon, 4 Apr 2016 20:39:50 +0000 (20:39 +0000)]
Fix an unused-variable warning by using the variable in the place
it was supposed to have been used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265344 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CrashReproducer] Pass -I, -F and -resource-dir to the reproducer script when using...
Bruno Cardoso Lopes [Mon, 4 Apr 2016 20:26:57 +0000 (20:26 +0000)]
[CrashReproducer] Pass -I, -F and -resource-dir to the reproducer script when using modules/vfs

The reproducer should use -I/-F/-resource-dir in the same way as the
original command. The VFS already collects the right headers but without
these flags the reproducer will fail to do the right thing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265343 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Sema] Delete FIXME that has been fixed. NFC.
George Burgess IV [Mon, 4 Apr 2016 19:44:16 +0000 (19:44 +0000)]
[Sema] Delete FIXME that has been fixed. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265341 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix redundant "typename typename T" in Visual Studio Native Visualizer
Mike Spertus [Mon, 4 Apr 2016 19:36:48 +0000 (19:36 +0000)]
Fix redundant "typename typename T" in Visual Studio Native Visualizer

Also, a little minor cleanup

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265338 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAssignment operators should return by reference.
John McCall [Mon, 4 Apr 2016 18:53:01 +0000 (18:53 +0000)]
Assignment operators should return by reference.

Thanks to Sean Silva for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265328 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd copyright notice to the modulemap file.
Yunzhong Gao [Mon, 4 Apr 2016 18:46:09 +0000 (18:46 +0000)]
Add copyright notice to the modulemap file.

The module.modulemap file in the lib/Headers directory was missing the LLVM
copyright notice. This patch adds the copyright notice just like the rest of
the files in this directory.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265325 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoIRGen-level lowering for the Swift calling convention.
John McCall [Mon, 4 Apr 2016 18:33:08 +0000 (18:33 +0000)]
IRGen-level lowering for the Swift calling convention.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265324 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd a couple of convenience operations to CharUnits.
John McCall [Mon, 4 Apr 2016 18:33:00 +0000 (18:33 +0000)]
Add a couple of convenience operations to CharUnits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265323 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OPENMP] Codegen for teams directive for NVPTX
Carlo Bertolli [Mon, 4 Apr 2016 15:55:02 +0000 (15:55 +0000)]
[OPENMP] Codegen for teams directive for NVPTX

This patch implements the teams directive for the NVPTX backend. It is different from the host code generation path as it:

Does not call kmpc_fork_teams. All necessary teams and threads are started upon touching the target region, when launching a CUDA kernel, and their execution is coordinated through sequential and parallel regions within the target region.
Does not call kmpc_push_num_teams even if a num_teams of thread_limit clause is present. Setting the number of teams and the thread limit is implemented by the nvptx-related runtime.
Please note that I am now passing a Clang Expr * to emitPushNumTeams instead of the originally chosen llvm::Value * type. The reason for that is that I want to avoid emitting expressions for num_teams and thread_limit if they are not needed in the target region.

http://reviews.llvm.org/D17963

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265304 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAnnotateFunctions: Tweak for mingw.
NAKAMURA Takumi [Mon, 4 Apr 2016 15:30:44 +0000 (15:30 +0000)]
AnnotateFunctions: Tweak for mingw.

  - Externalize the registry.
  - Update libdeps.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265301 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd a PragmaHandler Registry for plugins to add PragmaHandlers to
John Brawn [Mon, 4 Apr 2016 14:22:58 +0000 (14:22 +0000)]
Add a PragmaHandler Registry for plugins to add PragmaHandlers to

This allows plugins which add AST passes to also define pragmas to do things
like only enable certain behaviour of the AST pass in files where a certain
pragma is used.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265295 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OPENMP 4.0] Support for 'inbranch|noinbranch' clauses in 'declare
Alexey Bataev [Mon, 4 Apr 2016 10:12:15 +0000 (10:12 +0000)]
[OPENMP 4.0] Support for 'inbranch|noinbranch' clauses in 'declare
simd'.

Added parsing/semantic analysis for 'inbranch|notinbranch' clauses of
'#pragma omp declare simd' construct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265287 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix test case committed in r265197.
Akira Hatanaka [Sun, 3 Apr 2016 03:36:22 +0000 (03:36 +0000)]
Fix test case committed in r265197.

The test was failing on some release build because the basic block names
I was expecting weren't printed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265257 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[c-index-test] Fix leak in print_completion_result, NFC
Vedant Kumar [Sun, 3 Apr 2016 00:54:46 +0000 (00:54 +0000)]
[c-index-test] Fix leak in print_completion_result, NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265252 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoclang-cl: Don't skip i_group flags other than -include when building pchs.
Nico Weber [Sat, 2 Apr 2016 19:10:07 +0000 (19:10 +0000)]
clang-cl: Don't skip i_group flags other than -include when building pchs.

Before this change, e.g. -isystem flags in front of the /FI corresponding to the
pch file would be incorrectly ignored.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265238 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[test] Don't use "UNSUPPORTED" in FileCheck prefixes
Greg Parker [Sat, 2 Apr 2016 05:29:00 +0000 (05:29 +0000)]
[test] Don't use "UNSUPPORTED" in FileCheck prefixes

lit uses "UNSUPPORTED:" for its own purposes and may be
confused if that text appears elsewhere in the test file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265218 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Objective-C] Introduce objc_runtime_visible attribute.
Douglas Gregor [Fri, 1 Apr 2016 23:23:52 +0000 (23:23 +0000)]
[Objective-C] Introduce objc_runtime_visible attribute.

The objc_runtime_visible attribute deals with an odd corner case where
a particular Objective-C class is known to the Objective-C runtime
(and, therefore, accessible by name) but its symbol has been hidden
for some reason. For such classes, teach CodeGen to use
objc_lookUpClass to retrieve the Class object, rather than referencing
the class symbol directly.

Classes annotated with objc_runtime_visible have two major limitations
that fall out from places where Objective-C metadata needs to refer to
the class (or metaclass) symbol directly:

* One cannot implement a subclass of an objc_runtime_visible class.
* One cannot implement a category on an objc_runtime_visible class.

Implements rdar://problem/25494092.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265201 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CodeGen] Emit lifetime.end intrinsic after objects are destructed in
Akira Hatanaka [Fri, 1 Apr 2016 22:58:55 +0000 (22:58 +0000)]
[CodeGen] Emit lifetime.end intrinsic after objects are destructed in
landing pads.

Previously, lifetime.end intrinsics were inserted only on normal control
flows. This prevented StackColoring from merging stack slots for objects
that were destroyed on the exception handling control flow since it
couldn't tell their lifetime ranges were disjoint. This patch fixes
code-gen to emit the intrinsic on both control flows.

rdar://problem/22181976

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265197 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[modules] Start moving the code for encoding AST records out of ASTWriter into
Richard Smith [Fri, 1 Apr 2016 22:52:03 +0000 (22:52 +0000)]
[modules] Start moving the code for encoding AST records out of ASTWriter into
a separate class. The goal is for this class to have a separate lifetime from
the AST writer so that it can meaningfully track pending statement nodes and
context for more compact encoding of various types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265195 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoClean up a couple more preprocessor tests to use match-full-lines.
James Y Knight [Fri, 1 Apr 2016 21:33:20 +0000 (21:33 +0000)]
Clean up a couple more preprocessor tests to use match-full-lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265187 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDiagnose missing macro argument following charize operator.
Andy Gibbs [Fri, 1 Apr 2016 19:02:20 +0000 (19:02 +0000)]
Diagnose missing macro argument following charize operator.

For completeness, add a test-case for the equivalent stringize operator
diagnostic too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265177 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CrashReproducer] Add -fmodule-cache-path to reproducer script
Bruno Cardoso Lopes [Fri, 1 Apr 2016 17:39:08 +0000 (17:39 +0000)]
[CrashReproducer] Add -fmodule-cache-path to reproducer script

The cc1 invocation in the reproducer script should contain a valid path in
-fmodule-cache-path; for that reuse "<name>.cache/module" dir we already
use to dump the vfs and modules.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265162 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OpenCL] Moved nosvm attribute handling in Sema to other OpenCL attrs
Anastasia Stulova [Fri, 1 Apr 2016 16:05:09 +0000 (16:05 +0000)]
[OpenCL] Moved nosvm attribute handling in Sema to other OpenCL attrs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265146 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OPENMP] Fixed documentation category for 'declare simd' attribute, NFC.
Alexey Bataev [Fri, 1 Apr 2016 10:12:06 +0000 (10:12 +0000)]
[OPENMP] Fixed documentation category for 'declare simd' attribute, NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265127 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Lexer] Let the compiler infer string lengths. No functionality change intended.
Benjamin Kramer [Fri, 1 Apr 2016 10:04:07 +0000 (10:04 +0000)]
[Lexer] Let the compiler infer string lengths. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265126 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Lexer] Don't read out of bounds if a conflict marker is at the end of a file
Benjamin Kramer [Fri, 1 Apr 2016 09:58:45 +0000 (09:58 +0000)]
[Lexer] Don't read out of bounds if a conflict marker is at the end of a file

This can happen as we look for '<<<<' while scanning tokens but then expect
'<<<<\n' to tell apart perforce from diff3 conflict markers. Just harden
the pointer arithmetic.

Found by libfuzzer + asan!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265125 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OPENMP] Avoid useless recursive calls in getDSA if it is called in a loop, NFC
Dmitry Polukhin [Fri, 1 Apr 2016 09:52:30 +0000 (09:52 +0000)]
[OPENMP] Avoid useless recursive calls in getDSA if it is called in a loop, NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265123 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OPENMP 4.5] Allow data members as loop counters in loop-based
Alexey Bataev [Fri, 1 Apr 2016 09:23:34 +0000 (09:23 +0000)]
[OPENMP 4.5] Allow data members as loop counters in loop-based
directives.

OpenMP 4.5 allows privatization of non-static data members in non-static
member functions. Patch allows to use and implicit privatization of data
members used as counters in loop-based directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265121 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoRevert "[OPENMP] Allow skip expression after comma in clauses with lists."
Alexey Bataev [Fri, 1 Apr 2016 08:43:42 +0000 (08:43 +0000)]
Revert "[OPENMP] Allow skip expression after comma in clauses with lists."

This reverts commit http://reviews.llvm.org/rL265003. After some
thoughts decided to emit errors here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265119 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoVisual Studio native visualizers for clang::TemplateSpecializationType
Mike Spertus [Fri, 1 Apr 2016 03:31:43 +0000 (03:31 +0000)]
Visual Studio native visualizers for clang::TemplateSpecializationType

Displays a template specialization as, say, A<int, double>. Does not
yet handle UncommonTemplateNameStorage, QualifiedTemplateName, or
DependentTemplateName, but still more than worthwhile

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265104 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[analyzer] Prefer accessor method in extension over category in CallEvent.
Devin Coughlin [Fri, 1 Apr 2016 03:24:13 +0000 (03:24 +0000)]
[analyzer] Prefer accessor method in extension over category in CallEvent.

In ObjCMethodCall:getRuntimeDefinition(), if the method is an accessor in a
category, and it doesn't have a self declaration, first try to find the method
in a class extension. This works around a bug in Sema where multiple accessors
are synthesized for properties in class extensions that are redeclared in a
category. The implicit parameters are not filled in for the method on the
category, which causes a crash when trying to synthesize a getter for the
property in BodyFarm. The Sema bug is tracked as rdar://problem/25481164.

rdar://problem/25056531

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265103 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CUDA] Fix typo in __clang_cuda_runtime_wrapper.h.
Justin Lebar [Fri, 1 Apr 2016 00:25:42 +0000 (00:25 +0000)]
[CUDA] Fix typo in __clang_cuda_runtime_wrapper.h.

We're #including the wrong file!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265083 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdapt to LLVM API change in r265077.
Adrian Prantl [Thu, 31 Mar 2016 23:57:45 +0000 (23:57 +0000)]
Adapt to LLVM API change in r265077.
EmissionKind moved from DIBuilder to DICompileUnit.

<rdar://problem/25427165>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265078 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[index] Fix regression where ObjC method declarations may mistakenly get indexed...
Argyrios Kyrtzidis [Thu, 31 Mar 2016 20:18:22 +0000 (20:18 +0000)]
[index] Fix regression where ObjC method declarations may mistakenly get indexed as definition.

rdar://25372906

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265042 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDiagnostics: remove dodgy handler for bitcode inlineasm diagnostics.
Tim Northover [Thu, 31 Mar 2016 19:19:24 +0000 (19:19 +0000)]
Diagnostics: remove dodgy handler for bitcode inlineasm diagnostics.

Whatever crash it was there to present appears to have been fixed in the
backend now, and it had the nasty side-effect of causing clang to exit(0) and
leave a .o containing goodness knows what even when an error hit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265038 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[PGO] Avoid instrumenting constants at value sites
Betul Buyukkurt [Thu, 31 Mar 2016 18:41:34 +0000 (18:41 +0000)]
[PGO] Avoid instrumenting constants at value sites

Value profiling should not profile constants and/or constant
expressions when they appear as callees in call instructions.
Constant expressions form when a direct callee has bitcasts or
inttoptr(ptrtint (callee)) nests surrounding it. Value profiling
should avoid instrumenting such cases. Mostly NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265037 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix the comment for the function added in r264998.
Akira Hatanaka [Thu, 31 Mar 2016 18:32:38 +0000 (18:32 +0000)]
Fix the comment for the function added in r264998.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265035 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OpenCL] Added nosvm attribute for OpenCL v2.0.
Anastasia Stulova [Thu, 31 Mar 2016 11:07:22 +0000 (11:07 +0000)]
[OpenCL] Added nosvm attribute for OpenCL v2.0.

It is not widely used and removed from OpenCL v2.1.

This change modifies Clang to parse the attribute for OpenCL
but ignores it afterwards.

Patch by Liu Yaxun (Sam)!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265006 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OPENMP] Support dumping OpenMP specific constructs.
Alexey Bataev [Thu, 31 Mar 2016 09:30:50 +0000 (09:30 +0000)]
[OPENMP] Support dumping OpenMP specific constructs.

Add proper dumping support for OpenMP declarations, directives and
clauses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265004 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OPENMP] Allow skip expression after comma in clauses with lists.
Alexey Bataev [Thu, 31 Mar 2016 09:13:44 +0000 (09:13 +0000)]
[OPENMP] Allow skip expression after comma in clauses with lists.

Compatibility fix for better compatibility with the existing software.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@265003 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CodeGenCXX] Fix ItaniumCXXABI::getAlignmentOfExnObject to return 8-byte
Akira Hatanaka [Thu, 31 Mar 2016 06:36:07 +0000 (06:36 +0000)]
[CodeGenCXX] Fix ItaniumCXXABI::getAlignmentOfExnObject to return 8-byte
alignment on Darwin.

Itanium C++ ABI specifies that _Unwind_Exception should be double-word
aligned (16B). To conform to the ABI, libraries implementing exception
handling declare the struct with __attribute__((aligned)), which aligns
the unwindHeader field (and the end of __cxa_exception) to the default
target alignment (which is typically 16-bytes).

struct __cxa_exception {
  ...
  // struct is declared with __attribute__((aligned)).
  _Unwind_Exception unwindHeader;
};

Based on the assumption that _Unwind_Exception is declared with
__attribute__((aligned)), ItaniumCXXABI::getAlignmentOfExnObject returns
the target default alignment for __attribute__((aligned)). It turns out
that libc++abi, which is used on Darwin, doesn't declare the struct with
the attribute and therefore doesn't guarantee that unwindHeader is
aligned to the alignment specified by the ABI, which in some cases
causes the program to crash because of unaligned memory accesses.

This commit avoids crashes due to unaligned memory accesses by having
getAlignmentOfExnObject return an 8-byte alignment on Darwin. I've only
fixed the problem for Darwin, but we should also figure out whether other
platforms using libc++abi need similar fixes.

rdar://problem/25314277

Differential revision: http://reviews.llvm.org/D18479

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264998 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoVisual Studio native visualization for clang::TemplateDecl
Mike Spertus [Thu, 31 Mar 2016 06:09:56 +0000 (06:09 +0000)]
Visual Studio native visualization for clang::TemplateDecl

With this change, TemplateDecls display in the Locals Window something like

  template<typename T, typename U> struct A;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264997 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix -Wdynamic-class-memaccess to skip invalid classes.
Richard Trieu [Thu, 31 Mar 2016 04:18:07 +0000 (04:18 +0000)]
Fix -Wdynamic-class-memaccess to skip invalid classes.

This warning sometimes will infinitely recurse on CXXRecordDecl's from
ill-formed recursive classes that have fields of themselves.  Skip processing
these classes to prevent this from happening.
Fixes https://llvm.org/bugs/show_bug.cgi?id=27142

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264991 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[DarwinDriver] Increase the number of valid digits for ld64 version string.
Bruno Cardoso Lopes [Thu, 31 Mar 2016 02:45:46 +0000 (02:45 +0000)]
[DarwinDriver] Increase the number of valid digits for ld64 version string.

Previously only 3 digits were valid. Increase it to 5.

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

rdar://problem/24843016

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264987 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Sema] Fix PR27122: ICE with enable_if+ill-formed call.
George Burgess IV [Thu, 31 Mar 2016 00:16:25 +0000 (00:16 +0000)]
[Sema] Fix PR27122: ICE with enable_if+ill-formed call.

In some cases, when we encounter a direct function call with an
incorrect number of arguments, we'll emit a diagnostic, and pretend that
the call to the function was valid. For example, in C:

int foo();
int a = foo(1);

Prior to this patch, we'd get an ICE if foo had an enable_if attribute,
because CheckEnableIf assumes that the number of arguments it gets
passed is valid for the function it's passed. Now, we check that the
number of args looks valid prior to checking enable_if conditions.

This fix was not done inside of CheckEnableIf because the problem
presently can only occur in one caller of CheckEnableIf (ActOnCallExpr).
Additionally, checking inside of CheckEnableIf would make us emit
multiple diagnostics for the same error (one "enable_if failed", one
"you gave this function the wrong number of arguments"), which seems
worse than just complaining about the latter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264975 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CrashReproducer] Add a module map callback for added headers
Bruno Cardoso Lopes [Wed, 30 Mar 2016 23:54:25 +0000 (23:54 +0000)]
[CrashReproducer] Add a module map callback for added headers

The current ModuleDependencyCollector has a AST listener to collect
header files present in loaded modules, but this isn't enough to collect
all headers needed in the crash reproducer. One of the reasons is that
the AST writer doesn't write symbolic link header paths in the pcm modules,
this makes the listeners on the reader only able to collect the real files.

Since the module maps could contain submodules that use headers which
are symbolic links, not collecting those forbid the reproducer scripts
to regen the modules.

For instance:

usr/include/module.map:
  ...
  module pthread {
    header "pthread.h"
    export *

    module impl {
      header "pthread_impl.h"
      export *
    }
  }
  ...

usr/include/pthread/pthread_impl.h
usr/include/pthread_impl.h -> pthread/pthread_impl.h

The AST dump for the module above:

  <SUBMODULE_HEADER abbrevid=6/> blob data = 'pthread_impl.h'
  <SUBMODULE_TOPHEADER abbrevid=7/> blob data = '/<path_to_sdk>/usr/include/pthread/pthread_impl.h'

Note that we don't have "usr/include/pthread_impl.h" which is requested
by the module.map in case we want to reconstruct the module in the
reproducer. The reason the original symbolic link path isn't used is
because the headers are kept by name and requested through the
FileManager, which unique files and returns the real path only.

To fix that, add a callback to be invoked everytime a header is added
while parsing module maps and hook that up to the module dependecy
collector. This callback is only registered when generating the
reproducer.

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

rdar://problem/24499339

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264971 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[VFS] Handle empty entries in directory traversal
Bruno Cardoso Lopes [Wed, 30 Mar 2016 23:54:00 +0000 (23:54 +0000)]
[VFS] Handle empty entries in directory traversal

The VFS YAML files contain empty directory entries to describe that it's
returning from a subdirectory before describing new files in the parent.
In the future, we should properly sort and write YAML files avoiding
such empty dirs and mitigate the extra recurson cost. However, since
this is used by previous existing YAMLs, make the traversal work in
their presence.

rdar://problem/24499339

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264970 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CUDA] Add -disable-llvm-passes to CodeGenCUDA/link-device-bitcode.cu. NFC
Justin Lebar [Wed, 30 Mar 2016 23:45:38 +0000 (23:45 +0000)]
[CUDA] Add -disable-llvm-passes to CodeGenCUDA/link-device-bitcode.cu.  NFC

We already have this flag in most of the file, but we need it everywhere
else, to disable the NVVMReflect pass, which we're explicitly checking
doesn't run here.  (Upcoming changes to llvm will cause it to be run.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264969 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix deduction of __atomic_load's parameter types.
Eric Fiselier [Wed, 30 Mar 2016 23:39:56 +0000 (23:39 +0000)]
Fix deduction of __atomic_load's parameter types.

Summary:
__atomic_load's allows it's first argument to be a pointer to a const type. However the second argument is an output parameter and must be a pointer to non-const.
This patch fixes the signature of __atomic_load generated by clang so that it respects the above requirements.

Reviewers: rsmith, majnemer

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264967 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CUDA] Don't initialize the CUDA toolchain if we don't have any CUDA inputs.
Justin Lebar [Wed, 30 Mar 2016 23:30:25 +0000 (23:30 +0000)]
[CUDA] Don't initialize the CUDA toolchain if we don't have any CUDA inputs.

Summary:
This prevents errors when you invoke clang with a flag that the NVPTX
toolchain doesn't support.  For example, on x86-64,

  clang -mthread-model single -x c++ /dev/null -o /dev/null

should output just one error about "invalid thread model 'single' in
'-mthread-model single' for this target"; x86-64 doesn't support
-mthread-model, but we shouldn't also instantiate a NVPTX target!

Reviewers: echristo

Subscribers: tra, sunfish, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264965 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CUDA] Make unattributed constexpr functions implicitly host+device.
Justin Lebar [Wed, 30 Mar 2016 23:30:21 +0000 (23:30 +0000)]
[CUDA] Make unattributed constexpr functions implicitly host+device.

With this patch, by a constexpr function is implicitly host+device
unless:

 a) it's a variadic function (variadic functions are not allowed on the
    device side), or
 b) it's preceeded by a __device__ overload in a system header.

The restriction on overloading __host__ __device__ functions on the
basis of their CUDA attributes remains in place, but we use (b) to allow
us to define __device__ overloads for constexpr functions in cmath,
which would otherwise be __host__ __device__ and thus not overloadable.

You can disable this behavior with -fno-cuda-host-device-constexpr.

Reviewers: tra, rnk, rsmith

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264964 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[CUDA] Add math forward declares to CUDA header wrapper.
Justin Lebar [Wed, 30 Mar 2016 23:30:14 +0000 (23:30 +0000)]
[CUDA] Add math forward declares to CUDA header wrapper.

Summary:
This is necessary for a future patch which will make all constexpr
functions implicitly host+device.  cmath may declare constexpr
functions, but these we do *not* want to be host+device.  The forward
declares added in this patch prevent this (because the rule will be,
constexpr functions become implicitly host+device unless they're
preceeded by a decl with __device__).

Reviewers: tra

Subscribers: cfe-commits, rnk, rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264963 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Add frexp_mant + frexp_exp builtins
Matt Arsenault [Wed, 30 Mar 2016 22:57:40 +0000 (22:57 +0000)]
AMDGPU: Add frexp_mant + frexp_exp builtins

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264960 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoUpdate copyright year to 2016.
Paul Robinson [Wed, 30 Mar 2016 22:38:44 +0000 (22:38 +0000)]
Update copyright year to 2016.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264946 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoDocs: keep copyright years up-to-date.
Paul Robinson [Wed, 30 Mar 2016 22:24:57 +0000 (22:24 +0000)]
Docs: keep copyright years up-to-date.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264941 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoFix Clang crash with template type diffing.
Richard Trieu [Wed, 30 Mar 2016 22:23:00 +0000 (22:23 +0000)]
Fix Clang crash with template type diffing.

Fixes https://llvm.org/bugs/show_bug.cgi?id=27129 which is crash involving type
aliases and template type diffing.  Template arguments for type aliases and
template arguments for the underlying desugared type may not have one-to-one
relations, which could mess us the attempt to get more information from the
desugared type.  For type aliases, ignore the iterator over the desugared type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264940 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAdd -emit-llvm-only to the regression test for PR21547.
Vassil Vassilev [Wed, 30 Mar 2016 22:22:50 +0000 (22:22 +0000)]
Add -emit-llvm-only to the regression test for PR21547.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264939 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoCanonicalize UnaryTransformType types when they don't have a known underlying type.
Vassil Vassilev [Wed, 30 Mar 2016 22:18:29 +0000 (22:18 +0000)]
Canonicalize UnaryTransformType types when they don't have a known underlying type.

Fixes https://llvm.org/bugs/show_bug.cgi?id=26014

Reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264937 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoSilencing warnings from MSVC 2015 Update 2. Both of these changes silence "C4334...
Aaron Ballman [Wed, 30 Mar 2016 21:33:34 +0000 (21:33 +0000)]
Silencing warnings from MSVC 2015 Update 2. Both of these changes silence "C4334 '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)". NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264932 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoAMDGPU: Remove separate r600 double data layout
Matt Arsenault [Wed, 30 Mar 2016 21:32:37 +0000 (21:32 +0000)]
AMDGPU: Remove separate r600 double data layout

This is identical to the other r600 datalayout string.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264931 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Clang][ARM] __va_list declaration is not saved in ASTContext causing compilation...
Oleg Ranevskyy [Wed, 30 Mar 2016 21:30:30 +0000 (21:30 +0000)]
[Clang][ARM] __va_list declaration is not saved in ASTContext causing compilation error or crash

Summary:
When the code is compiled for arm32 and the builtin `__va_list` declaration is created by `CreateAAPCSABIBuiltinVaListDecl`, the declaration is not saved in the `ASTContext` which may lead to a compilation error or crash.

Minimal reproducer I was able to find:
**header.h**
```
#include <stdarg.h>
typedef va_list va_list_1;
```

**test.cpp**
```
typedef __builtin_va_list va_list_2;
void foo(const char* format, ...) { va_list args; va_start( args, format ); }
```

Steps to reproduce:
```
clang -x c++-header --target=armv7l-linux-eabihf header.h
clang -c -include header.h --target=armv7l-linux-eabihf test.cpp
```

Compilation error:
```
error: non-const lvalue reference to type '__builtin_va_list'
      cannot bind to a value of unrelated type 'va_list' (aka '__builtin_va_list')
```

Compiling the same code as a C source leads to a crash:
```
clang --target=armv7l-linux-eabihf header.h
clang -c -x c -include header.h --target=armv7l-linux-eabihf test.cpp
```

Reviewers: logan, rsmith

Subscribers: cfe-commits, asl, aemerson, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264930 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[Sema] s/UseUsingDeclRules/UseMemberUsingDeclRules/
Justin Lebar [Wed, 30 Mar 2016 20:41:05 +0000 (20:41 +0000)]
[Sema] s/UseUsingDeclRules/UseMemberUsingDeclRules/

Summary:
IsOverload has a param named UseUsingDeclRules.  But as far as I can
tell, it should be called UseMemberUsingDeclRules.  That is, it only
applies to "using" declarations inside classes or structs.

Reviewers: rsmith

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264920 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[modules] Write out identifiers if the ID is local, too.
Vassil Vassilev [Wed, 30 Mar 2016 20:16:03 +0000 (20:16 +0000)]
[modules] Write out identifiers if the ID is local, too.

In some cases a slot for an identifier is requested but it gets written to
another module, causing an assertion.

At the point when we start serializing Rtypes, we have no imported IdentifierID
for float_round_style. We start serializing stuff and allocate an ID for it.
Then, during the serialization process, we pull in the identifier info for it
from TSchemaHelper. Finally, WriteIdentifierTable decides that the identifier
has not changed since it was deserialized, so doesn't emit it.

Fixes https://llvm.org/bugs/show_bug.cgi?id=27041

Discussed on IRC with Richard Smith. Agreed on post commit review if needed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264913 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[modules] Add a regression test for PR21547.
Vassil Vassilev [Wed, 30 Mar 2016 20:10:07 +0000 (20:10 +0000)]
[modules] Add a regression test for PR21547.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264908 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[c-index-test] Delete dead function, NFC
Vedant Kumar [Wed, 30 Mar 2016 16:03:02 +0000 (16:03 +0000)]
[c-index-test] Delete dead function, NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264874 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[SystemZ] Specify required features for builtins.
Jonas Paulsson [Wed, 30 Mar 2016 15:51:24 +0000 (15:51 +0000)]
[SystemZ] Specify required features for builtins.

BuiltinsSystemZ.def is extended to include the required processor
features per intrinsic.

New test test/CodeGen/builtins-systemz-error2.c that checks for
expected errors when instrinsics are used with a subtarget that does
not support the required feature (e.g. vector support).

Reviewed by Ulrich Weigand.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264873 91177308-0d34-0410-b5e6-96231b3b80d8

8 years agoPrepare tests for change to emit Module SourceFileName to LLVM assembly
Teresa Johnson [Wed, 30 Mar 2016 13:59:49 +0000 (13:59 +0000)]
Prepare tests for change to emit Module SourceFileName to LLVM assembly

Modify these tests to ignore the source file name when looking for the
expected string. It was already catching the source file name once via
the ModuleID, and will catch it another time with an impending change to
LLVM to serialize out the module's SourceFileName.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264868 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[ASTMatchers] Existing matcher hasAnyArgument fixed
Gabor Horvath [Wed, 30 Mar 2016 11:22:14 +0000 (11:22 +0000)]
[ASTMatchers] Existing matcher hasAnyArgument fixed

Summary: A checker (will be uploaded after this patch) needs to check implicit casts. The checker needs matcher hasAnyArgument but it ignores implicit casts and parenthesized expressions which disables checking of implicit casts for arguments in the checker. However the documentation of the matcher contains a FIXME that this should be removed once separate matchers for ignoring implicit casts and parenthesized expressions are ready. Since these matchers were already there the fix could be executed. Only one Clang checker was affected which was also fixed (ignoreParenImpCasts added) and is separately uploaded. Third party checkers (not in the Clang repository) may be affected by this fix so the fix must be emphasized in the release notes.

Reviewers: klimek, sbenza, alexfh

Subscribers: alexfh, klimek, xazax.hun, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264855 91177308-0d34-0410-b5e6-96231b3b80d8

8 years ago[OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.
Alexey Bataev [Wed, 30 Mar 2016 10:43:55 +0000 (10:43 +0000)]
[OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.

Initial parsing/sema/serialization/deserialization support for '#pragma
omp declare simd' directive.
The 'declare simd' construct can be applied to a function to enable the
creation of one or more versions that can process multiple arguments
using SIMD instructions from a single invocation from a SIMD loop.
If the function has any declarations, then the declare simd construct
for any declaration that has one must be equivalent to the one specified
 for the definition. Otherwise, the result is unspecified.
This pragma can be applied many times to the same declaration.
Internally this pragma is represented as an attribute. But we need special processing for this pragma because it must be used before function declaration, this directive is applied to.
Differential Revision: http://reviews.llvm.org/D10599

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@264853 91177308-0d34-0410-b5e6-96231b3b80d8