]> granicus.if.org Git - clang/log
clang
7 years ago[OPENMP] Fix for PR31417: assert failure when compiling trivial openmp
Alexey Bataev [Thu, 22 Dec 2016 19:44:05 +0000 (19:44 +0000)]
[OPENMP] Fix for PR31417: assert failure when compiling trivial openmp
program

Offload related code is not quite ready yet, but some simple examples
must not crash the compiler. Patch fixes the problem in offloading code
with exceptions.

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

7 years agoFix warning introduced by r290297.
George Burgess IV [Thu, 22 Dec 2016 19:00:31 +0000 (19:00 +0000)]
Fix warning introduced by r290297.

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

7 years agoMake alloc_size only applicable to Functions.
George Burgess IV [Thu, 22 Dec 2016 18:48:34 +0000 (18:48 +0000)]
Make alloc_size only applicable to Functions.

I don't remember why I didn't make alloc_size only applicable to
Functions a year ago, but I can't see any compelling reason not to do
so now.

Fixes PR31453.

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

7 years ago[analyzer] Update GTestChecker to tighten API detection
Devin Coughlin [Thu, 22 Dec 2016 17:52:57 +0000 (17:52 +0000)]
[analyzer] Update GTestChecker to tighten API detection

Update the GTestChecker to tighten up the API detection and make it
cleaner in response to post-commit feedback. Also add tests for when
temporary destructors are enabled to make sure we get the expected behavior
when inlining constructors for temporaries.

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

7 years ago[analyzer] Improve suppress-on-sink behavior in incomplete analyses.
Artem Dergachev [Thu, 22 Dec 2016 14:48:52 +0000 (14:48 +0000)]
[analyzer] Improve suppress-on-sink behavior in incomplete analyses.

Warnings with suppress-on-sink are discarded during FlushReports when
BugReporter notices that all paths in ExplodedGraph that pass through the
warning eventually run into a sink node.

However, suppress-on-sink fails to filter out false positives when the analysis
terminates too early - by running into analyzer limits, such as block count
limits or graph size limits - and the interruption hits the narrow window
between throwing the leak report and reaching the no-return function call. In
such case the report is there, however suppression-on-sink doesn't work, because
the sink node was never constructed in the incomplete ExplodedGraph.

This patch implements a very partial solution: also suppress reports thrown
against a statement-node that corresponds to a statement that belongs to a
no-return block of the CFG.

rdar://problem/28832541

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

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

7 years agoclang-format: Less eagerly try to keep label-value pairs on a line.
Daniel Jasper [Thu, 22 Dec 2016 12:37:06 +0000 (12:37 +0000)]
clang-format: Less eagerly try to keep label-value pairs on a line.

Before:
  string v =
      StrCat("aaaaaaaaaaaaaaaaaaaaaaaaaaa: ", SomeFunction(aaaaaaaaaaaa,
                                                           aaaaaaaaaaaaaaa),
             bbbbbbbbbbbbbbbbbbbbbbb);

After:
  string v = StrCat("aaaaaaaaaaaaaaaaaaaaaaaaaaa: ",
                    SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaaa),
                    bbbbbbbbbbbbbbbbbbbbbbb);

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

7 years agoSpeculative revert of r290310 to see if that's the change that's making some of
Richard Smith [Thu, 22 Dec 2016 07:24:39 +0000 (07:24 +0000)]
Speculative revert of r290310 to see if that's the change that's making some of
the bots unhappy.

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

7 years ago[CrashReproducer] Add support for merging -ivfsoverlay
Bruno Cardoso Lopes [Thu, 22 Dec 2016 07:06:03 +0000 (07:06 +0000)]
[CrashReproducer] Add support for merging -ivfsoverlay

Merge all VFS mapped files inside -ivfsoverlay inputs into the vfs
overlay provided by the crash reproducer. This is the last missing piece
to allow crash reproducers to fully work with user frameworks; when
combined with headermaps, it allows clang to find additional frameworks.

rdar://problem/27913709

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

7 years agoMake FormatStyle.GetStyleOfFile test work on MSVC
Antonio Maiorano [Thu, 22 Dec 2016 05:10:07 +0000 (05:10 +0000)]
Make FormatStyle.GetStyleOfFile test work on MSVC

Modify getStyle to use vfs::FileSystem::makeAbsolute just like FS.addFile does,
rather than sys::fs::make_absolute. The latter gets the CWD from the platform,
while the former expects it to be set by the client, causing a mismatch when
converting relative paths to absolute.

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

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

7 years agoSema: print qualified name for overload candidates
Saleem Abdulrasool [Thu, 22 Dec 2016 04:26:57 +0000 (04:26 +0000)]
Sema: print qualified name for overload candidates

Print the fully qualified names for the overload candidates.  This makes
it easier to tell what the ambiguity is.  Especially if a template
is instantiated after a using namespace, it will not inherit the
namespace where it was declared.  The specialization will give a message
about a partial order being ambiguous for the same (unqualified) name,
which does not help identify the failure.

Addresses PR31450!

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

7 years agoOnly substitute into type of non-type template parameter once, rather than
Richard Smith [Thu, 22 Dec 2016 03:52:37 +0000 (03:52 +0000)]
Only substitute into type of non-type template parameter once, rather than
twice, in finalization of template argumetn deduction.

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

7 years agoDriver: use the triple to query the arch, not the toolchain
Saleem Abdulrasool [Thu, 22 Dec 2016 03:09:04 +0000 (03:09 +0000)]
Driver: use the triple to query the arch, not the toolchain

Although the result is the same, the intent is much more clear this way:
we care about the architecture we are targeting.  NFC.

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

7 years agoDriver: remove unnecessary parameter
Saleem Abdulrasool [Thu, 22 Dec 2016 03:09:02 +0000 (03:09 +0000)]
Driver: remove unnecessary parameter

We can query the Triple and EffectiveTriple from the ToolChain.  Avoid
passing in the argument and query it in the function.  NFC.

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

7 years agoDriver: rename parameter to reduce confusion
Saleem Abdulrasool [Thu, 22 Dec 2016 03:09:00 +0000 (03:09 +0000)]
Driver: rename parameter to reduce confusion

The parameter to ParsePICOpts passed the effective triple and then used
that in a few places and used the actual triple in others.  This was
slightly confusing.  Rename the parameter to make it more obvious.

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

7 years agoAdd the alloc_size attribute to clang, attempt 2.
George Burgess IV [Thu, 22 Dec 2016 02:50:20 +0000 (02:50 +0000)]
Add the alloc_size attribute to clang, attempt 2.

This is a recommit of r290149, which was reverted in r290169 due to msan
failures. msan was failing because we were calling
`isMostDerivedAnUnsizedArray` on an invalid designator, which caused us
to read uninitialized memory. To fix this, the logic of the caller of
said function was simplified, and we now have a `!Invalid` assert in
`isMostDerivedAnUnsizedArray`, so we can catch this particular bug more
easily in the future.

Fingers crossed that this patch sticks this time. :)

Original commit message:

This patch does three things:
- Gives us the alloc_size attribute in clang, which lets us infer the
  number of bytes handed back to us by malloc/realloc/calloc/any user
  functions that act in a similar manner.
- Teaches our constexpr evaluator that evaluating some `const` variables
  is OK sometimes. This is why we have a change in
  test/SemaCXX/constant-expression-cxx11.cpp and other seemingly
  unrelated tests. Richard Smith okay'ed this idea some time ago in
  person.
- Uniques some Blocks in CodeGen, which was reviewed separately at
  D26410. Lack of uniquing only really shows up as a problem when
  combined with our new eagerness in the face of const.

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

7 years agoPerform type-checking for a converted constant expression in a template
Richard Smith [Wed, 21 Dec 2016 21:42:57 +0000 (21:42 +0000)]
Perform type-checking for a converted constant expression in a template
argument even if the expression is value-dependent (we need to suppress the
final portion of the narrowing check, but the rest of the checking can still be
done eagerly).

This affects template template argument validity and partial ordering under
p0522r0.

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

7 years agoARM: define a macro for the FPv5 FPU in ARM mode.
Tim Northover [Wed, 21 Dec 2016 20:49:43 +0000 (20:49 +0000)]
ARM: define a macro for the FPv5 FPU in ARM mode.

FPv5 is in Cortex-M7 and the 64-bit CPUs when running in 32-bit mode. The name
is from the Cortex-M7 TRM.

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

7 years agoMake some diagnostic tests C++11 clean.
Paul Robinson [Wed, 21 Dec 2016 18:33:17 +0000 (18:33 +0000)]
Make some diagnostic tests C++11 clean.

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

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

7 years agoclang-format: Fix bug in handling of single-column lists.
Daniel Jasper [Wed, 21 Dec 2016 17:02:06 +0000 (17:02 +0000)]
clang-format: Fix bug in handling of single-column lists.

Members that are themselves wrapped in fake parentheses would lead to
AvoidBinPacking be set on the wrong ParenState.

After:
  vector<int> aaaa = {
      aaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaa.aaaaaaa,
      aaaaaa.aaaaaaa,
      aaaaaa.aaaaaaa,
      aaaaaa.aaaaaaa,
  };

Before we were falling back to bin-packing these.

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

7 years agoWdocumentation fix
Simon Pilgrim [Wed, 21 Dec 2016 16:39:09 +0000 (16:39 +0000)]
Wdocumentation fix

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

7 years agoRename several methods on ASTRecordReader to follow LLVM style (lowerCamelCase).
David L. Jones [Wed, 21 Dec 2016 04:34:52 +0000 (04:34 +0000)]
Rename several methods on ASTRecordReader to follow LLVM style (lowerCamelCase).

Summary:
This follows up to r290217, and makes functions on ASTRecordReader consistent
and valid style.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoFix windows build breakage in r290219. Unix path separators in testcase.
Graydon Hoare [Wed, 21 Dec 2016 03:00:11 +0000 (03:00 +0000)]
Fix windows build breakage in r290219. Unix path separators in testcase.

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

7 years agoFix defaulted-functions-in-C++98 extension to give the functions the same
Richard Smith [Wed, 21 Dec 2016 01:57:02 +0000 (01:57 +0000)]
Fix defaulted-functions-in-C++98 extension to give the functions the same
effect they would have in C++11. In particular, they do not prevent
value-initialization from performing zero-initialization, nor do they prevent a
struct from being an aggregate.

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

7 years ago[c++1z] When initializing a const-qualified class type, don't forget to add on
Richard Smith [Wed, 21 Dec 2016 01:31:56 +0000 (01:31 +0000)]
[c++1z] When initializing a const-qualified class type, don't forget to add on
the requested cv-qualifiers after construction. This usually doesn't matter,
but it does matter within a ?: operator.

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

7 years agoFactor out checking of template arguments after deduction into a separate
Richard Smith [Wed, 21 Dec 2016 01:10:31 +0000 (01:10 +0000)]
Factor out checking of template arguments after deduction into a separate
function. (This change would also allow us to handle default template arguments
in partial specializations if the standard ever permits them.)

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

7 years agoFix build breakage in r290219. Notes should not be in diagnostic groups.
Graydon Hoare [Wed, 21 Dec 2016 00:48:14 +0000 (00:48 +0000)]
Fix build breakage in r290219. Notes should not be in diagnostic groups.

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

7 years ago[modules] Handle modules with nonstandard names in module.private.modulemaps
Graydon Hoare [Wed, 21 Dec 2016 00:24:39 +0000 (00:24 +0000)]
[modules] Handle modules with nonstandard names in module.private.modulemaps

Summary:
The module system supports accompanying a primary module (say Foo) with
an auxiliary "private" module (defined in an adjacent module.private.modulemap
file) that augments the primary module when associated private headers are
available. The feature is intended to be used to augment the primary
module with a submodule (say Foo.Private), however some users in the wild
are choosing to augment the primary module with an additional top-level module
with a "similar" name (in all cases so far: FooPrivate).

This "works" when a user of the module initially imports a private header,
such as '#import "Foo/something_private.h"' since the Foo import winds up
importing FooPrivate in passing. But if the import is subsequently recorded
in a PCH file, reloading the PCH will fail to validate because of a cross-check
that attempts to find the module.modulemap (or module.private.modulemap) using
HeaderSearch algorithm, applied to the "FooPrivate" name. Since it's stored in
Foo.framework/Modules, not FooPrivate.framework/Modules, the check fails and
the PCH is rejected.

This patch adds a compensatory workaround in the HeaderSearch algorithm
when searching (and failing to find) a module of the form FooPrivate: the
name used to derive filesystem paths is decoupled from the module name
being searched for, and if the initial search fails and the module is
named "FooPrivate", the filesystem search name is altered to remove the
"Private" suffix, and the algorithm is run a second time (still looking for
a module named FooPrivate, but looking in directories derived from Foo).

Accompanying this change is a new warning that triggers when a user loads
a module.private.modulemap that defines a top-level module with a different
name from the top-level module defined in its adjacent module.modulemap.

Reviewers: doug.gregor, manmanren, bruno

Subscribers: bruno, cfe-commits

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

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

7 years agoStore the "current position" index within the ASTRecordReader.
David L. Jones [Wed, 21 Dec 2016 00:17:49 +0000 (00:17 +0000)]
Store the "current position" index within the ASTRecordReader.

Summary:
For ASTDeclReader and ASTStmtReader, every parameter "unsigned &Idx" ultimately
comes from a variable that is defined on the stack, next to the RecordData. This
change moves that index into the ASTRecordReader.

TypeLocReader cannot be transitioned, due to TableGen-generated code which calls
ASTReader::GetTypeSourceInfo.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoMake a test use a specific C++ dialect
Paul Robinson [Tue, 20 Dec 2016 22:30:44 +0000 (22:30 +0000)]
Make a test use a specific C++ dialect

In stack-reuse-miscompile.cpp, the allocas for the temps come out in
a different order depending on whether the dialect is C++03 or
C++11. Specify C++03 explicitly to avoid depending on the default.

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

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

7 years agoC++11 test cleanup: nonthrowing destructors
Paul Robinson [Tue, 20 Dec 2016 22:26:11 +0000 (22:26 +0000)]
C++11 test cleanup: nonthrowing destructors

If a dtor has no interesting members, then it ends up being nothrow,
which affects the generated IR. Modify some tests to tolerate this
difference between C++03 and C++11.

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

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

7 years agoMake two vtable tests tolerate C++11.
Paul Robinson [Tue, 20 Dec 2016 22:22:24 +0000 (22:22 +0000)]
Make two vtable tests tolerate C++11.

In C++11 we don't emit vtables as eagerly as we do for C++03, so
fiddle the tests to emit them when the test expects them.

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

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

7 years ago[c++1z] P0195R2: Support pack-expansion of using-declarations.
Richard Smith [Tue, 20 Dec 2016 21:35:28 +0000 (21:35 +0000)]
[c++1z] P0195R2: Support pack-expansion of using-declarations.

This change introduces UsingPackDecl as a marker for the set of UsingDecls
produced by pack expansion of a single (unresolved) using declaration. This is
not strictly necessary (we just need to be able to map from the original using
declaration to its expansions somehow), but it's useful to maintain the
invariant that each declaration reference instantiates to refer to one
declaration.

This is a re-commit of r290080 (reverted in r290092) with a fix for a
use-after-lifetime bug.

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

7 years ago[OPENMP] Fix for PR31416: Clang crashes on OMPCapturedExpr during source
Alexey Bataev [Tue, 20 Dec 2016 16:51:02 +0000 (16:51 +0000)]
[OPENMP] Fix for PR31416: Clang crashes on OMPCapturedExpr during source
based coverage compilation

Added source location info to captured expression declaration + fixed
source location info for loop based directives.

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

7 years agoclang-format: Fix bug in understanding string-label&value analysis.
Daniel Jasper [Tue, 20 Dec 2016 15:27:46 +0000 (15:27 +0000)]
clang-format: Fix bug in understanding string-label&value analysis.

While for <<-operators often used in log statments, a single key value
pair is always on the second operator, e.g.

  llvm::errs() << "aaaaa=" << aaaaa;

It is on the first operator for plus- or comma-concatenated strings:

  string s = "aaaaaaaaaa: " + aaaaaaaa;

(the "=" not counting because that's a different operator precedence)

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

7 years ago[OPENMP] Fix for PR31428: variable named like directive name modifier
Alexey Bataev [Tue, 20 Dec 2016 12:10:05 +0000 (12:10 +0000)]
[OPENMP] Fix for PR31428: variable named like directive name modifier

Directive name modifiers in 'if' clause are allowed only for OpenMP 4.5
and higher + in OpenMP 4.5 parsing procedure emits error message if ':'
is not found after directive name modifier.

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

7 years agoRevert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."
Daniel Jasper [Tue, 20 Dec 2016 10:05:04 +0000 (10:05 +0000)]
Revert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."

This reverts commit r290171. It triggers a bunch of warnings, because
the new enumerator isn't handled in all switches. We want a warning-free
build.

Replied on the commit with more details.

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

7 years agoFix for clang_Cursor_getSpellingNameRange()
Kevin Funk [Tue, 20 Dec 2016 09:56:56 +0000 (09:56 +0000)]
Fix for clang_Cursor_getSpellingNameRange()

Summary:
Fixes spelling name ranges for user-defined string literal operators.

Example:
  constexpr int operator""_toint(unsigned long long val)
  { return int(val); }

Before this patch the spelling name range on consisted of 'operator'.

After this patch: 'operator""_toint'.

Related to http://reviews.llvm.org/D5041, which fixes the function for
other cursor kinds.

Reviewers: akyrtzi, craigt, skalinichev, klimek, milianw, bkramer

Subscribers: cfe-commits

Tags: #clang-c

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

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

7 years ago[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.
Egor Churaev [Tue, 20 Dec 2016 09:15:21 +0000 (09:15 +0000)]
[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.

Summary: Enabling the compression of CLK_NULL_QUEUE to variable of type queue_t.

Reviewers: Anastasia

Subscribers: cfe-commits, yaxunl, bader

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

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

7 years agoRevert r290149: Add the alloc_size attribute to clang.
Chandler Carruth [Tue, 20 Dec 2016 08:28:19 +0000 (08:28 +0000)]
Revert r290149: Add the alloc_size attribute to clang.

This commit fails MSan when running test/CodeGen/object-size.c in
a confusing way. After some discussion with George, it isn't really
clear what is going on here. We can make the MSan failure go away by
testing for the invalid bit, but *why* things are invalid isn't clear.
And yet, other code in the surrounding area is doing precisely this and
testing for invalid.

George is going to take a closer look at this to better understand the
nature of the failure and recommit it, for now backing it out to clean
up MSan builds.

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

7 years agoAdd test for DR692.
Richard Smith [Tue, 20 Dec 2016 07:24:53 +0000 (07:24 +0000)]
Add test for DR692.

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

7 years agoFix the spelling of 'bitfield' in diagnostics to be consistently 'bit-field'.
Chandler Carruth [Tue, 20 Dec 2016 02:43:58 +0000 (02:43 +0000)]
Fix the spelling of 'bitfield' in diagnostics to be consistently 'bit-field'.

The latter agrees with most existing diagnostics and the C and C++ standards.

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

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

7 years ago[Parser] Correct typo after lambda capture initializer is parsed.
Akira Hatanaka [Tue, 20 Dec 2016 02:11:29 +0000 (02:11 +0000)]
[Parser] Correct typo after lambda capture initializer is parsed.

This patch fixes an assertion that is triggered when RecordLayoutBuilder
tries to compute the size of a field (for capture "name" in the test
case) whose type hasn't been deduced. The patch fixes the bug by
correcting the typo of the capture initializer after the initializer is
parsed and before setting the expression for the annotation token.

Fixes PR30566.

rdar://problem/23380132

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

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

7 years agoUpdate for LLVM global variable debug info API change.
Adrian Prantl [Tue, 20 Dec 2016 02:10:02 +0000 (02:10 +0000)]
Update for LLVM global variable debug info API change.

This reapplies r289921.

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

7 years agoAdd the alloc_size attribute to clang.
George Burgess IV [Tue, 20 Dec 2016 01:05:42 +0000 (01:05 +0000)]
Add the alloc_size attribute to clang.

This patch does three things:

- Gives us the alloc_size attribute in clang, which lets us infer the
  number of bytes handed back to us by malloc/realloc/calloc/any user
  functions that act in a similar manner.
- Teaches our constexpr evaluator that evaluating some `const` variables
  is OK sometimes. This is why we have a change in
  test/SemaCXX/constant-expression-cxx11.cpp and other seemingly
  unrelated tests. Richard Smith okay'ed this idea some time ago in
  person.
- Uniques some Blocks in CodeGen, which was reviewed separately at
  D26410. Lack of uniquing only really shows up as a problem when
  combined with our new eagerness in the face of const.

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

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

7 years agoFix completely bogus types for some builtins:
Richard Smith [Mon, 19 Dec 2016 23:59:34 +0000 (23:59 +0000)]
Fix completely bogus types for some builtins:

 * In C++, never create a FunctionNoProtoType for a builtin (fixes C++1z
   crasher from r289754).

 * Fix type of __sync_synchronize to be a no-parameter function rather than a
   varargs function. This matches GCC.

 * Fix type of vfprintf to match its actual type. We gave it a wrong type due
   to PR4290 (apparently autoconf generates invalid code and expects compilers
   to choke it down or it miscompiles the program; the relevant error in clang
   was downgraded to a warning in r122744 to fix other occurrences of this
   autoconf brokenness, so we don't need this workaround any more).

 * Turn off vararg argument checking for __noop, since it's not *really* a
   varargs function. Alternatively we could add custom type checking for it
   and synthesize parameter types matching the actual arguments in each call,
   but that seemed like overkill.

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

7 years agoMake another test insensitive to the default C++ dialect.
Paul Robinson [Mon, 19 Dec 2016 23:32:10 +0000 (23:32 +0000)]
Make another test insensitive to the default C++ dialect.

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

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

7 years ago[analyzer] Add checker modeling gtest APIs.
Devin Coughlin [Mon, 19 Dec 2016 22:50:31 +0000 (22:50 +0000)]
[analyzer] Add checker modeling gtest APIs.

gtest is a widely-used unit-testing API. It provides macros for unit test
assertions:

  ASSERT_TRUE(p != nullptr);

that expand into an if statement that constructs an object representing
the result of the assertion and returns when the assertion is false:

  if (AssertionResult gtest_ar_ = AssertionResult(p == nullptr))
      ;
  else
    return ...;

Unfortunately, the analyzer does not model the effect of the constructor
precisely because (1) the copy constructor implementation is missing from the
the header (so it can't be inlined) and (2) the boolean-argument constructor
is constructed into a temporary (so the analyzer decides not to inline it since
it doesn't reliably call temporary destructors right now).

This results in false positives because the analyzer does not realize that the
the assertion must hold along the non-return path.

This commit addresses the false positives by explicitly modeling the effects
of the two un-inlined constructors on the AssertionResult state.

I've added a new package, "apiModeling", for these kinds of checkers that
model APIs but don't emit any diagnostics. I envision all the checkers in
this package always being on by default.

This addresses the false positives reported in PR30936.

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

rdar://problem/22705813

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

7 years agoDon't try to emit nullability fix-its within/around macros.
Jordan Rose [Mon, 19 Dec 2016 22:35:24 +0000 (22:35 +0000)]
Don't try to emit nullability fix-its within/around macros.

The newly-added notes from r290132 are too noisy even when the fix-it
is valid. For the existing warning from r286521, it's probably the
right decision 95% of the time to put the change outside the macro if
the array is outside the macro and inside otherwise, but I don't want
to overthink it right now.

Caught by the ASan bot!

More rdar://problem/29524992

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

7 years ago[analyzer] Add sink after construction of temporary with no-return destructor.
Devin Coughlin [Mon, 19 Dec 2016 22:23:22 +0000 (22:23 +0000)]
[analyzer] Add sink after construction of temporary with no-return destructor.

The analyzer's CFG currently doesn't have nodes for calls to temporary
destructors. This causes the analyzer to explore infeasible paths in which
a no-return destructor would have stopped exploration and so results in false
positives when no-return destructors are used to implement assertions.

To mitigate these false positives, this patch stops generates a sink after
evaluating a constructor on a temporary object that has a no-return destructor.
This results in a loss of coverage because the time at which the destructor is
called may be after the time of construction (especially for lifetime-extended
temporaries).

This addresses PR15599.

rdar://problem/29131566

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

7 years ago[Format] Remove dead code.
Benjamin Kramer [Mon, 19 Dec 2016 21:10:50 +0000 (21:10 +0000)]
[Format] Remove dead code.

No functionality change.

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

7 years ago[ASTReader] Sort RawComments before merging
Bruno Cardoso Lopes [Mon, 19 Dec 2016 21:06:06 +0000 (21:06 +0000)]
[ASTReader] Sort RawComments before merging

`RawComments` are sorted by comparing underlying `SourceLocation`'s. This is
done by comparing `FileID` and `Offset`; when the `FileID` is the same it means
the locations are within the same TU and the `Offset` is used.

FileID, from the source code: "A mostly-opaque identifier, where 0 is
"invalid", >0 is this module, and <-1 is something loaded from another
module.". That said, when de-serializing SourceLocations, FileID's from
RawComments loaded from other modules get negative IDs where previously they
were positive. This makes imported RawComments unsorted, leading to a wrong
merge with other comments from the current TU. Fix that by sorting RawComments
properly after de-serialization and before merge.

This fixes an assertion in `ASTContext::getRawCommentForDeclNoCache`,
which fires only in a debug build of clang.

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

rdar://problem/29287314

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

7 years agoAdd fix-it notes to the nullability consistency warning.
Jordan Rose [Mon, 19 Dec 2016 20:58:20 +0000 (20:58 +0000)]
Add fix-it notes to the nullability consistency warning.

This is especially important for arrays, since no one knows the proper
syntax for putting qualifiers in arrays.

    nullability.h:3:26: warning: array parameter is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)
    void arrayParameter(int x[]);
                             ^
    nullability.h:3:26: note: insert '_Nullable' if the array parameter may be null
    void arrayParameter(int x[]);
                             ^
                              _Nullable
    nullability.h:3:26: note: insert '_Nonnull' if the array parameter should never be null
    void arrayParameter(int x[]);
                             ^
                              _Nonnull

rdar://problem/29524992

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

7 years agoReverting r290004, r290006, r290010 pending review.
Sean Callanan [Mon, 19 Dec 2016 19:15:43 +0000 (19:15 +0000)]
Reverting r290004, r290006, r290010 pending review.

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

7 years agoMake a few OpenMP tests "C++11 clean."
Paul Robinson [Mon, 19 Dec 2016 18:43:26 +0000 (18:43 +0000)]
Make a few OpenMP tests "C++11 clean."

This time trying to commit just the relevant 3 tests!
Reviewed by abataev (in D27794)

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

7 years agoRevert another accidental bit
Paul Robinson [Mon, 19 Dec 2016 18:20:19 +0000 (18:20 +0000)]
Revert another accidental bit

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

7 years agoUndo accidental comit
Paul Robinson [Mon, 19 Dec 2016 18:00:45 +0000 (18:00 +0000)]
Undo accidental comit

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

7 years agoMake a few OpenMP tests "C++11 clean."
Paul Robinson [Mon, 19 Dec 2016 17:58:09 +0000 (17:58 +0000)]
Make a few OpenMP tests "C++11 clean."

Reviewed by abataev (in D27794)

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

7 years ago[libclang] Revert part of r290025, "Remove the 'extern "C"' blocks from the implement...
NAKAMURA Takumi [Mon, 19 Dec 2016 16:50:43 +0000 (16:50 +0000)]
[libclang] Revert part of r290025, "Remove the 'extern "C"' blocks from the implementation files."

mingw32-ld complains missing symbols in exports,

  Cannot export clang_findIncludesInFileWithBlock: symbol not defined
  Cannot export clang_findReferencesInFileWithBlock: symbol not defined
  Cannot export clang_visitChildrenWithBlock: symbol not defined

They are excluded conditionally in header along has_blocks.

We should do either;

  1. Exclude also function bodies conditionally, and introduce "optional" exporter.
  2. Give dummy function bodies for them.
  3. Implement functions w/o blocks.

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

7 years ago[ARM] Add missing -backend-option for -arm-execute-only
Prakhar Bahuguna [Mon, 19 Dec 2016 15:43:33 +0000 (15:43 +0000)]
[ARM] Add missing -backend-option for -arm-execute-only

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

7 years agoclang-format: Slightly tweak the behavior of <<-wrapping.
Daniel Jasper [Mon, 19 Dec 2016 11:14:23 +0000 (11:14 +0000)]
clang-format: Slightly tweak the behavior of <<-wrapping.

Before:
  SomeLongLoggingStatementOrMacro() << "Some long text "
                                    << some_variable << "\n";

Before:
  SomeLongLoggingStatementOrMacro()
      << "Some long text " << some_variable << "\n";

Short logging statements are already special cased in a different part
of the code.

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

7 years ago[clang-format] revert an unintended change in r288493 and add a test case.
Eric Liu [Mon, 19 Dec 2016 10:41:05 +0000 (10:41 +0000)]
[clang-format] revert an unintended change in r288493 and add a test case.

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

7 years agoRevert "[c++1z] P0195R2: Support pack-expansion of using-declarations."
Daniel Jasper [Mon, 19 Dec 2016 10:09:25 +0000 (10:09 +0000)]
Revert "[c++1z] P0195R2: Support pack-expansion of using-declarations."

This reverts commit r290080 as it leads to many Clang crashes, e.g.:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/1814

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

7 years agoclang-format: Fix regression introduced in r290084.
Daniel Jasper [Mon, 19 Dec 2016 08:40:56 +0000 (08:40 +0000)]
clang-format: Fix regression introduced in r290084.

We still want to try in linewrap within single elements of a 1-column
list.

After:
  Type *Params[] = {PointerType::getUnqual(FunctionType::get(
Builder.getVoidTy(), Builder.getInt8PtrTy(), false)),
    Builder.getInt8PtrTy(),
    Builder.getInt32Ty(),
    LongType,
    LongType,
    LongType};

Before:
  No line break in the first element, so column limit violation.

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

7 years agoclang-format: Allow "single column" list layout even if that violates the
Daniel Jasper [Mon, 19 Dec 2016 07:26:11 +0000 (07:26 +0000)]
clang-format: Allow "single column" list layout even if that violates the
column limit.

Single-column layout basically means that we format the list with one
element per line. Not doing that when there is a column limit violation
doesn't change the fact that there is an item that doesn't fit within
the column limit.

Before (with a column limit of 30):
  std::vector<int> a = {
      aaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaa};

After:
  std::vector<int> a = {
      aaaaaaaa,
      aaaaaaaa,
      aaaaaaaa,
      aaaaaaaa,
      aaaaaaaaaa,
      aaaaaaaa,
      aaaaaaaaaaaaaaaaaaaaaaaaaaa};

(and previously we would have formatted like "After" it wasn't for the one
item that is too long)

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

7 years agoAdd __cpp_structured_bindings feature test macro for structured bindings, per
Richard Smith [Mon, 19 Dec 2016 04:21:36 +0000 (04:21 +0000)]
Add __cpp_structured_bindings feature test macro for structured bindings, per
latest (provisional) draft of SD-6.

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

7 years ago[c++1z] cxx_status: mark p0195r2 as done.
Richard Smith [Mon, 19 Dec 2016 04:16:03 +0000 (04:16 +0000)]
[c++1z] cxx_status: mark p0195r2 as done.

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

7 years ago[c++1z] P0195R2: Support pack-expansion of using-declarations.
Richard Smith [Mon, 19 Dec 2016 04:08:53 +0000 (04:08 +0000)]
[c++1z] P0195R2: Support pack-expansion of using-declarations.

This change introduces UsingPackDecl as a marker for the set of UsingDecls
produced by pack expansion of a single (unresolved) using declaration. This is
not strictly necessary (we just need to be able to map from the original using
declaration to its expansions somehow), but it's useful to maintain the
invariant that each declaration reference instantiates to refer to one
declaration.

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

7 years agoAdd a lit test for PR31374
Yaxun Liu [Mon, 19 Dec 2016 02:55:53 +0000 (02:55 +0000)]
Add a lit test for PR31374

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

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

7 years agoFix name hiding and redeclaration checking for dependent local
Richard Smith [Sun, 18 Dec 2016 22:01:46 +0000 (22:01 +0000)]
Fix name hiding and redeclaration checking for dependent local
using-declarations.

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

7 years agoFix some interactions between C++11 and C++14 features and using-declarations:
Richard Smith [Sun, 18 Dec 2016 21:39:37 +0000 (21:39 +0000)]
Fix some interactions between C++11 and C++14 features and using-declarations:

 * a dependent non-type using-declaration within a function template can be
   valid, as it can refer to an enumerator, so don't reject it in the template
   definition
 * we can partially substitute into a dependent using-declaration if it appears
   within a (local class in a) generic lambda within a function template, which
   means an UnresolvedUsing*Decl doesn't necessarily instantiate to a UsingDecl.

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

7 years agoWdocumentation fix
Simon Pilgrim [Sun, 18 Dec 2016 14:12:38 +0000 (14:12 +0000)]
Wdocumentation fix

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

7 years agoFix a lit test issue exposed by r290056
Yaxun Liu [Sun, 18 Dec 2016 07:26:01 +0000 (07:26 +0000)]
Fix a lit test issue exposed by r290056

The test requests a target which supports cl_khr_gl_msaa_sharing since in test/PCH/ocl_types.h
it tries to enable cl_khr_gl_msaa_sharing. Therefore this test fails on targets not supporting
cl_khr_gl_msaa_sharing, e.g. ppc64, etc.

The fix is to add triple spir-unknown-unknown which supports cl_khr_gl_msaa_sharing.

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

7 years agoAttempt to fix build failure and regressions due to r290056
Yaxun Liu [Sun, 18 Dec 2016 06:35:06 +0000 (06:35 +0000)]
Attempt to fix build failure and regressions due to r290056

Add llvm:: namespace to StringRef.
Make conversion between bool and uint64_t explicit.

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

7 years agoRecommit r289979 [OpenCL] Allow disabling types and declarations associated with...
Yaxun Liu [Sun, 18 Dec 2016 05:18:55 +0000 (05:18 +0000)]
Recommit r289979 [OpenCL] Allow disabling types and declarations associated with extensions

Fixed undefined behavior due to cast integer to bool in initializer list.

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

7 years ago[OpenMP] Sema and parsing for 'target teams' pragma
Kelvin Li [Sat, 17 Dec 2016 05:48:59 +0000 (05:48 +0000)]
[OpenMP] Sema and parsing for 'target teams' pragma

This patch is to implement sema and parsing for 'target teams' pragma.

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

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

7 years ago[libclang] Remove the 'extern "C"' blocks from the implementation files.
Argyrios Kyrtzidis [Sat, 17 Dec 2016 01:09:40 +0000 (01:09 +0000)]
[libclang] Remove the 'extern "C"' blocks from the implementation files.

These are unnecessary, the declarations already carry the 'extern C' property, and if there is mismatch
between declaration and definition then we will get linker errors via libclang.exports.

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

7 years ago[analyzer] UnixAPIChecker: Don't diagnose for functions in C++ namespaces
Devin Coughlin [Sat, 17 Dec 2016 01:08:17 +0000 (01:08 +0000)]
[analyzer] UnixAPIChecker: Don't diagnose for functions in C++ namespaces

Update the UnixAPIChecker to not diagnose for calls to functions that
are declared in C++ namespaces. This avoids false positives when a
namespaced function has the same name as a Unix API.

This address PR28331.

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

7 years agoAdded clangLex to the dependencies for clang-import-test.
Sean Callanan [Fri, 16 Dec 2016 23:45:03 +0000 (23:45 +0000)]
Added clangLex to the dependencies for clang-import-test.

This is part of the effort to get the i686-mingw32-RA-on-linux bot to like clang-import-test.

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

7 years agoFix MSVC build of libclang after r288438
Reid Kleckner [Fri, 16 Dec 2016 23:44:44 +0000 (23:44 +0000)]
Fix MSVC build of libclang after r288438

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

7 years agoAdd explicit triple to test to fix arm bots.
Peter Collingbourne [Fri, 16 Dec 2016 23:43:51 +0000 (23:43 +0000)]
Add explicit triple to test to fix arm bots.

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

7 years agoFixed library dependencies on clang-import-test to clean up the bots.
Sean Callanan [Fri, 16 Dec 2016 23:34:16 +0000 (23:34 +0000)]
Fixed library dependencies on clang-import-test to clean up the bots.

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

7 years ago[analyzer] Extend UnixAPIChecker open() checks to handle openat().
Devin Coughlin [Fri, 16 Dec 2016 23:31:56 +0000 (23:31 +0000)]
[analyzer] Extend UnixAPIChecker open() checks to handle openat().

The openat() API has similar constraints to the open() API -- it just takes
an extra parameter.

rdar://problem/29526458

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

7 years agoTestbed and skeleton of a new expression parser
Sean Callanan [Fri, 16 Dec 2016 23:21:38 +0000 (23:21 +0000)]
Testbed and skeleton of a new expression parser

LLVM's JIT is now the foundation of dynamic-compilation features for many languages. Clang also has low-level support for dynamic compilation (ASTImporter and ExternalASTSource, notably). How the compiler is set up for dynamic parsing is generally left up to individual clients, for example LLDB's C/C++/Objective-C expression parser and the ROOT project.

Although this arrangement offers external clients the flexibility to implement dynamic features as they see fit, the lack of an in-tree client means that subtle bugs can be introduced that cause regressions in the external clients but aren't caught by tests (or users) until much later. LLDB for example regularly encounters complicated ODR violation scenarios where it is not immediately clear who is at fault.

Other external clients (notably, Cling) rely on similar functionality, and another goal is to break this functionality up into composable parts so that any client can be built easily on top of Clang without requiring extensive additional code.

I propose that the parts required to build a simple expression parser be added to Clang.  Initially, I aim to have the following features:

- A piece that looks up external declarations from a variety of sources (e.g., from previous dynamic compilations, from modules, or from DWARF) and uses clear conflict resolution rules to reconcile differences, with easily understood errors. This functionality will be supported by in-tree tests.

- A piece that works hand in hand with the LLVM JIT to resolve the locations of external declarations so that e.g. variables can be redeclared and (for high-performance applications like DTrace) external variables can be accessed directly from the registers where they reside.

This commit adds a tester that parses a sequence of source files and then uses them as source data for an expression. External references are resolved using an ExternalASTSource that responds to name queries using an ASTImporter. This is the setup that LLDB uses, and the motivating reason for MinimalImport in ASTImporter.  When complete, this tester will implement the first of the above goals.

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

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

7 years agoReally revert all changes from r289979. Apparently conflict resolution failed
Reid Kleckner [Fri, 16 Dec 2016 22:11:28 +0000 (22:11 +0000)]
Really revert all changes from r289979. Apparently conflict resolution failed

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

7 years agoIRGen: Fix assertion failure when creating debug info for an integer constant wider...
Peter Collingbourne [Fri, 16 Dec 2016 22:10:52 +0000 (22:10 +0000)]
IRGen: Fix assertion failure when creating debug info for an integer constant wider than 64 bits.

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

7 years ago[libclang] Restore the CXXRecordDecl path for clang_Type_getNumTemplateArguments...
Argyrios Kyrtzidis [Fri, 16 Dec 2016 21:40:16 +0000 (21:40 +0000)]
[libclang] Restore the CXXRecordDecl path for clang_Type_getNumTemplateArguments and clang_Type_getTemplateArgumentAsType

Patch by Emilio Cobos Álvarez!
See https://reviews.llvm.org/D26907

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

7 years agoRevert r289979 due to regressions
Yaxun Liu [Fri, 16 Dec 2016 21:23:55 +0000 (21:23 +0000)]
Revert r289979 due to regressions

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

7 years ago[Sema] Transform the default arguments of a lambda expression when the
Akira Hatanaka [Fri, 16 Dec 2016 21:16:57 +0000 (21:16 +0000)]
[Sema] Transform the default arguments of a lambda expression when the
lambda expression is instantiated.

Rather than waiting until Sema::CheckCXXDefaultArgExpr tries to
transform the default arguments (which fails because it can't get the
template arguments that are used), transform the default arguments
earlier when the lambda expression is transformed in
TransformLambdaExpr.

rdar://problem/27535319

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

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

7 years ago[OpenMP] support the 'is_device_ptr' clause with 'target parallel' pragma
Kelvin Li [Fri, 16 Dec 2016 20:50:46 +0000 (20:50 +0000)]
[OpenMP] support the 'is_device_ptr' clause with 'target parallel' pragma

This patch is to add support of the 'is_device_ptr' clause in the 'target parallel' pragma.

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

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

7 years agoRemove the temporary fix to the RUN line that was committed in r289924.
Akira Hatanaka [Fri, 16 Dec 2016 20:25:11 +0000 (20:25 +0000)]
Remove the temporary fix to the RUN line that was committed in r289924.

Also, dump the AST and run FileCheck to make sure the expected nodes are
created in the AST.

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

7 years agoFix clang build
Zachary Turner [Fri, 16 Dec 2016 19:49:14 +0000 (19:49 +0000)]
Fix clang build

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

7 years agoRevert "Update for LLVM global variable debug info API change."
Adrian Prantl [Fri, 16 Dec 2016 19:39:18 +0000 (19:39 +0000)]
Revert "Update for LLVM global variable debug info API change."

This reverts commit r289921.

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

7 years ago[OpenCL] Allow disabling types and declarations associated with extensions
Yaxun Liu [Fri, 16 Dec 2016 19:22:08 +0000 (19:22 +0000)]
[OpenCL] Allow disabling types and declarations associated with extensions

Added a map to associate types and declarations with extensions.

Refactored existing diagnostic for disabled types associated with extensions and extended it to declarations for generic situation.

Fixed some bugs for types associated with extensions.

Allow users to use pragma to declare types and functions for supported extensions, e.g.

#pragma OPENCL EXTENSION the_new_extension_name : begin
// declare types and functions associated with the extension here
#pragma OPENCL EXTENSION the_new_extension_name : end

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

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

7 years ago[analyzer] Fix crash in MallocChecker.
Devin Coughlin [Fri, 16 Dec 2016 18:41:40 +0000 (18:41 +0000)]
[analyzer] Fix crash in MallocChecker.

Fix a crash in the MallocChecker when the extent size for the argument
to new[] is not known.

A patch by Abramo Bagnara and Dániel Krupp!

https://reviews.llvm.org/D27849

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

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

7 years ago[analyzer] Add another exception for Qt in MallocChecker
Artem Dergachev [Fri, 16 Dec 2016 12:21:55 +0000 (12:21 +0000)]
[analyzer] Add another exception for Qt in MallocChecker

Treat pointers passed to QObject::connectImpl() as escaping.

rdar://problem/29550440

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

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

7 years agoattempt to fix bots after r289914/r289919
Nico Weber [Fri, 16 Dec 2016 05:03:44 +0000 (05:03 +0000)]
attempt to fix bots after r289914/r289919

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

7 years agoUpdate for LLVM global variable debug info API change.
Adrian Prantl [Fri, 16 Dec 2016 04:26:15 +0000 (04:26 +0000)]
Update for LLVM global variable debug info API change.

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

7 years agoRemove "-disable-llvm-optzns -verify" from the RUN line.
Akira Hatanaka [Fri, 16 Dec 2016 04:18:53 +0000 (04:18 +0000)]
Remove "-disable-llvm-optzns -verify" from the RUN line.

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

7 years ago[Sema] Fix handling of enumerators used as default arguments of lambda
Akira Hatanaka [Fri, 16 Dec 2016 03:19:41 +0000 (03:19 +0000)]
[Sema] Fix handling of enumerators used as default arguments of lambda
expressions in a function or class template.

This patch makes the following changes:

- Create a DependentScopeDeclRefExpr for the default argument instead of
  a CXXDependentScopeMemberExpr.
- Pass CombineWithOuterScope=true so that the outer scope in which the
  enum is declared is searched for the instantiation of the enum.

This is the first part of https://reviews.llvm.org/D23096. Fixes PR28795

rdar://problem/27535319

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

7 years agoclang-format-vsix: add command to format document
Antonio Maiorano [Fri, 16 Dec 2016 01:51:43 +0000 (01:51 +0000)]
clang-format-vsix: add command to format document

Bound to Ctrl+R, Ctrl+D by default. Also added section on how to debug the extension to the Readme.

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

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