Commit Graph

63153 Commits

Author SHA1 Message Date
Faisal Vali 9da788fda2 Reorder data members to be consistent with member initializers, to silence warnings.
llvm-svn: 263922
2016-03-21 10:37:42 +00:00
Faisal Vali dc6b596ebb [Cxx1z] Implement Lambda Capture of *this by Value as [=,*this] (P0018R3)
Implement lambda capture of *this by copy.
For e.g.:
struct A {

  int d = 10;
  auto foo() { return [*this] (auto a) mutable { d+=a; return d; }; }

};

auto L = A{}.foo(); // A{}'s lifetime is gone.

// Below is still ok, because *this was captured by value.
assert(L(10) == 20);
assert(L(100) == 120);

If the capture was implicit, or [this] (i.e. *this was captured by reference), this code would be otherwise undefined.

Implementation Strategy:
  - amend the parser to accept *this in the lambda introducer
  - add a new king of capture LCK_StarThis
  - teach Sema::CheckCXXThisCapture to handle by copy captures of the
    enclosing object (i.e. *this)
  - when CheckCXXThisCapture does capture by copy, the corresponding 
    initializer expression for the closure's data member 
    direct-initializes it thus making a copy of '*this'.
  - in codegen, when assigning to CXXThisValue, if *this was captured by 
    copy, make sure it points to the corresponding field member, and
    not, unlike when captured by reference, what the field member points
    to.
  - mark feature as implemented in svn

Much gratitude to Richard Smith for his carefully illuminating reviews!   

llvm-svn: 263921
2016-03-21 09:25:37 +00:00
Nico Weber 2c8b5993be clang-cl: Add a comment about /Oy- (see r245913).
llvm-svn: 263920
2016-03-21 02:48:05 +00:00
Mike Spertus 6fa3e599ea Visual Studio Visualizers for clang::FunctionDecl
Readably displays a FunctionDecl in the Visual Studio Locals Window something like:
  void g(int, double d, struct A && arr)

llvm-svn: 263915
2016-03-20 20:15:23 +00:00
Devin Coughlin fcfa38cf76 [tsan] Allow -fsanitize=thread for iOS-style simulator targets
Update the clang driver to allow -fsanitize=thread when targeting x86_64 iOS and tvOS
simulators. Also restrict TSan targeting OS X to only be supported on x86_64 and not i386.

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

llvm-svn: 263913
2016-03-20 18:24:33 +00:00
Bruno Cardoso Lopes 936a054522 [VFS] Fix test to use more restrict set of headers
llvm-svn: 263912
2016-03-20 18:08:32 +00:00
Justin Bogner 62c04dedb9 AST: Fix some bogus indentation. NFC
Noticed by Liu Xin. Thanks!

llvm-svn: 263909
2016-03-20 16:58:03 +00:00
Simon Pilgrim 2714c49e96 Fixed -Wdocumentation warning
llvm-svn: 263908
2016-03-20 16:25:23 +00:00
Richard Smith 25dde97526 Mark C++ features implemented in Clang 3.8 as done now that 3.8 has released.
llvm-svn: 263896
2016-03-20 10:37:12 +00:00
Richard Smith 01694c340d P0184R0: Allow types of 'begin' and 'end' expressions in range-based for loops to differ.
llvm-svn: 263895
2016-03-20 10:33:40 +00:00
Bruno Cardoso Lopes d878e28e67 Reapply [2] [VFS] Add 'overlay-relative' field to YAML files
This reapplies r261552 and r263748. Fixed testcase to reapply.

The VFS overlay mapping between virtual paths and real paths is done through
the 'external-contents' entries in YAML files, which contains hardcoded paths
to the real files.

When a module compilation crashes, headers are dumped into <name>.cache/vfs
directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script
generated for reproduction uses -ivfsoverlay pointing to file to gather the
mapping between virtual paths and files inside <name>.cache/vfs. Currently, we
are only capable of reproducing such crashes in the same machine as they
happen, because of the hardcoded paths in 'external-contents'.

To be able to reproduce a crash in another machine, this patch introduces a new
option in the VFS yaml file called 'overlay-relative'. When it's equal to
'true' it means that the provided path to the YAML file through the
-ivfsoverlay option should also be used to prefix the final path for every
'external-contents'.

Example, given the invocation snippet "... -ivfsoverlay
<name>.cache/vfs/vfs.yaml" and the following entry in the yaml file:

"overlay-relative": "true",
"roots": [
...
  "type": "directory",
  "name": "/usr/include",
  "contents": [
    {
      "type": "file",
      "name": "stdio.h",
      "external-contents": "/usr/include/stdio.h"
    },
...

Here, a file manager request for virtual "/usr/include/stdio.h", that will map
into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h.

This is a useful feature for debugging module crashes in machines other than
the one where the error happened.

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

rdar://problem/24499339

llvm-svn: 263893
2016-03-20 02:08:48 +00:00
Mike Spertus 1d051ee78a Better visualization of clang::BuiltinType in VisualStudio
Whenever possible, use C++ names for visualizing builtin types. E.g., "long double" instead of "LongDouble"

llvm-svn: 263891
2016-03-20 00:32:30 +00:00
Mike Spertus 7f2de8e46a Visual Studio Visualizer for clang::FunctionProtoType
Displays return type and parameters for the Function Protoype object in the Locals window.

llvm-svn: 263890
2016-03-20 00:20:43 +00:00
George Burgess IV cc2f355f71 [Sema] Make type deduction work with some overloadable functions
Some functions can't have their address taken. If we encounter an
overload set where only one of the candidates can have its address
taken, we should automatically select that candidate's type in type
deduction.

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

llvm-svn: 263888
2016-03-19 21:51:45 +00:00
George Burgess IV 3cde9bf9d5 [Sema] Allow casting of some overloaded functions
Some functions can't have their address taken. If we encounter an
overload set where only one of the candidates can have its address
taken, we should automatically select that candidate in cast
expressions.

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

llvm-svn: 263887
2016-03-19 21:36:10 +00:00
Manman Ren 5e5d046a4f [TLS on Darwin] use CXX_FAST_TLS calling convention for tls_init.
This makes sure we don't generate a lot of code to spill/reload
CSRs when calling tls_init from the access functions.

This helps performance when tls_init is not inlined into the access
functions.

llvm-svn: 263854
2016-03-18 23:35:21 +00:00
Carlo Bertolli b74bfc80a4 [OPENMP] Implementation of codegen for firstprivate clause of target directive
This patch implements the following aspects:

It extends sema to check that a variable is not reference in both a map clause and firstprivate or private. This is needed to ensure correct functioning at codegen level, apart from being useful for the user.
It implements firstprivate for target in codegen. The implementation applies to both host and nvptx devices.
It adds regression tests for codegen of firstprivate, host and device side when using the host as device, and nvptx side.
Please note that the regression test for nvptx codegen is missing VLAs. This is because VLAs currently require saving and restoring the stack which appears not to be a supported operation by nvptx backend.

It adds a check in sema regression tests for target map, firstprivate, and private clauses.

http://reviews.llvm.org/D18203

llvm-svn: 263837
2016-03-18 21:43:32 +00:00
Steven Watanabe 9359b8fe5d Fix printing of anonymous struct typedefs.
clang -cc1 -ast-print put the struct
definition in the wrong place, like this:

  struct {} typedef S;

The reason that this happens is that the printing code
first prints the struct definition, and then tells the next
declaration to leave out the type. This behavior
is correct for simple variable declarations, but fails for
typedefs (or extern, mutable, etc).

The patch address this problem by skipping the struct
declaration when we first see it, and then telling the first
subsequent declaration that it needs to print out the full
struct definition.

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

llvm-svn: 263836
2016-03-18 21:35:59 +00:00
Akira Hatanaka 4c62c7c981 [Objective-c] Fix a crash in WeakObjectProfileTy::getBaseInfo.
The crash occurs in WeakObjectProfileTy::getBaseInfo when getBase() is
called on an ObjCPropertyRefExpr object whose receiver is an interface.
This commit fixes the crash by checking the type of the receiver and
setting IsExact to true if it is an interface.

rdar://problem/25208167

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

llvm-svn: 263818
2016-03-18 19:03:50 +00:00
Reid Kleckner 72a9d15aba [clang-cl] Allow use of -gline-tables-only
llvm-svn: 263816
2016-03-18 18:42:56 +00:00
Pirama Arumuga Nainar 8e2e9d6f4c Add -fnative-half-arguments-and-returns
Summary:
r246764 handled __fp16 arguments and returns for AAPCS, but skipped this
handling for OpenCL.  Simlar to OpenCL, RenderScript also handles __fp16
type natively.

This patch adds the -fnative-half-arguments-and-returns command line
flag to allow such languages to skip this coercion of __fp16.

Reviewers: srhines, olista01

Subscribers: cfe-commits

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

llvm-svn: 263795
2016-03-18 16:58:36 +00:00
Mike Spertus a814d3d288 Show members of DeclContexts (i.e., class members) in Visual Studio native visualizers
This change shows members of DeclContext objects in the Visual Studio debugger. It will also cast a TagType like a class or a struct to a DeclContext, so its methods and fields are visualized. 

llvm-svn: 263794
2016-03-18 16:38:34 +00:00
Benjamin Kramer d2f5bf7815 Make LookupResult movable again.
We lost copy semantics in r263730, because it only worked for a few very
specific cases. Move semantics don't have this issue. Sadly the
implementation is a bit messy but I don't know how to clean it up
without losing support for msvc 2013 :/

llvm-svn: 263785
2016-03-18 13:31:00 +00:00
Arpith Chacko Jacob 129fa9a048 Revert r263783 as buildbot failure is being investigated.
llvm-svn: 263784
2016-03-18 12:39:40 +00:00
Arpith Chacko Jacob ac563708ab [OpenMP] Base support for target directive codegen on NVPTX device.
Summary:
Reworked test case after buildbot failure on windows.

This patch adds base support for codegen of the target directive on the NVPTX device.

Reviewers: ABataev

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

llvm-svn: 263783
2016-03-18 11:47:43 +00:00
Chaoren Lin 37cbc43ecb Remove usage of LLVM_PREFIX.
Summary: LLVM_PREFIX could be undefined if CMAKE_INSTALL_PREFIX were set to empty.

Reviewers: kparzysz, bkramer, chandlerc

Subscribers: cfe-commits

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

llvm-svn: 263766
2016-03-18 00:05:37 +00:00
Manman Ren 34888f86ef Revert r263687 for ubsan bot failure.
llvm-svn: 263752
2016-03-17 22:13:50 +00:00
Bruno Cardoso Lopes 9e2f9d818f Revert "Reapply [VFS] Add 'overlay-relative' field to YAML files"
Tests failing on
http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/46102

This reverts commit a1683cd6c9e07359c09f86e98a4db6b4e1bc51fc.

llvm-svn: 263750
2016-03-17 21:30:55 +00:00
Bruno Cardoso Lopes 016b2d0ddc Reapply [VFS] Add 'overlay-relative' field to YAML files
This reapplies r261552.

The VFS overlay mapping between virtual paths and real paths is done through
the 'external-contents' entries in YAML files, which contains hardcoded paths
to the real files.

When a module compilation crashes, headers are dumped into <name>.cache/vfs
directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script
generated for reproduction uses -ivfsoverlay pointing to file to gather the
mapping between virtual paths and files inside <name>.cache/vfs. Currently, we
are only capable of reproducing such crashes in the same machine as they
happen, because of the hardcoded paths in 'external-contents'.

To be able to reproduce a crash in another machine, this patch introduces a new
option in the VFS yaml file called 'overlay-relative'. When it's equal to
'true' it means that the provided path to the YAML file through the
-ivfsoverlay option should also be used to prefix the final path for every
'external-contents'.

Example, given the invocation snippet "... -ivfsoverlay
<name>.cache/vfs/vfs.yaml" and the following entry in the yaml file:

"overlay-relative": "true",
"roots": [
...
  "type": "directory",
  "name": "/usr/include",
  "contents": [
    {
      "type": "file",
      "name": "stdio.h",
      "external-contents": "/usr/include/stdio.h"
    },
...

Here, a file manager request for virtual "/usr/include/stdio.h", that will map
into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h.

This is a useful feature for debugging module crashes in machines other than
the one where the error happened.

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

rdar://problem/24499339

llvm-svn: 263748
2016-03-17 21:11:23 +00:00
David Blaikie 2522f8bea4 Re-add (user defined) move ops to UnresolvedSetImpl to allow UnresolvedSet to be implicitly movable
llvm-svn: 263747
2016-03-17 20:45:38 +00:00
Reid Kleckner 4084504caa Revert "For MS ABI, emit dllexport friend functions defined inline in class"
This reverts commit r263738.

This appears to cause a failure in
CXX/temp/temp.decls/temp.friend/p1.cpp

llvm-svn: 263740
2016-03-17 20:06:58 +00:00
Reid Kleckner 0f6caf66e9 For MS ABI, emit dllexport friend functions defined inline in class
Summary: ...as that is apparently what MSVC does

Reviewers: rnk

Patch by Stephan Bergmann

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

llvm-svn: 263738
2016-03-17 19:52:20 +00:00
David Blaikie fef5c5a27a Remove defaulted move ops, the type is zero-cost copyable anyway, so there's no need for specific move ops
(addresses MSVC build error, since MSVC 2013 can't generate default move
ops)

llvm-svn: 263732
2016-03-17 18:28:16 +00:00
David Blaikie a9ff7a14ec Fix implicit copy ctor and copy assignment operator warnings when -Wdeprecated passed.
Fix implicit copy ctor and copy assignment operator warnings
when -Wdeprecated passed.

Patch by Don Hinton!

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

llvm-svn: 263730
2016-03-17 18:05:07 +00:00
Benjamin Kramer f8bff1c31c Use a simpler set of mock headers for the vfs+modules crash recovery tests.
The System/ mock is large and too complex for this test. It can cause
the tests to fail in mysterious ways as it depends on the resource dir
being present, which is not really supported for driver tests (using
%clang instead of %clang_cc1). Copy the tree and trim out all the
%unnecessary fat.

llvm-svn: 263718
2016-03-17 16:19:51 +00:00
Daniel Jasper 97439926e4 clang-format: [JS] Make requoting of JavaScript string literals only
change affected ranges.

llvm-svn: 263713
2016-03-17 13:03:41 +00:00
Daniel Jasper a4607e1b88 clang-format: [JS] Fix incorrect spacing around contextual keywords.
Before:
  x.of ();

After:
  x.of();

llvm-svn: 263710
2016-03-17 12:17:59 +00:00
Daniel Jasper 710f8493c8 clang-format: Slightly weaken AlignAfterOpenBracket=AlwaysBreak.
If a call takes a single argument, using AlwaysBreak can lead to lots
of wasted lines and additional indentation without improving the
readability in a significant way.

Before:
  caaaaaaaaaaaall(
      caaaaaaaaaaaall(
          caaaaaaaaaaaall(
              caaaaaaaaaaaaaaaaaaaaaaall(aaaaaaaaaaaaaa, aaaaaaaaa))));

After:
  caaaaaaaaaaaall(caaaaaaaaaaaall(caaaaaaaaaaaall(
      caaaaaaaaaaaaaaaaaaaaaaall(aaaaaaaaaaaaaa, aaaaaaaaa))));

llvm-svn: 263709
2016-03-17 12:00:22 +00:00
Alexey Bataev e122da19ea [OPENMP 4.5] Allow to use private data members in 'copyprivate' clause.
OpenMP 4.5 allows privatization of non-static data members in non-static
member functions. This patch adds support of private data members in
'copyprivate' clauses.

llvm-svn: 263706
2016-03-17 10:50:17 +00:00
Alexey Bataev a839dddf92 [OPENMP 4.0] Use 'declare reduction' constructs in 'reduction' clauses.
OpenMP 4.0 allows to define custom reduction operations using '#pragma
omp declare reduction' construct. Patch allows to use this custom
defined reduction operations in 'reduction' clauses.

llvm-svn: 263701
2016-03-17 10:19:46 +00:00
Junmo Park e19d6796ee Minor code cleanups. NFC.
llvm-svn: 263694
2016-03-17 06:41:27 +00:00
Bruno Cardoso Lopes 0f53cf1c7f [VFS] Remove wrong header include
Follow up from r263686. Forgot to remove the wrong header file.

llvm-svn: 263691
2016-03-17 04:59:52 +00:00
Argyrios Kyrtzidis 6377e4e09a [index] Make sure that declarations of builtin functions are indexed.
rdar://25154630

llvm-svn: 263689
2016-03-17 04:28:19 +00:00
Manman Ren a7c4760c8e Add an optional named argument (replacement = "xxx") to AvailabilityAttr.
This commit adds a named argument to AvailabilityAttr, while r263652 adds an
optional string argument to __attribute__((deprecated)). This enables the
compiler to provide Fix-Its for deprecated declarations.

rdar://20588929

llvm-svn: 263687
2016-03-17 03:09:55 +00:00
Bruno Cardoso Lopes b76c027717 Reapply [2]: [VFS] Add support for handling path traversals
This was applied twice r261551 and 263617 and later reverted because:

(1) Windows bot failing on unittests. Change the current behavior to do
not handle path traversals on windows.

(2) Windows bot failed to include llvm/Config/config.h in order to use
HAVE_REALPATH. Use LLVM_ON_UNIX instead, as done in lib/Basic/FileManager.cpp.

Handle ".", ".." and "./" with trailing slashes while collecting files
to be dumped into the vfs overlay directory.

Include the support for symlinks into components. Given the path:

/install-dir/bin/../lib/clang/3.8.0/include/altivec.h, if "bin"
component is a symlink, it's not safe to use `path::remove_dots` here,
and `realpath` is used to get the right answer. Since `realpath`
is expensive, we only do it at collecting time (which only happens
during the crash reproducer) and cache the base directory for fast lookups.

Overall, this makes the input to the VFS YAML file to be canonicalized
to never contain traversal components.

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

rdar://problem/24499339

llvm-svn: 263686
2016-03-17 02:20:43 +00:00
Carlo Bertolli a03acfa359 [OPENMP] Support for codegen of private clause of target, host side
This patch adds support for codegen of private clause of target and a regression test for host code generation, when the host is used as target device. I believe that code generation for nvptx backend would not require anything additional or different to what is done for the host.

http://reviews.llvm.org/D18105

llvm-svn: 263654
2016-03-16 19:04:22 +00:00
Manman Ren c7890fed01 Add an optional string argument to DeprecatedAttr for Fix-It.
We only add this to __attribute__((deprecated)).

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

llvm-svn: 263652
2016-03-16 18:50:49 +00:00
Roman Levenstein 35aa5cecf2 Add attributes for preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end
Till now, preserve_mostcc/preserve_allcc calling convention attributes were only
available at the LLVM IR level. This patch adds attributes for
preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end.

The code was mostly written by Juergen Ributzka.
I just added support for the AArch64 target and tests.

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

llvm-svn: 263647
2016-03-16 18:00:46 +00:00
Olivier Goffart b94ed61452 Fix destructor definition of invalid classes
The declaration of the destructor of an invalid class was not properly marked
as noexcept. As a result, the definition of the same destructor, which was
properly implicitly marked as noexcept, would not match the definition.
This would cause the definition CXXDestructorDecl to be matked as invalid
and omited from the AST.

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

llvm-svn: 263639
2016-03-16 14:36:11 +00:00
Mike Spertus 01b14bf761 Add visualizers for more clang types. Create more C++-like visualizations for existing Clang types
Created visualizer for PointerType, LValueReferenceType, RValueReferenceType, and TemplateParmType.
In addition, cleaned up the display of existing types to be more C++-like. For example, instead of

  SubstTemplateTypeParmType: {Identifier (("T"))} => Record (25), {Identifier (("A"))}

it now displays more readably as 

  SubstTemplateTypeParmType: {typename T <= struct A}

The <expand> sections still can be used for all the gory details if necessary.

llvm-svn: 263638
2016-03-16 14:27:50 +00:00
NAKAMURA Takumi 9ed443ccca Revert r263617, "Reapply: [VFS] Add support for handling path traversals"
It broke standalone clang build.

llvm-svn: 263636
2016-03-16 12:15:29 +00:00
Yaron Keren ebd142692d Directly get the canonical Type instead of going around through a CanQualType temporary, NFC.
llvm-svn: 263635
2016-03-16 12:14:43 +00:00
Vassil Vassilev 632eac3428 [modules] Fix adding a templated friend functions to a namespace from another module.
When clang adds argument dependent lookup candidates, it can perform template
instantiation. For example, it can instantiate a templated friend function and
register it in the enclosing namespace's lookup table.

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

Reviewed by Richard Smith.

llvm-svn: 263634
2016-03-16 11:17:04 +00:00
Pablo Barrio 2a35ff0687 Add more ARM Cortex-R8 regression tests to Clang.
Summary:
This patch adds Clang tests for Cortex-R8 related to FP capabilities and
hardware integer divide.

Reviewers: rengolin, bsmith

Subscribers: aemerson, cfe-commits, rengolin

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

llvm-svn: 263632
2016-03-16 10:21:04 +00:00
Marina Yatsina d6d8b315d3 Avoid using LookupResult's implicit copy ctor and assignment operator to avoid warnings
The purpose of this patch is to keep the same functionality without using LookupResult's implicit copy ctor and assignment operator, because they cause warnings when -Wdeprecated is passed.
This patch is meant to help the following review: http://reviews.llvm.org/D18123.
The functionality is covered by the tests in my original commit (255890)
The test case in this patch was added to test a bug caught in the review of the first version of this fix.

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

llvm-svn: 263630
2016-03-16 09:56:58 +00:00
NAKAMURA Takumi 770c627ad0 Revert r263622, "clang/lib/Frontend/ModuleDependencyCollector.cpp: Use clang/Config/config.h instead of llvm's."
I'll commit better fix(es) later. "llvm/Config/config.h" shouldn't be available here.

llvm-svn: 263623
2016-03-16 08:44:37 +00:00
NAKAMURA Takumi dc9e191f6f clang/lib/Frontend/ModuleDependencyCollector.cpp: Use clang/Config/config.h instead of llvm's.
llvm-svn: 263622
2016-03-16 08:28:55 +00:00
Bruno Cardoso Lopes c9daaaedb6 Reapply: [VFS] Add support for handling path traversals
This is originally r261551, reverted because of windows bots failing on
unittests. Change the current behavior to do not handle path traversals
on windows.

Handle ".", ".." and "./" with trailing slashes while collecting files
to be dumped into the vfs overlay directory.

Include the support for symlinks into components. Given the path:

/install-dir/bin/../lib/clang/3.8.0/include/altivec.h, if "bin"
component is a symlink, it's not safe to use `path::remove_dots` here,
and `realpath` is used to get the right answer. Since `realpath`
is expensive, we only do it at collecting time (which only happens
during the crash reproducer) and cache the base directory for fast lookups.

Overall, this makes the input to the VFS YAML file to be canonicalized
to never contain traversal components.

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

rdar://problem/24499339

llvm-svn: 263617
2016-03-16 04:39:38 +00:00
Pete Cooper be6c750a8e Convert some ObjC msgSends to runtime calls.
It is faster to directly call the ObjC runtime for methods such as retain/release instead of sending a message to those functions.

This patch adds support for converting messages to retain/release/alloc/autorelease to their equivalent runtime calls.

Tests included for the positive case of applying this transformation, negative tests that we ensure we only convert "alloc" to objc_alloc, not "alloc2", and also a driver test to ensure we enable this only for supported runtime versions.

Reviewed by John McCall.

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

llvm-svn: 263607
2016-03-16 00:33:21 +00:00
Douglas Katzman 6871afcfca Myriad: define __myriad2 macro automatically
llvm-svn: 263596
2016-03-15 22:34:02 +00:00
Arpith Chacko Jacob 9cb61faa61 Revert commit http://reviews.llvm.org/D17877 to fix tests on x86.
llvm-svn: 263589
2016-03-15 21:26:34 +00:00
Arpith Chacko Jacob 5e1493b560 [OpenMP] Base support for target directive codegen on NVPTX device.
Summary:
This patch adds base support for codegen of the target directive on the NVPTX device.

Reviewers: ABataev

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

llvm-svn: 263587
2016-03-15 21:04:57 +00:00
Bob Wilson 57819fc809 Move the fixit for -Wformat-security to a note.
r263299 added a fixit for the -Wformat-security warning, but that runs
into complications with our guideline that error recovery should be done
as-if the fixit had been applied. Putting the fixit on a note avoids that.

llvm-svn: 263584
2016-03-15 20:56:38 +00:00
Evgeniy Stepanov 02279ed12d [cfi] Don't emit checks for disabled CFI kinds.
In the cross-DSO CFI mode clang emits __cfi_check_fail that handles
errors triggered from other modules with targets in the current
module. With this change, __cfi_check_fail will handle errors for
CFI kinds that are not enabled in the current module as if they
have the trapping behaviour (-fsanitize-trap=...).

This fixes a bug where some combinations of -fsanitize* flags may
result in a link failure due to a missing sanitizer runtime library
for the diagnostic calls in __cfi_check_fail.

llvm-svn: 263578
2016-03-15 20:19:29 +00:00
Pablo Barrio 1c1b2518c1 Test commit - Remove some trailing whitespace
llvm-svn: 263574
2016-03-15 19:03:09 +00:00
Chris Bieneman ba83735b2f [CMake] Updating Apple build configurations
This updates Apple build configurations to adapt to r263566 & r263570, which added a PACKAGE_VENDOR variable.

llvm-svn: 263571
2016-03-15 18:27:28 +00:00
Chris Bieneman 4ec7f3f47d [CMake] Defaulting CLANG_VENDOR to PACKAGE_VENDOR
LLVM r263566 adds a generic PACKAGE_VENDOR configuration which can be used to specify the vendor for LLVM toolchain tools. This change defaults the CLANG_VENDOR to the PACKAGE_VENDOR so that you don't have to specify both when building a package.

llvm-svn: 263570
2016-03-15 18:25:36 +00:00
Chris Bieneman 348de81e9a Fix a bot I broke.
The builtin library isn't added by the driver unless it exists, so we shouldn't check for it. I've marked this as a FIXME, because we probably should have a way to test this.

llvm-svn: 263568
2016-03-15 18:17:48 +00:00
Chris Bieneman 7f2844f8f7 [Driver] [Darwin] Fix linking libclang_rt.profile_*sim.a
Summary: isTarget*() calls are order-dependent. This is because iOS Sim *is* iOS. This means checks for the simulator version of the platform must always be ahead of checks for the embedded platform.

Reviewers: zaks.anna, bogner

Subscribers: cfe-commits

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

llvm-svn: 263567
2016-03-15 18:08:20 +00:00
Douglas Katzman 4c12508362 Myriad: Pass -mcpu to movi{Compile,Asm}
Differential Revision: http://reviews.llvm.org/D18186

llvm-svn: 263556
2016-03-15 16:41:31 +00:00
Arpith Chacko Jacob fc46c25d74 Reverted http://reviews.llvm.org/D17877 to fix tests.
llvm-svn: 263555
2016-03-15 16:19:13 +00:00
Arpith Chacko Jacob c61744c26b [OpenMP] Base support for target directive codegen on NVPTX device.
Summary:
This patch adds base support for codegen of the target directive on the NVPTX device.

Reviewers: ABataev

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

llvm-svn: 263552
2016-03-15 15:24:52 +00:00
John Brawn 6c78974b29 Make it possible for AST plugins to enable themselves by default
Currently when an AST plugin is loaded it must then be enabled by passing
-plugin pluginname or -add-plugin pluginname to the -cc1 command line. This
patch adds a method to PluginASTAction which allows it to declare that the
action happens before, instead of, or after the main AST action, plus the
relevant changes to make the plugin action happen at that time automatically.

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

llvm-svn: 263546
2016-03-15 12:51:40 +00:00
Benjamin Kramer fd652b1b8f Restrict the hack from r263429 to asan and msan.
The other sanitizers don't have backend passes that rely on value names.
Avoid paying the compile time cost of names there.

llvm-svn: 263541
2016-03-15 09:41:39 +00:00
Teresa Johnson a0d29406cb [ThinLTO] Clang side of renaming of function index (NFC)
This is the companion to an LLVM patch that renamed the function index
data structures and files to use the more general module summary index.

(Recommit after fixing LLVM side to add back missed file)

llvm-svn: 263514
2016-03-15 00:04:44 +00:00
NAKAMURA Takumi 423ec18cc2 clang/test/CodeGenCXX/virtual-function-attrs.cpp: Appease i686-mingw32 to expect x86_thiscallcc.
llvm-svn: 263505
2016-03-14 23:00:44 +00:00
Teresa Johnson 376b46128f Revert "[ThinLTO] Clang side of renaming of function index (NFC)"
This reverts commit r263491. Missed a file on the LLVM side.

llvm-svn: 263494
2016-03-14 21:18:17 +00:00
Teresa Johnson 9c6cd5df8c [ThinLTO] Clang side of renaming of function index (NFC)
This is the companion to an LLVM patch that renamed the function index
data structures and files to use the more general module summary index.

llvm-svn: 263491
2016-03-14 21:06:06 +00:00
Chris Bieneman cc2aded1ff [CMake] Updating Apple Clang CMake caches
This is a big update that gets the public configurations more in line with the ones we're actually using internally to ship Clang in Xcode.

From here forward I expect most of the changes in these files to be incremental as the changes get made internally.

llvm-svn: 263483
2016-03-14 20:23:21 +00:00
Peter Collingbourne e609197a64 Relax test introduced in r263464 to accept ARM ABI output.
Should fix ARM bots.

llvm-svn: 263477
2016-03-14 20:13:59 +00:00
Daniel Jasper 1dcbbcfc5c clang-format: [JS] Handle certain cases of ASI.
Automatic Semicolon Insertion can only be properly handled by parsing
source code. However conservatively catching just a few, common
situations prevents breaking code during development, which greatly
improves usability.

JS code should still use semicolons, and ASI code should be flagged by
a compiler or linter.

Patch by Martin Probst. Thank you.

llvm-svn: 263470
2016-03-14 19:21:36 +00:00
Peter Collingbourne 4e6a540024 CodeGen: Use 32-bit gep offsets to address vtable address points.
The relative vtable ABI will use a struct rather than an array as the type
of a vtable. LLVM only allows 32-bit integers as struct indices, so we need
to use 32-bit integers to get addresses of address points. In order to keep
the code simple, we might as well do that unconditionally.

It's probably a reasonable implementation limit to support no more than 2
billion virtual functions per class.

This change causes quite a bit of churn in the test suite, so I'm making
it separately.

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

llvm-svn: 263469
2016-03-14 19:07:10 +00:00
Peter Collingbourne 0446e7cfae CodeGen: Mark functions used in vtables as unnamed_addr.
This marks virtual function declarations, as well as runtime library functions
__cxa_pure_virtual, __cxa_deleted_virtual and _purecall, as unnamed_addr. This
will allow us to correctly form relative references to them from vtables in
the relative vtable ABI.

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

llvm-svn: 263464
2016-03-14 18:41:59 +00:00
Richard Smith 8d4e90b319 [modules] Don't diagnose non-modular includes from modular files that are
implementation units of modules rather than interface units.

llvm-svn: 263449
2016-03-14 17:52:37 +00:00
Samuel Antao aeb7b539f5 [OpenMP] Replace offloading option that start with -o with -fo.
Summary:
The current offloading implementation is using -omptargets and -omp-host-ir-file-path options in the frontend. This causes the user a lot of trouble due to to the conflicts with the -o option. E.g. if the user misspells  omptargets he will end up with a file with a weird name.

This patches replaces these two options with  -fomptargets and -fomp-host-ir-file-path to avoid these issues, and it is also more consistent with the other options like -fopenmp.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: cfe-commits, caomhin, fraggamuffin

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

llvm-svn: 263442
2016-03-14 15:57:41 +00:00
Benjamin Kramer 35bc38af20 Revert "Recommitted r261634 "Supporting all entities declared in lexical scope in LLVM debug info." After fixing PR26715 at r263379."
This reverts commit r263425. Breaks self-host.

llvm-svn: 263436
2016-03-14 14:58:28 +00:00
Jonas Hahnfeld f2e73a1adb Fix some more tests with CLANG_DEFAULT_CXX_STDLIB
Also use -stdlib=platform instead of -stdlib=libstdc++ when testing if Clang
chooses the correct default for the given platform.

llvm-svn: 263435
2016-03-14 14:34:10 +00:00
Jonas Hahnfeld 099541907f Make FreeBSD and NetBSD use CLANG_DEFAULT_CXX_STDLIB
Also introduce -stdlib=platform to override the configured value
and use it to make the tests always pass.

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

llvm-svn: 263434
2016-03-14 14:34:04 +00:00
Benjamin Kramer 12f2de1a1f [Frontend] Disable value name discarding for all sanitizers.
ASan also relies on names on allocas and will emit unhelpful output if
they're not present. Just force-enable value names for now. Should
unbreak release builds of asan.

llvm-svn: 263429
2016-03-14 13:23:58 +00:00
Amjad Aboud 22c997deb6 Recommitted r261634 "Supporting all entities declared in lexical scope in LLVM debug info."
After fixing PR26715 at r263379.

llvm-svn: 263425
2016-03-14 12:03:55 +00:00
Andrey Turetskiy a486857cd4 [Driver] Enable --rtlib option for MSVC target
This enables "--rtlib compiler-rt" option under MSVC environment.

Patch by Roman Shirokiy.

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

llvm-svn: 263422
2016-03-14 11:19:43 +00:00
Eric Christopher c2c3a545c1 Temporarily make discard value names depend on whether or not we're
trying to track origins in the memory sanitizer since the backend
instrumentation pass currently takes names from the Instruction.

Fixes all of the origin tracking tests in compiler-rt after the
-discard-value-name option was added.

llvm-svn: 263412
2016-03-14 08:10:47 +00:00
Eric Christopher ae6d694ae7 Give the test a temporary output so it can be cleaned up.
llvm-svn: 263410
2016-03-14 06:21:07 +00:00
Nico Weber 627fa8e424 Try to get cl-pch-showincludes passing on AArch64 bots.
llvm-svn: 263400
2016-03-13 22:26:26 +00:00
Mehdi Amini 557c20a886 Remove compile time PreserveName in favor of a runtime cc1 -discard-value-names option
Summary:
This flag is enabled by default in the driver when NDEBUG is set. It
is forwarded on the LLVMContext to discard all value names (but
GlobalValue) for performance purpose.

This an improved version of D18024

Reviewers: echristo, chandlerc

Subscribers: cfe-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263394
2016-03-13 21:05:23 +00:00
Amjad Aboud 13d7a70657 Added test that covers changes in r263379.
llvm-svn: 263380
2016-03-13 11:12:57 +00:00
Matt Arsenault c477f48f03 Update for new argument to scalbn
llvm-svn: 263371
2016-03-13 05:12:47 +00:00
Nico Weber deed64e52c Also test that the pch file is not printed in /showIncludes
llvm-svn: 263355
2016-03-13 03:04:46 +00:00
Nico Weber efe190a6eb Make test a bit stricter to check not just the file basename is printed.
llvm-svn: 263353
2016-03-13 02:48:51 +00:00
Nico Weber 4b5aedef16 clang-cl: Add /Yc argument to /showIncludes output.
To make this work, delay printing of ExtraDeps in HeaderIncludesCallback a bit,
so that it happens after CompilerInstance::InitializeSourceManager() has run.

General /FI arguments are still missing from /showIncludes output, this still
needs to be fixed.

llvm-svn: 263352
2016-03-13 02:44:13 +00:00
Nico Weber 1f8bad5198 clang-cl: Add a test for the interaction of /Yc and /showIncludes.
We almost get this right, but not completely (see FIXME).  It looks like /FI
headers generally aren't included in /showIncludes yet, but they should be.
But it seems good to have test coverage for the bits that already work.

llvm-svn: 263344
2016-03-12 19:55:59 +00:00
Eric Christopher 02e3dd4b2e Temporarily revert these patches:
commit 60d9845f6a037122d9be9a6d92d4de617ef45b04
Author: Mehdi Amini <mehdi.amini@apple.com>
Date:   Fri Mar 11 18:48:02 2016 +0000

    Fix clang crash: when CodeGenAction is initialized without a
    context, use the member and not the parameter

    From: Mehdi Amini <mehdi.amini@apple.com>

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

commit af7ce3bf04a75ad5124b457b805df26006bd215b
Author: Mehdi Amini <mehdi.amini@apple.com>
Date:   Fri Mar 11 17:32:58 2016 +0000

    Fix build: use -> with pointers and not .

    Silly typo.

    From: Mehdi Amini <mehdi.amini@apple.com>

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

commit d0eea119192814954e7368c77d0dc5a9eeec1fbb
Author: Mehdi Amini <mehdi.amini@apple.com>
Date:   Fri Mar 11 17:15:44 2016 +0000

    Remove compile time PreserveName switch based on NDEBUG

    Summary:
    Following r263086, we are now relying on a flag on the Context to
    discard Value names in release builds.

    Reviewers: chandlerc

    Subscribers: cfe-commits

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

    From: Mehdi Amini <mehdi.amini@apple.com>

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

until we can fix the Release builds.

This reverts commits 263257, 263267, 263273

llvm-svn: 263320
2016-03-12 01:47:11 +00:00
Daniel Jasper be50836514 Make functions in altivec.h be __inline__. As they are all also marked
__always_inline__, this has likely been meant from the start.

Review: http://reviews.llvm.org/D18015
llvm-svn: 263302
2016-03-11 22:13:28 +00:00
Bob Wilson cf2cf0dba4 Add fix-it for format-security warnings.
llvm-svn: 263299
2016-03-11 21:55:37 +00:00
Jordan Rose 31cf7d49db Fix ObjCMethodDecl::findPropertyDecl for class properties.
This affects code completion and a few other things; hopefully the code completion
test is sufficient to catch regressions.

llvm-svn: 263295
2016-03-11 21:14:40 +00:00
Reid Kleckner 4776f2ed75 Add missing triple to instantiate-sizeof.cpp test
llvm-svn: 263285
2016-03-11 19:17:53 +00:00
Reid Kleckner 1af391df13 Allow sizeof(UnrelatedClass::field) in C++11 class template methods
This feature works outside of templates by forming a DeclRefExpr to a
FieldDecl instead of a MemberExpr, which requires a base object in
addition to the FieldDecl.

Previously, while building up the template AST before instantiation, we
formed a CXXDependentScopeMemberExpr, which always instantiates to a
MemberExpr. Now, in unevaluated contexts we form a
DependentScopeDeclRefExpr, which is a more flexible node that can
instantiate to either a MemberExpr or a DeclRefExpr depending on lookup
results.

Fixes PR26893.

llvm-svn: 263279
2016-03-11 18:59:12 +00:00
Teresa Johnson f39a70cf32 Update test case for llvm summary format changes in D17592.
llvm-svn: 263276
2016-03-11 18:52:42 +00:00
Mehdi Amini 4661b39e33 Fix clang crash: when CodeGenAction is initialized without a context, use the member and not the parameter
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263273
2016-03-11 18:48:02 +00:00
Reid Kleckner e10b601537 [SEH] Remove nounwind/noinline from outlined finally funclets
With the new EH representation this is no longer necessary.

llvm-svn: 263269
2016-03-11 17:36:16 +00:00
Mehdi Amini 7850f596e2 Fix build: use -> with pointers and not .
Silly typo.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263267
2016-03-11 17:32:58 +00:00
Mehdi Amini e803fc3276 Remove compile time PreserveName switch based on NDEBUG
Summary:
Following r263086, we are now relying on a flag on the Context to
discard Value names in release builds.

Reviewers: chandlerc

Subscribers: cfe-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263257
2016-03-11 17:15:44 +00:00
Alexandros Lamprineas 5ccf78b67d Add tests for ARM Cortex-R8
Add command-line tests for ARM Cortex-R8 checking that the driver calls
clang -cc1 with the correct little-endian/big-endian, and ARM/Thumb triple.

Patch by Pablo Barrio <pablo.barrio@arm.com>

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

llvm-svn: 263245
2016-03-11 15:03:40 +00:00
Chandler Carruth 4ddaadca76 Update to include the new header file providing createGVNPass.
llvm-svn: 263210
2016-03-11 09:02:43 +00:00
Dmitry Polukhin 644a9252ab [OpenMP] NFC fix compilation warning about unused variable
lib/Sema/SemaOpenMP.cpp:9243:13: warning: variable ‘IsRightMostExpression’ set but not used

llvm-svn: 263202
2016-03-11 07:58:34 +00:00
John McCall 7509ba64c4 Removing the friend declaration was not a good idea.
llvm-svn: 263194
2016-03-11 05:03:01 +00:00
John McCall 519966fc92 Speculatively attempt to fix the MSVC build by making some
methods non-private.

llvm-svn: 263193
2016-03-11 04:55:21 +00:00
John McCall f26e73df75 Add a coerce-and-expand ABIArgInfo as a generalization of some
of the things we do with Expand / Direct.

NFC for now, but this will be used by swiftcall expansion.

llvm-svn: 263192
2016-03-11 04:30:43 +00:00
John McCall c56a8b3284 Preserve ExtParameterInfos into CGFunctionInfo.
As part of this, make the function-arrangement interfaces
a little simpler and more semantic.

NFC.

llvm-svn: 263191
2016-03-11 04:30:31 +00:00
Ekaterina Romanova 13f189da86 Add doxygen comments to avxintrin.h's intrinsics.
Only around 25% of the intrinsics in this file are documented here. The patches for the other half will be sent out later.

The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream.

llvm-svn: 263175
2016-03-11 00:05:54 +00:00
Manman Ren 42e09eb022 Print strict in Availability attribute when it is on.
llvm-svn: 263172
2016-03-10 23:54:12 +00:00
Manman Ren 515758e076 Add has_feature objc_class_property.
rdar://23891898

llvm-svn: 263171
2016-03-10 23:51:03 +00:00
Jonathan Coe 02281b8419 libclang python bindings: Fix for bug 26394
Summary:
https://llvm.org/bugs/show_bug.cgi?id=26394 reports that clang's python bindings tests are failing.

I can confirm that the bug exists and that the proposed fix is good.

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

llvm-svn: 263170
2016-03-10 23:29:45 +00:00
Nico Weber 416ad130ea Reenable asm-errors.c
r134811 made the test pass and reenabled it, but r134831
accidentally disabled it again due to a bad merge.

llvm-svn: 263168
2016-03-10 22:40:02 +00:00
Richard Smith 4d3d785e3f Add test for r263138.
llvm-svn: 263155
2016-03-10 19:22:21 +00:00
Manman Ren 073db02476 Add TreatUnavailableAsInvalid for the verification-only mode in InitListChecker.
Given the following test case:
typedef struct {
  const char *name;
  id field;
} Test9;
extern void doSomething(Test9 arg);
void test9() {
  Test9 foo2 = {0, 0};
  doSomething(foo2);
}
With a release compiler, we don't emit any message and silently ignore the
variable "foo2". With an assert compiler, we get an assertion failure.

The root cause —————————————
Back in r140457 we gave InitListChecker a verification-only mode, and will use
CanUseDecl instead of DiagnoseUseOfDecl for verification-only mode.

These two functions handle unavailable issues differently:
In Sema::CanUseDecl, we say the decl is invalid when the Decl is unavailable and
the current context is available.

In Sema::DiagnoseUseOfDecl, we say the decl is usable by ignoring the return
code of DiagnoseAvailabilityOfDecl

So with an assert build, we will hit an assertion in diagnoseListInit
assert(DiagnoseInitList.HadError() &&
       "Inconsistent init list check result.");

The fix -------------------
If we follow what is implemented in CanUseDecl and treat Decls with
unavailable issues as invalid, the variable decl of “foo2” will be marked as
invalid. Since unavailable checking is processed in delayed diagnostics
(r197627), we will silently ignore the diagnostics when we find out that
the variable decl is invalid.

We add a flag "TreatUnavailableAsInvalid" for the verification-only mode.
For overload resolution, we want to say decls with unavailable issues are
invalid; but for everything else, we should say they are valid and
emit diagnostics. Depending on the value of the flag, CanUseDecl
can return different values for unavailable issues.

rdar://23557300
Differential Revision: http://reviews.llvm.org/D15314

llvm-svn: 263149
2016-03-10 18:53:19 +00:00
Nico Weber f0b1f09389 Make remaining ImplicitFallthrough warning DefaultIgnore.
Follow-up to r262881, which caused this to fire more often.

llvm-svn: 263138
2016-03-10 18:42:37 +00:00
Simon Pilgrim 05e07836c8 Updated SSE3 builtin tests to more closely match the llvm fast-isel equivalent tests
llvm-svn: 263117
2016-03-10 14:46:49 +00:00
Simon Pilgrim 99665cb77f Added note to SSE4a builtins about keeping in sync with llvm tests
llvm-svn: 263116
2016-03-10 14:44:32 +00:00
Simon Pilgrim baed60dd0a Updated SSSE3 builtin tests to more closely match the llvm fast-isel equivalent tests
llvm-svn: 263115
2016-03-10 14:42:17 +00:00
Simon Pilgrim 0d1e3fff2b Minor Wdocumentation fix. NFCI.
llvm-svn: 263113
2016-03-10 14:16:36 +00:00
Aaron Ballman 10670b4f1c Correcting an attribute documentation generation error by giving the abi_tag attribute a documentation category.
llvm-svn: 263109
2016-03-10 13:08:22 +00:00
Ekaterina Romanova e2961f71d2 Add doxygen comments to xmmintrin.h's intrinsics.
Only half of the intrinsics in this file is documented here. The patch for the other half will be sent out later.

The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream.

llvm-svn: 263098
2016-03-10 09:37:04 +00:00
Tim Northover e5dc94ee31 ARM: fix arm_neon_intrinsics.c and re-enable.
It turns out I'd never actually tested my recent change because it was
gated on long-tests. Failure ensued.

llvm-svn: 263093
2016-03-10 04:39:45 +00:00
Richard Trieu 9402d58e5b Disable failing test and fix RUN line.
See https://llvm.org/bugs/show_bug.cgi?id=26894 for details.  This change
fixes the incorrect flags to Clang and the piping issue.  It also disables
the FileCheck portion of the test, which is currently failing.

llvm-svn: 263091
2016-03-10 04:04:12 +00:00
Steven Wu 92910f69a0 Fix false positives for for-loop-analysis warning
Summary:
For PseudoObjectExpr, the DeclMatcher need to search only all the semantics
but also need to search pass OpaqueValueExpr for all potential uses for the
Decl.

Reviewers: thakis, rtrieu, rjmccall, doug.gregor

Subscribers: xazax.hun, rjmccall, doug.gregor, cfe-commits

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

llvm-svn: 263087
2016-03-10 02:02:48 +00:00
Alexey Samsonov ae81bbb496 EmitCXXStructorCall -> EmitCXXDestructorCall. NFC.
This function is only used in Microsoft ABI and only to emit
destructors. Rename/simplify it accordingly.

llvm-svn: 263081
2016-03-10 00:20:37 +00:00
Alexey Samsonov efa956cea0 Remove unused function arguments. NFC.
llvm-svn: 263080
2016-03-10 00:20:33 +00:00
Ben Langmuir 3c4b1290a4 [Modules] Add stdatomic to the list of builtin headers
Since it's provided by the compiler. This allows a system module map
file to declare a module for it.

No test change for cstd.m, since stdatomic.h doesn't function without a
relatively complete stdint.h and stddef.h, which tests using this module
don't provide.

rdar://problem/24931246

llvm-svn: 263076
2016-03-09 23:31:34 +00:00
Davide Italiano 7f96b39151 [modules] Simplify code logic. NFC.
llvm-svn: 263060
2016-03-09 21:09:51 +00:00
Tim Northover 67181e3c3a ARM & AArch64: fix IR-converted tests.
My script was converting %a0 to [[A]]0 if it had seen %a defined before %a0.
Oops.

llvm-svn: 263056
2016-03-09 20:06:10 +00:00
Dmitry Polukhin 5af55b663c NFC fix documentation build by rL263015
This time I hope it will fix the build for real.

llvm-svn: 263052
2016-03-09 19:39:16 +00:00
Kit Barton fbab158767 [PPC] FE support for generating VSX [negated] absolute value instructions
Includes new built-in, conversion of built-in to target-independent intrinsic
and update in the header file. Tests are also updated. There is a second part in
the backend for which I will post a separate code-review. BACKEND PART SHOULD BE
COMMITTED FIRST.

Phabricator: http://reviews.llvm.org/D17816
llvm-svn: 263051
2016-03-09 19:28:31 +00:00
Tim Northover 58672974a9 ARM & AArch64: convert asm tests to LLVM IR and restrict optimizations.
This is mostly a one-time autoconversion of tests that checked assembly after
"-Owhatever" compiles to only run "opt -mem2reg" and check the assembly. This
should make them much more stable to changes in LLVM so they won't break on
unrelated changes.

"opt -mem2reg" is a compromise designed to increase the readability of tests
that check dataflow, while minimizing dependency on LLVM. Hopefully mem2reg is
stable enough that no surpises will come along.

Should address http://llvm.org/PR26815.

llvm-svn: 263048
2016-03-09 18:54:42 +00:00
Aaron Ballman 2648d42ecc Use an explicit instantiation to work around delayed template parsing for MSVC-built bots.
llvm-svn: 263041
2016-03-09 18:07:17 +00:00
Tim Northover 6b582867ad AArch64: remove a couple more tests already covered elsewhere.
llvm-svn: 263038
2016-03-09 18:00:06 +00:00
Aaron Ballman 22b5a4d597 Speculative fix for this test case (the test doesn't run on my typical build environment).
llvm-svn: 263034
2016-03-09 17:34:16 +00:00
Hans Wennborg b2ed61a611 ReleaseNotes: update 'you may prefer' link to 3.8
llvm-svn: 263031
2016-03-09 17:26:46 +00:00
Aaron Ballman a35b8fcef8 Adding new AST matchers for: addrLabelExpr, atomicExpr, binaryConditionalOperator, designatedInitExpr, designatorCountIs, hasSyntacticForm, implicitValueInitExpr, labelDecl, opaqueValueExpr, parenListExpr, predefinedExpr, requiresZeroInitialization, and stmtExpr.
Patch by Aleksei Sidorin.

llvm-svn: 263027
2016-03-09 17:11:51 +00:00
Aaron Ballman 0bcd6c1b18 Implement support for [[maybe_unused]] in C++1z that is based off existing support for unused, and treat it as an extension pre-C++1z. This also means extending the existing unused attribute so that it can be placed on an enum and enumerator, in addition to the other subjects.
llvm-svn: 263025
2016-03-09 16:48:08 +00:00
Dmitry Polukhin bc82e2635d NFC fix documentation build by rL263015
llvm-svn: 263023
2016-03-09 16:19:04 +00:00
Samuel Antao a9f35cb7d6 [OpenMP] Add support for multidimensional array sections in map clause SEMA.
Summary: In some cases it can be proved statically that multidimensional array section refer to contiguous storage and can therefore be allowed in a map clause. This patch adds support for those cases in SEMA.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: cfe-commits, fraggamuffin, caomhin

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

llvm-svn: 263019
2016-03-09 15:46:05 +00:00
Dmitry Polukhin bf17ecf59a [GCC] PR23529 Sema part of attrbute abi_tag support
Original patch by Stefan Bühler http://reviews.llvm.org/D12834

Difference between original and this one:
- fixed all comments in original code review
- added more tests, all new diagnostics now covered by tests
- moved abi_tag on re-declaration checks to Sema::mergeDeclAttributes
  where they actually may work as designed
- clang-format + other stylistic changes

Mangle part will be sent for review as a separate patch.

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

llvm-svn: 263015
2016-03-09 15:30:53 +00:00
Michael Zuckerman 10d6f9ac04 Fixing wrong header title name.
Differential Revision: http://reviews.llvm.org/D17917

llvm-svn: 263007
2016-03-09 11:26:45 +00:00
Manuel Klimek 7186309cde Pacify gcc's parenthesis warning, which doesn't realize that parens don't matter here.
llvm-svn: 263004
2016-03-09 10:06:45 +00:00
Alexey Bataev ef549a8955 [OPENMP 4.5] Codegen for data members in 'linear' clause
OpenMP 4.5 allows privatization of non-static data members in OpenMP
constructs. Patch adds proper codegen support for data members in
'linear' clause

llvm-svn: 263003
2016-03-09 09:49:09 +00:00
Alexey Bataev 78849fb464 [OPENMP 4.5] Codegen for data members in 'linear' clause.
OpenMP 4.5 allows to use data members in private clauses. Patch adds
codegen support for 'linear' clause.

llvm-svn: 263002
2016-03-09 09:49:00 +00:00
Peter Zotov e43b741359 Accept absolute paths in the -fuse-ld option.
This patch extends the -fuse-ld option to accept a full path to an executable
and use it verbatim to invoke the linker. There are generally two reasons
to desire this.

The first reason relates to the sad truth is that Clang is retargetable,
Binutils are not.

While any Clang from a binary distribution is sufficient to compile code
for a wide range of architectures and prefixed BFD linkers (e.g.
installed as /usr/bin/arm-none-linux-gnueabi-ld) as well as cross-compiled
libc's (for non-bare-metal targets) are widely available, including on all
Debian derivatives, it is impossible to use them together because
the -fuse-ld= option allows to specify neither a linker prefix nor
a full path to one.

The second reason is linker development, both when porting existing linkers
to new architectures and when working on a new linker such as LLD.

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

llvm-svn: 262996
2016-03-09 05:18:16 +00:00
Argyrios Kyrtzidis 96e1479326 [index] Add a message for the assertion, NFC.
llvm-svn: 262991
2016-03-09 02:53:12 +00:00
Argyrios Kyrtzidis 542f38f31f [index] libclang: Make sure to treat forward ObjC protocols as ObjCProtocolRef declarations, and fix related crash.
rdar://25035376

llvm-svn: 262985
2016-03-09 02:12:46 +00:00
Argyrios Kyrtzidis 0ad65ac816 [index] Fix assertion hit when indexing re-declarations of built-in functions.
llvm-svn: 262984
2016-03-09 02:12:40 +00:00
Richard Smith 464bc55a1e Readd testcase accidentally removed in r262888.
llvm-svn: 262971
2016-03-09 00:12:38 +00:00
Davide Italiano 21668754a2 [Modules] Modernize, use range-based loops.
llvm-svn: 262969
2016-03-08 23:58:08 +00:00
Richard Smith bbbe618467 Fix crash in access check for aggregate initialization of base classes. It's
not obvious how to access-check these, so pick a conservative rule until we get
feedback from CWG.

llvm-svn: 262966
2016-03-08 23:17:35 +00:00
Richard Smith 6365e46459 Fix -Werror build.
llvm-svn: 262965
2016-03-08 23:16:16 +00:00
Tim Northover f53713769d AArch64: remove tests of intrinsics completely duplicated elsewhere.
llvm-svn: 262964
2016-03-08 23:10:58 +00:00
Richard Smith 872307e2ac P0017R1: In C++1z, an aggregate class can have (public non-virtual) base classes; these are initialized as if they were data members.
llvm-svn: 262963
2016-03-08 22:17:41 +00:00
Aaron Ballman bb5d862a84 Silence duplicate diagnostics because parsing of a standards-based attribute triggers parsing diagnostics that may also be picked up during semantic analysis.
llvm-svn: 262960
2016-03-08 21:31:32 +00:00
Aaron Ballman 6cbf4d8776 Turning on the /bigobj flag for two more files that will not link with MSVC 2015 Win64 Debug due to the section limit.
llvm-svn: 262938
2016-03-08 16:34:37 +00:00
Mike Spertus 288daa5bc6 Add Visual Studio native visualizers for several Clang types
This is one of a series of changes to improve the MSVC visualization of Clang types.
This one focuses on Record and SubstTemplateTypeParmType meaning that, for example,
a TemplateArgumentLoc no longer displays incomprehensibly in the locals window as

  {Argument={DeclArg={Kind=1 QT=0x033acb00 D=0xcccccccc {DeclType=???}}...

but instead much more usefully as

  Type template parameter: SubstTemplateTypeParm: {Identifier (("T"))} => Record, {Identifier (("A"))}

Additional types and improvements will be made in subsequent commits

llvm-svn: 262933
2016-03-08 16:14:23 +00:00
Kevin Funk d9fe95c506 Bump libclang API version after r262318
llvm-svn: 262922
2016-03-08 10:34:23 +00:00
Duncan P. N. Exon Smith 8536392a83 Sema: Methods in unavailable classes are unavailable
Similar to the template cases in r262050, when a C++ method in an
unavailable struct/class calls unavailable API, don't diagnose an error.
I.e., this case was failing:

    void foo() __attribute__((unavailable));
    struct __attribute__((unavailable)) A {
      void bar() { foo(); }
    };

Since A is unavailable, A::bar is allowed to call foo.  However, we were
emitting a diagnostic here.  This commit checks up the context chain
from A::bar, in a manner inspired by SemaDeclAttr.cpp:isDeclUnavailable.

I expected to find other related issues but failed to trigger them:

- I wondered if DeclBase::getAvailability should check for
  `TemplateDecl` instead of `FunctionTemplateDecl`, but I couldn't find
  a way to trigger this.  I left behind a few extra tests to make sure
  we don't regress.

- I wondered if Sema::isFunctionConsideredUnavailable should be
  symmetric, checking up the context chain of the callee (this commit
  only checks up the context chain of the caller).  However, I couldn't
  think of a testcase that didn't require first referencing the
  unavailable type; this, we already diagnose.

rdar://problem/25030656

llvm-svn: 262921
2016-03-08 10:28:52 +00:00
Duncan P. N. Exon Smith 5d6790c746 Sema: Treat 'strict' availability flag like unavailable
This is a follow-up to r261512, which made the 'strict' availability
attribute flag behave like 'unavailable'.  However, that fix was
insufficient.  The following case would (erroneously) error when the
deployment target was older than 10.9:

    struct __attribute__((availability(macosx,strict,introduced=10.9))) A;
    __attribute__((availability(macosx,strict,introduced=10.9))) void f(A*);

The use of A* in the argument list for f is valid here, since f and A
have the same availability.

The fix is to return AR_Unavailable from DeclBase::getAvailability
instead of AR_NotYetIntroduced.  This also reverts the special handling
added in r261163, instead relying on the well-tested logic for
AR_Unavailable.

rdar://problem/23791325

llvm-svn: 262915
2016-03-08 06:12:54 +00:00
Ekaterina Romanova c8976d58fe Add doxygen comments to bmiintrin.h's intrinsics.
The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream.

llvm-svn: 262895
2016-03-08 01:36:59 +00:00
Anna Zaks 30d4668774 [analyzer] Fix missed leak from MSVC specific allocation functions
Add the wide character strdup variants (wcsdup, _wcsdup) and the MSVC
version of alloca (_alloca) and other differently named function used
by the Malloc checker.

A patch by Alexander Riccio!

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

llvm-svn: 262894
2016-03-08 01:21:51 +00:00
Richard Smith 89e9597a50 Use class="svn" for features with SVN status.
llvm-svn: 262889
2016-03-08 00:45:37 +00:00
Richard Smith e513cd25bd Move [[nodiscard]] tests into test/CXX tree.
llvm-svn: 262888
2016-03-08 00:44:49 +00:00
Richard Smith d5d796ecde Define __has_cpp_attribute(fallthrough) to a more reasonable value. (What year is it?!)
llvm-svn: 262887
2016-03-08 00:40:32 +00:00
Richard Smith 33023662cb Add accidentally forgotten testcase from r262881.
llvm-svn: 262882
2016-03-08 00:34:49 +00:00
Richard Smith 4f902c7ecc P0188R1: add support for standard [[fallthrough]] attribute. This is almost
exactly the same as clang's existing [[clang::fallthrough]] attribute, which
has been updated to have the same semantics. The one significant difference
is that [[fallthrough]] is ill-formed if it's not used immediately before a
switch label (even when -Wimplicit-fallthrough is disabled). To support that,
we now build a CFG of any function that uses a '[[fallthrough]];' statement
to check.

In passing, fix some bugs with our support for statement attributes -- in
particular, diagnose their use on declarations, rather than asserting.

llvm-svn: 262881
2016-03-08 00:32:55 +00:00
Aaron Ballman e7964789da Implement support for [[nodiscard]] in C++1z that is based off existing support for warn_unused_result, and treat it as an extension pre-C++1z. This also means extending the existing warn_unused_result attribute so that it can be placed on an enum as well as a class.
llvm-svn: 262872
2016-03-07 22:44:55 +00:00
Adrian Prantl 5a9a42778a Module Debugging: Fix a crash when emitting debug info for nested tag types
whose DeclContext is not yet complete by deferring their emission.

rdar://problem/24918680

llvm-svn: 262851
2016-03-07 20:58:52 +00:00
Michael Zuckerman e71d59fc4f [CLANG][AVX512][BUILTIN] Add builtin vcomi{ss|sd}
Differential Revision: http://reviews.llvm.org/D17919

llvm-svn: 262847
2016-03-07 19:15:00 +00:00
Guillaume Papin 06eff5f2c8 python binding: expose compile command filename
Reviewers: compnerd, skalinichev

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

llvm-svn: 262845
2016-03-07 18:44:42 +00:00
Marina Yatsina 5f77679356 [ms-inline-asm][AVX512] Add ability to use k registers in MS inline asm + fix bag with curly braces
Until now curly braces could only be used in MS inline assembly to mark block start/end.
All curly braces were removed completely at a very early stage.
This approach caused bugs like:
"m{o}v eax, ebx" turned into "mov eax, ebx" without any error.

In addition, AVX-512 added special operands (e.g., k registers), which are also surrounded by curly braces that mark them as such.
Now, we need to keep the curly braces and identify at a later stage if they are marking block start/end (if so, ignore them), or surrounding special AVX-512 operands (if so, parse them as such).

This patch fixes the bug described above and enables the use of AVX-512 special operands.

This commit is the the clang part of the patch.
The clang part of the review is: http://reviews.llvm.org/D17766
The llvm part of the review is: http://reviews.llvm.org/D17767

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

llvm-svn: 262842
2016-03-07 18:10:25 +00:00
Joerg Sonnenberger d0be8dcbf8 Implement __builtin_eh_return_data_regno for SPARC and SPARC64.
llvm-svn: 262838
2016-03-07 17:19:15 +00:00
Joerg Sonnenberger b123c8b7e8 Describe the magic numbers returned by getEHDataRegisterNumber.
llvm-svn: 262837
2016-03-07 17:18:41 +00:00
Michael Zuckerman 9f33848f04 [CLANG][AVX512][BUILTIN] Adding new feature flag headed files and new BUILTIN vpermi2varq{i|t}{128|256|512}{mask|maskz}
Differential Revision: http://reviews.llvm.org/D17917

llvm-svn: 262834
2016-03-07 17:04:11 +00:00
Carlo Bertolli 0ff587d4a4 [OPENMP] Codegen for distribute directive: fix bug in ordering of parameters.
llvm-svn: 262833
2016-03-07 16:19:13 +00:00
Carlo Bertolli fc35ad2bbc Reapply r262741 [OPENMP] Codegen for distribute directive
This patch provide basic implementation of codegen for teams directive, excluding all clauses except dist_schedule. It also fixes parts of AST reader/writer to enable correct pre-compiled header handling.

http://reviews.llvm.org/D17170

llvm-svn: 262832
2016-03-07 16:04:49 +00:00
Amjad Aboud faea560286 Resolved Bug 26414.
https://llvm.org/bugs/show_bug.cgi?id=26414
Since interrupt handler must be returned with iret, tail call can't be used.

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

llvm-svn: 262830
2016-03-07 14:22:46 +00:00
Michael Zuckerman 0190c65571 [CLANG][AVX512][BUILTIN] Adding new feature flag header file and new builtin vpmadd52{h|l}uq{128|256|512}{mask|maskz}
Differential Revision: http://reviews.llvm.org/D17915

llvm-svn: 262820
2016-03-07 09:55:55 +00:00
David Majnemer febb27283d [MS ABI] Mangle symbols names longer than 4096 characters correctly
Really long symbols are hashed using MD5 and prefixed/suffixed with the
usual sigils.  There is an additional reason beyond the usual
compatibility with MSVC, it is important to keep COFF symbols shorter
than 0xFFFF because the CodeView debugging format has a maximum
symbol/record size of 0xFFFF.

There are some quirks worth noting:
- Some mangled names reference other entities which are mangled
separately.  A quick example:

int I;
template <int *> struct S {};
S<I> s;

In this case, the mangling for 's' doesn't depend directly on the
mangling for 'I'.  While 's' would need an MD5 hash if 'I' also needed
one, the hash for 's' applied to the fully realized mangled name.  In
other words, the mangled name for 's' will not depend on the MD5 of the
mangled name for 'I'.

- Some mangled names, like the venerable CatchableType, embed the MD5
verbatim.

- Finally, the complete object locator is handled as a special case.
A complete object locators are mangled exactly like a VFTable except for
a small deviation in the prefix sigils.  However, complete object
locators for hashed vftables result in a complete object locator whose
name is identical to the vftable except for an additional suffix.

llvm-svn: 262818
2016-03-07 08:51:17 +00:00
Michael Zuckerman 912be16a0e [CLANG][AVX512][BUILTIN] Adding vpmultishiftqb{128|256|512}
Differential Revision: http://reviews.llvm.org/D17914

llvm-svn: 262817
2016-03-07 08:29:10 +00:00
Felix Berger 40ef42a932 [ASTMatchers] Document that isAnyPointer() matcher also matches Objective-C object pointers.
Summary: Add test for Objective-C object pointer matching.

Reviewers: aaron.ballman

Subscribers: klimek

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

llvm-svn: 262806
2016-03-06 15:27:59 +00:00
Davide Italiano 5d29dee003 [Modules] Don't swallow errors when parsing optional attributes.
Differential Revision:	http://reviews.llvm.org/D17787

llvm-svn: 262789
2016-03-06 04:20:05 +00:00
Simon Pilgrim 1feae0d0bb Fixed -Wdocumentation warning - typo in a parameter name
llvm-svn: 262783
2016-03-05 22:35:55 +00:00
Saleem Abdulrasool ac25f2c073 Misc: add a test for TargetParser usage
Ensure that an invalid value passed to target parser does not cause an assertion
in +Asserts builds.

Supporting test for PR26839.

llvm-svn: 262780
2016-03-05 21:12:33 +00:00
Daniel Jasper acffeb8b63 clang-format: [JS] Support destructuring assignments in for loops.
Before:
  for (let { a, b } of x) {
  }

After:
  for (let {a, b} of x) {
  }

llvm-svn: 262776
2016-03-05 18:34:26 +00:00
Simon Pilgrim 4aa36fd4e3 [X86] AMD Bobcat CPU (btver1) doesn't support XSAVE
btver1 is a SSSE3/SSE4a only CPU - it doesn't have AVX and doesn't support XSAVE.

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

llvm-svn: 262772
2016-03-05 14:35:44 +00:00
Richard Trieu 2334a30e15 Add null check to diagnostic path for lambda captures.
Previously, the failed capture of a variable in nested lambdas may crash when
the lambda pointer is null.  Only give the note if a location can be retreived
from the lambda pointer.

llvm-svn: 262765
2016-03-05 04:04:57 +00:00
Mike Spertus c4572c2a85 Test commit: Fix run-on sentence in comment
llvm-svn: 262764
2016-03-05 01:56:07 +00:00
Devin Coughlin a1d9d75a88 [analyzer] Nullability: add option to not report on calls to system headers.
Add an -analyzer-config 'nullability:NoDiagnoseCallsToSystemHeaders' option to
the nullability checker. When enabled, this option causes the analyzer to not
report about passing null/nullable values to functions and methods declared
in system headers.

This option is motivated by the observation that large projects may have many
nullability warnings. These projects may find warnings about nullability
annotations that they have explicitly added themselves higher priority to fix
than warnings on calls to system libraries.

llvm-svn: 262763
2016-03-05 01:32:43 +00:00
Richard Smith 560a3579b2 Update diagnostics now that hexadecimal literals look likely to be part of C++17.
llvm-svn: 262753
2016-03-04 22:32:06 +00:00
David Blaikie ac92893a93 PR5941 - improve diagnostic for * vs & confusion when choosing overload candidate with a parameter of incomplete (ref or pointer) type
Reviewers: dblaikie

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

llvm-svn: 262752
2016-03-04 22:29:11 +00:00
Nico Weber 381ec2afbf clang-cl: Enable PCH flags by default.
Now that pragma comment and pragma detect_mismatch are implemented, this might
just work.

Some pragmas aren't serialized yet (from the top of my head: code_seg, bss_seg,
data_seg, const_seg, init_seg, section, vtordisp), but these are as far as I
know usually pushed and popped within the header and usually don't leak out.
If it turns out the current PCH support isn't good enough yet, we can turn it
off again.

llvm-svn: 262749
2016-03-04 21:59:42 +00:00
Richard Smith 8ee39e31bb Implement P0036R0: remove support for empty unary folds of +, *, |, &.
llvm-svn: 262747
2016-03-04 21:27:21 +00:00
Samuel Antao bf4d18d3d2 Revert r262741 - [OPENMP] Codegen for distribute directive
Was causing a failure in one of the buildbot slaves.

llvm-svn: 262744
2016-03-04 21:02:14 +00:00
Richard Smith f006a96aff Update cxx_status with likely new features from Jacksonville WG21 meeting.
llvm-svn: 262743
2016-03-04 21:01:14 +00:00
Stephen Hines e3f91e31ab Switch krait to use -mcpu=cortex-a15 for assembler tool invocations.
Summary:
Using -no-integrated-as causes -mcpu=krait to be transformed into
-march=armv7-a today. This precludes the assembler from using
instructions like sdiv, which are present for krait. Cortex-a15 is the
closest subset of functionality for krait, so we should switch the
assembler to use that instead.

Reviewers: cfe-commits, apazos, weimingz

Subscribers: aemerson

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

llvm-svn: 262742
2016-03-04 20:57:22 +00:00
Carlo Bertolli 4a56e3831d [OPENMP] Codegen for distribute directive
This patch provide basic implementation of codegen for teams directive, excluding all clauses except dist_schedule. It also fixes parts of AST reader/writer to enable correct pre-compiled header handling.

http://reviews.llvm.org/D17170

llvm-svn: 262741
2016-03-04 20:24:58 +00:00
James Y Knight b214cbc785 Make TargetInfo store an actual DataLayout instead of a string.
Use it to calculate UserLabelPrefix, instead of specifying it (often
incorrectly).

Note that the *actual* user label prefix has always come from the
DataLayout, and is handled within LLVM. The main thing clang's
TargetInfo::UserLabelPrefix did was to set the #define value. Having
these be different from each-other is just silly.

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

llvm-svn: 262737
2016-03-04 19:00:41 +00:00
Devin Coughlin a604679897 [analyzer] Add diagnostic in ObjCDeallocChecker for use of -dealloc instead of -release.
In dealloc methods, the analyzer now warns when -dealloc is called directly on
a synthesized retain/copy ivar instead of -release. This is intended to find mistakes of
the form:

- (void)dealloc {
  [_ivar dealloc]; // Mistaken call to -dealloc instead of -release

  [super dealloc];
}

rdar://problem/16227989

llvm-svn: 262729
2016-03-04 18:09:58 +00:00
Benjamin Kramer 6c3856d850 Move class into anonymous namespace. NFC.
llvm-svn: 262716
2016-03-04 14:18:52 +00:00
Pavel Labath a174d8709f [SemaExprCXX] Avoid calling isInSystemHeader for invalid source locations
Summary:
While diagnosing a CXXNewExpr warning, we were calling isInSystemHeader(), which expect to be
called with a valid source location. This causes an assertion failure if the location is unknown.
A quick grep shows it's not without precedent to guard calls to the function with a
"Loc.isValid()".

This fixes a test failure in LLDB, which always creates object with invalid source locations as it
does not (always) have access to the source.

Reviewers: nlewycky

Subscribers: lldb-commits, cfe-commits

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

llvm-svn: 262700
2016-03-04 10:00:08 +00:00
Alexey Bataev c5b1d320b8 [OPENMP 4.0] Codegen for 'declare reduction' construct.
Emit function for 'combiner' part of 'declare reduction' construct and
'initialilzer' part, if any.

llvm-svn: 262699
2016-03-04 09:22:22 +00:00
Vedant Kumar 22bd871ea6 [Coverage] Fix the start/end locations of switch statements
While pushing switch statements onto the region stack we neglected to
specify their start/end locations. This results in a crash (PR26825) if
we end up in nested macro expansions without enough information to
handle the relevant file exits.

I added a test in switchmacro.c and fixed up a bunch of incorrect CHECK
lines that specify strange end locations for switches.

llvm-svn: 262697
2016-03-04 08:07:15 +00:00
Alexey Bataev 37e594c799 [OPENMP] Simplify handling of clauses with postupdates, NFC.
Clauses with post-update expressions always have pre-init statement. So
OMPClauseWithPreInit now is the base for OMPClauseWithPostUpdate.

llvm-svn: 262696
2016-03-04 07:21:16 +00:00
Argyrios Kyrtzidis 7332106499 [index] Distinguish USRs of anonymous enums by using their first enumerator.
rdar://24609949.

llvm-svn: 262695
2016-03-04 07:17:53 +00:00
Argyrios Kyrtzidis 2682f9e5de [index] Include parameter types in the USRs for C functions marked with 'overloadable' attribute.
llvm-svn: 262694
2016-03-04 07:17:48 +00:00
Argyrios Kyrtzidis 9c99867386 [index] In ObjC++ handle objc type parameters for function USRs.
llvm-svn: 262693
2016-03-04 07:17:43 +00:00
Xiuli Pan 4415bdbdc3 [OpenCL] Refine pipe builtin support
Summary:
Refine the type builtin support as the request with
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20160201/148637.html

Reviewers: pekka.jaaskelainen, Anastasia, yaxunl

Subscribers: rsmith, cfe-commits

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

llvm-svn: 262692
2016-03-04 07:11:16 +00:00
Bhushan D. Attarde bacb988735 [MIPS] initFeatureMap() to handle empty string argument
SUMMARY:
    This patch sets CPU string to its default value when it is not supplied by caller.
    
    Reviewers: vkalintiris, dsanders
    Subscribers: mohit.bhakkad, sagar, jaydeep, cfe-commits
    Differential Revision: http://reviews.llvm.org/D16139

llvm-svn: 262691
2016-03-04 06:56:29 +00:00
David Majnemer e2ae228c76 [X86] Pass __m64 types via SSE registers for GCC compatibility
For compatibility with GCC, classify __m64 as SSE.
However, clang is a platform compiler for certain targets; retain our
old behavior on those targets: classify __m64 as integer.

This fixes PR26832.

llvm-svn: 262688
2016-03-04 05:26:16 +00:00
David Majnemer 6a6206d440 [VFS] Switch from close to SafelyCloseFileDescriptor
The SafelyCloseFileDescriptor machinery does the right thing in the face
of signals while close will do something platform specific which results
in the FD potentially getting leaked.

llvm-svn: 262687
2016-03-04 05:26:14 +00:00
Argyrios Kyrtzidis 8757fc5594 [index] Ignore ObjCTypeParamDecls during indexing.
llvm-svn: 262686
2016-03-04 04:24:32 +00:00
Carlo Bertolli 6ad7b5aff2 [OPENMP] firstprivate and private clauses of teams, host codegeneration
Add code generation support for firstprivate and private clauses of teams on the host. Add extensive regression tests including lambda functions and vla testing.

http://reviews.llvm.org/D17582

llvm-svn: 262663
2016-03-03 22:09:40 +00:00
Devin Coughlin 578a20a82e [analyzer] ObjCDeallocChecker: Only check for nil-out when type is retainable.
This fixes a crash when setting a property of struct type in -dealloc.

llvm-svn: 262659
2016-03-03 21:38:39 +00:00
Carlo Bertolli 430d8ecc55 Add code generation for teams directive inside target region
llvm-svn: 262652
2016-03-03 20:34:23 +00:00
Anastasia Stulova 782d5f43ca [OpenCL] Improve diagnostics of address spaces for variables in function
- Prevent local variables to be declared in global AS
 - Diagnose AS of local variables with an extern storage class
   as if they would be in a program scope

Review: http://reviews.llvm.org/D17345
llvm-svn: 262641
2016-03-03 18:38:40 +00:00
Daniel Jasper 94a96fcebe clang-format: Use stable_sort when sorting #includes.
Otherwise, clang-format can output useless replacements in the presence
of identical #includes

llvm-svn: 262630
2016-03-03 17:34:14 +00:00
Samuel Antao b68e2db8f9 [OpenMP] Code generation for teams - kernel launching
Summary:
This patch implements the launching of a target region in the presence of a nested teams region, i.e calls tgt_target_teams with the required arguments gathered from the enclosed teams directive.

The actual codegen of the region enclosed by the teams construct will be contributed in a separate patch.

Reviewers: hfinkel, arpith-jacob, kkwli0, carlo.bertolli, ABataev

Subscribers: cfe-commits, caomhin, fraggamuffin

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

llvm-svn: 262625
2016-03-03 16:20:23 +00:00
Bradley Smith f4affc13c5 [ARM] Add Clang targeting for ARMv8-M Baseline/Mainline
llvm-svn: 262619
2016-03-03 13:52:22 +00:00
Michael Zuckerman 0d67e4b5d6 [CLANG][AVX512][BUILTIN] movddup{128|256|512}
Differential Revision: http://reviews.llvm.org/D17826

llvm-svn: 262617
2016-03-03 13:43:05 +00:00
Anastasia Stulova 1f95cc097c [OpenCL] Apply missing restrictions for Blocks in OpenCL v2.0
Applying the following restrictions for block types in OpenCL (v2.0 s6.12.5):
 - __block storage class is disallowed
 - every block declaration must be const qualified and initialized
 - a block can't be used as a return type of a function
 - a blocks can't be used to declare a structure or union field
 - extern speficier is disallowed

Corrected image and sampler types diagnostics with struct and unions.

Review: http://reviews.llvm.org/D16928
llvm-svn: 262616
2016-03-03 13:33:19 +00:00
Michael Zuckerman 56de012b41 Fixing a checkfile error in avx512vlbw-builtins.c
Differential Revision: http://reviews.llvm.org/D17814

llvm-svn: 262611
2016-03-03 12:17:50 +00:00
Michael Zuckerman 1ad03e7f01 [CLANG][AVX512][BUILTIN] movdqu{qi|hi} {128|256|512}
Differential Revision: http://reviews.llvm.org/D17814

llvm-svn: 262609
2016-03-03 11:34:52 +00:00
NAKAMURA Takumi dd30704201 Tweak CMakeLists not for libclang to depend on the variable CLANG_TOOL_EXTRA_BUILD.
llvm-svn: 262606
2016-03-03 11:09:43 +00:00
Alexander Kornienko a079856a51 [docs] Add missing file
llvm-svn: 262604
2016-03-03 10:44:10 +00:00
Alexander Kornienko 33a03cd898 [docs] Updated doxygen files to work well with doxygen 1.8.11
Doxygen 1.8.11 doesn't seem to like files with ".intro" extension by default.

llvm-svn: 262603
2016-03-03 10:42:46 +00:00
Michael Zuckerman ffbb67a8e2 [CLANG][AVX512][BUILTIN] movdqa{32|64}{load|store|}{128|256|512}
Differential Revision: http://reviews.llvm.org/D17812

llvm-svn: 262598
2016-03-03 09:26:01 +00:00
Benjamin Kramer c1ffdab3fb [libclang] Link clang-tidy plugin into libclang if present.
This is a sad workaround for the lack of plugin support in libclang. Depends
on D17807, a tools-extra change that also contains the test case.

This is designed to be easy to remove again if libclang ever grows proper
plugin support.

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

llvm-svn: 262596
2016-03-03 08:58:18 +00:00
Michael Zuckerman abbe34bce6 [Clang][AVX512][BUILTIN] Adding PSRL{W|WI}{128|256|512}
Differential Revision: http://reviews.llvm.org/D17754

llvm-svn: 262593
2016-03-03 08:55:20 +00:00
John McCall 477f2bb0d5 Semantic analysis for the swiftcall calling convention.
I've tried to keep the infrastructure behind parameter ABI
treatments fairly general.

llvm-svn: 262587
2016-03-03 06:39:32 +00:00
Argyrios Kyrtzidis 34a0c1a572 [index] Report references of ObjC super class/protocols in interfaces and protocols.
llvm-svn: 262584
2016-03-03 05:33:54 +00:00
Argyrios Kyrtzidis d68a4d6ae0 [test] Re-enable asan on the test, stack usage should be lower.
llvm-svn: 262583
2016-03-03 05:33:48 +00:00
Alexey Bataev 94a4f0cb5f [OPENMP 4.0] Initial support for 'omp declare reduction' construct.
Add parsing, sema analysis and serialization/deserialization for 'declare reduction' construct.
User-defined reductions are defined as

#pragma omp declare reduction( reduction-identifier : typename-list : combiner ) [initializer ( initializer-expr )]
These custom reductions may be used in 'reduction' clauses of OpenMP constructs. The combiner specifies how partial results can be combined into a single value. The
combiner can use the special variable identifiers omp_in and omp_out that are of the type of the variables being reduced with this reduction-identifier. Each of them will
denote one of the values to be combined before executing the combiner. It is assumed that the special omp_out identifier will refer to the storage that holds the resulting
combined value after executing the combiner.
As the initializer-expr value of a user-defined reduction is not known a priori the initializer-clause can be used to specify one. Then the contents of the initializer-clause
will be used as the initializer for private copies of reduction list items where the omp_priv identifier will refer to the storage to be initialized. The special identifier
omp_orig can also appear in the initializer-clause and it will refer to the storage of the original variable to be reduced.
Differential Revision: http://reviews.llvm.org/D11182

llvm-svn: 262582
2016-03-03 05:21:39 +00:00
Alexey Bataev 2bbf7217ea [OPENMP 4.5] Initial support for data members in 'linear' clause.
OpenMP 4.5 allows to privatize data members of current class in member
functions. Patch adds initial support for privatization of data members
in 'linear' clause, no codegen support.

llvm-svn: 262578
2016-03-03 03:52:24 +00:00
Sean Callanan 3a83ea7ec6 Caught and fixed a typo in r262572.
I should have checked and imported D's in-class initializer.
Instead I accidentally used ToField's in-class initializer,
which is always NULL so ToField will never get one.

<rdar://problem/24943405>

llvm-svn: 262576
2016-03-03 02:22:05 +00:00
Sean Callanan bb33f58a1a Fixed a problem where the ASTImporter mishandled in-class initializers.
Previously, the ASTImporter, when copying a FieldDecl, would make the
new FieldDecl use the exact same in-class initializer as the original
FieldDecl, which is a problem since the initializer is in the wrong AST.
The initializer must be imported, just like all the other parts of the
field.

Doug Gregor reviewed this fix.

<rdar://problem/24943405>

llvm-svn: 262572
2016-03-03 01:21:28 +00:00
Ekaterina Romanova 4711441e52 This patch adds doxygen comments for all the intrinsincs in the header file tmmintrin.h.
The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code review upstream.

llvm-svn: 262565
2016-03-03 00:20:11 +00:00
Nico Weber 4293231e50 Serialize `pragma pointers_to_members` state.
Like r262539, but for pointers_to_members.

llvm-svn: 262552
2016-03-03 00:17:35 +00:00
John McCall 3b5a8f5ffc Improve some infrastructure for extended parameter infos and
fix a bug with the instantiation of ns_consumed parameter
attributes in ARC.

llvm-svn: 262551
2016-03-03 00:10:03 +00:00
Nico Weber 8ab9219295 clang-cl pch test: Instead of copying the input, use /Fp to not write into the test directory.
Also fix a bug with /Fp and absolute paths uncovered by this.
Follow-up to r262487.

llvm-svn: 262541
2016-03-02 23:29:29 +00:00
Nico Weber 779355f96b Serialize `pragma ms_struct` state.
pragma ms_struct has an effect on struct decls, and the effect is serialized
correctly already.  But the "is ms_struct currently on" state wasn't before
this change.

This uses the same approach as `pragma clang optimize`: When writing a module,
the state isn't serialized, only when writing a pch file.

llvm-svn: 262539
2016-03-02 23:22:00 +00:00
Daniel Jasper abd1f57453 clang-format: [JS] Optionally re-quote string literals.
Turns "foo" into 'foo' (or vice versa, depending on configuration).
This makes it more convenient to follow the Google JavaScript style
guide:
https://google.github.io/styleguide/javascriptguide.xml?showone=Strings#Strings

This functionality is behind the option "JavaScriptQuotes", which can be:

  * "leave" (no re-quoting)
  * "single" (change to single quotes)
  * "double" (change to double quotes)

This also changes single quoted JavaScript string literals to be treated
as tok::string_literal, not tok::char_literal, which fixes two unrelated
tests.

Patch by Martin Probst. Thank you.

llvm-svn: 262534
2016-03-02 22:44:03 +00:00
Devin Coughlin 2b2f8996ce [analyzer] Move ObjCSuperDeallocChecker out of the alpha package.
It will now be on by default on Darwin.

rdar://problem/6953275

llvm-svn: 262526
2016-03-02 22:01:03 +00:00
Devin Coughlin 2b77c4603d [analyzer] Move ObjCDeallocChecker out of the alpha package.
It will now be on by default on Darwin.

rdar://problem/6927496

llvm-svn: 262524
2016-03-02 21:50:54 +00:00
Devin Coughlin dce8d8b3f1 [analyzer] Fix capitalization in ObjCSuperDeallocChecker diagnostic.
llvm-svn: 262520
2016-03-02 21:22:48 +00:00
Artem Belevich 3609085dc4 Fixed test failure platforms with name mangling different from Linux.
* Run cc with -triple x86_64-linux-gnu to make symbol mangling predictable.
* Use temporary file as a fake GPU input so its content
  does not interfere with pattern matching.

llvm-svn: 262516
2016-03-02 21:03:20 +00:00
Rong Xu 9c6f1538cc [PGO] Change profile use cc1 option to handle IR level profiles
This patch changes cc1 option for PGO profile use from
-fprofile-instr-use=<path> to -fprofile-instrument-use-path=<path>.
-fprofile-instr-use=<path> is now a driver only option.

In addition to decouple the cc1 option from the driver level option, this patch
also enables IR level profile use. cc1 option handling now reads the profile
header and sets CodeGenOpt ProfileUse (valid values are {None, Clang, LLVM}
-- this is a common enum for -fprofile-instrument={}, for the profile
instrumentation), and invoke the pipeline to enable the respective PGO use pass.

Reviewers: silvas, davidxl

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

llvm-svn: 262515
2016-03-02 20:59:36 +00:00
Nico Weber eebcfde61a fix test from r262506
llvm-svn: 262508
2016-03-02 19:38:24 +00:00
Nico Weber cbbaeb1307 Serialize `#pragma detect_mismatch`.
This is like r262493, but for pragma detect_mismatch instead of pragma comment.
The two pragmas have similar behavior, so use the same approach for both.

llvm-svn: 262506
2016-03-02 19:28:54 +00:00
Kostya Serebryany 578787ad30 [libFuzzer] allow -fsanitize-coverage=0 (disables all coverage)
llvm-svn: 262503
2016-03-02 19:16:54 +00:00
Artem Belevich 8c1ec1ef38 [CUDA] Do not generate unnecessary runtime init code.
Differential Revision: http://reviews.llvm.org/D17780

llvm-svn: 262499
2016-03-02 18:28:53 +00:00
Artem Belevich 42e1949b46 [CUDA] Emit host-side 'shadows' for device-side global variables
... and register them with CUDA runtime.

This is needed for commonly used cudaMemcpy*() APIs that use address of
host-side shadow to access their counterparts on device side.

Fixes PR26340

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

llvm-svn: 262498
2016-03-02 18:28:50 +00:00
Nico Weber 6622029d5e Serialize `#pragma comment`.
`#pragma comment` was handled by Sema calling a function on ASTConsumer, and
CodeGen then implementing this function and writing things to its output.

Instead, introduce a PragmaCommentDecl AST node and hang one off the
TranslationUnitDecl for every `#pragma comment` line, and then use the regular
serialization machinery. (Since PragmaCommentDecl has codegen relevance, it's
eagerly deserialized.)

http://reviews.llvm.org/D17799

llvm-svn: 262493
2016-03-02 17:28:48 +00:00
Daniel Jasper 649fdb126a test/Driver/cl-pch-errorhandling.cpp: Copy input file to a temporary
location as we cannot assume the location of the input file to be
writable.

llvm-svn: 262487
2016-03-02 14:26:59 +00:00
Michael Zuckerman 3df95e711f [CLANG] [AVX512] [BUILTIN] Adding PSRA{W|WI}{128|256|512}.
Differential Revision: http://reviews.llvm.org/D17706

llvm-svn: 262481
2016-03-02 12:06:06 +00:00
Michael Zuckerman d15c95a793 [CLANG] [AVX512] [BUILTIN] Adding PSRAV
Differential Revision: http://reviews.llvm.org/D17699

llvm-svn: 262471
2016-03-02 09:05:46 +00:00
David Majnemer ec4b7341cc [Sema] PR26444 fix crash when alignment value is >= 2**16
Sema allows max values up to 2**28, use unsigned instead of unsiged
short to hold values that large.

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

Patch by Don Hinton!

llvm-svn: 262466
2016-03-02 06:48:47 +00:00
Davide Italiano 75df821670 [modules] addHeaderInclude() can't fail.
Differential Revision:	  http://reviews.llvm.org/D17794

llvm-svn: 262463
2016-03-02 06:09:18 +00:00
Alexey Bataev 61205070c4 [OPENMP 4.5] Codegen for data members in 'reduction' clause.
OpenMP 4.5 allows to privatize non-static data members of current class
in non-static member functions. Patch supports codegen for non-static
data members in 'reduction' clauses.

llvm-svn: 262460
2016-03-02 04:57:40 +00:00
Reid Kleckner 9cc4b4e042 Add a few dllimport/dllexport tests. NFC
Summary:
This change just adds tests for some corner cases of dllimport/dllexport,
primarily for some static methods.

We plan to enable dllimport/dllexport support for the PS4, and these
additional tests are for points we previously were testing internally.

-Warren Ristow
SN Systems - Sony Computer Entertainment Group

Reviewers: rnk

Subscribers: silvas

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

llvm-svn: 262442
2016-03-02 01:21:48 +00:00
Chris Bieneman db5294d9c0 [CMake] Add convenience target clang-test-depends to build test dependencies.
This is useful when paired with the distribution targets to build prerequisites for running tests.

llvm-svn: 262429
2016-03-02 00:27:15 +00:00
Nico Weber 2ca4be97de clang-cl: Implement initial limited support for precompiled headers.
In the gcc precompiled header model, one explicitly runs clang with `-x
c++-header` on a .h file to produce a gch file, and then includes the header
with `-include foo.h` and if a .gch file exists for that header it gets used.
This is documented at
http://clang.llvm.org/docs/UsersManual.html#precompiled-headers

cl.exe's model is fairly different, and controlled by the two flags /Yc and
/Yu. A pch file is generated as a side effect of a regular compilation when
/Ycheader.h is passed. While the compilation is running, the compiler keeps
track of #include lines in the main translation unit and writes everything up
to an `#include "header.h"` line into a pch file. Conversely, /Yuheader.h tells
the compiler to skip all code in the main TU up to and including `#include
"header.h"` and instead load header.pch. (It's also possible to use /Yc and /Yu
without an argument, in that case a `#pragma hrdstop` takes the role of
controlling the point where pch ends and real code begins.)

This patch implements limited support for this in that it requires the pch
header to be passed as a /FI force include flag – with this restriction,
it can be implemented almost completely in the driver with fairly small amounts
of code. For /Yu, this is trivial, and for /Yc a separate pch action is added
that runs before the actual compilation. After r261774, the first failing
command makes a compilation stop – this means if the pch fails to build the
main compilation won't run, which is what we want. However, in /fallback builds
we need to run the main compilation even if the pch build fails so that the
main compilation's fallback can run. To achieve this, add a ForceSuccessCommand
that pretends that the pch build always succeeded in /fallback builds (the main
compilation will then fail to open the pch and run the fallback cl.exe
invocation).

If /Yc /Yu are used in a setup that clang-cl doesn't implement yet, clang-cl
will now emit a "not implemented yet; flag ignored" warning that can be
disabled using -Wno-clang-cl-pch.

Since clang-cl doesn't yet serialize some important things (most notably
`pragma comment(lib, ...)`, this feature is disabled by default and only
enabled by an internal driver flag. Once it's more stable, this internal flag
will disappear.

(The default stdafx.h setup passes stdafx.h as explicit argument to /Yc but not
as /FI – instead every single TU has to `#include <stdafx.h>` as first thing it
does. Implementing support for this should be possible with the approach in
this patch with minimal frontend changes by passing a --stop-at / --start-at
flag from the driver to the frontend. This is left for a follow-up. I don't
think we ever want to support `#pragma hdrstop`, and supporting it with this
approach isn't easy: This approach relies on the driver knowing the pch
filename in advance, and `#pragma hdrstop(out.pch)` can set the output
filename, so the driver can't know about it in advance.)

clang-cl now also honors /Fp and puts pch files in the same spot that cl.exe
would put them, but the pch file format is of course incompatible. This has
ramifications on /fallback, so /Yc /Yu aren't passed through to cl.exe in
/fallback builds.

http://reviews.llvm.org/D17695

llvm-svn: 262420
2016-03-01 23:16:44 +00:00
Simon Pilgrim 2e6a9a290b Updated SSE41 builtin tests to more closely match the llvm fast-isel equivalent tests
llvm-svn: 262418
2016-03-01 22:38:33 +00:00
John McCall 07daf721fb Mangle extended qualifiers in the proper order and mangle the
ARC ownership-convention function type modifications.

According to the Itanium ABI, vendor extended qualifiers are
supposed to be mangled in reverse-alphabetical order before
any CVR qualifiers.  The ARC function type conventions are
plausibly order-significant (they are associated with the
function type), which permits us to ignore the need to correctly
inter-order them with any other vendor qualifiers on the parameter
and return types.

Implementing these rules correctly is technically an ABI break.
Apple is comfortable with the risk of incompatibility here for
the ARC features, and I believe that address-space qualification
is still uncommon enough to allow us to adopt the conforming
rule without serious risk.  Still, targets which make heavy
use of address space qualification may want to revert to the
non-conforming order.

llvm-svn: 262414
2016-03-01 22:18:03 +00:00
Daniel Sanders c1eb1e0419 Explicitly select IAS on one more RUN line in new embed-bitcode.c test.
This should fix clang-cmake-mips builder since MIPS does not have IAS enabled
by default (yet).

llvm-svn: 262409
2016-03-01 21:57:22 +00:00
Daniel Jasper 56ef6aca2b [clang-format] Detect constructor initializers preceded by `noexcept`.
Patch by Erik Kessler, thank you.

llvm-svn: 262402
2016-03-01 21:41:58 +00:00
Ekaterina Romanova c207006bbb This patch adds doxygen comments for the intrinsincs in the header file popcntintrin.h.
The doxygen comments are automatically generated based on Sony's intrinsics documentation.

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

llvm-svn: 262385
2016-03-01 20:04:57 +00:00
Reid Kleckner 8f1b1f5921 Reword a misleading comment discussing landingpads and SEH
SEH doesn't use landingpads anymore.

llvm-svn: 262382
2016-03-01 19:51:48 +00:00
David Majnemer 25eb165f18 [MSVC Compat] Correctly handle finallys nested within finallys
We'd lose track of the parent CodeGenFunction, leading us to get
confused with regard to which function a nested finally belonged to.

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

llvm-svn: 262379
2016-03-01 19:42:53 +00:00
Kit Barton 2b36b15834 [PPC64][VSX] Add short, char, and bool data type for vec_vsx_ld and vec_vsx_st intrinsics
Issue: https://llvm.org/bugs/show_bug.cgi?id=26720

Fix compile error when building ffmpeg for PowerPC64LE because of some
vec_vsx_ld/vec_vsx_st intrinsics are not supported by current clang.

New added intrinsics:

(vector) {signed|unsigned} {short|char} vec_vsx_ld: (total: 8)
bool vec_vsx_ld: (total: 1)
(vector) {signed|unsigned} {short|char} vec_vsx_st: (total: 8)
bool vec_vsx_st: (total: 1)
Total: 18 intrinsics

Phabricator: http://reviews.llvm.org/D17637
llvm-svn: 262359
2016-03-01 18:11:28 +00:00
Michael Zuckerman d176d744af [CLANG][AVX512][BUILTIN] Adding PSRL{DI|QI}{128|256|512} builtin
Differential Revision: http://reviews.llvm.org/D17714

llvm-svn: 262355
2016-03-01 17:49:03 +00:00
Daniel Sanders 946b556c88 Explicitly select IAS in new embed-bitcode.c test.
This should fix clang-cmake-mips builder since MIPS does not have IAS enabled
by default (yet).

llvm-svn: 262350
2016-03-01 17:15:11 +00:00
Filipe Cabecinhas 08830c705e [cmake] Add a few more compiler-rt check-* targets for EXTERNAL_COMPILER_RT
llvm-svn: 262341
2016-03-01 15:33:52 +00:00
Filipe Cabecinhas e5bee80802 [cmake] Try to appease the buildbots.
llvm-svn: 262340
2016-03-01 15:07:19 +00:00
Filipe Cabecinhas 2cc9d4795f [cmake] Pass through the cmake_3_2_USES_TERMINAL variable so we get progress bars on an external compiler-rt build
llvm-svn: 262336
2016-03-01 14:10:38 +00:00
Filipe Cabecinhas a3c4f2f479 [cmake] Use CMake's USES_TERMINAL for the test targets.
llvm-svn: 262335
2016-03-01 14:08:18 +00:00
Filipe Cabecinhas 03ca68d6a6 [cmake] Fallback to LLVM_EXTERNAL_COMPILER_RT_SOURCE_DIR if COMPILER_RT_SRC_ROOT doesn't exist.
llvm-svn: 262334
2016-03-01 14:08:13 +00:00
NAKAMURA Takumi 15765f5db7 FormatTests: Update libdeps corresponding to r262323.
llvm-svn: 262329
2016-03-01 13:11:36 +00:00
Michael Zuckerman 0165e7669c [CLANG][AVX512][BUILTIN] Adding PSRLV builtin
Differential Revision: http://reviews.llvm.org/D17718

llvm-svn: 262326
2016-03-01 13:03:45 +00:00
Manuel Klimek 0000eeceb6 Fix test breakage on windows where the default std is c++11 by forcing c++03 in the test.
llvm-svn: 262325
2016-03-01 12:53:18 +00:00
Manuel Klimek 2c50b312ea Fix DLL build by adding required dependency.
llvm-svn: 262324
2016-03-01 12:47:30 +00:00
Manuel Klimek b12e5a5ccd Add functions to apply replacements and reformat them.
This is a commonly useful feature to have, and we have implemented it
multiple times with different kinds of bugs. This implementation
centralizes the idea in a set of functions that we can then use from the various
tools.

Reverts r262234, which is a revert of r262232, and puts the functions
into FOrmat.h, as they are closely coupled to clang-format, and we
otherwise introduce a cyclic dependency between libFormat and
libTooling.

Patch by Eric Liu.

llvm-svn: 262323
2016-03-01 12:37:30 +00:00
Michael Zuckerman 1ac360cca4 [CLANG] [AVX512] [BUILTIN] Adding PSRA{Q|D|QI|DI}{128|256|512} builtin
Differential Revision: http://reviews.llvm.org/D17693

llvm-svn: 262321
2016-03-01 11:38:16 +00:00
Manuel Klimek 016c024ca4 Optionally demote fatal errors to non-fatal errors.
This behavior is enabled when the new CXTranslationUnit_KeepGoing
option is passed to clang_parseTranslationUnit{,2}. It is geared
towards use by IDEs and similar consumers of the clang-c API where
fatal errors may arise when parsing incomplete code mid-edit, or
when include paths are not properly configured yet. In such situations
one still wants to get as much information as possible about a TU.
Previously, the semantic analysis would not instantiate templates
or report additional fatal errors after the first fatal error was
encountered.

Fixes PR24268.

Patch by Milian Wolff.

llvm-svn: 262318
2016-03-01 10:56:19 +00:00
John McCall 62969a39fa Test template instantiation of ns_consumed and ns_returns_retained.
llvm-svn: 262311
2016-03-01 06:54:30 +00:00
John McCall 65a6fe0c66 Better comments for ExtParameterInfo.
llvm-svn: 262308
2016-03-01 06:27:40 +00:00
Argyrios Kyrtzidis 14a79d7736 [test] After r262290 reducing stack usage, try re-enabling asan on the related test.
llvm-svn: 262295
2016-03-01 04:40:20 +00:00
Daniel Jasper 04b4e10873 clang-format: Correctly apply wrap before multi-line RHS rule to
ternary expressions.

Before:
  return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? aaaaa : bbbbbbbbbbbbbbb +
							     cccccccccccccccc;

After:
  return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ?
	     aaaaa :
	     bbbbbbbbbbbbbbb + cccccccccccccccc;

llvm-svn: 262293
2016-03-01 04:19:59 +00:00
Daniel Jasper f9168de892 clang-format: Increase the penalty for breaking between array subscripts.
Before:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaa]
                                    [a].aaaaaaaaaaaaaaaaaaaaaa();

After:
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaaaaaaaaaaaa][a]
      .aaaaaaaaaaaaaaaaaaaaaa();

llvm-svn: 262292
2016-03-01 04:19:55 +00:00
Daniel Jasper b18425bf96 clang-format: [JS] Support quoted object literal keys.
Before:
  var x = {
    a: a,
    b: b, 'c': c,
  };

After:
  var x = {
    a: a,
    b: b,
    'c': c,
  };

llvm-svn: 262291
2016-03-01 04:19:47 +00:00
Argyrios Kyrtzidis d7511c8a22 [index] Fix issue where data visitation was disabled with C++ operator call expressions, during indexing.
llvm-svn: 262290
2016-03-01 02:46:32 +00:00
John McCall c8e321d4bc Fix the template instantiation of ExtParameterInfos; tests to follow.
llvm-svn: 262289
2016-03-01 02:09:25 +00:00
John McCall 5d7cf778e4 Add an llvm_unreachable back to the autogeneration of this covered switch.
llvm-svn: 262288
2016-03-01 02:09:20 +00:00
Steven Wu f406b07a17 Fix the testcase in r262282
-bitcode_bundle is only passed to the darwin ld64 linker and it is only
implemented there. Remove the check on the linker flag.

llvm-svn: 262286
2016-03-01 01:24:54 +00:00
Sean Silva 05c8ef085b Make test more robust.
Really all these tests are checking is that we find a file path. The
behavior when we don't find one will have `"ps4-ld"` in it. We just need
a path separator to know that a path has been found.

The root cause of the flakiness of these tests is the same on Windows
and non-Windows: setting the PATH environment variable is not sufficient
to guarantee that a particular path is looked up first.
Driver::GetProgramPath checks some paths before deferring to PATH
(in particular, the directory containing the clang binary itself).

I initally ran into this on Windows when putting a PS4 linker in
build-dir/bin/ps4-ld for testing.
After digging for a while thinking that it was some windows path search
oddity (the Windows SearchPathW documentation indicates that its
behavior varies depending on a registry setting...).
I eventually tried reproducing the issue on Mac and to my surprise found
the same issue.
Ultimately I traced it down to the extra lookups in
Driver::GetProgramPath.

llvm-svn: 262285
2016-03-01 01:20:15 +00:00
Steven Wu 574b0f2f9c Introduce -fembed-bitcode driver option
Summary:
This is the clang driver part of the change to embedded bitcode. This
includes:
1. -fembed-bitcode option which breaks down the compilation into two
stages. The first stage emits optimized bitcode and the second stage
compiles bitcode into object file.
2. -fembed-bitcode-marker option which doesn't really break down to
two stages to speedup the compilation flow.
3. pass the correct linker flag to darwin linker if tool chains supports
embedded bitcode.

Reviewers: rsmith, thakis

Subscribers: thakis, cfe-commits

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

llvm-svn: 262282
2016-03-01 01:07:58 +00:00
John McCall 18afab762a Generalize the consumed-parameter array on FunctionProtoType
to allow arbitrary data to be associated with a parameter.

Also, fix a bug where we apparently haven't been serializing
this information for the last N years.

llvm-svn: 262278
2016-03-01 00:49:02 +00:00
Devin Coughlin 6d0c8a036e [analyzer] Update CheckObjCDealloc diagnostic for missing -dealloc.
Update the diagnostic for classes missing -dealloc to mention an instance
variable that needs to be released.

llvm-svn: 262277
2016-03-01 00:39:04 +00:00
John McCall 2225c8b2e4 Infrastructure improvements to Clang attribute TableGen.
This should make it easier to add new Attr subclasses.

llvm-svn: 262275
2016-03-01 00:18:05 +00:00
Devin Coughlin 093594938b [analyzer] Teach CheckObjCDealloc about Block_release().
It now treats Block_release(b) as a release in addition to [b release].

llvm-svn: 262272
2016-02-29 23:57:10 +00:00
Devin Coughlin 3fc67e47e5 [analyzer] Don't treat calls to system headers as escaping in CheckObjCDealloc.
This prevents false negatives when a -dealloc method, for example, removes itself as
as an observer with [[NSNotificationCenter defaultCenter] removeObserver:self]. It is
unlikely that passing 'self' to a system header method will release 'self''s instance
variables, so this is unlikely to produce false positives.

A challenge here is that while CheckObjCDealloc no longer treats these calls as
escaping, the rest of the analyzer still does. In particular, this means that loads
from the same instance variable before and after a call to a system header will
result in different symbols being loaded by the region store. To account for this,
the checker now treats different ivar symbols with the same instance and ivar decl as
the same for the purpose of release checking and more eagerly removes a release
requirement when an instance variable is assumed to be nil. This was not needed before
because when an ivar escaped its release requirement was always removed -- now the
requirement is not removed for calls to system headers.

llvm-svn: 262261
2016-02-29 21:44:08 +00:00
Rong Xu 522b5cb375 [PGO] clang cc1 option change to enable IR level instrumentation
This patch expands cc1 option -fprofile-instrument= with a new value: -fprofile-instrument=llvm
which enables IR level PGO instrumentation.

Reviewers: davidxl, silvas

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

llvm-svn: 262239
2016-02-29 18:54:59 +00:00
Manuel Klimek 06d5af4c9d Revert "Implement new interfaces for code-formatting when applying replacements."
This reverts commit r262232.

llvm-svn: 262234
2016-02-29 16:44:16 +00:00
Manuel Klimek 4823631af4 Implement new interfaces for code-formatting when applying replacements.
Patch by Eric Liu.

llvm-svn: 262232
2016-02-29 16:27:41 +00:00
Tom Stellard 2c7cdd25ee AMDGPU: Add missing Volcanic Islands targets
Reviewers: arsenm

Subscribers: cfe-commits

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

llvm-svn: 262228
2016-02-29 15:08:56 +00:00
Daniel Jasper 35ca66debf clang-format: Don't format unrelated nested blocks.
With this change:

  SomeFunction(
      [] {
	int i;
	 return i;  // Format this line.
      },
      [] {
	 return 2;  // Don't "fix" this.
      });

llvm-svn: 262216
2016-02-29 12:26:20 +00:00
Argyrios Kyrtzidis 113387e08e [index] Print and test module import references.
llvm-svn: 262208
2016-02-29 07:56:07 +00:00
Argyrios Kyrtzidis a8b51c1e20 [index] Add a caller relation for a call reference.
llvm-svn: 262207
2016-02-29 07:56:00 +00:00
Argyrios Kyrtzidis c97c7c88c0 [AST/RecursiveASTVisitor] Correction so that dataTraverseStmtPost will get called after the statement has been visited.
Fixes the indexing client of this.

llvm-svn: 262206
2016-02-29 07:55:55 +00:00
Argyrios Kyrtzidis d97ec18fe4 [index] Use ',' to separate symbol roles when printing.
llvm-svn: 262205
2016-02-29 07:55:51 +00:00
Craig Topper b4f83a00a9 [X86] Disabling avx512f should also disable avx512vbmi and avx512ifma. Enabling avx512vbmi or avx512ifma should enable avx512f. Add command line switches and header defines for avx512ifma and avx512vbmi.
llvm-svn: 262201
2016-02-29 06:51:38 +00:00
Craig Topper 840927e074 [X86] Enabling xsave should not enable AVX. I seem to have done this, but I don't know why.
llvm-svn: 262200
2016-02-29 06:51:34 +00:00
Alexey Bataev 60da77e438 [OPENMP 4.5] Initial support for data members in 'reduction' clauses.
OpenMP 4.5 allows to privatize non-static data members of current class
in non-static member functions. Patch adds initial parsing/semantic
analysis for data members support in 'reduction' clauses.

llvm-svn: 262199
2016-02-29 05:54:20 +00:00
David Majnemer cd5855e354 [clang-cl] /EHc should not effect functions with explicit exception specifications
Functions with an explicit exception specification have their behavior
dictated by the specification.  The additional /EHc behavior only comes
into play if no exception specification is given.

llvm-svn: 262198
2016-02-29 01:40:36 +00:00
David Majnemer 387fccd8da [clang-cl] /EHc should not have an effect on /EHa
This matches behavior with MSVC.

llvm-svn: 262197
2016-02-29 01:40:30 +00:00
Vassil Vassilev 4d75e8d676 [modules] Prefer more complete array types.
If we import a module that has a complete array type and one that has an
incomplete array type, the declaration found by name lookup might be the one with
the incomplete type, possibly resulting in rejects-valid.

Now, the name lookup prefers decls with a complete array types. Also,
diagnose cases when the redecl chain has array bound, different from the merge
candidate.

Reviewed by Richard Smith.

llvm-svn: 262189
2016-02-28 19:08:24 +00:00
Logan Chien 3267ca225d Add ARM EHABI-related constants to unwind.h.
Adds a number of constants, defined in the ARM EHABI spec, to the Clang
lib/Headers/unwind.h header. This is prerequisite for landing
http://reviews.llvm.org/D15781, as previously discussed there.

Patch by Timon Van Overveldt.

llvm-svn: 262178
2016-02-28 15:01:42 +00:00
Michael Zuckerman 431b0e18b4 [CLANG] [AVX512] [BUILTIN] Adding PSLL{V|W|Wi}{128|256|512} builtin
Differential Revision: http://reviews.llvm.org/D17685

llvm-svn: 262177
2016-02-28 07:39:34 +00:00
Alexander Kornienko 70f97c9bfb Workaround doxygen bug https://bugzilla.gnome.org/show_bug.cgi?id=506243
llvm-svn: 262138
2016-02-27 14:02:08 +00:00
Aaron Ballman b1be8f6928 Correcting indentation for an RST code block.
llvm-svn: 262136
2016-02-27 13:13:16 +00:00
Matt Arsenault 39edcd0e1d AMDGPU: Add builtins for recently added intrinsics
llvm-svn: 262126
2016-02-27 09:54:43 +00:00
Matt Arsenault 5e020b2628 AMDGPU: Fix broken/confusing predefined macro
amdgcn should not be defining __R600__

llvm-svn: 262124
2016-02-27 09:06:26 +00:00
Matt Arsenault b015d623d6 AMDGPU: Fix inconsistent register name for flat_scratch
llvm-svn: 262123
2016-02-27 09:06:22 +00:00
Matt Arsenault 2d9339890f Add __builtin_canonicalize
llvm-svn: 262122
2016-02-27 09:06:18 +00:00
Richard Smith e5a91464bc Fix bug in using shadow decl checking: a using shadow decl should not conflict
with a prior UsingDecl -- those should not even really be found by the lookup
here, except that we use the same lookup results for two different checks, and
the other check needs them.

This happens to work in *almost all* cases, because either the lookup results
list the UsingDecl first (and the NonTag result gets replaced by something
else) or because the problematic declaration is a function (which causes us to
use different logic to detect conflicts). This can also be triggered from a
state only reachable through modules (where the name lookup results can contain
multiple UsingDecls in the same scope).

llvm-svn: 262105
2016-02-27 02:36:43 +00:00
Samuel Antao f91b163950 [OpenMP] Fix parsing of delete map clause modifier in C++ mode.
Summary: The map modifier 'delete' is parser in c++ mode as a delete keyword, which requires special handling in the map clause parsing.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev

Subscribers: cfe-commits, fraggamuffin, caomhin

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

llvm-svn: 262094
2016-02-27 00:01:58 +00:00
Chris Bieneman 33b41961c3 [CMake] Only configure Native target in stage 1, configure all in other stages
This patch causes the 3-stage build pipeline to only build a host compiler in the first stage, and to build all targets for subsequent stages. The host target is determined via the Native target specifier added in r262070.

llvm-svn: 262071
2016-02-26 21:23:59 +00:00
Chris Bieneman 0e64cc886b [CMake] Add BINUTILS_INCDIR to the default passthrough list for multi-stage builds
This is needed to build the gold plugin in multi-stage builds.

Patch by Mike Edwards

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

llvm-svn: 262065
2016-02-26 21:04:41 +00:00
Reid Kleckner 5b64034a43 [dllexport] Sort out emission order of delayed exported classes
Relands r260194 with a fix. If we have a template that transitions from
an extern template to an explicitly instantiated dllexport template, we
would add that class to the delayed exported class list without flushing
it.

For explicit instantiations, we can just flush the list of delayed
classes immediately. We don't have to worry about the bug fixed in
r260194 in this case because explicit instantiations can only occur at
file and namespace scope.

Fixes PR26490.

llvm-svn: 262056
2016-02-26 19:51:02 +00:00
Paul Robinson 65ab102be3 Fix Clang tests that used CHECK-NEXT-NOT and CHECK-DAG-NOT.
FileCheck actually doesn't support combo suffixes.

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

llvm-svn: 262052
2016-02-26 19:34:01 +00:00
Duncan P. N. Exon Smith ec599a906b SemaCXX: Support templates in availability attributes
If the availability context is `FunctionTemplateDecl`, we should look
through it to the `FunctionDecl`.  This prevents a diagnostic in the
following case:

    class C __attribute__((unavailable));
    template <class T> void foo(C&) __attribute__((unavailable));

This adds tests for availability in templates in many other cases, but
that was the only case that failed before this patch.

I added a feature `__has_feature(attribute_availability_in_templates)`
so users can test for this.

rdar://problem/24561029

llvm-svn: 262050
2016-02-26 19:27:00 +00:00
Sunil Srivastava a3a51fca81 Minor tweak to match the overall style.
llvm-svn: 262042
2016-02-26 18:01:12 +00:00
Saleem Abdulrasool 16fcf0aa52 Basic: fix __USER_LABEL_PREFIX__ on Cygwin
Adjust the user label prefix for cygwin x86_64.

Resolves PR26744.

llvm-svn: 262030
2016-02-26 16:34:01 +00:00
Andy Gibbs 9a31b3b07a Reduce false positives in printf/scanf format checker
Summary:
The printf/scanf format checker is a little over-zealous in handling the conditional operator.  This patch reduces work by not checking code-paths that are never used and reduces false positives regarding uncovered arguments, for example in the code fragment:

printf(minimal ? "%i\n" : "%i: %s\n", code, msg);

Reviewers: rtrieu

Subscribers: cfe-commits

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

llvm-svn: 262025
2016-02-26 15:35:16 +00:00
Aaron Ballman 38f912ea00 Fixing an issue with the code block so that it does not appear as a list.
llvm-svn: 262013
2016-02-26 13:39:38 +00:00
Aaron Ballman c521a1a467 Giving this attribute documentation group a heading; fixes a documentation generation error.
llvm-svn: 262012
2016-02-26 13:30:58 +00:00