]> granicus.if.org Git - clang/log
clang
8 years agoWiden type of __offset_flags in RTTI on Mingw64
Reid Kleckner [Thu, 25 Aug 2016 22:16:30 +0000 (22:16 +0000)]
Widen type of __offset_flags in RTTI on Mingw64

Otherwise we can't handle secondary base classes at offsets greater than
2**24. This agrees with libstdc++abi.

We could extend this change to other LLP64 platforms, but then we would
want to update libc++abi and it would require additional review.

Fixes PR29116

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

8 years ago[MS] Win64 va_arg should expect large arguments to be passed indirectly
Reid Kleckner [Thu, 25 Aug 2016 20:42:26 +0000 (20:42 +0000)]
[MS] Win64 va_arg should expect large arguments to be passed indirectly

Fixes PR20569

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

8 years agoFix clang-offload-bundler.c test on Windows
Reid Kleckner [Thu, 25 Aug 2016 20:40:23 +0000 (20:40 +0000)]
Fix clang-offload-bundler.c test on Windows

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

8 years agoRefactor to remove the assumption that we know the name of the module we're emitting...
Richard Smith [Thu, 25 Aug 2016 18:26:30 +0000 (18:26 +0000)]
Refactor to remove the assumption that we know the name of the module we're emitting at the point when we create a PCHGenerator (with the C++ modules TS, we find that out part way through parsing the input).

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

8 years agoOmit column info for CodeView by default
Adrian McCarthy [Thu, 25 Aug 2016 18:24:35 +0000 (18:24 +0000)]
Omit column info for CodeView by default

Clang tracks only start columns, not start-end ranges. CodeView allows for that, but the VS debugger doesn't handle anything less than a complete range well--it either highlights the wrong part of a statement or truncates source lines in the assembly view. It's better to have no column information at all.

So by default, we'll omit the column information for CodeView targeting Windows.

Since the column info is still useful for sanitizers, I've promoted -gcolumn-info (and -gno-column-info) to a CoreOption and added a couple tests to make sure that works for clang-cl.

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

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

8 years ago[MS] Pass non-trivially-copyable objects indirectly on Windows ARM
Reid Kleckner [Thu, 25 Aug 2016 18:23:28 +0000 (18:23 +0000)]
[MS] Pass non-trivially-copyable objects indirectly on Windows ARM

This isn't exactly what MSVC does, unfortunately. MSVC does not pass
objects with destructors but no copy constructors by address. More ARM
expertise is required to really understand what should be done here.

Fixes PR29136.

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

8 years ago[Sema][Comments] Add support for TypeAliasTemplate
Bruno Cardoso Lopes [Thu, 25 Aug 2016 17:09:33 +0000 (17:09 +0000)]
[Sema][Comments] Add support for TypeAliasTemplate

Emit proper diagnostics when -Wdocumentation is used with constructs such as:

  template<typename T>
  using fn = int(T aaa, int ccc);

Previously clang wouldn't recognize the function and complain with
'comment that is not attached to a function declaration'.

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

rdar://problem/27300695

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

8 years agoFix offload bundler test to support Windows new lines.
Samuel Antao [Thu, 25 Aug 2016 14:35:20 +0000 (14:35 +0000)]
Fix offload bundler test to support Windows new lines.

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

8 years agoclang-format: [JS] nested and tagged template strings.
Martin Probst [Thu, 25 Aug 2016 10:13:21 +0000 (10:13 +0000)]
clang-format: [JS] nested and tagged template strings.

JavaScript template strings can be nested arbitrarily:

    foo = `text ${es.map(e => { return `<${e}>`; })} text`;

This change lexes nested template strings using a stack of lexer states to
correctly switch back to template string lexing on closing braces.

Also, reuse the same stack for the token-stashed logic.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

8 years agoFix memory leaks in clang-offload-bundler
Vitaly Buka [Thu, 25 Aug 2016 07:21:34 +0000 (07:21 +0000)]
Fix memory leaks in clang-offload-bundler

Summary:
1. Pair removed from StringMap was not destroyed
2. ObjectFile had no owner

Reviewers: sfantao

Subscribers: llvm-commits

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

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

8 years agoRemove a pointless LLVM_CONSTEXPR. NFC.
George Burgess IV [Thu, 25 Aug 2016 01:54:37 +0000 (01:54 +0000)]
Remove a pointless LLVM_CONSTEXPR. NFC.

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

8 years agoLazily load the ContextDecl for a lambda's DefinitionData, to fix a
Richard Smith [Thu, 25 Aug 2016 00:34:00 +0000 (00:34 +0000)]
Lazily load the ContextDecl for a lambda's DefinitionData, to fix a
deserialization cycle caused by the ContextDecl recursively importing members
of the lambda's closure type.

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

8 years ago[Sema][Comments] Factor out function type loc logic. NFCI
Bruno Cardoso Lopes [Thu, 25 Aug 2016 00:22:08 +0000 (00:22 +0000)]
[Sema][Comments] Factor out function type loc logic. NFCI

This is in prepatation for @param TypeAliasTemplate support.

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

8 years agoDebugInfo: Let -gsplit-dwarf and -gmlt compose if -fno-split-dwarf-inlining is used
David Blaikie [Wed, 24 Aug 2016 23:22:36 +0000 (23:22 +0000)]
DebugInfo: Let -gsplit-dwarf and -gmlt compose if -fno-split-dwarf-inlining is used

If the inline info is not duplicated into the skeleton CU, then there's
value in using -gsplit-dwarf and -gmlt together (to keep all those extra
subprograms out of the skeleton CU, while also producing smaller .dwo
files)

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

8 years ago[Order Files] On Darwin use DTrace's oneshot probe
Chris Bieneman [Wed, 24 Aug 2016 22:09:46 +0000 (22:09 +0000)]
[Order Files] On Darwin use DTrace's oneshot probe

The oneshot probe only gets executed the first time the probe is hit in the process. For order file generation this is really all we care about.

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

8 years agoDisable test under asan: it uses a lot of stack, and asan increases the
Richard Smith [Wed, 24 Aug 2016 21:30:00 +0000 (21:30 +0000)]
Disable test under asan: it uses a lot of stack, and asan increases the
per-frame stack usage enough to cause it to hit our stack limit. This is not
ideal; we should find a better way of dealing with this, such as increasing
our stack allocation when built with ASan.

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

8 years agoPR29097: add an update record when we instantiate the default member
Richard Smith [Wed, 24 Aug 2016 21:25:37 +0000 (21:25 +0000)]
PR29097: add an update record when we instantiate the default member
initializer of an imported field.

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

8 years ago[Sema][Comments] Support @param with c++ 'using' keyword
Bruno Cardoso Lopes [Wed, 24 Aug 2016 21:11:43 +0000 (21:11 +0000)]
[Sema][Comments] Support @param with c++ 'using' keyword

Give appropriate warnings with -Wdocumentation for @param comments
that refer to function aliases defined with 'using'. Very similar
to typedef's behavior. This does not add support for
TypeAliasTemplateDecl yet.

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

rdar://problem/27300695

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

8 years agoFix offload bundler tests so that diagnostic can start with caps.
Samuel Antao [Wed, 24 Aug 2016 18:52:18 +0000 (18:52 +0000)]
Fix offload bundler tests so that diagnostic can start with caps.

Windows require that.

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

8 years agoDebugInfo: Add flag to CU to disable emission of inline debug info into the skeleton CU
David Blaikie [Wed, 24 Aug 2016 18:29:58 +0000 (18:29 +0000)]
DebugInfo: Add flag to CU to disable emission of inline debug info into the skeleton CU

In cases where .dwo/.dwp files are guaranteed to be available, skipping
the extra online (in the .o file) inline info can save a substantial
amount of space - see the original r221306 for more details there.

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

8 years agoclang-offload-bundler: Update libdeps.
NAKAMURA Takumi [Wed, 24 Aug 2016 17:05:48 +0000 (17:05 +0000)]
clang-offload-bundler: Update libdeps.

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

8 years agofix typo "varaible"
Nico Weber [Wed, 24 Aug 2016 16:37:21 +0000 (16:37 +0000)]
fix typo "varaible"

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

8 years agoAdd target REQUIRES directives to offload bundler test.
Samuel Antao [Wed, 24 Aug 2016 15:47:06 +0000 (15:47 +0000)]
Add target REQUIRES directives to offload bundler test.

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

8 years ago[Driver][OpenMP][CUDA] Add capability to bundle object files in sections of the host...
Samuel Antao [Wed, 24 Aug 2016 15:39:07 +0000 (15:39 +0000)]
[Driver][OpenMP][CUDA] Add capability to bundle object files in sections of the host binary format.

Summary:
This patch adds the capability to bundle object files in sections of the host binary using a designated naming convention for these sections. This patch uses the functionality of the object reader already in the LLVM library to read bundled files, and invokes clang with the incremental linking options to create bundle files.

Bundling files involves creating an IR file with the contents of the bundle assigned as initializers of globals binded to the designated sections. This way the bundling implementation is agnostic of the host object format.

The features added by this patch were requested in the RFC discussion in  http://lists.llvm.org/pipermail/cfe-dev/2016-February/047547.html.

Reviewers: echristo, tra, jlebar, hfinkel, ABataev, Hahnfeld

Subscribers: mkuron, whchung, cfe-commits, andreybokhanko, Hahnfeld, arpith-jacob, carlo.bertolli, mehdi_amini, caomhin

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

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

8 years agoclang-offload-bundler - offload files bundling/unbundling tool
Samuel Antao [Wed, 24 Aug 2016 15:21:05 +0000 (15:21 +0000)]
clang-offload-bundler - offload files bundling/unbundling tool

Summary:
One of the goals of programming models that support offloading (e.g. OpenMP) is to enable users to offload with little effort, by annotating the code with a few pragmas. I'd also like to save users the trouble of changing their existent applications' build system. So having the compiler always return a single file instead of one for the host and each target even if the user is doing separate compilation is desirable.

This diff proposes a tool named clang-offload-bundler (happy to change the name if required) that is used to bundle files associated with the same user source file but different targets, or to unbundle a file into separate files associated with different targets.

This tool supports the driver support for OpenMP under review in http://reviews.llvm.org/D9888. The tool is used there to enable separate compilation, so that the very first action on input files that are not source files is a "unbundling action" and the very last non-linking action is a "bundling action".

The format of the bundled files is currently very simple: text formats are concatenated with comments that have a magic string and target identifying triple in between, and binary formats have a header that contains the triple and the offset and size of the code for host and each target.

The goal is to improve this tool in the future to deal with archive files so that each individual file in the archive is properly dealt with. We see that archives are very commonly used in current applications to combine separate compilation results. So I'm convinced users would enjoy this feature.

This tool can be used like this:

`clang-offload-bundler -targets=triple1,triple2 -type=ii -inputs=a.triple1.ii,a.triple2.ii -outputs=a.ii`

or

`clang-offload-bundler -targets=triple1,triple2 -type=ii -outputs=a.triple1.ii,a.triple2.ii -inputs=a.ii -unbundle`

I implemented the tool under clang/tools. Please let me know if something like this should live somewhere else.

This patch is prerequisite for http://reviews.llvm.org/D9888.

Reviewers: hfinkel, rsmith, echristo, chandlerc, tra, jlebar, ABataev, Hahnfeld

Subscribers: whchung, caomhin, andreybokhanko, arpith-jacob, carlo.bertolli, mehdi_amini, guansong, Hahnfeld, cfe-commits

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

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

8 years ago[AST] Make InitListExpr::isExplicit const (NFC)
Vedant Kumar [Wed, 24 Aug 2016 06:44:57 +0000 (06:44 +0000)]
[AST] Make InitListExpr::isExplicit const (NFC)

Patch by Alexander Shaposhnikov!

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

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

8 years ago[Pragma] Clear loop distribution attribute between loops
Adam Nemet [Wed, 24 Aug 2016 04:31:56 +0000 (04:31 +0000)]
[Pragma] Clear loop distribution attribute between loops

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

8 years agoRemove excessive padding from PTHStatData (NFC)
Mehdi Amini [Wed, 24 Aug 2016 04:26:57 +0000 (04:26 +0000)]
Remove excessive padding from PTHStatData (NFC)

This diff reorders the fields and removes excessive padding.
This fixes the following warning:

PTHLexer.cpp:629:7: warning: Excessive padding in 'class (anonymous namespace)::PTHStatData' (14 padding bytes, where 6 is optimal). Optimal fields order: Size, ModTime, UniqueID, HasData, IsDirectory, consider reordering the fields or adding explicit padding members.

Patch by: Alexander Shaposhnikov <shal1t712@gmail.com>

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

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

8 years agoAdding an additional test to ensure the frame pointer is emitted
Douglas Yung [Wed, 24 Aug 2016 02:02:32 +0000 (02:02 +0000)]
Adding an additional test to ensure the frame pointer is emitted
when compiling with optimization when PS4 is the target.

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

8 years agoFix member call on null pointer, found by sanitizer buildbot.
Richard Smith [Tue, 23 Aug 2016 21:12:54 +0000 (21:12 +0000)]
Fix member call on null pointer, found by sanitizer buildbot.

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

8 years agodriver: Support checking for rlimits via cmake (when bootstrapping)
Chris Bieneman [Tue, 23 Aug 2016 20:07:07 +0000 (20:07 +0000)]
driver: Support checking for rlimits via cmake (when bootstrapping)

Summary:
Add a cmake check for sys/resource.h and replace the __has_include() check with its result, in order to make it possible to use rlimits when building with compilers not supporting __has_include() -- i.e. when bootstrapping.

// Please also re-apply dfcd52eb1d8e5d322404b40414cb7331c7380a8c (llvm-config.h fix)

Patch by: Michał Górny

Reviewers: rsmith, beanz

Subscribers: cfe-commits

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

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

8 years agoRemove two dos line endings.
Nico Weber [Tue, 23 Aug 2016 19:59:55 +0000 (19:59 +0000)]
Remove two dos line endings.

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

8 years agoFix regression introduced by r279164: only pass definitions as the PatternDef
Richard Smith [Tue, 23 Aug 2016 19:41:39 +0000 (19:41 +0000)]
Fix regression introduced by r279164: only pass definitions as the PatternDef
to DiagnoseUninstantiableTemplate, teach hasVisibleDefinition to correctly
determine whether a function definition is visible, and mark both the function
and the template as visible when merging function template definitions to
provide hasVisibleDefinition with the relevant information.

The change to always pass the right declaration as the PatternDef to
DiagnoseUninstantiableTemplate also caused those checks to happen before other
diagnostics in InstantiateFunctionDefinition, giving worse diagnostics for the
same situations, so I sunk the relevant diagnostics into
DiagnoseUninstantiableTemplate. Those parts of this patch are based on changes
in reviews.llvm.org/D23492 by Vassil Vassilev.

This reinstates r279486, reverted in r279500, with a fix to
DiagnoseUninstantiableTemplate to only mark uninstantiable explicit
instantiation declarations as invalid if we actually diagnosed them. (When we
trigger an explicit instantiation of a class member from an explicit
instantiation declaration for the class, it's OK if there is no corresponding
definition and we certainly don't want to mark the member invalid in that
case.) This previously caused a build failure during bootstrap.

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

8 years agoclang-cl: Make /Brepro actually work.
Nico Weber [Tue, 23 Aug 2016 19:32:02 +0000 (19:32 +0000)]
clang-cl: Make /Brepro actually work.

/Brepro means we want reproducible builds, i.e. we _don't_ want the timestamp
that's needed to be compatible with the incremental linker.

https://reviews.llvm.org/D23805

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

8 years agoARM-Darwin: ignore and diagnose attempts to omit frame pointer.
Tim Northover [Tue, 23 Aug 2016 18:12:58 +0000 (18:12 +0000)]
ARM-Darwin: ignore and diagnose attempts to omit frame pointer.

iOS (and other 32-bit ARM variants) always require a valid frame pointer to
improve backtraces. Previously the -fomit-frame-pointer and
-momit-leaf-frame-pointer options were being silently discarded via hacks in
the backend. It's better if Clang configures itself to emit the correct IR and
warns about (ignored) attempts to override this.

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

8 years agoclang-cl: Accept MSVC 2015's `/source-charset:utf-8` flag.
Nico Weber [Tue, 23 Aug 2016 16:47:09 +0000 (16:47 +0000)]
clang-cl: Accept MSVC 2015's `/source-charset:utf-8` flag.

clang already treats all inputs as utf-8. Warn if anything but utf-8 is passed.

Do this by mapping source-charset to finput-charset, which already behaves like
this. Slightly tweak finput-charset to accept "utf-8" case-insensitively. This
matches gcc's and cl.exe's behavior, and IANA says that character set names are
case-insensitive.

https://reviews.llvm.org/D23807

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

8 years ago[analyzer] Fix CloneDetector crash on calling methods of class templates.
Artem Dergachev [Tue, 23 Aug 2016 16:42:00 +0000 (16:42 +0000)]
[analyzer] Fix CloneDetector crash on calling methods of class templates.

If a call expression represents a method call of a class template,
and the method itself isn't templated, then the method may be considered
to be a template instantiation without template specialization arguments.

No longer crash when we could not find template specialization arguments.

Patch by Raphael Isemann!

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

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

8 years agoRevert r279486 "Fix regression introduced by r279164"
Chandler Carruth [Tue, 23 Aug 2016 02:00:51 +0000 (02:00 +0000)]
Revert r279486 "Fix regression introduced by r279164"

Build bots seem unhappy and as Richard was leaving he asked me to revert
this for him. Doing so.

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

8 years agoTypo.
Adrian Prantl [Mon, 22 Aug 2016 22:38:18 +0000 (22:38 +0000)]
Typo.

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

8 years agoAdd comments. NFC
Adrian Prantl [Mon, 22 Aug 2016 22:38:16 +0000 (22:38 +0000)]
Add comments. NFC

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

8 years agoAdd the second half of the testcase I should have added in 279485.
Adrian Prantl [Mon, 22 Aug 2016 22:30:34 +0000 (22:30 +0000)]
Add the second half of the testcase I should have added in 279485.

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

8 years agoFix regression introduced by r279164: only pass definitions as the PatternDef
Richard Smith [Mon, 22 Aug 2016 22:25:03 +0000 (22:25 +0000)]
Fix regression introduced by r279164: only pass definitions as the PatternDef
to DiagnoseUninstantiableTemplate, teach hasVisibleDefinition to correctly
determine whether a function definition is visible, and mark both the function
and the template as visible when merging function template definitions to
provide hasVisibleDefinition with the relevant information.

The change to always pass the right declaration as the PatternDef to
DiagnoseUninstantiableTemplate also caused those checks to happen before other
diagnostics in InstantiateFunctionDefinition, giving worse diagnostics for the
same situations, so I sunk the relevant diagnostics into
DiagnoseUninstantiableTemplate. Those parts of this patch are based on changes
in reviews.llvm.org/D23492 by Vassil Vassilev.

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

8 years agoModule debug info: Don't assert when encountering an incomplete definition
Adrian Prantl [Mon, 22 Aug 2016 22:23:58 +0000 (22:23 +0000)]
Module debug info: Don't assert when encountering an incomplete definition
in isDefinedInClangModule() and assume that the incomplete definition
is not defined in the module.

This broke the -gmodules self host recently.
rdar://problem/27894367

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

8 years ago[SemaObjC] Do not RebuildObjCMessageExpr without valid method decl
Bruno Cardoso Lopes [Mon, 22 Aug 2016 21:50:22 +0000 (21:50 +0000)]
[SemaObjC] Do not RebuildObjCMessageExpr without valid method decl

Fix crash-on-invalid in ObjC Sema by avoiding to rebuild a message
expression to a 'super' class in case the method to call does not exist
(i.e. comes from another missing identifier).

In this case, the typo transform is invoked upon the message expression
in an attempt to solve a typo in a 'super' call parameters, but it
crashes since it assumes the method to call has a valid declaration.

rdar://problem/27305403

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

8 years ago[AST] Remove unused function, to silence a GCC7 warning.
Davide Italiano [Mon, 22 Aug 2016 21:33:12 +0000 (21:33 +0000)]
[AST] Remove unused function, to silence a GCC7 warning.

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

8 years ago[GraphTraits] Replace all NodeType usage with NodeRef
Tim Shen [Mon, 22 Aug 2016 21:09:30 +0000 (21:09 +0000)]
[GraphTraits] Replace all NodeType usage with NodeRef

This should finish the GraphTraits migration.

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

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

8 years agoAMDGPU: Handle structs directly in AMDGPUABIInfo
Matt Arsenault [Mon, 22 Aug 2016 19:25:59 +0000 (19:25 +0000)]
AMDGPU: Handle structs directly in AMDGPUABIInfo

Structs are currently handled as pointer + byval, which makes AMDGPU
LLVM backend generate incorrect code when structs are used. This patch
changes struct argument to be handled directly and without flattening,
which Clover (Mesa 3D Gallium OpenCL state tracker) will be able to
handle. Flattening would expand the struct to individual elements and
pass each as a separate argument, which Clover can not
handle. Furthermore, such expansion does not fit the OpenCL
programming model which requires to explicitely specify each argument
index, size and memory location.

Patch by Vedran Miletić

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

8 years agoADT: Remove uses of ilist_*sentinel_traits, NFC
Duncan P. N. Exon Smith [Mon, 22 Aug 2016 18:57:44 +0000 (18:57 +0000)]
ADT: Remove uses of ilist_*sentinel_traits, NFC

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

8 years ago[CUDA] Collapsed offload actions should not be top-level jobs.
Artem Belevich [Mon, 22 Aug 2016 18:50:34 +0000 (18:50 +0000)]
[CUDA] Collapsed offload actions should not be top-level jobs.

If they are, we end up with the last intermediary output preserved
in the current directory after compilation.

Added a test case to verify that we're using appropriate filenames
for outputs of different phases.

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

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

8 years agoPR29086: DebugInfo: Improve support for fixed array dimensions in variable length...
David Blaikie [Mon, 22 Aug 2016 17:49:56 +0000 (17:49 +0000)]
PR29086: DebugInfo: Improve support for fixed array dimensions in variable length arrays

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

8 years agoRemove redundant test
David Blaikie [Mon, 22 Aug 2016 17:49:50 +0000 (17:49 +0000)]
Remove redundant test

test/CodeGenCXX/debug-info-zero-length-arrays.cpp tests this
functionality more comprehensively

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

8 years agoclang-format: [JS] supports casts to types starting with punctuation ("{[(").
Martin Probst [Mon, 22 Aug 2016 14:23:30 +0000 (14:23 +0000)]
clang-format: [JS] supports casts to types starting with punctuation ("{[(").

Before:

    x as{x: number}

After:

    x as {x: number}

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

8 years agoReapply "[analyzer] Added valist related checkers."
Gabor Horvath [Mon, 22 Aug 2016 11:21:30 +0000 (11:21 +0000)]
Reapply "[analyzer] Added valist related checkers."

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

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

8 years ago[analyzer] Correctly add assumptions based on array bounds.
Gabor Horvath [Mon, 22 Aug 2016 10:07:32 +0000 (10:07 +0000)]
[analyzer] Correctly add assumptions based on array bounds.

Also simplify the constraints generated by the checker.

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

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

8 years agoTest commit (Removing trailing whitespace).
Elad Cohen [Mon, 22 Aug 2016 07:34:21 +0000 (07:34 +0000)]
Test commit (Removing trailing whitespace).

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

8 years ago[X86][AVX512F] minor fix of the parameter names
Asaf Badouh [Sun, 21 Aug 2016 07:56:47 +0000 (07:56 +0000)]
[X86][AVX512F] minor fix of the parameter names
add "__" prefix

Bug 28842 https://llvm.org/bugs/show_bug.cgi?id=29040

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

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

8 years agoWdocumentation fix
Simon Pilgrim [Sat, 20 Aug 2016 20:21:27 +0000 (20:21 +0000)]
Wdocumentation fix

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

8 years ago[analyzer] Use faster hashing (MD5) in CloneDetector.
Artem Dergachev [Sat, 20 Aug 2016 17:35:53 +0000 (17:35 +0000)]
[analyzer] Use faster hashing (MD5) in CloneDetector.

This replaces the old approach of fingerprinting every AST node into a string,
which avoided collisions and was simple to implement, but turned out to be
extremely ineffective with respect to both performance and memory.

The collisions are now dealt with in a separate pass, which no longer causes
performance problems because collisions are rare.

Patch by Raphael Isemann!

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

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

8 years ago[Sema] Don't crash on scanf on forward-declared enums.
Benjamin Kramer [Sat, 20 Aug 2016 16:51:33 +0000 (16:51 +0000)]
[Sema] Don't crash on scanf on forward-declared enums.

This is valid in GNU C, which allows pointers to incomplete enums. GCC
just pretends that the underlying type is 'int' in those cases, follow
that behavior.

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

8 years agoPR28423: Compare primary declaration contexts.
Vassil Vassilev [Sat, 20 Aug 2016 14:50:22 +0000 (14:50 +0000)]
PR28423: Compare primary declaration contexts.

In certain cases (mostly coming from modules), Sema's idea of the StdNamespace
does not point to the first declaration of namespace std.

Patch by Cristina Cristescu!

Reviewed by Richard Smith.

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

8 years ago[analyzer] Make CloneDetector consider macro expansions.
Artem Dergachev [Sat, 20 Aug 2016 10:06:59 +0000 (10:06 +0000)]
[analyzer] Make CloneDetector consider macro expansions.

So far macro-generated code was treated by the CloneDetector as normal code.
This caused that some macros where reported as false-positive clones because
large chunks of code coming from otherwise concise macro expansions were treated
as copy-pasted code.

This patch ensures that macros are treated in the same way as literals/function
calls. This prevents macros that expand into multiple statements
from being reported as clones.

Patch by Raphael Isemann!

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

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

8 years ago[analyzer] Make CloneDetector consider template arguments.
Artem Dergachev [Sat, 20 Aug 2016 09:57:21 +0000 (09:57 +0000)]
[analyzer] Make CloneDetector consider template arguments.

For example, code samples `isa<Stmt>(S)' and `isa<Expr>(S)'
are no longer considered to be clones.

Patch by Raphael Isemann!

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

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

8 years agoRevert r279351 and r279357 due to bot failures
Manman Ren [Sat, 20 Aug 2016 03:00:54 +0000 (03:00 +0000)]
Revert r279351 and r279357 due to bot failures

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

8 years agoFix windows bot
Manman Ren [Sat, 20 Aug 2016 02:28:15 +0000 (02:28 +0000)]
Fix windows bot

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

8 years ago[NFC] Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.
Manman Ren [Sat, 20 Aug 2016 00:04:21 +0000 (00:04 +0000)]
[NFC] Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.

This is in preparation of adding a new type class ObjCTypeParamType that
can take protocol qualifiers. ObjCProtocolQualifiers will be shared between
ObjCObjectType and ObjCTypeParamType.

rdar://24619481
rdar://25060179

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

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

8 years ago[Driver] Remove unused #include of llvm/Support/config.h
Vedant Kumar [Fri, 19 Aug 2016 23:15:35 +0000 (23:15 +0000)]
[Driver] Remove unused #include of llvm/Support/config.h

This is a follow-up to r279112 (which removed the need for the header)
and in the same spirit as r279035 (which attempted to un-break
out-of-tree builds).

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

8 years ago[www] Add nullability questions to analyzer FAQ.
Devin Coughlin [Fri, 19 Aug 2016 22:04:45 +0000 (22:04 +0000)]
[www] Add nullability questions to analyzer FAQ.

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

8 years ago[CallGraph] Use decltype instead of pointer_to_unary_function. NFC.
Tim Shen [Fri, 19 Aug 2016 21:52:42 +0000 (21:52 +0000)]
[CallGraph] Use decltype instead of pointer_to_unary_function. NFC.

Reviewers: dblaikie

Subscribers: cfe-commits

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

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

8 years ago[GraphTraits] Make nodes_iterator dereference to NodeType*/NodeRef
Tim Shen [Fri, 19 Aug 2016 21:20:13 +0000 (21:20 +0000)]
[GraphTraits] Make nodes_iterator dereference to NodeType*/NodeRef

Currently nodes_iterator may dereference to a NodeType* or a NodeType&. Make them all dereference to NodeType*, which is NodeRef later.

Differential Revision: https://reviews.llvm.org/D23704
Differential Revision: https://reviews.llvm.org/D23705

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

8 years agoclang-format: [JS] handle object literals with casts.
Martin Probst [Fri, 19 Aug 2016 14:35:01 +0000 (14:35 +0000)]
clang-format: [JS] handle object literals with casts.

Summary: E.g. `{a: 1} as b`.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

8 years agoFixed a typo (compilation_commands.json --> compile_commands.json).
Andrey Bokhanko [Fri, 19 Aug 2016 13:36:31 +0000 (13:36 +0000)]
Fixed a typo (compilation_commands.json --> compile_commands.json).

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

8 years ago[AMDGPU] add s_incperflevel/s_decperflevel builtins
Valery Pykhtin [Fri, 19 Aug 2016 12:54:31 +0000 (12:54 +0000)]
[AMDGPU] add s_incperflevel/s_decperflevel builtins

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

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

8 years agoclang/test/Modules/prebuilt-module.m: Prune "-triple" to fix a configuration mismatch.
NAKAMURA Takumi [Fri, 19 Aug 2016 05:25:26 +0000 (05:25 +0000)]
clang/test/Modules/prebuilt-module.m: Prune "-triple" to fix a configuration mismatch.

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

8 years agoRe-commit [OpenCL] AMDGCN: Fix size_t type
Yaxun Liu [Fri, 19 Aug 2016 05:17:25 +0000 (05:17 +0000)]
Re-commit [OpenCL] AMDGCN: Fix size_t type

There was a premature cast to pointer type in emitPointerArithmetic which caused assertion in tests with assertion enabled.

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

8 years agoC++ Modules TS: support parsing the 'module' declaration (including extensions
Richard Smith [Fri, 19 Aug 2016 01:43:06 +0000 (01:43 +0000)]
C++ Modules TS: support parsing the 'module' declaration (including extensions
from p0273r0 approved by EWG). We'll eventually need to handle this from the
lexer as well, in order to disallow preprocessor directives preceding the
module declaration and to support macro import.

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

8 years ago[www] Add analyzer FAQ about not releasing ivars in -dealloc.
Devin Coughlin [Fri, 19 Aug 2016 01:22:50 +0000 (01:22 +0000)]
[www] Add analyzer FAQ about not releasing ivars in -dealloc.

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

8 years ago[analyzer] Weaken assertion in trackNullOrUndefValue()
Devin Coughlin [Fri, 19 Aug 2016 01:05:31 +0000 (01:05 +0000)]
[analyzer] Weaken assertion in trackNullOrUndefValue()

We should ignore paren casts when making sure that the semantic expression
in a PseudoObjectExpr for an ObjC getter is a message send.

This has no other intended functionality change.

Adding a test for this exposed an interesting issue in another test case
that only manifests under ARC. trackNullOrUndefValue() is not properly
suppressing for nil values that are the result of nil propagation from a nil
receiver when the nil is returned from a function. I've added a FIXME for that
missing suppression.

rdar://problem/27290568

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

8 years agoAMDGPU: Add clang builtin for ds_swizzle.
Changpeng Fang [Thu, 18 Aug 2016 22:04:54 +0000 (22:04 +0000)]
AMDGPU: Add clang builtin for ds_swizzle.

Summary:
  int __builtin_amdgcn_ds_swizzle (int a, int imm);
while imm is a constant.

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

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

8 years agoPR28794: Don't try to instantiate function templates which are not visible.
Vassil Vassilev [Thu, 18 Aug 2016 22:01:25 +0000 (22:01 +0000)]
PR28794: Don't try to instantiate function templates which are not visible.

Reviewed by Richard Smith.

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

8 years agoC++ Modules TS: Add parsing support for module import declaration.
Richard Smith [Thu, 18 Aug 2016 21:59:42 +0000 (21:59 +0000)]
C++ Modules TS: Add parsing support for module import declaration.

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

8 years agoCodeGen: Rename a variable to better fit LLVM style. NFC
Justin Bogner [Thu, 18 Aug 2016 21:46:54 +0000 (21:46 +0000)]
CodeGen: Rename a variable to better fit LLVM style. NFC

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

8 years agoCodeGen: use range based for loop, NFC
Saleem Abdulrasool [Thu, 18 Aug 2016 21:40:06 +0000 (21:40 +0000)]
CodeGen: use range based for loop, NFC

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

8 years agoFixed more signed/unsigned mismatch warnings introduced in my change at r279076
Cameron Desrochers [Thu, 18 Aug 2016 20:56:48 +0000 (20:56 +0000)]
Fixed more signed/unsigned mismatch warnings introduced in my change at r279076

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

8 years ago[CUDA] Improve handling of math functions.
Justin Lebar [Thu, 18 Aug 2016 20:43:13 +0000 (20:43 +0000)]
[CUDA] Improve handling of math functions.

Summary:
A bunch of related changes here to our CUDA math headers.

- The second arg to nexttoward is a double (well, technically, long
  double, but we don't have that), not a float.

- Add a forward-declare of llround(float), which is defined in the CUDA
  headers.  We need this for the same reason we need most of the other
  forward-declares: To prevent a constexpr function in our standard
  library from becoming host+device.

- Add nexttowardf implementation.

- Pull "foobarf" functions defined by the CUDA headers in the global
  namespace into namespace std.  This lets you do e.g. std::sinf.

- Add overloads for math functions accepting integer types.  This lets
  you do e.g. std::sin(0) without having an ambiguity between the
  overload that takes a float and the one that takes a double.

With these changes, we pass testcases derived from libc++ for cmath and
math.h.  We can check these testcases in to the test-suite once support
for CUDA lands there.

Reviewers: tra

Subscribers: cfe-commits

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

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

8 years agoRevert [OpenCL] AMDGCN: Fix size_t type
Yaxun Liu [Thu, 18 Aug 2016 20:01:06 +0000 (20:01 +0000)]
Revert [OpenCL] AMDGCN: Fix size_t type

due to regressions in test/CodeGen/exprs.c on certain platforms.

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

8 years agoFix json compilation database syntax on non-Windows.
Zachary Turner [Thu, 18 Aug 2016 19:42:00 +0000 (19:42 +0000)]
Fix json compilation database syntax on non-Windows.

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

8 years ago[OpenCL] AMDGCN: Fix size_t type
Yaxun Liu [Thu, 18 Aug 2016 19:34:04 +0000 (19:34 +0000)]
[OpenCL] AMDGCN: Fix size_t type

Pointers of certain GPUs in AMDGCN target in private address space is 32 bit but pointers in other address spaces are 64 bit. size_t type should be defined as 64 bit for these GPUs so that it could hold pointers in all address spaces. Also fixed issues in pointer arithmetic codegen by using pointer specific intptr type.

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

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

8 years agoResubmit "[Tooling] Parse compilation database command lines on Windows."
Zachary Turner [Thu, 18 Aug 2016 19:31:48 +0000 (19:31 +0000)]
Resubmit "[Tooling] Parse compilation database command lines on Windows."

This patch introduced the ability to decide at runtime whether to parse
JSON compilation database command lines using Gnu syntax or Windows
syntax.  However, there were many existing unit tests written that
hardcoded Gnu-specific paths.  These tests were now failing because
the auto-detection logic was choosing to parse them using Windows
rules.

This resubmission of the patch fixes this by introducing an enum
which defines the syntax mode, which defaults to auto-detect, but
for which the unit tests force Gnu style parsing.

Reviewed By: alexfh
Differential Revision: https://reviews.llvm.org/D23628

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

8 years ago[MS] Silence -Wextern-init on const selectany variables
Reid Kleckner [Thu, 18 Aug 2016 18:45:07 +0000 (18:45 +0000)]
[MS] Silence -Wextern-init on const selectany variables

In C, 'extern' is typically used to avoid tentative definitions when
declaring variables in headers, but adding an intializer makes it a
defintion. This is somewhat confusing, so GCC and Clang both warn on it.
In C++, 'extern' is often used to give implictly static 'const'
variables external linkage, so don't warn in that case. If selectany is
present, this might be header code intended for C and C++ inclusion, so
apply the C++ rules.

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

8 years agoRemoved use of 'emplace' on std::map, since not all buildbot slaves support it
Cameron Desrochers [Thu, 18 Aug 2016 18:41:41 +0000 (18:41 +0000)]
Removed use of 'emplace' on std::map, since not all buildbot slaves support it

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

8 years agoUse __has_include rather than a configure-time macro to determine if
Richard Smith [Thu, 18 Aug 2016 18:22:22 +0000 (18:22 +0000)]
Use __has_include rather than a configure-time macro to determine if
<sys/resource.h> is available. This should fix out-of-tree builds, at the cost
of not providing the higher rlimits to stage 1 clang when built with an old
host compiler not implementing this feature yet (bootstrap builds should be
fine, though).

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

8 years agoRevert "[Driver] Use llvm-config.h, not config.h to unbreak out-of-tree builds"
Vedant Kumar [Thu, 18 Aug 2016 17:43:02 +0000 (17:43 +0000)]
Revert "[Driver] Use llvm-config.h, not config.h to unbreak out-of-tree builds"

This reverts commit r279035. According to Richard Smith, llvm-config.h
does not contain the right definitions.

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

8 years agoModule: add -fprebuilt-module-path to support loading prebuilt modules.
Manman Ren [Thu, 18 Aug 2016 17:42:15 +0000 (17:42 +0000)]
Module: add -fprebuilt-module-path to support loading prebuilt modules.

In this mode, there is no need to load any module map and the programmer can
simply use "@import" syntax to load the module directly from a prebuilt
module path. When loading from prebuilt module path, we don't support
rebuilding of the module files and we ignore compatible configuration
mismatches.

rdar://27290316
Differential Revision: http://reviews.llvm.org/D23125

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

8 years ago[libclang] Added missing entry for newly introduced 'clang_getAllSkippedRanges' to...
Cameron Desrochers [Thu, 18 Aug 2016 17:18:03 +0000 (17:18 +0000)]
[libclang] Added missing entry for newly introduced 'clang_getAllSkippedRanges' to libclang.exports

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

8 years ago[libclang] Fixed signed/unsigned comparison warning introduced in my revision r279076
Cameron Desrochers [Thu, 18 Aug 2016 16:25:42 +0000 (16:25 +0000)]
[libclang] Fixed signed/unsigned comparison warning introduced in my revision r279076

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

8 years ago[libclang] Add clang_getAllSkippedRanges function
Cameron Desrochers [Thu, 18 Aug 2016 15:43:55 +0000 (15:43 +0000)]
[libclang] Add clang_getAllSkippedRanges function

This complements the clang_getSkippedRanges function which returns skipped ranges filtered by a specific file.

This function is useful when all the ranges are desired (and a lot more efficient than the equivalent of asking for the ranges file by file, since the implementation of clang_getSkippedRanges iterates over all ranges anyway).

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

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

8 years ago[analyzer] Teach CloneDetector to find clones that look like copy-paste errors.
Artem Dergachev [Thu, 18 Aug 2016 12:29:41 +0000 (12:29 +0000)]
[analyzer] Teach CloneDetector to find clones that look like copy-paste errors.

The original clone checker tries to find copy-pasted code that is exactly
identical to the original code, up to minor details.

As an example, if the copy-pasted code has all references to variable 'a'
replaced with references to variable 'b', it is still considered to be
an exact clone.

The new check finds copy-pasted code in which exactly one variable seems
out of place compared to the original code, which likely indicates
a copy-paste error (a variable was forgotten to be renamed in one place).

Patch by Raphael Isemann!

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

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

8 years agoCorrect the documentation for isSignedInteger() and isUnsignedInteger().
Aaron Ballman [Thu, 18 Aug 2016 12:26:17 +0000 (12:26 +0000)]
Correct the documentation for isSignedInteger() and isUnsignedInteger().

Patch by Visoiu Mistrih Francis

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

8 years agoRevert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma"
Diana Picus [Thu, 18 Aug 2016 09:25:07 +0000 (09:25 +0000)]
Revert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma"

This reverts commit r279003 as it breaks some of our buildbots (e.g.
clang-cmake-aarch64-quick, clang-x86_64-linux-selfhost-modules).

The error is in OpenMP/teams_distribute_simd_ast_print.cpp:
clang: /home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/include/llvm/ADT/DenseMap.h:527:
bool llvm::DenseMapBase<DerivedT, KeyT, ValueT, KeyInfoT, BucketT>::LookupBucketFor(const LookupKeyT&, const BucketT*&) const
[with LookupKeyT = clang::Stmt*; DerivedT = llvm::DenseMap<clang::Stmt*, long unsigned int>;
      KeyT = clang::Stmt*; ValueT = long unsigned int;
      KeyInfoT = llvm::DenseMapInfo<clang::Stmt*>;
      BucketT = llvm::detail::DenseMapPair<clang::Stmt*, long unsigned int>]:
Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) &&
"Empty/Tombstone value shouldn't be inserted into map!"' failed.

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

8 years agorevert [analyzer] Added valist related checkers.
Gabor Horvath [Thu, 18 Aug 2016 09:13:37 +0000 (09:13 +0000)]
revert [analyzer] Added valist related checkers.

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