]> granicus.if.org Git - clang/log
clang
7 years ago[MS] Fix prologue this adjustment when 'this' is passed indirectly
Reid Kleckner [Wed, 7 Sep 2016 18:21:30 +0000 (18:21 +0000)]
[MS] Fix prologue this adjustment when 'this' is passed indirectly

Move the logic for doing this from the ABI argument lowering into
EmitParmDecl, which runs for all parameters. Our codegen is slightly
suboptimal in this case, as we may leave behind a dead store after
optimization, but it's 32-bit inalloca, and this fixes the bug in a
robust way.

Fixes PR30293

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

7 years ago[clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What...
Eugene Zelenko [Wed, 7 Sep 2016 17:37:28 +0000 (17:37 +0000)]
[clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes.

Differential revision: https://reviews.llvm.org/D24165

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

7 years agoAdd missing include. White space.
Vassil Vassilev [Wed, 7 Sep 2016 17:30:50 +0000 (17:30 +0000)]
Add missing  include. White space.

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

7 years agoAdd MS __nop intrinsic to intrin.h
Reid Kleckner [Wed, 7 Sep 2016 16:55:12 +0000 (16:55 +0000)]
Add MS __nop intrinsic to intrin.h

Summary: There was no definition for __nop function - added inline
assembly.

Patch by Albert Gutowski!

Reviewers: rnk, thakis

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D24286

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

7 years agoParsing MS pragma intrinsic
Reid Kleckner [Wed, 7 Sep 2016 16:38:32 +0000 (16:38 +0000)]
Parsing MS pragma intrinsic

Parse pragma intrinsic, display warning if the function isn't a builtin
function in clang and suggest including intrin.h.

Patch by Albert Gutowski!

Reviewers: aaron.ballman, rnk

Subscribers: aaron.ballman, cfe-commits

Differential Revision: https://reviews.llvm.org/D23944

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

7 years ago[MS] Fix 'this' type when calling virtual methods with inalloca
Reid Kleckner [Wed, 7 Sep 2016 15:15:51 +0000 (15:15 +0000)]
[MS] Fix 'this' type when calling virtual methods with inalloca

If the virtual method comes from a secondary vtable, then the type of
the 'this' parameter should be i8*, and not a pointer to the complete
class. In the MS ABI, the 'this' parameter on entry points to the vptr
containing the virtual method that was called, so we use i8* instead of
the normal type. We had a mismatch where the CGFunctionInfo of the call
didn't match the CGFunctionInfo of the declaration, and this resulted in
some assertions, but now both sides agree the type of 'this' is i8*.

Fixes one issue raised in PR30293

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

7 years ago[EfficiencySanitizer] [MIPS64] Enables esan clang driver options for MIPS64
Sagar Thakur [Wed, 7 Sep 2016 12:23:15 +0000 (12:23 +0000)]
[EfficiencySanitizer] [MIPS64] Enables esan clang driver options for MIPS64

Reviewed by bruening
Differential: D23800

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

7 years ago[OpenCL] Fix pipe built-in functions return type.
Alexey Bader [Wed, 7 Sep 2016 10:32:03 +0000 (10:32 +0000)]
[OpenCL] Fix pipe built-in functions return type.

By default return type of call expressions calling built-in
functions is set to bool.

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

Reviewers: Anastasia

Subscribers: dmitry, cfe-commits, yaxunl

Differential Revision: https://reviews.llvm.org/D24136

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

7 years agoOpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness
Matt Arsenault [Wed, 7 Sep 2016 07:08:02 +0000 (07:08 +0000)]
OpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness

OpenCL requires __ENDIAN_LITTLE__ be set for little endian targets.
The default for targets was also apparently big endian, so AMDGPU
was incorrectly reported as big endian. Set this from the triple
so targets don't have another place to set the endianness.

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

7 years agoFix whitespace issues
Matt Arsenault [Wed, 7 Sep 2016 07:07:59 +0000 (07:07 +0000)]
Fix whitespace issues

^M and extra space

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

7 years agoFix clang's handling of the copy performed in the second phase of class
Richard Smith [Wed, 7 Sep 2016 02:14:33 +0000 (02:14 +0000)]
Fix clang's handling of the copy performed in the second phase of class
copy-initialization. We previously got this wrong in a couple of ways:
 - we only looked for copy / move constructors and constructor templates for
   this copy, and thus would fail to copy in cases where doing so should use
   some other constructor (but see core issue 670),
 - we mishandled the special case for disabling user-defined conversions that
   blocks infinite recursion through repeated application of a copy constructor
   (applying it in slightly too many cases) -- though as far as I can tell,
   this does not ever actually affect the result of overload resolution, and
 - we misapplied the special-case rules for constructors taking a parameter
   whose type is a (reference to) the same class type by incorrectly assuming
   that only happens for copy/move constructors (it also happens for
   constructors instantiated from templates and those inherited from base
   classes).

These changes should only affect strange corner cases (for instance, where the
copy constructor exists but has a non-const-qualified parameter type), so for
the most part it only causes us to produce more 'candidate' notes, but see the
test changes for other cases whose behavior is affected.

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

7 years ago[scan-build-py] Increase precision of timestamp in report directory name
Devin Coughlin [Tue, 6 Sep 2016 23:42:51 +0000 (23:42 +0000)]
[scan-build-py] Increase precision of timestamp in report directory name

This commit improves compatibility with the perl version of scan-build.

The perl version of scan-build produces output report directories with
increasing lexicographic ordering. This ordering is relied on by the CmpRuns.py
tool in utils/analyzer when comparing results for build commands with multiple
steps. That tool tries to line up the output directory for each step between
different runs of the analyzer based on the increasing directory name.

The python version of scan-build uses file.mkdtemp() with a time stamp
prefix to create report directories. The timestamp has a 1-second precision.
This means that when analysis of a single build step takes less than a second
the ordering property that CmpRuns.py expects will sometimes not hold,
depending on the timing and the random suffix generated by mkdtemp(). Ultimately
this causes CmpRuns to incorrectly correlate results from build steps and report
spurious differences between runs.

This commit increases the precision of the timestamp used in scan-build-py to
the microsecond level. This approach still has the same underlying issue -- but
in practice analysis of any build step is unlikely to take less than a
millisecond.

Differential Revision: https://reviews.llvm.org/D24163

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

7 years agoclang-format: [JS] whitespace required between ! and as.
Martin Probst [Tue, 6 Sep 2016 18:55:34 +0000 (18:55 +0000)]
clang-format: [JS] whitespace required between ! and as.

Summary:
Before:
    x!as string
After:
    x! as string

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D24272

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

7 years agoclang-format: [JS] ignore comments when wrapping returns.
Martin Probst [Tue, 6 Sep 2016 18:39:30 +0000 (18:39 +0000)]
clang-format: [JS] ignore comments when wrapping returns.

Summary:
When code contains a comment between `return` and the value:

    return /* lengthy comment here */ (
        lengthyValueComesHere);

Do not wrap before the comment, as that'd break the code through JS' automatic
semicolon insertion.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D24257

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

7 years agoModules: Fix an assertion in DeclContext::buildLookup.
Manman Ren [Tue, 6 Sep 2016 18:16:54 +0000 (18:16 +0000)]
Modules: Fix an assertion in DeclContext::buildLookup.

When calling getMostRecentDecl, we can pull in more definitions from
a module. We call getPrimaryContext afterwards to make sure that
we buildLookup on a primary context.

rdar://27926200

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

7 years agoFormatting with clang-format patch r280701
Leny Kholodov [Tue, 6 Sep 2016 17:06:14 +0000 (17:06 +0000)]
Formatting with clang-format patch r280701

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

7 years ago[clang-cl] Check that we are in clang cl mode before enabling support for the CL...
Pierre Gousseau [Tue, 6 Sep 2016 10:48:27 +0000 (10:48 +0000)]
[clang-cl] Check that we are in clang cl mode before enabling support for the CL environment variable.

Checking for the type of the command line tokenizer should not be the criteria to enable support for the CL environment variable, this change checks that we are in clang-cl mode instead.

Differential Revision: https://reviews.llvm.org/D23503

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

7 years agoDebugInfo: use llvm::DINode::DIFlags type for debug info flags
Leny Kholodov [Tue, 6 Sep 2016 10:48:04 +0000 (10:48 +0000)]
DebugInfo: use llvm::DINode::DIFlags type for debug info flags

Use llvm::DINode::DIFlags type (strongly typed enum) for debug flags instead of unsigned int to avoid problems on platforms with sizeof(int) < 4: we already have flags with values > (1 << 16).

Patch by: Victor Leschuk <vleschuk@gmail.com>

Differential Revision: https://reviews.llvm.org/D23767

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

7 years ago[OpenCL] Remove access qualifiers on images in arg info metadata.
Alexey Bader [Tue, 6 Sep 2016 10:10:28 +0000 (10:10 +0000)]
[OpenCL] Remove access qualifiers on images in arg info metadata.

Summary:
Remove access qualifiers on images in arg info metadata:
 * kernel_arg_type
 * kernel_arg_base_type

Image access qualifiers are inseparable from type in clang implementation,
but OpenCL spec provides a special query to get access qualifier
via clGetKernelArgInfo with CL_KERNEL_ARG_ACCESS_QUALIFIER.

Besides that OpenCL conformance test_api get_kernel_arg_info expects
image types without access qualifier.

Patch by Evgeniy Tyurin.

Reviewers: bader, yaxunl, Anastasia

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D23915

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

7 years agoAdd support for targeting armv6-unknown-cloudabi-eabihf.
Ed Schouten [Mon, 5 Sep 2016 18:38:34 +0000 (18:38 +0000)]
Add support for targeting armv6-unknown-cloudabi-eabihf.

I'm in the progress of adding ARMv6 support to CloudABI. On the compiler
side, everything seems to work properly with this tiny change applied.

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

7 years agoclang/test/Modules/compiler_builtins_x86.c: Fix r280658.
NAKAMURA Takumi [Mon, 5 Sep 2016 13:14:54 +0000 (13:14 +0000)]
clang/test/Modules/compiler_builtins_x86.c: Fix r280658.

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

7 years agoAttempt to fix buildbots not targetting x86
James Molloy [Mon, 5 Sep 2016 12:28:49 +0000 (12:28 +0000)]
Attempt to fix buildbots not targetting x86

r280613 introduced failures for all builds that don't target x86 by default. Add an explicit target to avoid a missing feature diagnostic.

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

7 years ago[AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div builtins...
Craig Topper [Sun, 4 Sep 2016 18:30:17 +0000 (18:30 +0000)]
[AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div builtins and replace with native operations.

We can't do the 512-bit ones because they take a rounding mode argument that we can't represent.

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

7 years agoTest case for r280607 to check presence and sanity of the *_LOCK_FREE
Joerg Sonnenberger [Sun, 4 Sep 2016 11:21:27 +0000 (11:21 +0000)]
Test case for r280607 to check presence and sanity of the *_LOCK_FREE
macros.

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

7 years ago[Modules] Add 'freestanding' to the 'requires-declaration' feature-list.
Elad Cohen [Sun, 4 Sep 2016 06:00:42 +0000 (06:00 +0000)]
[Modules] Add 'freestanding' to the 'requires-declaration' feature-list.

This adds support for modules that require (non-)freestanding
environment, such as the compiler builtin mm_malloc submodule.

Differential Revision: https://reviews.llvm.org/D23871

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

7 years agoTrailing dot that shouldn't have been committed.
Joerg Sonnenberger [Sun, 4 Sep 2016 00:51:02 +0000 (00:51 +0000)]
Trailing dot that shouldn't have been committed.

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

7 years agoPR 27200: Fix names of the atomic lock-free macros.
Joerg Sonnenberger [Sun, 4 Sep 2016 00:44:10 +0000 (00:44 +0000)]
PR 27200: Fix names of the atomic lock-free macros.

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

7 years ago[AVX-512] Remove masked integer mullo builtins and replace with native IR.
Craig Topper [Sat, 3 Sep 2016 19:19:49 +0000 (19:19 +0000)]
[AVX-512] Remove masked integer mullo builtins and replace with native IR.

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

7 years ago[AVX-512] Remove masked integer add/sub builtins and replace with native IR.
Craig Topper [Sat, 3 Sep 2016 18:29:35 +0000 (18:29 +0000)]
[AVX-512] Remove masked integer add/sub builtins and replace with native IR.

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

7 years agoFix the attribute documentation build.
Aaron Ballman [Sat, 3 Sep 2016 15:36:52 +0000 (15:36 +0000)]
Fix the attribute documentation build.

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

7 years agoReplace the Radeon GCN GPU family names by more descriptive ones
Niels Ole Salscheider [Sat, 3 Sep 2016 07:13:54 +0000 (07:13 +0000)]
Replace the Radeon GCN GPU family names by more descriptive ones

Differential Revision: https://reviews.llvm.org/D23957

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

7 years agoAdd a test Aaron asked for that I forgot to add before landing r280578.
Nico Weber [Sat, 3 Sep 2016 04:27:14 +0000 (04:27 +0000)]
Add a test Aaron asked for that I forgot to add before landing r280578.

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

7 years ago[ms] Add support for parsing uuid as a Microsoft attribute.
Nico Weber [Sat, 3 Sep 2016 03:25:22 +0000 (03:25 +0000)]
[ms] Add support for parsing uuid as a Microsoft attribute.

Some Windows SDK classes, for example
Windows::Storage::Streams::IBufferByteAccess, use the ATL way of spelling
attributes:

  [uuid("....")] class IBufferByteAccess {};

To be able to use __uuidof() to grab the uuid off these types, clang needs to
support uuid as a Microsoft attribute. There was already code to skip Microsoft
attributes, extend that to look for uuid and parse it.  Use the new "Microsoft"
attribute type added in r280575 (and r280574, r280576) for this.

Final part of https://reviews.llvm.org/D23895

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

7 years agoLet Microsoft attributes apply to the type, not the variable.
Nico Weber [Sat, 3 Sep 2016 03:01:32 +0000 (03:01 +0000)]
Let Microsoft attributes apply to the type, not the variable.

There was already a function that moved attributes off the declspec into
an attribute list for attributes applying to the type, teach that function to
also move Microsoft attributes around and rename it to match its new broader
role.

Nothing uses Microsoft attributes yet, so no behavior change.

Part of https://reviews.llvm.org/D23895

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

7 years agoAdd plumbing for new attribute type "Microsoft".
Nico Weber [Sat, 3 Sep 2016 02:55:10 +0000 (02:55 +0000)]
Add plumbing for new attribute type "Microsoft".

This is for attributes in []-delimited lists preceding a class, like e.g.
`[uuid("...")] class Foo {};`  Not used by anything yet, so no behavior change.
Part of https://reviews.llvm.org/D23895

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

7 years agoMove calls of MaybeParseMicrosoftAttributes() before ParseExternalDeclaration()
Nico Weber [Sat, 3 Sep 2016 02:48:03 +0000 (02:48 +0000)]
Move calls of MaybeParseMicrosoftAttributes() before ParseExternalDeclaration()
into ParseDeclOrFunctionDefInternal() (which is called by
MaybeParseMicrosoftAttributes()), so that the attributes can be stored in
the DeclSpec.  No behavior change yet, part of https://reviews.llvm.org/D23895

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

7 years agoRemove function name from comment.
Nico Weber [Sat, 3 Sep 2016 02:41:17 +0000 (02:41 +0000)]
Remove function name from comment.

The comment starting with "ParseDeclarationOrFunctionDefinition -" is above
a function called ParseDeclOrFunctionDefInternal.  Fix the comment by not
mentioning a function name, like the style guide requests nowadays.  No behavior
change.

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

7 years ago[Sema] Fix how we set implicit conversion kinds.
George Burgess IV [Sat, 3 Sep 2016 00:28:25 +0000 (00:28 +0000)]
[Sema] Fix how we set implicit conversion kinds.

We have invariants we like to guarantee for the
`ImplicitConversionKind`s in a `StandardConversionSequence`. These
weren't being upheld in code that r280553 touched, so Richard suggested
that we should fix that. See D24113.

I'm not entirely sure how to go about testing this, so no test case is
included. Suggestions welcome.

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

7 years ago(clang part) Implement MASM-flavor intel syntax behavior for inline MS asm block.
Yunzhong Gao [Fri, 2 Sep 2016 23:16:06 +0000 (23:16 +0000)]
(clang part) Implement MASM-flavor intel syntax behavior for inline MS asm block.
Clang tests for verifying the following syntaxes:
1. 0xNN and NNh are accepted as valid hexadecimal numbers, but 0xNNh is not.
   0xNN and NNh may come with optional U or L suffix.
2. NNb is accepted as a valid binary (base-2) number, but 0bNN is not.
   NNb may come with optional U or L suffix.

Differential Revision: https://reviews.llvm.org/D22112

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

7 years ago[Sema] Relax overloading restrictions in C.
George Burgess IV [Fri, 2 Sep 2016 22:59:57 +0000 (22:59 +0000)]
[Sema] Relax overloading restrictions in C.

This patch allows us to perform incompatible pointer conversions when
resolving overloads in C. So, the following code will no longer fail to
compile (though it will still emit warnings, assuming the user hasn't
opted out of them):

```
void foo(char *) __attribute__((overloadable));
void foo(int) __attribute__((overloadable));

void callFoo() {
  unsigned char bar[128];
  foo(bar); // selects the char* overload.
}
```

These conversions are ranked below all others, so:

  A. Any other viable conversion will win out
  B. If we had another incompatible pointer conversion in the example
     above (e.g. `void foo(int *)`), we would complain about
     an ambiguity.

Differential Revision: https://reviews.llvm.org/D24113

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

7 years agoImplement __attribute__((require_constant_initialization)) for safe static initializa...
Eric Fiselier [Fri, 2 Sep 2016 18:53:31 +0000 (18:53 +0000)]
Implement __attribute__((require_constant_initialization)) for safe static initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

Differential Revision: https://reviews.llvm.org/D23385

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

7 years agoRevert r280516 since it contained accidental changes.
Eric Fiselier [Fri, 2 Sep 2016 18:43:25 +0000 (18:43 +0000)]
Revert r280516 since it contained accidental changes.

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

7 years agoBased on post-commit feedback over IRC with dblaikie, ideally, we should have a Small...
Aaron Ballman [Fri, 2 Sep 2016 18:31:31 +0000 (18:31 +0000)]
Based on post-commit feedback over IRC with dblaikie, ideally, we should have a SmallVector constructor that accepts anything which can supply a range via ADL begin()/end() calls so that we can construct the SmallVector directly from anything range-like.

Since that doesn't exist right now, use a local variable instead of calling getAssocExprs() twice; NFC.

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

7 years agoImplement __attribute__((require_constant_initialization)) for safe static initializa...
Eric Fiselier [Fri, 2 Sep 2016 18:25:29 +0000 (18:25 +0000)]
Implement __attribute__((require_constant_initialization)) for safe static initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

Differential Revision: https://reviews.llvm.org/D23385

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

7 years agoclang-format: [JS] merge requoting replacements.
Martin Probst [Fri, 2 Sep 2016 14:29:48 +0000 (14:29 +0000)]
clang-format: [JS] merge requoting replacements.

Summary:
When formatting source code that needs both requoting and reindentation,
merge the replacements to avoid erroring out for conflicting replacements.

Also removes the misleading Replacements parameter from the
TokenAnalyzer API.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D24155

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

7 years agoclang-format: [JS] handle default bindings in imports.
Martin Probst [Fri, 2 Sep 2016 14:06:32 +0000 (14:06 +0000)]
clang-format: [JS] handle default bindings in imports.

Summary:
Default imports appear outside of named bindings in curly braces:

  import A from 'a';
  import A, {symbol} from 'a';

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D23973

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

7 years agoclang-format: [JS] Sort all JavaScript imports if any changed.
Martin Probst [Fri, 2 Sep 2016 14:01:17 +0000 (14:01 +0000)]
clang-format: [JS] Sort all JavaScript imports if any changed.

Summary:
User feedback is that they expect *all* imports to be sorted if any import was
affected by a change, not just imports up to the first non-affected line, as
clang-format currently does.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D23972

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

7 years agoAllow a C11 generic selection expression to select a function with the overloadable...
Aaron Ballman [Fri, 2 Sep 2016 13:45:40 +0000 (13:45 +0000)]
Allow a C11 generic selection expression to select a function with the overloadable attribute as the result expression without crashing. This fixes PR30201.

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

7 years agoClean up handling of reading module files from stdin. Don't bother trying to
Richard Smith [Fri, 2 Sep 2016 00:18:05 +0000 (00:18 +0000)]
Clean up handling of reading module files from stdin. Don't bother trying to
look for a corresponding file, since we're not going to read it anyway.

No observable behavior change (though we now avoid pointlessly trying to stat
or open a file named "-").

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

7 years agoRefactor to avoid holding a reference to a container element that could go away
Richard Smith [Fri, 2 Sep 2016 00:10:28 +0000 (00:10 +0000)]
Refactor to avoid holding a reference to a container element that could go away
during this function, and to avoid rolling back changes to the module manager's
data structures. Instead, we defer registering the module file until after we
have successfully finished loading it.

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

7 years agoRemove excessive padding from MismatchingNewDeleteDetector
Alexander Shaposhnikov [Thu, 1 Sep 2016 23:18:00 +0000 (23:18 +0000)]
Remove excessive padding from MismatchingNewDeleteDetector

The class MismatchingNewDeleteDetector is in
lib/Sema/SemaExprCXX.cpp inside the anonymous namespace.
This diff reorders the fields and removes the excessive padding.
Test plan: make -j8 check-clang

Differential revision: https://reviews.llvm.org/D23898

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

7 years ago[WebAssembly] Change wasm SizeType to match asmjs
Derek Schuff [Thu, 1 Sep 2016 22:38:37 +0000 (22:38 +0000)]
[WebAssembly] Change wasm SizeType to match asmjs

Summary:
We want wasm and asmjs to have matching ABIs, and right now asmjs uses
unsigned int for its size_t. This causes exported symbols in libcxx to
not match and can cause weird breakage where libcxx doesn't get linked
as a result.  Long-term we probably want wasm32, wasm64, and asmjs to
all use unsigned long, but that would cause unnecessary ABI churn for
asmjs so defer that until we can make all the ABI changes at once.

Patch by Jacob Gravelle

Differential Revision: https://reviews.llvm.org/D24134

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

7 years agoWhen we reach the end of a #include of a header of a local submodule that we
Richard Smith [Thu, 1 Sep 2016 20:15:25 +0000 (20:15 +0000)]
When we reach the end of a #include of a header of a local submodule that we
textually included, create an ImportDecl just as we would if we reached a
#include of any other modular header. This is necessary in order to correctly
determine the set of variables to initialize for an imported module.

This should hopefully make the modules selfhost buildbot green again.

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

7 years ago[CMake] Properly connecting Compiler-RT check and test-depends
Chris Bieneman [Thu, 1 Sep 2016 18:28:49 +0000 (18:28 +0000)]
[CMake] Properly connecting Compiler-RT check and test-depends

This correctly connects compiler-rt-test-depends to test-depends and
check-compiler-rt to check-all.

Based on LLVM r280392, and Compiler-RT r280393.

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

7 years ago[analyzer] ExprEngine: remove second call to PreStmt<CastExpr>
Aleksei Sidorin [Thu, 1 Sep 2016 13:55:38 +0000 (13:55 +0000)]
[analyzer] ExprEngine: remove second call to PreStmt<CastExpr>

This patch also introduces AnalysisOrderChecker which is intended for testing
of callback call correctness.

Differential Revision: https://reviews.llvm.org/D23804

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

7 years ago[analyzer] Add more FileIDs to PlistDiagnostic map to avoid assertion
Aleksei Sidorin [Thu, 1 Sep 2016 12:25:16 +0000 (12:25 +0000)]
[analyzer] Add more FileIDs to PlistDiagnostic map to avoid assertion

Some FileIDs that may be used by PlistDiagnostics were not added while building
a list of pieces. This caused assertion violation in GetFID() function.
This patch adds some missing FileIDs to avoid the assertion. It also contains
small refactoring of PlistDiagnostics::FlushDiagnosticsImpl().

Patch by Aleksei Sidorin, Ilya Palachev.

Differential Revision: https://reviews.llvm.org/D22090

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

7 years ago[Frontend] Fix mcount inlining bug
Honggyu Kim [Thu, 1 Sep 2016 11:29:21 +0000 (11:29 +0000)]
[Frontend] Fix mcount inlining bug

Since some profiling tools, such as gprof, ftrace, and uftrace, use
-pg option to generate a mcount function call at the entry of each
function. Function invocation can be detected by this hook function.

But mcount insertion is done before function inlining phase in clang,
sometime a function that already has a mcount call can be inlined in the
middle of another function.

This patch adds an attribute "counting-function" to each function
rather than emitting the mcount call directly in frontend so that this
attribute can be processed in backend. Then the mcount calls can be
properly inserted in backend after all the other optimizations are
completed.

Link: https://llvm.org/bugs/show_bug.cgi?id=28660
Reviewers: hans, rjmccall, hfinkel, rengolin, compnerd

Subscribers: shenhan, cfe-commits

Differential Revision: https://reviews.llvm.org/D22666

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

7 years ago[analyzer][test commit] ExprEngine.cpp: Remove training whitespace; NFC
Aleksei Sidorin [Thu, 1 Sep 2016 11:11:46 +0000 (11:11 +0000)]
[analyzer][test commit] ExprEngine.cpp: Remove training whitespace; NFC

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

7 years agoRemove whitespace to test commit access
Honggyu Kim [Thu, 1 Sep 2016 06:14:45 +0000 (06:14 +0000)]
Remove whitespace to test commit access

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

7 years agoFix typos in comments.
George Burgess IV [Thu, 1 Sep 2016 01:26:58 +0000 (01:26 +0000)]
Fix typos in comments.

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

7 years ago[Sema] Don't diagnose an array type mismatch when the new or previous
Akira Hatanaka [Thu, 1 Sep 2016 01:03:21 +0000 (01:03 +0000)]
[Sema] Don't diagnose an array type mismatch when the new or previous
declaration has a dependent type.

This fixes a bug where clang errors out on a valid code.

rdar://problem/28051467

Differential Revision: https://reviews.llvm.org/D24110

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

7 years agoFix all tests under test/CXX (and test/Analysis) to pass if clang's default
Richard Smith [Wed, 31 Aug 2016 23:24:08 +0000 (23:24 +0000)]
Fix all tests under test/CXX (and test/Analysis) to pass if clang's default
C++ language standard is not C++98.

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

7 years agoDR259: Demote the pedantic error for an explicit instantiation after an
Richard Smith [Wed, 31 Aug 2016 23:23:25 +0000 (23:23 +0000)]
DR259: Demote the pedantic error for an explicit instantiation after an
explicit specialization to a warning for C++98 mode (this is a defect report
resolution, so per our informal policy it should apply in C++98), and turn
the warning on by default for C++11 and later. In all cases where it fires, the
right thing to do is to remove the pointless explicit instantiation.

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

7 years agoAdd -fprofile-dir= to clang.
Nick Lewycky [Wed, 31 Aug 2016 23:04:32 +0000 (23:04 +0000)]
Add -fprofile-dir= to clang.

-fprofile-dir=path allows the user to specify where .gcda files should be
emitted when the program is run. In particular, this is the first flag that
causes the .gcno and .o files to have different paths, LLVM is extended to
support this. -fprofile-dir= does not change the file name in the .gcno (and
thus where lcov looks for the source) but it does change the name in the .gcda
(and thus where the runtime library writes the .gcda file). It's different from
a GCOV_PREFIX because a user can observe that the GCOV_PREFIX_STRIP will strip
paths off of -fprofile-dir= but not off of a supplied GCOV_PREFIX.

To implement this we split -coverage-file into -coverage-data-file and
-coverage-notes-file to specify the two different names. The !llvm.gcov
metadata node grows from a 2-element form {string coverage-file, node dbg.cu}
to 3-elements, {string coverage-notes-file, string coverage-data-file, node
dbg.cu}. In the 3-element form, the file name is already "mangled" with
.gcno/.gcda suffixes, while the 2-element form left that to the middle end
pass.

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

7 years agoDebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining
David Blaikie [Wed, 31 Aug 2016 20:54:35 +0000 (20:54 +0000)]
DebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining

I tested the cases involving split-dwarf + gmlt +
no-split-dwarf-inlining, but didn't verify the simpler case without
gmlt.

The logic is, admittedly, a little hairy, but seems about as simple as I
could wrangle it.

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

7 years agoDon't diagnoes a mismatch between implicit and explicit exception
Richard Smith [Wed, 31 Aug 2016 20:38:32 +0000 (20:38 +0000)]
Don't diagnoes a mismatch between implicit and explicit exception
specifications under -fno-exceptions, just as we don't diagnose other exception
specification mismatch errors.

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

7 years agoFix mishandling of deletedness for assignment operators of classes with
Richard Smith [Wed, 31 Aug 2016 20:37:39 +0000 (20:37 +0000)]
Fix mishandling of deletedness for assignment operators of classes with
indirect virtual bases. We don't need to be able to invoke such an assignment
operator from the derived class, and we shouldn't delete the derived assignment
op if we can't do so.

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

7 years ago[codeview] Don't emit vshape info for classes without vfptrs
Reid Kleckner [Wed, 31 Aug 2016 20:35:01 +0000 (20:35 +0000)]
[codeview] Don't emit vshape info for classes without vfptrs

Classes with no virtual methods or whose virtual methods were all
inherited from virtual bases don't have a vfptr at offset zero. We were
crashing attempting to get the layout of that non-existent vftable.

We don't need any vshape info in this case because the debugger can
infer it from the base class information. The current class may not
introduce any virtual methods if we are in this situation.

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

7 years agoRevert "Driver: use the canonical static library naming"
Saleem Abdulrasool [Wed, 31 Aug 2016 19:27:07 +0000 (19:27 +0000)]
Revert "Driver: use the canonical static library naming"

This breaks chromium and its unclear if this is actually a modern convention.

This reverts SVN r280169.

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

7 years agoFix a typo in a comment.
George Burgess IV [Wed, 31 Aug 2016 18:14:15 +0000 (18:14 +0000)]
Fix a typo in a comment.

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

7 years agos/static inline/static/ for headers I have changed in r279475. NFC.
Tim Shen [Wed, 31 Aug 2016 16:48:13 +0000 (16:48 +0000)]
s/static inline/static/ for headers I have changed in r279475. NFC.

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

7 years ago[codeview] Pass through vftable shape information
Reid Kleckner [Wed, 31 Aug 2016 16:11:43 +0000 (16:11 +0000)]
[codeview] Pass through vftable shape information

The shape is really just the number of methods in the vftable, since we
don't support 16 bit far calls. All calls are near. Encode this number
in the size of the artificial __vtbl_ptr_type DIDerivedType that we
generate. For DWARF, this will be a normal pointer, but for codeview
this will be a wide pointer that gets pattern matched into a
VFTableShape record. Insert this type into the element list of all
dynamic classes when emitting CodeView, so that the backend can emit the
shape even if the vptr lives in a primary base class.

Fixes PR28150

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

7 years agoclang-format: Set default WebKit style to use C++11.
Daniel Jasper [Wed, 31 Aug 2016 14:05:56 +0000 (14:05 +0000)]
clang-format: Set default WebKit style to use C++11.

The WebKit style page says to use nullptr, so this should be fine:
https://webkit.org/code-style-guidelines/

This fixes: llvm.org/PR30220

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

7 years ago[clang-format-vim] Support vim linked against py3
Luke Drummond [Wed, 31 Aug 2016 13:36:36 +0000 (13:36 +0000)]
[clang-format-vim] Support vim linked against py3

clang-format.py previously only worked in vim compiled against python2.

This patch adds the necessary syntax changes to make this work with vim
linked against python3, which is now shipped by default for at least Ubuntu16 and Arch.

Differential Revision: https://reviews.llvm.org/D23319

Subscribers: cfe-commits

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

7 years agoRevision r280064 adds new options -fdenormal-fp-math and passes through option
Sjoerd Meijer [Wed, 31 Aug 2016 12:31:03 +0000 (12:31 +0000)]
Revision r280064 adds new options -fdenormal-fp-math and passes through option
-ffast-math to CC1, but it included a wrong llvm regression tests which was
removed in r280065.  Although regression test noexceptionsfpmath.c makes sure
-fno-trapping-math ends up as a function attribute, this adds a test that
explicitly checks the driver output for -fno-trapping-math.

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

7 years agoAttempt to pacify buildbots after r280217
James Molloy [Wed, 31 Aug 2016 11:01:41 +0000 (11:01 +0000)]
Attempt to pacify buildbots after r280217

These clang tests check diagnostics from the backend by giving it an unvectorizable loop. This loop is now vectorized :/

Make it really unvectorizable by making it unprofitable to ifconvert.

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

7 years ago[Coverage] Suppress creating a code region if the same area is covered by an expansio...
Igor Kudrin [Wed, 31 Aug 2016 07:04:16 +0000 (07:04 +0000)]
[Coverage] Suppress creating a code region if the same area is covered by an expansion region.

In most cases these code regions are just redundant, but sometimes they
could be assigned to the counter of the parent code region instead of
the counter of the nested block.

Differential Revision: https://reviews.llvm.org/D23987

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

7 years ago[AVX-512] Implement masked floating point logical operations with native IR and remov...
Craig Topper [Wed, 31 Aug 2016 05:38:58 +0000 (05:38 +0000)]
[AVX-512] Implement masked floating point logical operations with native IR and remove the builtins.

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

7 years ago[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.
Craig Topper [Wed, 31 Aug 2016 05:38:55 +0000 (05:38 +0000)]
[X86] Use v2i64 vectors to implement _mm_and/andn/or/xor_pd.

These will be reused when removing some builtins from avx512vldqintrin.h and this will make the tests for that change show a better number of vector elements.

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

7 years agoPR12298 et al: don't recursively instantiate a template specialization from
Richard Smith [Wed, 31 Aug 2016 02:15:21 +0000 (02:15 +0000)]
PR12298 et al: don't recursively instantiate a template specialization from
within the instantiation of that same specialization. This could previously
happen for eagerly-instantiated function templates, variable templates,
exception specifications, default arguments, and a handful of other cases.

We still have an issue here for default template arguments that recursively
make use of themselves and likewise for substitution into the type of a
non-type template parameter, but in those cases we're producing a different
entity each time, so they should instead be caught by the instantiation depth
limit. However, currently we will typically run out of stack before we reach
it. :(

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

7 years agoConcatenate two FileCheck lines in a test.
Richard Trieu [Wed, 31 Aug 2016 01:57:12 +0000 (01:57 +0000)]
Concatenate two FileCheck lines in a test.

'cc1' is a valid sequence of hexadecimal and sometimes can occur in the path
when testing.  This can lead to FileCheck matching the incorrect occurance
of the 'cc1' string and causing a test failure.  Join two adjacent flags
together into one check to prevent this.

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

7 years agoclangTooling: Update libdeps: LLVMOptions, since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:32 +0000 (00:46 +0000)]
clangTooling: Update libdeps: LLVMOptions, since r280118.

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

7 years agoclangTooling depends on ClangDriverOptions since r280118.
NAKAMURA Takumi [Wed, 31 Aug 2016 00:46:25 +0000 (00:46 +0000)]
clangTooling depends on ClangDriverOptions since r280118.

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

7 years agoDon't try to run a test that generates code for x86 if it's not a registered target.
Richard Smith [Tue, 30 Aug 2016 23:53:34 +0000 (23:53 +0000)]
Don't try to run a test that generates code for x86 if it's not a registered target.

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

7 years ago[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker
Devin Coughlin [Tue, 30 Aug 2016 23:07:14 +0000 (23:07 +0000)]
[analyzer] Use lazily created buffer in EmptyLocalizationContextChecker

Fix a crash when relexing the underlying memory buffer to find incorrect
arguments to NSLocalizedString(). With precompiled headers, the raw
buffer may be NULL. Instead, use the source manager to get the buffer,
which will lazily create the buffer for precompiled headers.

rdar://problem/27429091

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

7 years agoDriver: use the canonical static library naming
Saleem Abdulrasool [Tue, 30 Aug 2016 22:10:27 +0000 (22:10 +0000)]
Driver: use the canonical static library naming

On Windows, static libraries are named lib<name>.lib while import libraries are
named <name>.lib.  Use the appropriate naming on itanium and msvc environments.
This is setup properly so that if a dynamic builtins is used on Windows, it
would do the right thing, although this is not currently wired through the
driver (i.e. there is no equivalent to -{shared,static}-gcc).

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

7 years agoclang-format: Correctly calculate affected ranges when sorting #includes.
Daniel Jasper [Tue, 30 Aug 2016 21:33:41 +0000 (21:33 +0000)]
clang-format: Correctly calculate affected ranges when sorting #includes.

affectedRanges takes a start and an end offset, not offset and length.

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

7 years ago[Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.
Bruno Cardoso Lopes [Tue, 30 Aug 2016 21:25:42 +0000 (21:25 +0000)]
[Modules] Add 'gnuinlineasm' to the 'requires-declaration' feature-list.

This adds support for modules that require (no-)gnu-inline-asm
environment, such as the compiler builtin cpuid submodule.

This is the gnu-inline-asm variant of https://reviews.llvm.org/D23871

Differential Revision: https://reviews.llvm.org/D23905

rdar://problem/26931199

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

7 years agoFix memory leak by storing returned pointer in std::unique_ptr
Richard Trieu [Tue, 30 Aug 2016 21:12:48 +0000 (21:12 +0000)]
Fix memory leak by storing returned pointer in std::unique_ptr

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

7 years ago[test] Pass a fake libLTO.dylib to a driver test which depends on it
Vedant Kumar [Tue, 30 Aug 2016 20:36:50 +0000 (20:36 +0000)]
[test] Pass a fake libLTO.dylib to a driver test which depends on it

This makes it possible to run 'check-clang' on Darwin without building
libLTO.dylib. See r280142 for more context.

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

7 years agoRevert "[test] Add libLTO as a clang test dependency on Darwin"
Vedant Kumar [Tue, 30 Aug 2016 20:36:48 +0000 (20:36 +0000)]
Revert "[test] Add libLTO as a clang test dependency on Darwin"

This reverts commit r280142. Mehdi suggested a better way to fix up the
test: just create a fake libLTO.dylib and tell the driver where to find
it. Patch incoming...

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

7 years ago[test] Add libLTO as a clang test dependency on Darwin
Vedant Kumar [Tue, 30 Aug 2016 19:57:40 +0000 (19:57 +0000)]
[test] Add libLTO as a clang test dependency on Darwin

Running 'check-clang' on a stock checkout of llvm+clang doesn't work on
Darwin, because test/Driver/darwin-ld-lto.c can't find libLTO.dylib. Add
libLTO as a clang test dependency on Darwin to fix the problem.

Note: We don't have this issue with check-all because libLTO is in the
test-depends target.

Differential Revision: https://reviews.llvm.org/D24042

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

7 years agoPR29166: when merging declarations with typedef names for linkage purposes,
Richard Smith [Tue, 30 Aug 2016 19:13:18 +0000 (19:13 +0000)]
PR29166: when merging declarations with typedef names for linkage purposes,
don't assume that the anonymous struct will be part of the most recent
declaration of the typedef.

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

7 years agoUnrevert r280035 now that the clang-cl bug it exposed has been fixed by
Richard Smith [Tue, 30 Aug 2016 19:06:26 +0000 (19:06 +0000)]
Unrevert r280035 now that the clang-cl bug it exposed has been fixed by
r280133. Original commit message:

C++ Modules TS: driver support for building modules.

This works as follows: we add --precompile to the existing gamut of options for
specifying how far to go when compiling an input (-E, -c, -S, etc.). This flag
specifies that an input is taken to the precompilation step and no further, and
this can be specified when building a .pcm from a module interface or when
building a .pch from a header file.

The .cppm extension (and some related extensions) are implicitly recognized as
C++ module interface files. If --precompile is /not/ specified, the file is
compiled (via a .pcm) to a .o file containing the code for the module (and then
potentially also assembled and linked, if -S, -c, etc. are not specified). We
do not yet suppress the emission of object code for other users of the module
interface, so for now this will only work if everything in the .cppm file has
vague linkage.

As with the existing support for module-map modules, prebuilt modules can be
provided as compiler inputs either via the -fmodule-file= command-line argument
or via files named ModuleName.pcm in one of the directories specified via
-fprebuilt-module-path=.

This also exposes the -fmodules-ts cc1 flag in the driver. This is still
experimental, and in particular, the concrete syntax is subject to change as
the Modules TS evolves in the C++ committee. Unlike -fmodules, this flag does
not enable support for implicitly loading module maps nor building modules via
the module cache, but those features can be turned on separately and used in
conjunction with the Modules TS support.

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

7 years agoPR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.
Richard Smith [Tue, 30 Aug 2016 18:55:16 +0000 (18:55 +0000)]
PR30195: Fix clang-cl attempting to precompile bogus (non-precompilable) input types.

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

7 years agotypo + indentation [NFC]
Etienne Bergeron [Tue, 30 Aug 2016 18:38:25 +0000 (18:38 +0000)]
typo + indentation [NFC]

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

7 years agoBasic/Targets.cpp: Add polaris10 and polaris11 gpus
Niels Ole Salscheider [Tue, 30 Aug 2016 18:00:22 +0000 (18:00 +0000)]
Basic/Targets.cpp: Add polaris10 and polaris11 gpus

Differential Revision: https://reviews.llvm.org/D23746

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

7 years agoFix colored diagnostics from tools
Olivier Goffart [Tue, 30 Aug 2016 17:42:29 +0000 (17:42 +0000)]
Fix colored diagnostics from tools

r271042 changed the way the diagnostic arguments are parsed. It assumes that
the diagnostics options were already parsed by the "Driver".
For tools using clang::Tooling, the diagnostics argument were not parsed.

Differential Revision: https://reviews.llvm.org/D23837

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

7 years agoDisable clang/test/SemaTemplate/instantiation-depth-default.cpp temporarily for targe...
NAKAMURA Takumi [Tue, 30 Aug 2016 15:38:18 +0000 (15:38 +0000)]
Disable clang/test/SemaTemplate/instantiation-depth-default.cpp temporarily for targeting mingw32. It crashes. Investigating.

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

7 years ago[OpenCL] Make is_valid_event, create_user_event overloadable.
Alexey Bader [Tue, 30 Aug 2016 14:42:54 +0000 (14:42 +0000)]
[OpenCL] Make is_valid_event, create_user_event overloadable.

Summary: Make is_valid_event and create_user_event overloadable like other built-ins.

Patch by Evgeniy Tyurin.

Reviewers: bader, yaxunl

Subscribers: Anastasia, cfe-commits

Differential Revision: https://reviews.llvm.org/D23914

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