Commit Graph

61684 Commits

Author SHA1 Message Date
Chris Bieneman ae5433907a [CMake] Add support for generating profdata for clang from training files
Summary:
This patch adds support for using LIT to drive generating PGO profile data for clang.

This first pass implementation should work on Linux and Unix based platforms. If you build clang using CMake with LLVM_BUILD_INSTRUMENTED=On the CMake build generates a generate-profdata target that will use the just-built clang to build any test files (see hello_world.cpp as an example). Each test compile will generate profraw files for each clang process. After all tests have run CMake will merge the profraw files using llvm-profdata.

Future opportunities for extension:
* Support for Build->Profile->Build bootstrapping
* Support for linker order file generation using a similar mechanism and the same training data
* Support for Windows

Reviewers: dexonsmith, friss, bogner, cmatthews, vsk, silvas

Subscribers: cfe-commits

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

llvm-svn: 255740
2015-12-16 01:02:44 +00:00
Evgeniy Stepanov e3fb51cf5a [cfi] Exclude ubsan runtime library from non-diag CFI builds (driver changes).
Split the CFI runtime in two: cfi and cfi_diag. The latter includes
UBSan runtime to allow printing diagnostics.

llvm-svn: 255736
2015-12-16 00:38:42 +00:00
Reid Kleckner 39329d57b5 Reland "[SEH] Use llvm.x86.seh.recoverfp for SEH filters on x64 as well as 32bit"
I forgot to initialize RecoverFP.

llvm-svn: 255731
2015-12-16 00:26:37 +00:00
Reid Kleckner d8f719fa1c Revert "[SEH] Use llvm.x86.seh.recoverfp for SEH filters on x64 as well as 32bit"
This reverts commit r255710.

llvm-svn: 255728
2015-12-16 00:20:21 +00:00
Richard Smith 9043d75e75 Fix grammar.
llvm-svn: 255727
2015-12-16 00:19:23 +00:00
Richard Smith e873686e3c Update our claims about GCC's diagnostics quality to reflect recent improvements to GCC.
llvm-svn: 255726
2015-12-16 00:18:47 +00:00
Richard Smith 90ae7922b5 These days, GCC has at least minimal documentation for its VLAIS extension.
llvm-svn: 255723
2015-12-16 00:09:57 +00:00
Evgeniy Stepanov 028685a5db Relax checks in cfi-cross-dso test.
The test is failing with unnamed labels.

llvm-svn: 255712
2015-12-15 23:49:51 +00:00
Reid Kleckner cf2626600c [SEH] Use llvm.x86.seh.recoverfp for SEH filters on x64 as well as 32bit
llvm-svn: 255710
2015-12-15 23:47:40 +00:00
Evgeniy Stepanov fd6f92d5cb Cross-DSO control flow integrity (Clang part).
Clang-side cross-DSO CFI.

* Adds a command line flag -f[no-]sanitize-cfi-cross-dso.
* Links a runtime library when enabled.
* Emits __cfi_slowpath calls is bitset test fails.
* Emits extra hash-based bitsets for external CFI checks.
* Sets a module flag to enable __cfi_check generation during LTO.

This mode does not yet support diagnostics.

llvm-svn: 255694
2015-12-15 23:00:20 +00:00
NAKAMURA Takumi db87d5dbfd clang/test/CodeGen/ms_this.cpp: Fix for -Asserts.
llvm-svn: 255690
2015-12-15 22:42:28 +00:00
NAKAMURA Takumi 512bd57699 Fix clang/test/CodeGen/ms_this.cpp.
llvm-svn: 255685
2015-12-15 22:19:00 +00:00
David Majnemer 0b17d44faf [WinEH] Update clang to use operand bundles on call sites
This updates clang to use bundle operands to associate an invoke with
the funclet which it is contained within.

Depends on D15517.

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

llvm-svn: 255675
2015-12-15 21:27:59 +00:00
Krzysztof Parzyszek 6c3b837452 Unsupport test that should not be run on Hexagon
llvm-svn: 255667
2015-12-15 19:14:24 +00:00
Nico Weber 0d10b2cf3c clang-cl: Add an alias for /wd4100
llvm-svn: 255655
2015-12-15 17:07:16 +00:00
Michael Zuckerman 724d02a21e [Microsoft][C++] Clang doesn't support a use of "this" pointer inside inline asm
add triple to test

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

llvm-svn: 255647
2015-12-15 14:35:51 +00:00
Michael Zuckerman 229158c491 [Microsoft][C++] Clang doesn't support a use of "this" pointer inside inline asm
Clang doesn’t support a use of “this” pointer inside inline asm.
When I tried to compile a class or a struct (see example) with an inline asm that contains "this" pointer.
Clang returns with an error.
This patch fixes that.

error: expected unqualified-id
For example:
'''
struct A {
    void f() {
          __asm mov eax, this
              // error: expected unqualified-id
                  }
};
'''
Differential Revision: http://reviews.llvm.org/D15115

llvm-svn: 255645
2015-12-15 14:04:18 +00:00
Alexey Bataev d60e2a3ebf [OPENMP 4.5] Fix test compatibility with 32 bit mode.
llvm-svn: 255640
2015-12-15 11:38:29 +00:00
Alexey Bataev fc57d1601d [OPENMP 4.5] Codegen for 'hint' clause of 'critical' directive
OpenMP 4.5 defines 'hint' clause for 'critical' directive. Patch adds codegen for this clause.

llvm-svn: 255639
2015-12-15 10:55:09 +00:00
NAKAMURA Takumi b4a6884844 clang/test/Analysis/padding_c.c: Suppress a test incompatible to i686-linux.
error: 'warning' diagnostics expected but not seen:
    File clang/test/Analysis/padding_c.c Line 194 (directive at clang/test/Analysis/padding_c.c:193): Excessive padding in 'struct DefaultAttrAlign'
  1 error generated.

llvm-svn: 255636
2015-12-15 09:37:01 +00:00
Benjamin Kramer 5c248d89f3 [libclang] Add a flag to create the precompiled preamble on the first parse.
Summary:
The current default is to create the preamble on the first reparse, aka
second parse. This is useful for clients that do not want to block when
opening a file because serializing the preamble takes a bit of time.
However, this makes the reparse much more expensive and that may be on the
critical path as it's the first interaction a user has with the source code.

YouCompleteMe currently optimizes for the first code interaction by parsing
the file twice when loaded. That's just unnecessarily slow and this flag
helps to avoid that.

Reviewers: doug.gregor, klimek

Subscribers: cfe-commits

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

llvm-svn: 255635
2015-12-15 09:30:31 +00:00
Gabor Horvath 009c5d52e3 Add a new matcher to match character types.
llvm-svn: 255627
2015-12-15 08:35:45 +00:00
Alexey Bataev 28c75417b2 [OPENMP 4.5] Parsing/sema for 'hint' clause of 'critical' directive.
OpenMP 4.5 adds 'hint' clause to critical directive. Patch adds parsing/semantic analysis for this clause.

llvm-svn: 255625
2015-12-15 08:19:24 +00:00
Xinliang David Li ddbdb1e0be [PGO] make profile prefix even shorter and more readable
llvm-svn: 255587
2015-12-15 00:33:12 +00:00
Xinliang David Li 8608513b69 [PGO] Shorten profile symbol prefixes
(test case update)
Profile symbols have long prefixes which waste space and creating pressure for linker.
This patch shortens the prefixes to minimal length without losing verbosity.

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

llvm-svn: 255576
2015-12-14 23:26:46 +00:00
Rafael Espindola 8ce88a59fd Update for llvm api change.
llvm-svn: 255572
2015-12-14 23:17:07 +00:00
George Burgess IV 8d141e0120 [Sema] Make nullness warnings appear in C++.
Given the following code:

    int *_Nullable ptr;
    int *_Nonnull nn = ptr;

...In C, clang will warn you about `nn = ptr`, because you're assigning
a nonnull pointer to a nullable pointer. In C++, clang issues no such
warning. This patch helps ensure that clang doesn't ever miss an
opportunity to complain about C++ code.

N.B. Though this patch has a differential revision link, the actual
review took place over email.

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

llvm-svn: 255556
2015-12-14 22:00:49 +00:00
Ben Craig cd7e9f143b Reordering fields to reduce padding in Clang. NFC
llvm-svn: 255552
2015-12-14 21:54:11 +00:00
Ben Craig 97c191c473 [PATCH] Adding checker to detect excess padding in records
The intent of this checker is to generate a report for any class / structure
that could reduce its padding by reordering the fields.  This results in a very
noisy checker.  To reduce the noise, this checker will currently only warn when
the number of bytes over "optimal" is more than 24.  This value is configurable
with -analyzer-config performance.Padding:AllowedPad=N.  Small values of
AllowedPad have the potential to generate hundreds of reports, and gigabytes
of HTML reports.

The checker searches for padding violations in two main ways.  First, it goes
record by record.  A report is generated if the fields could be reordered in a
way that reduces the padding by more than AllowedPad bytes.  Second, the
checker will generate a report if an array will cause more than AllowedPad
padding bytes to be generated.

The record checker currently skips many ABI specific cases.  Classes with base
classes are skipped because base class tail padding is ABI specific.  Bitfields
are just plain hard, and duplicating that code seems like a bad idea.  VLAs are
both uncommon and non-trivial to fix.

The array checker isn't very thorough right now.  It only checks to see if the
element type's fields could be reordered, and it doesn't recursively check to
see if any of the fields' fields could be reordered.  At some point in the
future, it would be nice if "arrays" could also look at array new usages and
malloc patterns that appear to be creating arrays.

llvm-svn: 255545
2015-12-14 21:38:59 +00:00
Petar Jovanovic 2f264c31d3 [PowerPC] Fix test/CodeGen/ppc-sfvarargs
The issue seems to be that .ll file may either use number of register
value or alias %numUsedRegs, so the check needs to cover both cases.

This will hopefully fix the last regression introduced by r255515.

llvm-svn: 255539
2015-12-14 20:30:02 +00:00
Petar Jovanovic 59a981a8f3 [PowerPC] Fix make-check issues
Previous change r255515 introduced a couple of issues likely caused by
a different configure setup.

llvm-svn: 255533
2015-12-14 19:22:35 +00:00
John McCall 9d145df4c8 Allow pseudo-destructor calls on forward-declared Objective-C class pointers.
rdar://18522255

llvm-svn: 255531
2015-12-14 19:12:54 +00:00
Hans Wennborg 4ae76c2692 clang-cl: make /Wall turn on both -Wall and -Wextra (PR25563)
The documentation suggests /Wall should really turn on -Wextra and any
other warnings that are not enabled by default. That would correspond
to Clang's -Weverything, but is probably not what users want.

llvm-svn: 255524
2015-12-14 18:46:11 +00:00
David Majnemer feeefb214d [MS ABI] Don't rely on terminatepad
We'd like to remove support for terminatepad from LLVM.  To do this, we
need to move Clang off of it first.  The intent behind terminatepad was
to carefully model exception specifications for the MSVC personality.

However, we don't support exception specifications for the MSVC
personality and neither does MSVC.  Instead, MSVC supports
all-or-nothing exception specifications.  We can model this limited
usage using cleanuppads which call std::terminate.

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

llvm-svn: 255521
2015-12-14 18:34:18 +00:00
Petar Jovanovic 88a328fbbe [Power PC] add soft float support for ppc32
This patch enables soft float support for ppc32 architecture and fixes
the ABI for variadic functions. This is the first in a set of patches
for soft float support in LLVM.

Patch by Strahinja Petrovic.

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

llvm-svn: 255515
2015-12-14 17:51:50 +00:00
Krzysztof Parzyszek 1065323eec [Hexagon] Xfail two tests that fail due to over-aligning arrays
llvm-svn: 255510
2015-12-14 17:17:20 +00:00
Krzysztof Parzyszek 1e6e3c60b4 [Hexagon] Update default paths and arguments
- Removed support for hexagonv3 and earlier.
- Added handling of hexagonv55 and hexagonv60.
- Added handling of target features (hvx, hvx-double).
- Updated paths to reflect current directory layout.

llvm-svn: 255502
2015-12-14 15:03:57 +00:00
Carlo Bertolli 6200a3d0f3 Add parse and sema of OpenMP distribute directive with all clauses except dist_schedule
llvm-svn: 255498
2015-12-14 14:51:25 +00:00
Alexey Bataev 33c56402d8 [OPENMP] Fix debug info for 'atomic' construct.
Debug info for statement under 'atomic' construct must point exactly to that statement, not the directive itself.

llvm-svn: 255487
2015-12-14 09:26:19 +00:00
Daniel Jasper 870d1bcdf9 clang-format: Add test for AlignAfterOpenBracket = AlwaysBreak in C++.
Revision 251405 added AlwaysBreak to support Google's JavaScript style. This
changeset complete existing AlignsAfterOpenBracket tests to exercise
AlwaysBreak for C++.

I thought this would be worthwhile.  With this option we can support request
from http://lists.llvm.org/pipermail/cfe-dev/2015-May/042942.html, that had
been requested a few times. This also partially solve related Bug 23422 and is
probably sufficient for most people.

  AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak;
  BinPackArguments = false;
  BinPackParameters = false;

With these setting we obtain this formatting:

  void fooWithAVeryLongParamList(
      int firstParameter,
      int secondParameter
      int lastParameter)
  {
      object.alsoThisDoenstFitSoIBreakImmidiatly(
          firstParameter,
          secondParameter,
          lastParameter);
  }

Patch by Jean-Philippe Dufraigne, thank you.

llvm-svn: 255486
2015-12-14 08:41:18 +00:00
Daniel Jasper 96cbb502b7 clang-format: Extend Linux-brace-wrapping test.
llvm-svn: 255485
2015-12-14 08:33:07 +00:00
Daniel Jasper e87f5cf4ef clang-format: Fix style default for WebKit and Linux styles.
Brought up in codereviews:
http://reviews.llvm.org/D15445
http://reviews.llvm.org/D15485

llvm-svn: 255484
2015-12-14 08:24:16 +00:00
Craig Topper 84543b09cb [Sema] Add -Wparentheses warnings for '^' in '|' expressions and '&' in '^' expressions to compliment '&' in '|' that is already present. Matches gcc behavior.
llvm-svn: 255450
2015-12-13 05:41:41 +00:00
Craig Topper b0dfa7a79a [Sema] Write some checks for groups of BinaryOperatorKinds in terms of the predicates already available in BinaryOperator. NFC
llvm-svn: 255449
2015-12-13 05:41:37 +00:00
Xinliang David Li 13ec697056 Revert r255445: adding a new test case
llvm-svn: 255447
2015-12-13 04:45:49 +00:00
Xinliang David Li c79d69ddd7 Resubmit new test case after adding more constraint
llvm-svn: 255445
2015-12-13 03:03:35 +00:00
Xinliang David Li e82c58588d Revert 255436 : remove test that needs to be refined
llvm-svn: 255437
2015-12-12 18:49:37 +00:00
Xinliang David Li c8788d2a97 [PGO] add a test case with -no-integrated-as
llvm-svn: 255436
2015-12-12 17:39:38 +00:00
Xinliang David Li aab1fd16bc [PGO] Stop using invalid char in instr variable names.
(This is part-2 of the patch of r255434 -- 
fixing test cases, second try)

llvm-svn: 255435
2015-12-12 17:28:37 +00:00
Craig Topper 716d3088e1 Minor formatting cleanup. NFC
llvm-svn: 255428
2015-12-12 06:30:51 +00:00
Craig Topper f942fde819 [Sema] Simplify a couple if statements. Explicitly check up front that only one of the expressions is a comparision op. Then if we find that either is a bitwise op, we know it must be the other one. NFC
llvm-svn: 255427
2015-12-12 06:30:48 +00:00
David Majnemer f052f99f08 Try to appease a buildbot.
llvm-svn: 255424
2015-12-12 05:50:32 +00:00
David Majnemer 4e52d6f811 Update clang to use the updated LLVM EH instructions
Depends on D15139.

Reviewers: rnk

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

llvm-svn: 255423
2015-12-12 05:39:21 +00:00
Richard Smith 97047d8cb6 Preserve source location information for qualified names used in a constructor
initializer list to name a base class. Patch by Shahms King!

llvm-svn: 255420
2015-12-12 02:17:54 +00:00
Easwaran Raman dd4c71ca6e Revert r254647.
Reason: The testcase fails in many architectures.

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

llvm-svn: 255416
2015-12-12 01:11:09 +00:00
Easwaran Raman d547e5e168 Attach maximum function count to Module when using PGO mode
This sets the maximum entry count among all functions in the program to the
module using module flags. This allows the optimizer to use this information.

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

llvm-svn: 255397
2015-12-12 00:31:02 +00:00
Peter Collingbourne 93bb862f9b docs: Document -fno-sanitize-trap= and -fsanitize-recover= flags for CFI.
llvm-svn: 255393
2015-12-11 23:54:18 +00:00
Richard Smith 8aed422294 [modules] If the semantic and lexical DC of a decl are the same, write out the
second one as 0 instead of writing the same bits to the module file twice.
This typically reduces PCM file size by about 1%.

llvm-svn: 255384
2015-12-11 22:41:00 +00:00
Richard Smith 84824edd0b Allow non-defining declarations of class template partial specializations to
have a nested name specifier. Strictly speaking, forward declarations of class
template partial specializations are not permitted at all, but that seems like
an obvious wording defect, and if we allow them without a nested name specifier
we should also allow them with a nested name specifier.

llvm-svn: 255383
2015-12-11 22:39:52 +00:00
Nico Weber c80367417c [clang-cl] Let /W4 map to -Wall -Wextra instead of just -Wall.
There's no way to make a flag alias to two flags, so add a /WCL4 flag that
maps to the All, Extra diag groups.  Fixes PR25563.

http://reviews.llvm.org/D15350

llvm-svn: 255382
2015-12-11 22:31:16 +00:00
Ben Langmuir 237ccb165e Reapply "[Modules] Fix regression when an elaborated-type-specifier mentions a hidden tag"
Now not trying to use a C++ lookup mechanism in C (d'oh).  Unqualified
lookup is actually fine for this case in C.

llvm-svn: 255377
2015-12-11 22:05:13 +00:00
Reid Kleckner 436745143a Unify diagnostics for type defintitions in bad contexts
The message for a type definition in an "if" condition was different
from the other three for no particular reason.

llvm-svn: 255372
2015-12-11 21:39:12 +00:00
Nick Lewycky 6ee53bc085 Error on redeclaring with a conflicting asm label and on redeclaring with an asm label after the first ODR-use. Detects problems like the one in PR22830 where gcc and clang both compiled the file but with different behaviour.
llvm-svn: 255371
2015-12-11 21:28:55 +00:00
Xinliang David Li e1769ef559 [PGO] Revert r255366: solution incomplete, not handling lambda yet
llvm-svn: 255368
2015-12-11 20:23:12 +00:00
Xinliang David Li 871daea550 [PGO] Stop using invalid char in instr variable names.
(This is part-2 of the patch -- fixing test cases)

Before the patch, -fprofile-instr-generate compile will fail
if no integrated-as is specified when the file contains
any static functions (the -S output is also invalid).

This patch fixed the issue. With the change, the index format
version will be bumped up by 1. Backward compatibility is 
preserved with this change.

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

llvm-svn: 255366
2015-12-11 19:53:35 +00:00
Anastasia Stulova 2446b8ba8a [OpenCL 2.0] In OpenCL v2.0 s6.5 all pointers are implicitly in generic
address space unless address space is explicitly specified.

Correct the behavior of NULL constant detection -
generic AS void pointer should be accepted as a valid NULL constant.

http://reviews.llvm.org/D15293

llvm-svn: 255346
2015-12-11 17:41:19 +00:00
Anastasia Stulova f016a1bb86 Reverting r255337 as it seems to kill bots. Needs investigation.
llvm-svn: 255339
2015-12-11 15:23:00 +00:00
Anastasia Stulova 12e484e80a [OpenCL 2.0] In OpenCL v2.0 s6.5 all pointers are implicitly in generic
address space unless address space is explicitly specified.

Correct the behavior of NULL constant detection -
generic AS void pointer should be accepted as a valid NULL constant.

http://reviews.llvm.org/D15293

llvm-svn: 255337
2015-12-11 13:49:15 +00:00
Saleem Abdulrasool 20f733acc4 Driver: add multilibs for ARM EB
This improves the coverage for the multilib directories used for ARM.  Also add
tests covering the internal triple (thumbv7-*).  The Juno board can be run in
this configuration.

llvm-svn: 255328
2015-12-11 06:20:59 +00:00
Xinliang David Li 9c586b6c8f [PGO] Add a test case to cover version-3 format
llvm-svn: 255326
2015-12-11 04:02:57 +00:00
John McCall dc40b618cf Correctly type-check the default arguments of local functions
when eagerly instantiating them.

rdar://23721638

llvm-svn: 255325
2015-12-11 01:56:36 +00:00
Ben Langmuir 38f2bfbbe4 Revert "[Modules] Fix regression when an elaborated-type-specifier mentions a hidden tag"
This is causing assertion failures; reverting until I can fix.

This reverts commit r255267

llvm-svn: 255324
2015-12-11 01:44:43 +00:00
Faisal Vali 1e5dfedae7 Add some more tests for initializer lists related to CWG1591
llvm-svn: 255323
2015-12-11 01:04:30 +00:00
George Burgess IV 533ff009ff Clean ExprConstant/CGExprConstant up a bit. NFC.
llvm-svn: 255314
2015-12-11 00:23:35 +00:00
Ben Langmuir f13302e63f [VFS] Fix status() of opened redirected file
Make RedirectedFileSystem::openFilForRead(path)->status() the same as
RedirectedFileSystem::status(path). Previously we would just get the
status of the underlying real file, which would not have the IsVFSMapped
bit set.

This fixes rebuilding a module that has an include that is relative to
the includer where we will lookup the real path of that file before we
lookup the VFS location.

rdar://problem/23640339

llvm-svn: 255312
2015-12-10 23:41:39 +00:00
John McCall 8376037861 In Objective-C, ignore attempts to redefine the ARC/GC qualifier macros.
This works around existing system headers which unconditionally
redefine these macros.

This is reasonably safe to do because we used to warn about it anyway
(outside of system headers).  Continue to warn if the redefinition
would have changed the expansion.  Still permit redefinition if the
macro is explicitly #undef'ed first.

rdar://23788307

llvm-svn: 255311
2015-12-10 23:31:01 +00:00
Douglas Gregor 9dd25b7696 Objective-C properties: merge attributes when redeclaring 'readonly' as 'readwrite' in an extension.
r251874 stopped back-patching the AST when an Objective-C 'readonly'
property is redeclared in a class extension as 'readwrite'. However,
it did not properly handle merging of Objective-C property attributes
(e.g., getter name, ownership, atomicity) to the redeclaration,
leading to bad metadata. Merge (and check!) those property attributes
so we get the right metadata and reasonable ASTs. Fixes
rdar://problem/23823989.

llvm-svn: 255309
2015-12-10 23:02:09 +00:00
Justin Bogner 78a9db7ae0 www: Mention -DGCC_INSTALL_PREFIX instead of --with-gcc-toolchain
Since the instructions use cmake, we should probably refer to the
cmake flags and not the configure ones.

llvm-svn: 255297
2015-12-10 20:52:59 +00:00
George Burgess IV 0fc4e8b4e7 [Sema] Replace pointer-to-map with a map. NFC.
llvm-svn: 255288
2015-12-10 19:25:21 +00:00
Ekaterina Romanova 9218a3bf04 Do not generate DW_TAG_imported_module for anonymous namespaces (even nested) for all the platforms except PS4.
For PS4, generate explicit import for anonymous namespaces and mark it by DW_AT_artificial attribute.

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

llvm-svn: 255281
2015-12-10 18:52:50 +00:00
Saleem Abdulrasool 8aa0b80ec7 libclang: expose dllexport, dllimport attributes
These attributes were previously unexposed.  Expose them through the libclang
interfaces.  Add tests that cover both the MSVC spelling and the GNU spelling.

llvm-svn: 255273
2015-12-10 18:45:18 +00:00
Ben Langmuir c589462beb [Modules] Fix regression when an elaborated-type-specifier mentions a hidden tag
This makes non-C++ languages find the same decl as C++ does to
workaround a regression introduced in r252960.

rdar://problem/23784203

llvm-svn: 255267
2015-12-10 17:28:51 +00:00
Faisal Vali dd76cc1920 [NFC] Improve a comment from my previous commit (r255221)
llvm-svn: 255244
2015-12-10 12:29:11 +00:00
Artem Dergachev 733e71b73b [analyzer] Fix symbolic element index lifetime.
SymbolReaper was destroying the symbol too early when it was referenced only
from an index SVal of a live ElementRegion.

In order to test certain aspects of this patch, extend the debug.ExprInspection
checker to allow testing SymbolReaper in a direct manner.

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

llvm-svn: 255236
2015-12-10 09:28:06 +00:00
Craig Topper a92ffb011e [Sema] Use UnaryOperatorKind and BinaryOperatorKind in parameter lists instead of just unsigned. Removes a few explicit casts. NFC
llvm-svn: 255232
2015-12-10 08:51:49 +00:00
Craig Topper 08529538d1 Add parentheses to suppress a -Wparentheses warning.
llvm-svn: 255231
2015-12-10 08:49:55 +00:00
Alexey Bataev dffa93a620 [OPENMP] Fixed processing of predetermined data-sharing attributes
Predetermined data-shared attributes for local variables are now considered as implicit. Also, patch prohibits changin of DSA for static memebers of classes.

llvm-svn: 255229
2015-12-10 08:20:58 +00:00
Saleem Abdulrasool d5af8ae17f libclang: correct inverted logic
The complete dtor is only emitted when there is a virtual destructor.  The test
itself was incorrect, so the issue in the code was not noticed.

llvm-svn: 255225
2015-12-10 06:30:23 +00:00
Alexey Bataev 897451d372 [OPENMP] Make -fopenmp to turn on OpenMP support by default, clang part
Patch turns on OpenMP support in clang by default after fixing OpenMP buildbots.
Differential Revision: http://reviews.llvm.org/D13803

llvm-svn: 255223
2015-12-10 05:47:10 +00:00
Faisal Vali f6dfdb361f Fix PR24694 (CWG1591): Deducing array bound and element type from initializer list
https://llvm.org/bugs/show_bug.cgi?id=24694
http://wg21.link/cwg1591

Teach DeduceFromInitializerList in SemaTemplateDeduction.cpp to deduce against array (constant and dependent sized) parameters (really, reference to arrays since they don't decay to pointers), by checking if the template parameter is either one of those kinds of arrays, and if so, deducing each initializer list element against the element type, and then deducing the array bound if needed.

In brief, this patch enables the following code:
template<class T, int N> int *f(T (&&)[N]);
int *ip = f({1, 2, 3});

llvm-svn: 255221
2015-12-10 05:36:39 +00:00
Alexey Bataev 60520e2203 [MSVC] Fix for http://llvm.org/PR25636: indexed accessor property not supported correctly.
All problems described in http://llvm.org/PR25636 are implemented except for return value of the 'put' property. This patch fixes this problem with the indexed properties
Differential Revision: http://reviews.llvm.org/D15174

llvm-svn: 255218
2015-12-10 04:38:18 +00:00
Hans Wennborg 2edb8fcf0d Mark MS inline ASM 'nodplicate' it it has labels (PR23715)
Duplicating it can lead to labels being defined twice.

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

llvm-svn: 255201
2015-12-10 01:38:04 +00:00
Yunzhong Gao eecc9e97d2 Fix a typo in the clang user manual.
-fmax-unknown-pointer-align => -fmax-type-align

llvm-svn: 255200
2015-12-10 01:37:18 +00:00
Richard Smith efb116fba6 PR25416: Improve performance of processing inline assembly consisting of many
implicitly-concatenated string literals. When looking for the start of a token
in the inline assembly, start from the end of the previous token, not the start
of the entire string.

Patch by Yunlian Jiang!

llvm-svn: 255198
2015-12-10 01:11:47 +00:00
Charles Li 85dec55989 [Lit Test] Updated 20 Lit tests to be C++11 compatible.
This is the 5th Lit test patch.
Expanded expected diagnostics to vary by C++ dialect.
Expanded RUN line to: default, C++98/03 and C++11.

llvm-svn: 255196
2015-12-10 01:07:17 +00:00
Reid Kleckner 4a09e8872f Fix crash on invalid initialization with std::initializer_list
It is possible for CheckListElementTypes to fail without filling in any
initializer list elements.

llvm-svn: 255176
2015-12-09 23:18:38 +00:00
Douglas Gregor 429183e7c8 Objective-C properties: loosen 'atomic' checking for readonly properties.
r251874 reworked the way we handle properties declared within
Objective-C class extensions, which had the effective of tightening up
property checking in a number of places. In this particular class of
cases, we end up complaining about "atomic" mismatches between an
implicitly-atomic, readonly property and a nonatomic, readwrite
property, which doesn't make sense because "atomic" is essentially
irrelevant to readonly properties.

Therefore, suppress this diagnostic when the readonly property is
implicitly atomic. Fixes rdar://problem/23803109.

llvm-svn: 255174
2015-12-09 22:57:32 +00:00
Chris Bieneman 3d9f89f04f [CMake] Pass CMAKE_MAKE_PROGRAM through to compiler-rt build.
This is needed if your make tool is overridden.

llvm-svn: 255172
2015-12-09 22:46:25 +00:00
Sanjay Patel 5690454bd6 fix typos; NFC
llvm-svn: 255163
2015-12-09 22:16:07 +00:00
David Blaikie d2725a31eb unique_ptrify some collections in FileManager
llvm-svn: 255129
2015-12-09 17:23:13 +00:00
Krzysztof Parzyszek e28d04da59 [Hexagon] Use integrated assembler by default
llvm-svn: 255127
2015-12-09 16:34:24 +00:00
Daniel Jasper 3a4ce6e1f2 clang-format: Improve documentation of AlignOperands.
llvm-svn: 255099
2015-12-09 07:56:52 +00:00
NAKAMURA Takumi aa13f94456 Reformat linefeeds.
llvm-svn: 255098
2015-12-09 07:52:46 +00:00
NAKAMURA Takumi 2d5c6ddf74 Revert r255001, "Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule."
It causes memory leak. Some tests in test/OpenMP would fail.

llvm-svn: 255094
2015-12-09 04:35:57 +00:00
Vedant Kumar 13e6f311af [Basic] Rangify two for loops. NFC.
llvm-svn: 255091
2015-12-09 01:44:02 +00:00
Bill Schmidt 4b8841a327 [PPC64, TSAN] Enable thread sanitizer for PPC64
Patch by Simone Atzeni.

This enables the -fsanitize=thread flag for PPC64 and PPC64LE.

llvm-svn: 255067
2015-12-08 22:48:02 +00:00
Douglas Gregor 1cbb289c7d Objective-C properties: fix bogus use of "isa<>" on a QualType.
The code used "isa" to check the type and then "getAs" to look through
sugar; we need to look through the sugar when checking, too, otherwise
any kind of sugar (nullability qualifiers in the example; or a
typedef) will thwart this semantic check. Fixes rdar://problem/23804250.

llvm-svn: 255066
2015-12-08 22:45:17 +00:00
Douglas Gregor 8f64ca1529 Module file extensions: pass a Sema through to the extension writer.
Module file extensions are likely to need access to
Sema/Preprocessor/ASTContext, and cannot get it through other
sources.

llvm-svn: 255065
2015-12-08 22:43:32 +00:00
George Burgess IV 850269a47e [Sema] Add warning when comparing nonnull and null
Currently, we emit warnings in some cases where nonnull function
parameters are compared against null. This patch extends this support
to warn when comparing the result of `returns_nonnull` functions
against null.

More specifically, we will now warn cases like:

int *foo() __attribute__((returns_nonnull));
int main() {
  if (foo() == NULL) {} // warning: will always evaluate to false
}

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

llvm-svn: 255058
2015-12-08 22:02:00 +00:00
Simon Pilgrim 2a4df3fd2a [X86][AVX2] Stripped backend codegen tests
As discussed on the ml, backend tests need to be put in llvm/test/CodeGen/X86 as fast-isel tests using IR that is as close to what is generated here as possible.

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

llvm-svn: 255050
2015-12-08 21:16:45 +00:00
Eugene Zelenko 5f02b777c6 Use range loops and autos in utils/TableGen/ClangAttrEmitter.cpp and generated code.
Differential revision: http://reviews.llvm.org/D15313

llvm-svn: 255042
2015-12-08 18:49:01 +00:00
Eugene Zelenko ddaa4b4990 Use range loops and autos in lib/Serialization/ASTWriter.cpp.
Differential revision: http://reviews.llvm.org/D15311

llvm-svn: 255033
2015-12-08 18:00:11 +00:00
Hans Wennborg d0edbdfad1 Update clang-format-vs README
VS2013 is requried after r231084.

llvm-svn: 255029
2015-12-08 17:54:27 +00:00
Asaf Badouh 5e4248b4e0 [x86][avx512] more changes in intrinsics to be align with gcc format
Differential Revision: http://reviews.llvm.org/D15328

llvm-svn: 255012
2015-12-08 12:34:38 +00:00
Alexey Bataev 382967a2e4 [OPENMP 4.5] Parsing/sema for 'num_tasks' clause.
OpenMP 4.5 adds directives 'taskloop' and 'taskloop simd'. These directives support clause 'num_tasks'. Patch adds parsing/semantic analysis for this clause.

llvm-svn: 255008
2015-12-08 12:06:20 +00:00
Craig Topper 8901448aad Replace bitwise AND with logical AND in an expression that already had another logical AND. NFC
llvm-svn: 255006
2015-12-08 06:49:15 +00:00
Craig Topper bd44cd9d55 [Sema] Remove tab characters. NFC
llvm-svn: 255004
2015-12-08 04:33:04 +00:00
Carlo Bertolli b9bfa75b28 Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule.
llvm-svn: 255001
2015-12-08 04:21:03 +00:00
Richard Smith ce8eca578d Explicitly permit undefined behavior in constant initializers for global
variables in C, in the cases where we can constant-fold it to a value
regardless (such as floating-point division by zero and signed integer
overflow). Strictly enforcing this rule breaks too much code.

llvm-svn: 254992
2015-12-08 03:21:47 +00:00
Eric Christopher c1984075d8 Replace a bunch of duplicate conditions with the call from types::.
llvm-svn: 254986
2015-12-08 02:10:19 +00:00
Eric Christopher b0a44f70e3 Remove name from FIXME.
llvm-svn: 254985
2015-12-08 01:59:51 +00:00
Eric Christopher 379294685b Update comment to reflect that we use other tools via the toolchain to
handle more than just C.

llvm-svn: 254984
2015-12-08 01:59:47 +00:00
Reid Kleckner da30cff9ef [diagnostics] Avoid crashes while printing macro backtraces
When attempting to map a source into a given level of macro expansion,
this code was ignoring the possibility that the start and end of the
range might take wildly different paths through the tree of macro
expansions. It was assuming that the begin spelling location would
always precede the end spelling location, which is false. A macro can
easily transpose its arguments.

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

Pair programmed with Richard Smith.

Fixes PR12818.

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

rdar://problem/23748072

llvm-svn: 254962
2015-12-07 23:01:53 +00:00
Alexey Samsonov af89de9d66 Add llvm-objdump to compiler-rt test deps.
llvm-svn: 254961
2015-12-07 22:45:36 +00:00
Eric Christopher efef8ef8f3 80-col and whitespace fixups.
llvm-svn: 254958
2015-12-07 22:43:05 +00:00
Teresa Johnson ecc8038571 Remove target specifier from new tests
Hopefully fix the remaining bot failure from r254927. Remove
target specification since it shouldn't be needed, and this causes
an error when trying to check the pass execution structure in
test/CodeGen/thinlto_backend.c on non-x86 arches.

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

llvm-svn: 254938
2015-12-07 20:26:57 +00:00
Justin Bogner cbc12262e3 AST: defer to TypeLoc::copy in TypeLoc::initializeFullCopy
If we're initializing a TypeLoc from one that's been allocated with
different alignment, memcpy will get the padding wrong. The `copy`
method already checks and handles this case, so we should just defer
to it.

This also drops the `const` off of the `initializeFullCopy`
declarations, since it isn't even remotely true (and the compiler
notices when we try to call copy() instead of tricking it with
memcpy).

Fixes llvm.org/pr23516.

llvm-svn: 254935
2015-12-07 20:04:57 +00:00
Daniel Jasper f901a57cda clang-format: Make wrapping after "./->" cheaper, even if the element
before it is not a closing parenthesis.

Otherwise, this frequently leads to "hanging" indents that users
perceive as "weird".

Before:
  return !soooooooooooooome_map.insert(
                                   aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
              .second;

After:
  return !soooooooooooooome_map
              .insert(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
              .second;

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

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

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

Depends on D15024

Reviewers: joker.eph, dexonsmith

Subscribers: joker.eph, davidxl, cfe-commits

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

llvm-svn: 254927
2015-12-07 19:21:34 +00:00
Asaf Badouh 3e5111e313 [avx512] rename gcc intrinsics to be align with gcc format
rename the gcc intrinsics suffix : _mask ->_round

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

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

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

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

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



 

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

This change fixes PR24996.

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

llvm-svn: 254876
2015-12-06 14:32:39 +00:00
Craig Topper 59c2ada25d Use llvm::make_range to reduce mentions of iterator type. NFC
llvm-svn: 254870
2015-12-06 05:07:12 +00:00
Dawn Perchik ddd03bf6a0 Fix crash in ASTDumper when dumping NamedDecl with NULL getQualifier().
Reviewed by: aaron.ballman
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D15254

llvm-svn: 254867
2015-12-05 22:37:55 +00:00
Simon Pilgrim 474f24cc5e [X86][3DNow!] Stripped backend codegen tests
As discussed on the ml, backend tests need to be put in llvm/test/CodeGen/X86 as fast-isel tests using IR that is as close to what is generated here as possible.

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

llvm-svn: 254849
2015-12-05 11:12:23 +00:00
Simon Pilgrim dfd2cf3f89 Updated test names to match the intrinsics being tested
llvm-svn: 254848
2015-12-05 11:08:51 +00:00
Simon Pilgrim efc2e45b77 [X86][F16C] Stripped backend codegen tests
As discussed on the ml, backend tests need to be put in llvm/test/CodeGen/X86 as fast-isel tests using IR that is as close to what is generated here as possible.

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

I will update PR24580 on this new plan

llvm-svn: 254847
2015-12-05 10:37:35 +00:00
Craig Topper 8fa890e4b8 [AST] Use std::copy and std::fill to simplify some memcpy and memset calls. Also const-correct some methods being used since the std::copy catches the mismatch where memcpy didn't.
llvm-svn: 254846
2015-12-05 07:41:44 +00:00
Craig Topper caf138e32b Use std::copy and std::transform instead of manual loops. NFC
llvm-svn: 254845
2015-12-05 07:41:42 +00:00
Xinliang David Li a569e24a95 Pass profile version info to name API (NFC)
llvm-svn: 254839
2015-12-05 05:37:15 +00:00
Reid Kleckner 953fe0367b Revert "[x86] Exclusion of incorrect include headers paths for MCU target"
This reverts commit r254195.

From the description, I suspect that the wrong patch was committed here,
and this is causing assertion failures in EmitDeferred() when the global
value ends up being a bitcast of a global.

llvm-svn: 254823
2015-12-05 01:52:14 +00:00
Dan Gohman 4b971e4463 [WebAssembly] Remove an obsolete TODO comment.
llvm-svn: 254817
2015-12-05 01:36:31 +00:00
Devin Coughlin 46089867de [analyzer] Fix MemRegion crash casting non-struct to derived struct (PR25426).
This commit prevents MemRegion::getAsOffset() from crashing when the analyzed
program casts a symbolic region of a non-record type to some derived type and
then attempts to access a field of the base type.

rdar://problem/23458069

llvm-svn: 254806
2015-12-05 00:22:36 +00:00
Alexey Samsonov b6761c2e1e [Docs] One more cleanup of -fsanitize= section.
Describe -fsanitize-blacklist flags in separate paragraphs, move
notes about importance of clang++ for vptr down to UBSan docs.

llvm-svn: 254798
2015-12-04 23:13:14 +00:00
Chris Bieneman 24423e9d03 [CMake] Don't build the libclang tests unless you're building libclang
This fixes a build issue reported by users at Apple.

llvm-svn: 254797
2015-12-04 23:12:19 +00:00
Alexey Samsonov 1f7051e31b [Docs] Update MSan docs
Summary:
1. Move MSan-specific flags and features from user manual to MSan page.
2. Update current status / list of supported platforms.

Reviewers: eugenis, kcc

Subscribers: cfe-commits

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

llvm-svn: 254788
2015-12-04 22:50:44 +00:00
Alexey Samsonov 9eda64043e [Docs] Move the list of CFI schemes down to CFI doc, and update it.
Use proper headling levels in CFI doc. Before that, all sections
were considered a subsection of "Introduction".

Reviewers: pcc, kcc

Subscribers: cfe-commits

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

llvm-svn: 254771
2015-12-04 21:30:58 +00:00
Nico Weber de059e15c0 Small follow-up to 254750 to get the test added there passing...
llvm-svn: 254754
2015-12-04 19:35:45 +00:00
Nico Weber 7123bca7fb Fix debug info for Objective-C properties from class extensions after r251874
After r251874, properties from class extensions no longer show up in
ObjCInterfaceDecl::properties().  Make debug info emission explicitly
look for properties in class extensions before looking at direct properties.

Also add a test that checks for this.  There are three interesting cases:

1. A property is only declared in a class extension, and the @implementation
   is in a different file.  This used to generated a DIObjcProperty before
   r251874 and does again with this fix.

2. A property is declared as readonly in the class itself and redeclared as
   readwrite in a class extension. clang before r251874 put the DIObjcProperty
   on the first declaration. clang after r251874 didn't emit any DIObjcProperty,
   and clang with this fix puts it on the readwrite redeclaration (which is
   what lookup finds).  This seems like a progression.

3. Like 2, but with an @implementation in the same file.  In this case,
   the property debug info gets generated a second time through the ivar
   from the definition.  In this case, lookup and declaration code need
   to agree on the line number so that the DIObjcProperty isn't emitted
   twice.  In this case, clang before r251874 emitted one DIObjcProperty
   on the first declaration, clang with r251874 emitted one on the second
   declaration, and clang with this patch still does the latter.

llvm-svn: 254750
2015-12-04 19:14:14 +00:00
Alexey Samsonov 8846017dd4 [Docs] Remove false claim: UBSan can also be combined with TSan/MSan.
llvm-svn: 254734
2015-12-04 17:35:47 +00:00
Alexey Samsonov 778fc728ed Clang documentation for UBSan.
Summary:
Create a separate page describing UBSan tool, move the description of
fine-grained checks there, provide extra information about supported
platforms, symbolization etc. This text is compiled from four parts:

* Existing documentation copied from User's Manual
* Layout used in documentation for another sanitizers (ASan, MSan etc.)
* Text written from scratch
* Small parts taken from Michael Morrison's attempt at creating UBSan
  page:
  http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20141215/249503.html

Reviewers: kcc, rsmith, silvas

Subscribers: tberghammer, danalbert, srhines, kcc

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

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

llvm-svn: 254718
2015-12-04 15:02:30 +00:00
Craig Topper 2d54c842b5 Fix an unused variable warning in released builds. While there use 'auto' to simplify code.
llvm-svn: 254704
2015-12-04 05:27:29 +00:00
Craig Topper 9ee84add63 [AST] ArrayRef-ize CompoundStmt::setStmts.
llvm-svn: 254703
2015-12-04 05:01:44 +00:00
Devin Coughlin ebeed88078 [analyzer] Support inlining lambda-converted blocks.
clang converts C++ lambdas to blocks with an implicit user-defined conversion
operator method on the lambda record. This method returns a block that captures a copy
of the lambda. To inline a lambda-converted block, the analyzer now calls the lambda
records's call operator method on the lambda captured by the block.

llvm-svn: 254702
2015-12-04 05:00:36 +00:00
Richard Smith 5c40f09b3d Don't assert if evaluation of an expression that we're syntactically required
to treat as an ICE results in undefined behavior. Instead, return the "natural"
result of the operation (signed wraparound / inf / nan).

llvm-svn: 254699
2015-12-04 03:00:44 +00:00
Stephen Hines 8267e7d456 LLDB JIT needs android vector passing rules.
Summary:
Looking into some recent issues with LLDBs expression parser highlighted that upstream clang passes vectors types differently to Android Open Source Project's clang for Arm Android targets.
This patch reflects the changes present in the AOSP and allows LLDB's JIT expression evaluation to work correctly for Arm Android targets when passing vectors.

This is submitted with consent of the original author Stephen Hines.

Reviewers: asl, rsmith, ADodds, rnk

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

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

llvm-svn: 254682
2015-12-04 01:39:30 +00:00
Alexey Samsonov 2e2469d9d9 [Docs] Sanitizer docs migrated from code.google.com to github.com.
llvm-svn: 254672
2015-12-04 00:38:13 +00:00
Petar Jovanovic 402257b84e [PowerPC] Fix calculating address of arguments on stack for variadic func
Fix calculating address of arguments larger than 32 bit on stack for
variadic functions (rounding up address to alignment) on ppc32 architecture.

Patch by Strahinja Petrovic.

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

llvm-svn: 254670
2015-12-04 00:26:47 +00:00
Richard Smith 2b2a176752 PR25731: namespace alias declarations can appear at block scope; ensure that we
do scope-based lookup when looking for redeclarations of them. Add some related
missing checks for the scope-based redeclaration lookup: properly filter the
list of found declarations to match the scope, and diagnose shadowing of a
template parameter name.

llvm-svn: 254663
2015-12-03 23:24:04 +00:00
George Burgess IV 5e8701c356 Fix pass_object_size test on Windows.
The tests were failing because the types of some member functions, when
printed, unexpectedly had "__attribute__((thiscall))" at the end. The
types in question were relatively unimportant to begin with, so they
were removed/replaced with regexes.

llvm-svn: 254650
2015-12-03 21:15:22 +00:00
George Burgess IV c3ec9508ea Add tests for `&enable_if_function` diagnostics.
The introduction of pass_object_size fixed a few bugs related to taking
the address of a function with enable_if attributes. This patch adds
tests for the cases that were fixed.

llvm-svn: 254646
2015-12-03 20:54:58 +00:00
Chris Bieneman 865c4ee9cb [CMake] Removing an unnecessary layer of variable indirection
This prevents passthrough variables from having values.

llvm-svn: 254642
2015-12-03 19:47:25 +00:00
Devin Coughlin dfde655461 [analyzer] Suppress stack address escape on CK_CopyAndAutoreleaseBlockObject.
Don't warn about addresses of stack-allocated blocks escaping if the block
region was cast with CK_CopyAndAutoreleaseBlockObject. These casts, which
are introduced in the implicit conversion operator for lambda-to-block
conversions, cause the block to be copied to the heap -- so the warning is
spurious.

llvm-svn: 254639
2015-12-03 19:41:24 +00:00
George Burgess IV 08a4a8c389 Add tests for pass_object_size.
These additions were meant to go in as a part of r254554; while it's
certainly nice to have new functionality, it's nicer if we have tests to
go with it. :)

llvm-svn: 254632
2015-12-03 19:19:09 +00:00
Nico Weber 08c9333df2 Fix Objective-C metadata for properties from class extensions after r251874
After, properties from class extensions no longer show up in
ObjCInterfaceDecl::properties().  Make ObjCCommonMac::EmitPropertyList()
explicitly look for properties in class extensions before looking at
direct properties.

Also add a test that passes both with clang before r251874 and after this
patch (but fails with r251874 and without this patch).

llvm-svn: 254622
2015-12-03 17:44:51 +00:00
NAKAMURA Takumi 66389e8ff2 Fix clang/test/Sema/struct-packed-align.c. "Windows" is not MS compiler.
llvm-svn: 254614
2015-12-03 16:03:34 +00:00
Nico Weber ae92083d72 Make check-clang depend on LTO.
r249143 added test/Driver/darwin-ld-lto.c which requires libLTO.dylib
to pass, but when running `ninja check-clang` in a fresh build directory
nothing caused libLTO.dylib to be built and the test would fail.

llvm-svn: 254612
2015-12-03 15:40:23 +00:00
Krzysztof Parzyszek fceb4e7cb4 Unxfail passing test: test/CodeGenCXX/crash.cpp
llvm-svn: 254606
2015-12-03 12:03:56 +00:00
Alexander Kornienko 061900fea8 Revert "Fix for merging decls in pragma weak Calling CheckFunctionDeclaration so that 2 decls for the 'weak' are merged. Differential Revision: http://reviews.llvm.org/D13048"
This reverts commit r254143 which introduces a crash on the following input:
  f(char *);
  g(char *);
  #pragma weak f = g
  int g(char *p) {}

llvm-svn: 254605
2015-12-03 11:37:28 +00:00
Manuel Klimek 6003384ea9 Add fall-back mode for clang tools.
Run without flags if we cannot load a compilation database. This matches
the behavior of clang itself when simply called with a source file.

Based on a patch by Russell Wallace.

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

llvm-svn: 254597
2015-12-03 09:40:15 +00:00
Alexey Bataev 830dfccfb2 PR25575: Make GCC 4.4+ comatible layout for packed bit-fileds of char type, patch by D. Polukhin
This CL is for discussion how to better fix bit-filed layout compatibility issue with GCC (see PR25575 for test case and more details). Current clang behavior is compatible with GCC 4.1-4.3 series but it was fixed in 4.4+. Ignoring packed attribute looks very odd and because it was also fixed in GCC 4.4+, it makes sense also fix it in clang.
Differential Revision: http://reviews.llvm.org/D14872

llvm-svn: 254596
2015-12-03 09:34:49 +00:00
Simon Pilgrim 068c2ce836 [X86] Stripped backend codegen tests
As discussed on the ml, backend tests need to be put in llvm/test/CodeGen/X86 as fast-isel tests using IR that is as close to what is generated here as possible.

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

I will update PR24580 on this new plan

llvm-svn: 254594
2015-12-03 08:45:21 +00:00
Nico Weber baf4b7d734 Fix a comment typo from r251874.
llvm-svn: 254579
2015-12-03 02:25:26 +00:00
Sanjay Patel 4994956f1a generalize CHECK lines to make buildbot happy
llvm-svn: 254576
2015-12-03 01:51:39 +00:00
Richard Smith 0c6124ba82 PR17381: Treat undefined behavior during expression evaluation as an unmodeled
side-effect, so that we don't allow speculative evaluation of such expressions
during code generation.

This caused a diagnostic quality regression, so fix constant expression
diagnostics to prefer either the first "can't be constant folded" diagnostic or
the first "not a constant expression" diagnostic depending on the kind of
evaluation we're doing. This was always the intent, but didn't quite work
correctly before.

This results in certain initializers that used to be constant initializers to
no longer be; in particular, things like:

  float f = 1e100;

are no longer accepted in C. This seems appropriate, as such constructs would
lead to code being executed if sanitizers are enabled.

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

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

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

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

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

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

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

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

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

llvm-svn: 254554
2015-12-02 21:58:08 +00:00
Sumanth Gundapaneni b79fdff9e2 Fix the clang driver when "-nostdlib" is present
This patch is a fix to r252901 which changed the behavior of 
clang driver. In the presence of "-nostdlib" none of the standard
libraries should be passed to link line.

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

llvm-svn: 254535
2015-12-02 19:12:41 +00:00
Paul Robinson 941bc91518 Move _mm256_cvtps_ph and _mm256_cvtph_ps to immintrin.h.
This more closely matches their locations as described by Intel
documentation, and lets us remove a pair of redundant typedefs.

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

llvm-svn: 254528
2015-12-02 18:41:52 +00:00
Samuel Antao 4af1b7b693 [OpenMP] Update target directive codegen to use 4.5 implicit data mappings.
Summary:
This patch implements the 4.5 specification for the implicit data maps. OpenMP 4.5 specification changes the default way data is captured into a target region. All the non-aggregate kinds are passed by value by default. This required activating the capturing by value during SEMA for the target region. All the non-aggregate values that can be encoded in the size of a pointer are properly casted and forwarded to the runtime library. On top of fixing the previous weird behavior for mapping pointers in nested data regions (an explicit map was always required), this also improves performance as the number of allocations/transactions to the device per non-aggregate map are reduced from two to only one - instead of passing a reference and the value, only the value passed.

Explicit maps will be added later on once firstprivate, private, and map clauses' SEMA and parsing are available.

Reviewers: hfinkel, rjmccall, ABataev

Subscribers: cfe-commits, carlo.bertolli

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

llvm-svn: 254521
2015-12-02 17:44:43 +00:00
Aaron Ballman 32beedc982 Making the deleted copy constructor parameter const; NFC.
llvm-svn: 254520
2015-12-02 17:07:30 +00:00
Aaron Ballman a60bcdab92 Add a narrowing AST matcher that matches on a FunctionDecl with a non-throwing exception specification.
llvm-svn: 254516
2015-12-02 15:23:59 +00:00
Aaron Ballman 08dd61de24 Amending r254423 by deleting the copy constructor and adding a move constructor instead; NFC as neither of these constructors are currently called, but this is a safer design.
llvm-svn: 254515
2015-12-02 15:05:47 +00:00
Daniel Jasper c8f472c3a6 Traverse the NestedNameSpecifier(Loc) of NamespaceAliasDecls.
Review: http://reviews.llvm.org/D15149
llvm-svn: 254510
2015-12-02 13:57:46 +00:00
Christof Douma ba13ad58f7 Teaches clang about Cortex-A35.
Adds support for the new Cortex-A35 ARMv8-A core.

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

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

llvm-svn: 254485
2015-12-02 03:13:50 +00:00
Kostya Serebryany 5ce81794c3 [sanitizer coverage] document -fsanitize-coverage=trace-bb
llvm-svn: 254481
2015-12-02 02:08:26 +00:00
Peter Collingbourne 9de8fc5766 docs: Add design documentation for forward-edge CFI for indirect calls.
llvm-svn: 254464
2015-12-01 21:58:54 +00:00
Adrian Prantl d6ec3bc48d Clang-format an 80-column violation.
llvm-svn: 254455
2015-12-01 20:19:44 +00:00
Adrian Prantl 354bebda48 Add an accessor to Decl::LoadedFieldsFromExternalStorage for LLDB.
Patch by Greg Clayton
Reviewed by Doug Gregor

llvm-svn: 254451
2015-12-01 19:54:07 +00:00
Rafael Espindola f0202c46be Update for llvm api change.
llvm-svn: 254450
2015-12-01 19:51:03 +00:00
Benjamin Kramer 5fecd67462 Avoid picking up system headers in unittest by providing a fake libstdc++ with a ridiculously high version number.
The host libstdc++ may be horribly broken and we want the fake one to be
picked up. This workaround is lame but I don't see a better way.

llvm-svn: 254446
2015-12-01 19:42:07 +00:00
David Majnemer f3027177bc [MS ABI] Correctly mangle nullptr member pointers for variable templates
Variable templates behave the same as class templates with regard to
nullptr memeber pointers.

llvm-svn: 254439
2015-12-01 19:13:51 +00:00
Aaron Ballman a9918e897b It appears that this horrible mutating copy constructor is unused. Kill it with fire.
llvm-svn: 254423
2015-12-01 17:15:13 +00:00
Daniel Jasper a0a5039d2e clang-format: Make it possible to turn off comment reflowing.
llvm-svn: 254414
2015-12-01 13:28:53 +00:00
Daniel Jasper a00de6366a clang-format: treat Q_SIGNALS as an access modifier
Patch by Alexander Richardson, thank you!

llvm-svn: 254407
2015-12-01 12:05:04 +00:00
Daniel Jasper ec90e51c79 This fixes https://llvm.org/bugs/show_bug.cgi?id=25329, as well as
misalignments like the following:

  int a, b = 2;
  int c    = 3;

Patch by Beren Minor, thanks!

llvm-svn: 254406
2015-12-01 12:00:43 +00:00
Alexey Bataev a056935a2f [OPENMP 4.5] Parsing/sema analysis for 'priority' clause.
OpenMP 4.5 defines new clause 'priority' for 'task', 'taskloop' and 'taskloop simd' directives. Added parsing and sema analysis for 'priority' clause in 'task' and 'taskloop' directives.

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

Original patch by: Gyorgy Orban!

llvm-svn: 254394
2015-12-01 09:00:41 +00:00
Yaron Keren 2c07cc70c4 Remove superfluous StringRef casts, NFC.
llvm-svn: 254392
2015-12-01 08:14:39 +00:00
Craig Topper 5ec97a7b9b [X86] Improve codegen for AVX2 gather with an all 1s mask.
Use undefined instead of setzero as the pass through input since its going to be fully overwritten. Use cmpeq of two zero vectors to produce the all 1s vector. Casting -1 to a double and vectorizing causes a constant load of a -1.0 floating point value.

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

llvm-svn: 254367
2015-12-01 04:18:41 +00:00
Richard Smith 64daf7b1a5 [modules] Don't reject multiple modules providing contents for the same embedded file.
llvm-svn: 254365
2015-12-01 03:32:49 +00:00
Richard Smith 5a99c49d2e Fix use-after-free when a C++ thread_local variable gets replaced (because its
type changes when the initializer is attached). Don't hold onto the
GlobalVariable*; recompute it from the VarDecl* instead.

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

This fixes PR25661.

llvm-svn: 254323
2015-11-30 20:34:28 +00:00
Samuel Antao e5113bce6c Add --gcc-toolchain= to one of the libclang unitests to fix issue related to
the gcc libraries clang picks for when it was configures with a user defined 
path.

llvm-svn: 254306
2015-11-30 17:26:28 +00:00
Aaron Ballman 415c414bf2 Do not crash when dumping the objc_bridge_related attribute when its optional arguments are not supplied.
Patch thanks to Joe Ranieri!

llvm-svn: 254303
2015-11-30 15:25:34 +00:00
Craig Topper 9b2438f6d1 Use range-based for loop to avoid the need for calculating an array size. NFC
llvm-svn: 254282
2015-11-30 03:11:12 +00:00
Craig Topper ac67c05a50 Use std::begin() and std::end() instead of doing the same manually. NFC
llvm-svn: 254281
2015-11-30 03:11:10 +00:00
Craig Topper e20b8c68ed [X86] _mm256_permutevar8x32_ps should take an integer vector for its shuffle index input.
llvm-svn: 254270
2015-11-29 22:53:32 +00:00
Simon Pilgrim a5c0493ddb [X86][SSE2] Added SSE2 IR + assembly codegen builtin tests
Improved tests as discussed in PR24580

llvm-svn: 254262
2015-11-29 20:23:00 +00:00
NAKAMURA Takumi 704b795634 clang/test/CodeGen/arm-v8.1a-neon-intrinsics.c REQUIRES both arm and aarch64.
llvm-svn: 254252
2015-11-29 13:43:05 +00:00
Alexandros Lamprineas cd8d973932 ARM v8.1a adds Advanced SIMD instructions for Rounding Double Multiply
Add/Subtract.

Add missing tests that accidentally were not committed in rL254250.

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

llvm-svn: 254251
2015-11-29 10:53:28 +00:00
Alexandros Lamprineas 502592c1d4 ARM v8.1a adds Advanced SIMD instructions for Rounding Double Multiply
Add/Subtract.

The following instructions are added to AArch32 instruction set:

- VQRDMLAH: Vector Saturating Rounding Doubling Multiply Accumulate
            Returning High Half
- VQRDMLSH: Vector Saturating Rounding Doubling Multiply Subtract
            Returning High Half

The following instructions are added to AArch64 instruction set:

- SQRDMLAH: Signed Saturating Rounding Doubling Multiply Accumulate
            Returning High Half
- SQRDMLSH: Signed Saturating Rounding Doubling Multiply Subtract
            Returning High Half

This patch adds intrinsic and ACLE macro support for these instructions,
as well as corresponding tests.

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

llvm-svn: 254250
2015-11-29 10:43:59 +00:00
Craig Topper 3a71f35a67 [X86] Remove temporary variables from intrinsic macros. NFC
llvm-svn: 254247
2015-11-29 06:50:33 +00:00
Daniel Sanders 54dd84d48f Fixed default label in fully covered switch warning that was introduced in r254203.
llvm-svn: 254208
2015-11-27 19:49:24 +00:00
Kelvin Li a15fb1a110 [OpenMP] Parsing and sema support for thread_limit clause.
http://reviews.llvm.org/D15029

llvm-svn: 254207
2015-11-27 18:47:36 +00:00
Artyom Skrobov d08cb6c528 int function without a return statement is invalid C++.
Changing the return type to void.

llvm-svn: 254206
2015-11-27 18:10:49 +00:00
Daniel Sanders bd3f47f5b5 [mips] Interrupt attribute support.
Summary: This patch adds support for the interrupt attribute for mips32r2+.

Patch by Simon Dardis.

Reviewers: dsanders, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 254205
2015-11-27 18:03:44 +00:00
Daniel Sanders 8f8eb8f545 Revert r254203: [mips] Interrupt attribute support.
I forgot to credit the author.

llvm-svn: 254204
2015-11-27 18:00:36 +00:00
Daniel Sanders 586be02495 [mips] Interrupt attribute support.
Summary: This patch adds support for the interrupt attribute for mips32r2+.

Reviewers: dsanders, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 254203
2015-11-27 17:39:20 +00:00
Joerg Sonnenberger 97f4d2c47f Revert Sparc and SparcV9 to external assembler. Now that the CPU
handling is corrected, the primary reason for forcing IAS as default is
gone and the remaining issues are still somewhat problematic in common
situations.

llvm-svn: 254199
2015-11-27 13:16:33 +00:00
Andrey Bokhanko 2a4db90157 [x86] Exclusion of incorrect include headers paths for MCU target
Exclusion of /usr/include and /usr/local/include headers paths for MCU target.

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

llvm-svn: 254195
2015-11-27 12:18:22 +00:00
Pierre Gousseau 2a3ca840e3 Test commit
Remove tabs.

llvm-svn: 254181
2015-11-26 22:08:58 +00:00
Justin Bogner 98712bd771 docs: Remove references to the long-defunct LLVM_USED_LIBS
LLVM_USED_LIBS hasn't done anything since 2012, stop telling people to
set it in the docs.

llvm-svn: 254173
2015-11-26 19:52:24 +00:00
Oliver Stannard 4cc70802c7 [AArch64] Add command-line options for Statistical Profiling Extension
This adds the "+profile" and +noprofile" suffixes for the -march and
-mcpu options, to allow enabling or disabling the options Statistical
Profiling Extension to ARMv8.2-A.

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

llvm-svn: 254161
2015-11-26 15:38:54 +00:00
Oliver Stannard 76afca7617 [AArch64] Add command-line options for ARMv8.2-A
This adds new values for the -march option (armv8.2a and armv8.2-a,
which are aliases of each other), and new suffixes for the -march and
-mcpu options (+fp16 and +nofp16), to allow targeting the ARMv8.2-A
architecture and it's optional half-precision floating-point extension.

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

llvm-svn: 254160
2015-11-26 15:36:42 +00:00
Alexander Musman f97c8933cb Fix for merging decls in pragma weak
Calling CheckFunctionDeclaration so that 2 decls for the 'weak' are merged.
Differential Revision: http://reviews.llvm.org/D13048

llvm-svn: 254143
2015-11-26 09:34:30 +00:00
Alexey Bataev 7b6bc88c5a [OPENMP 4.5] Fixed rules for 'ordered' clause.
According to OpenMP 4.5 the parameter of 'ordered' clause must be greater than or equal to the parameter of 'collapse' clause. Patch adds this rule.

llvm-svn: 254141
2015-11-26 07:50:39 +00:00
Craig Topper 5e35e669a5 [Diagnostics] Call setMapping on the correct diagnostic states in a few places. GetCurDiagState() was being used when it shouldn't be.
I spotted this by inspection in the for loop that wasn't using its iterator and was just acting on the current state repeatedly.

This appears to have been introduced as a copy and paste bug in r140763 over 4 years ago.

I have no idea how to test this. I just went back to the original commit and tried to use the variables it was using before that.

llvm-svn: 254134
2015-11-26 05:51:54 +00:00
Craig Topper a52e2b22e6 Use range-based for loops. NFC
llvm-svn: 254133
2015-11-26 05:10:07 +00:00
Richard Smith 85864d5b43 Update reference to final TM TS spec.
llvm-svn: 254123
2015-11-26 02:23:21 +00:00
Richard Smith 4a0cd89325 P0002R1: increment on expressions of type bool is no longer allowed in C++1z.
llvm-svn: 254122
2015-11-26 02:16:37 +00:00
Richard Smith a8cfffa351 [modules] Refactor handling of -fmodules-embed-*. Track this properly rather
than reusing the "overridden buffer" mechanism. This will allow us to make
embedded files and overridden files behave differently in future.

llvm-svn: 254121
2015-11-26 02:04:16 +00:00
Martell Malone 5cad22519d Driver: protect from empty -L args
Differential Revision: http://reviews.llvm.org/D12466

llvm-svn: 254117
2015-11-26 01:02:07 +00:00
Devin Coughlin 2c2c3cb3d0 [analyzer] Add tests for generalized lambda capture (C++14). NFC.
Add tests demonstrating that the analyzer supports generalized lambda capture. This
support falls out naturally from the work Gábor Horváth did adding C++11 lambdas to
the analyzer.

llvm-svn: 254114
2015-11-26 00:11:23 +00:00
Devin Coughlin b6029b7ef4 [analyzer] Include block capture copy expressions in the CFG.
This prevents spurious dead store warnings when a C++ lambda is casted to a block.

I've also added several tests documenting our still-incomplete support for lambda-to-block
casts.

rdar://problem/22236293

llvm-svn: 254107
2015-11-25 22:35:37 +00:00
Richard Smith 291027692f P0001R1: 'register' storage class specifier is no longer permitted in C++1z.
We will still allow it in system headers, in macros from system headers, when
combined with an 'asm' label, and under the flag -Wno-register.

llvm-svn: 254097
2015-11-25 21:34:21 +00:00
Richard Smith 3275813d35 Stop using SFINAE to detect whether a derived-class override of Traverse* can
take a queue; some supported versions of GCC believe that this substitution
failure is an error. Instead, use a partial specialization to detect the type
of a pointer to the corresponding member. This is less general, but good enough
for our uses.

llvm-svn: 254083
2015-11-25 19:33:20 +00:00
Alexey Bataev f763027f04 [MSVC] 'property' with an empty array in array subscript expression.
MSVC supports 'property' attribute and allows to apply it to the declaration of an empty array in a class or structure definition.
For example:
```
__declspec(property(get=GetX, put=PutX)) int x[];
```
The above statement indicates that x[] can be used with one or more array indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), and p->x[a][b] = i will be turned into p->PutX(a, b, i);
Differential Revision: http://reviews.llvm.org/D13336

llvm-svn: 254067
2015-11-25 12:01:00 +00:00
Alexey Bataev c99b04983b [X86] Support for C calling convention only for MCU target.
For MCU only C calling convention is allowed, all other calling conventions are not supported.
Differential Revision: http://reviews.llvm.org/D14864

llvm-svn: 254063
2015-11-25 09:24:26 +00:00
Richard Smith cb50b511de Fix typo that was being SFINAE'd away (and apparently GCC 4.7.2 rejects-valid on this).
llvm-svn: 254053
2015-11-25 02:41:42 +00:00
Richard Smith a205719319 Teach RAV to pass its DataRecursionQueue to derived classes if they ask for it,
to allow them to explicitly opt into data recursion despite having overridden
Traverse*Stmt or Traverse*Expr. Use this to reintroduce data recursion to the
one place that lost it when DataRecursiveASTVisitor was removed.

llvm-svn: 254041
2015-11-24 23:50:47 +00:00
Kelvin Li 099bb8c65d [OpenMP] Parsing and sema support for num_teams clause
http://reviews.llvm.org/D14802

llvm-svn: 254019
2015-11-24 20:50:12 +00:00
Yaron Keren 4c31fcfcf5 Replace [=] lambda capture with [&] per David Blaikieþ suggestion.
llvm-svn: 254013
2015-11-24 20:18:24 +00:00
Devin Coughlin c1986638a7 [analyzer] Pass value expression for inlined defensive checks when binding null to nonnull.
The nullability checker was not suppressing false positives resulting from
inlined defensive checks when null was bound to a nonnull variable because it
was passing the entire bind statement rather than the value expression to
trackNullOrUndefValue().

This commit changes that checker to synactically match on the bind statement to
extract the value expression so it can be passed to trackNullOrUndefValue().

rdar://problem/23575439

llvm-svn: 254007
2015-11-24 19:15:11 +00:00
Nirav Dave b0bb6142f5 Fix rewrite of reserved library name in case of -nodefaultlibs
The Driver only checked if nostdlib was set when deciding to add
reserved_lib_stdcxx, but as nostdlib is always exactly nodefaultlibs and
nostartfiles we should be checking one (clearly nodefaultlibs in the
case) as well. This appears to be the only such instance of this in the
codebase.

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

llvm-svn: 253990
2015-11-24 16:07:21 +00:00
Alexey Bataev 40e36f1f64 [OPENMP] Fix crash on codegen for 'task' directive with no shared variables.
If 'task' region does not have shared variables codegen could crash on calculation of size of list of shared variables.

llvm-svn: 253977
2015-11-24 13:01:44 +00:00
Richard Smith 812465436b Reduce the stack usage per recursive step when RecursiveASTVisitor cannot perform data recursion.
llvm-svn: 253958
2015-11-24 07:13:06 +00:00
Richard Smith 919ce23566 [modules] Add -cc1 flag -fmodules-embed-all-files.
This flag causes all files that were read by the compilation to be embedded
into a produced module file. This is useful for distributed build systems that
use an include scanning system to determine which files are "needed" by a
compilation, and only provide those files to remote compilation workers. Since
using a module can require any file that is part of that module (or anything it
transitively includes), files that are not found by an include scanner can be
required in a regular build using explicit modules. With this flag, only files
that are actually referenced by transitively-#included files are required to be
present on the build machine.

llvm-svn: 253950
2015-11-24 04:22:21 +00:00
Richard Smith 50668455a7 Remove DataRecursiveASTVisitor; it no longer serves any purpose, since it's just an alias for RecursiveASTVisitor.
llvm-svn: 253949
2015-11-24 03:55:01 +00:00
Richard Smith 8583872060 Use data recursion in RecursiveASTVisitor when traversing Stmt and Expr nodes.
When RAV traverses a Stmt or Expr node, if the corresponding Traverse*
functions have not been overridden, it will now use data recursion to walk
those nodes. We arrange this to be an unobservable optimization to RAV
subclasses, and to gracefully degrade as parts of the visitation are overridden
with functions that might observe the visitation.

For instance, if an RAV subclass overrides TraverseUnaryNot, we will ensure
that there are real recursive stack frames for those traversals, but we'll
use data recursion for all other traversals.

This removes the need for DataRecursiveASTVisitor, and for the
'shouldUseDataRecursionFor' extension point, both of which are removed by this
change.

llvm-svn: 253948
2015-11-24 03:09:01 +00:00
Artem Belevich d977f4ab99 Do not attempt to include CUDA headers during the test.
llvm-svn: 253947
2015-11-24 02:45:55 +00:00
Richard Smith 2af65c4a89 [coroutines] Build a CoroutineBodyStmt when finishing parsing a coroutine, and form the initial_suspend, final_suspend, and get_return_object calls.
llvm-svn: 253946
2015-11-24 02:34:39 +00:00
NAKAMURA Takumi 8965799aa3 CodeGenFunction.h: Prune a \param in r253926. [-Wdocumentation]
llvm-svn: 253938
2015-11-23 23:38:13 +00:00
Chris Bieneman ae88ac200d NFC. Fixing my consistently incorrect spelling.
llvm-svn: 253937
2015-11-23 23:34:13 +00:00
NAKAMURA Takumi a70cdf5166 clang-c/Index.h: Move \brief. [-Wdocumentation]
llvm-svn: 253932
2015-11-23 22:51:26 +00:00
Samuel Antao 798f11cfb7 Preserve exceptions information during calls code generation.
This patch changes the generation of CGFunctionInfo to contain 
the FunctionProtoType if it is available. This enables the code 
generation for call instructions to look into this type for 
exception information and therefore generate better quality 
IR - it will not create invoke instructions for functions that 
are know not to throw.

llvm-svn: 253926
2015-11-23 22:04:44 +00:00
Chad Rosier c6bb4241fd Fix a warning about commas at the end of enumerator lists.
llvm-svn: 253914
2015-11-23 21:05:04 +00:00
Ehsan Akhgari 93697fa755 Make clang_Cursor_getMangling not mangle if the declaration isn't mangled
Right now clang_Cursor_getMangling will attempt to mangle any
declaration, even if the declaration isn't mangled (extern C).  This
results in a partially mangled name which isn't useful for much. This
patch makes clang_Cursor_getMangling return an empty string if the
declaration isn't mangled.

Patch by Michael Wu <mwu@mozilla.com>.

llvm-svn: 253909
2015-11-23 19:56:46 +00:00
Yaron Keren 941ad90146 Replace loop with std::any_of, NFC.
Inspired by similar commits from Craig Topper.

llvm-svn: 253904
2015-11-23 19:28:42 +00:00
Daniel Jasper 8e8b4fb678 clang-format: Re-add code path deleted in r253873 and add missing test.
llvm-svn: 253900
2015-11-23 19:11:45 +00:00
Martell Malone a96925322b Fix alignment of r253898
llvm-svn: 253899
2015-11-23 19:05:19 +00:00
Martell Malone f6301faa8b Driver: fallback to the location of clang if no sysroot,
hard coding /usr makes little sense for mingw-w64.
If we have portable toolchains having /usr breaks that.
If the clang we use is in /usr/bin or /usr/sbin etc this will
still detect as though it was hard coded to /usr

This makes the most sense going forward for mingw-w64 toolchains
on both linux and mac

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

llvm-svn: 253898
2015-11-23 18:59:48 +00:00
Sumanth Gundapaneni c61c08e618 Make tbm-builtins.c as X86 specific unit test
Differential Revision: http://reviews.llvm.org/D14887

llvm-svn: 253887
2015-11-23 17:33:49 +00:00
Xinliang David Li 4dff875259 Disable frame pointer elimination when using -pg
(Re-apply patch after bug fixing)

This diff makes sure that the driver does not pass
-fomit-frame-pointer or -momit-leaf-frame-pointer to
the frontend when -pg is used. Currently, clang gives 
an error if -fomit-frame-pointer is used in combination 
with -pg, but -momit-leaf-frame-pointer was forgotten.
Also, disable frame pointer elimination in the frontend 
when -pg is set.

Patch by Stefan Kempf.

llvm-svn: 253886
2015-11-23 17:30:31 +00:00
Aaron Ballman 6290fc9154 Add an AST matcher for narrowing when a type is volatile-qualified.
llvm-svn: 253882
2015-11-23 17:09:24 +00:00
Martell Malone ba0f7d2b9d Revert part of r253813
The new lld gnu frontend does not support the -target option

llvm-svn: 253874
2015-11-23 16:04:55 +00:00
Daniel Jasper 569369ce28 clang-format: Signficantly refactor the cast detection.
No functional changes intended.

llvm-svn: 253873
2015-11-23 15:55:55 +00:00
Daniel Jasper 9bb3001d53 clang-format: Fix incorrect cast detection.
Before:
  bool b = f(g<int>)&&c;

After:
  bool b = f(g<int>) && c;

llvm-svn: 253872
2015-11-23 15:55:50 +00:00
Daniel Jasper 253dad2323 clang-format: If the template list of a variable declaration spans
multiple lines, also break before the variable name.

Before:
  std::vector<aaaaaa, // wrap
              aa> aaa;

After:
  std::vector<aaaaaa, // wrap
              aa>
      aaa;

llvm-svn: 253871
2015-11-23 15:55:45 +00:00
Alexey Bataev 92e82f9cce [OPENMP] 'out' dependency for 'task' directives must be the same as 'inout'.
Runtime library requires, that codegen for 'depend' clause for 'out' dependency kind must be the same as codegen for 'depend' clause with 'inout' dependency.

llvm-svn: 253866
2015-11-23 13:33:42 +00:00
Anastasia Stulova 784fb78274 [OpenCL 2.0] Apply default address space (AS).
If AS of a variable/parameter declaration is not set by the source,
OpenCL v2.0 s6.5 defines explicit rules for default ASes:

- The AS of global and local static variables defaults to global;
- All pointers point to generic AS.

http://reviews.llvm.org/D13168

llvm-svn: 253863
2015-11-23 11:14:44 +00:00
Daniel Jasper 7048edb104 Fix clang-format test. I believe that the new behavior is better.
llvm-svn: 253861
2015-11-23 08:50:52 +00:00
Daniel Jasper b68aabf7fc clang-format: Make moving of the Cursor work properly when sorting #includes.
llvm-svn: 253860
2015-11-23 08:36:35 +00:00
Daniel Jasper 3fed94525c Fix calculation of shifted cursor/code positions. Specifically support
the case where a specific range is replaced by new text. Previously,
the calculation would shift any position from within a replaced region
to the first character after the region. This is undersirable, e.g. for
clang-format's include sorting.

llvm-svn: 253859
2015-11-23 08:33:48 +00:00
NAKAMURA Takumi 805e657584 OpenMPClause.h: Fix typos. [-Wdocumentation]
llvm-svn: 253854
2015-11-23 06:41:50 +00:00
Vedant Kumar 280001807b [Driver] Mark isForDiagnostics as const. NFC.
llvm-svn: 253853
2015-11-23 06:40:49 +00:00
Xinliang David Li a2124eebbd Revert r253846 (build bot failure))
llvm-svn: 253851
2015-11-23 05:41:05 +00:00
Kelvin Li 7010ed6be3 [OpenMP] Parsing and sema support for map clause - add test case
http://reviews.llvm.org/D14134 

llvm-svn: 253850
2015-11-23 05:36:37 +00:00
Kelvin Li 0bff7afab5 [OpenMP] Parsing and sema support for map clause
http://reviews.llvm.org/D14134 

llvm-svn: 253849
2015-11-23 05:32:03 +00:00
Xinliang David Li eadaf84e78 Disable frame pointer elimination when using -pg
This diff makes sure that the driver does not pass
-fomit-frame-pointer or -momit-leaf-frame-pointer to
the frontend when -pg is used. Currently, clang gives 
an error if -fomit-frame-pointer is used in combination 
with -pg, but -momit-leaf-frame-pointer was forgotten.
Also, disable frame pointer elimination in the frontend 
when -pg is set.

Patch by Stefan Kempf.

llvm-svn: 253846
2015-11-23 05:09:10 +00:00
David Majnemer 67528eaacf [MS ABI] Tolerate invokes of __RTDynamicCast
The pointer returned by __RTDynamicCast must be bitcasted.  However, it
was not expected that __RTDynamicCast would be invoked, resulting in the
bitcast occuring in a different BasicBlock than the invoke.  This caused
a down-stream PHI to get confused about which BasicBlock the incomming
value was from.

This fixes PR25606.

llvm-svn: 253843
2015-11-23 03:01:14 +00:00
Richard Smith 71d403effb [coroutines] Check for overload sets in co_yield / co_return operands being resolved by a call to yield_value / return_value before rejecting them.
llvm-svn: 253817
2015-11-22 07:33:28 +00:00
Richard Smith 4ba66602bd [coroutines] Build implicit return_value / return_void calls for co_return.
llvm-svn: 253816
2015-11-22 07:05:16 +00:00
Martell Malone 605cdb5c9c Test: Update mingw-useld.c to reflect r253813
llvm-svn: 253815
2015-11-22 05:45:03 +00:00
Martell Malone aac044e35c Driver: Specifically tell the linker the target for mingw-w64
Cross compiling from linux and OSX results in Error: Exec format.
This is because the linker is expecting ELF formated objects.
By passing the target we can explicitly tell the linker that
it should be linking COFF objects regardless of the host.

llvm-svn: 253813
2015-11-22 05:40:06 +00:00
Richard Smith 1f38eddee0 [coroutines] Materialize the awaitable before generating the await_* calls.
llvm-svn: 253812
2015-11-22 03:13:02 +00:00