]> granicus.if.org Git - clang/log
clang
7 years agoFix implicit-fallthrough warning by adding missing break
Simon Pilgrim [Sun, 24 Sep 2017 15:17:46 +0000 (15:17 +0000)]
Fix implicit-fallthrough warning by adding missing break

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

7 years agoDon't warn about runtime behavior problems in variable initializers that we
Richard Smith [Sat, 23 Sep 2017 18:27:11 +0000 (18:27 +0000)]
Don't warn about runtime behavior problems in variable initializers that we
know are going to be constant-evaluated.

Any relevant diagnostics should be produced by constant expression evaluation.

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

7 years agoSilence unused variable warning in Release builds.
Benjamin Kramer [Sat, 23 Sep 2017 16:08:48 +0000 (16:08 +0000)]
Silence unused variable warning in Release builds.

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

7 years ago[docs] Fix typos in Clang's User's Manual.
Reka Kovacs [Sat, 23 Sep 2017 12:13:32 +0000 (12:13 +0000)]
[docs] Fix typos in Clang's User's Manual.

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

7 years agoPromote storage-only __fp16 vector operands to float vectors.
Akira Hatanaka [Sat, 23 Sep 2017 05:02:02 +0000 (05:02 +0000)]
Promote storage-only __fp16 vector operands to float vectors.

This commit fixes a bug in the handling of storage-only __fp16 vectors
where clang didn't promote __fp16 vector operands to float vectors.

Conceptually, it performs the following transformation on the AST in
CreateBuiltinBinOp and CreateBuiltinUnaryOp:

(Before)
  typedef __fp16 half4 __attribute__ ((vector_size (8)));
  typedef float float4 __attribute__ ((vector_size (16)));
  half4 hv0, hv1, hv2, hv3;

  hv0 = hv1 + hv2 + hv3;

(After)
  float4 t0 = (float4)hv1 + (float4)hv2;
  float4 t1 = t0 + (float4)hv3;
  hv0 = (half4)t1;

Note that this commit fixes the bug for targets that set
HalfArgsAndReturns to true (ARM and ARM64). Targets using intrinsics
such as llvm.convert.to.fp16 to handle __fp16 are still broken.

rdar://problem/20625184

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

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

7 years agoCorrectly compute linkage for members of internal linkage classes.
Richard Smith [Sat, 23 Sep 2017 04:02:17 +0000 (04:02 +0000)]
Correctly compute linkage for members of internal linkage classes.

We used to give such members no linkage instead of giving them the linkage of
the class.

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

7 years agoCommit missing fixes for tool_file_rename
Reid Kleckner [Sat, 23 Sep 2017 01:04:42 +0000 (01:04 +0000)]
Commit missing fixes for tool_file_rename

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

7 years ago[Support] Rename tool_output_file to ToolOutputFile, NFC
Reid Kleckner [Sat, 23 Sep 2017 01:03:17 +0000 (01:03 +0000)]
[Support] Rename tool_output_file to ToolOutputFile, NFC

This class isn't similar to anything from the STL, so it shouldn't use
the STL naming conventions.

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

7 years ago[Analyzer] Fix minor errors in python scripts.
George Karpenkov [Fri, 22 Sep 2017 22:58:46 +0000 (22:58 +0000)]
[Analyzer] Fix minor errors in python scripts.

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

7 years agoDR1113: anonymous namespaces formally give their contents internal linkage.
Richard Smith [Fri, 22 Sep 2017 22:21:44 +0000 (22:21 +0000)]
DR1113: anonymous namespaces formally give their contents internal linkage.

This doesn't affect our code generation in any material way -- we already give
such declarations internal linkage from a codegen perspective -- but it has
some subtle effects on code validity.

We suppress the 'L' (internal linkage) marker for mangled names in anonymous
namespaces, because it is redundant (the information is already carried by the
namespace); this deviates from GCC's behavior if a variable or function in an
anonymous namespace is redundantly declared 'static' (where GCC does include
the 'L'), but GCC's behavior is incoherent because such a declaration can be
validly declared with or without the 'static'.

We still deviate from the standard in one regard here: extern "C" declarations
in anonymous namespaces are still granted external linkage. Changing those does
not appear to have been an intentional consequence of the standard change in
DR1113.

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

7 years ago[test] Enable clang-func-mapping as a test dep with the analyzer
Vedant Kumar [Fri, 22 Sep 2017 22:17:10 +0000 (22:17 +0000)]
[test] Enable clang-func-mapping as a test dep with the analyzer

clang-func-mapping should not be a test dependency when the static
analyzer isn't being built.

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

7 years agoFix unused variable warning in non-debug builds.
Richard Trieu [Fri, 22 Sep 2017 22:16:13 +0000 (22:16 +0000)]
Fix unused variable warning in non-debug builds.

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

7 years agoclang-format plugin: Add missing NL (new line) at EOF (end of file)
Hans Wennborg [Fri, 22 Sep 2017 21:47:39 +0000 (21:47 +0000)]
clang-format plugin: Add missing NL (new line) at EOF (end of file)

clang-format.exe removes trailing new lines at end of file.

However, if no NL is found at EOF one should be added.

Patch by Teodor MICU!

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

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

7 years ago[CodeGen][ObjC] Build the global block structure before emitting the
Akira Hatanaka [Fri, 22 Sep 2017 21:32:06 +0000 (21:32 +0000)]
[CodeGen][ObjC] Build the global block structure before emitting the
body of global block invoke functions.

This commit fixes an infinite loop in IRGen that occurs when compiling
the following code:

void FUNC2() {
  static void (^const block1)(int) = ^(int a){
    if (a--)
      block1(a);
  };
}

This is how IRGen gets stuck in the infinite loop:

1. GenerateBlockFunction is called to emit the body of "block1".

2. GetAddrOfGlobalBlock is called to get the address of "block1". The
   function calls getAddrOfGlobalBlockIfEmitted to check whether the
   global block has been emitted. If it hasn't been emitted, it then
   tries to emit the body of the block function by calling
   GenerateBlockFunction, which goes back to step 1.

This commit prevents the inifinite loop by building the global block in
GenerateBlockFunction before emitting the body of the block function.

rdar://problem/34541684

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

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

7 years ago[clang] Fix isExternC matcher docs
Alexander Shaposhnikov [Fri, 22 Sep 2017 19:29:38 +0000 (19:29 +0000)]
[clang] Fix isExternC matcher docs

The wording in the documentation for the matcher isExternC
appears to be misleading since this matcher
is applicable to functions and variables as well.
This diff changes the comment and regenerates the html file.

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

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

7 years agoSet completion priority of destructors and operators to CCP_Unlikely.
Ilya Biryukov [Fri, 22 Sep 2017 19:07:37 +0000 (19:07 +0000)]
Set completion priority of destructors and operators to CCP_Unlikely.

Summary:
It will move destructors and operators to the end of completion list.
Destructors and operators are currently very high on the completion
list, as they have the same priority as member functions. However,
they are clearly not something users usually choose in completion
lists.

Reviewers: arphaman, erikjv, bkramer, krasimir

Reviewed By: arphaman

Subscribers: eraman, klimek, cfe-commits

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

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

7 years ago[lit.cfg] Avoid concatenating which(clang-func-mapping) if it's missing
Vedant Kumar [Fri, 22 Sep 2017 18:42:28 +0000 (18:42 +0000)]
[lit.cfg] Avoid concatenating which(clang-func-mapping) if it's missing

This un-breaks a lit workflow where you run lit tests from a test
sub-directory within clang without first building clang-func-mapping.

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

7 years ago[clang] Fix printf fixit for objc specific types
Alexander Shaposhnikov [Fri, 22 Sep 2017 18:36:06 +0000 (18:36 +0000)]
[clang] Fix printf fixit for objc specific types

For the triple thumbv7-apple-ios8.0.0 ssize_t is long and size_t is unsigned long,
while NSInteger is int and NSUinteger is unsigned int. Following
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
Clang catches it and insert a cast to long, for example
 printf("%zd", getNSInteger())
will be replaced with
 printf("%zd", (long)getNSInteger())
but since the underlying type of ssize_t is long the specifier "%zd" is not getting replaced.
This diff changes this behavior to enable replacing the specifier "%zd" with the correct one.

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

Test plan: make check-all

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

7 years agobindings: expose Linkage to the python bindings
Saleem Abdulrasool [Fri, 22 Sep 2017 18:35:09 +0000 (18:35 +0000)]
bindings: expose Linkage to the python bindings

Add Python bindings for the 'clang_getCursorLinkage', and tests to
validate the functionality.

Patch by Masud Rahman!

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

7 years ago[Coverage] Add an option to emit limited coverage info
Vedant Kumar [Fri, 22 Sep 2017 18:23:04 +0000 (18:23 +0000)]
[Coverage] Add an option to emit limited coverage info

Add an option to emit limited coverage info for unused decls. It's just a
cl::opt for now to allow us to experiment quickly.

When building llc, this results in an 84% size reduction in the llvm_covmap
section, and a similar size reduction in the llvm_prf_names section. In
practice I expect the size reduction to be roughly quadratic with the size of
the program.

The downside is that coverage for headers will no longer be complete. This will
make the line/function/region coverage metrics incorrect, since they will be
artificially high. One mitigation would be to somehow disable those metrics
when using limited-coverage=true.

This is related to: llvm.org/PR34533 (make SourceBasedCodeCoverage scale)

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

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

7 years ago[index] Generate class & metaclass manglings for objc
Dave Lee [Fri, 22 Sep 2017 16:58:57 +0000 (16:58 +0000)]
[index] Generate class & metaclass manglings for objc

Summary:
ObjC classes have two associated symbols, one for the class and one for the
metaclass.

This change overloads `CodegenNameGenerator::getAllManglings` to produce both
class and metaclass symbols.

While this function is called by `clang_Cursor_getCXXManglings`, it's only
called for CXXRecordDecl and CXXMethodDecl, and so libclang's behavior is
unchanged.

Reviewers: arphaman, abdulras, alexshap, compnerd

Reviewed By: compnerd

Subscribers: compnerd

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

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

7 years ago[OPENMP] Handle re-declaration of captured variables in CodeGen.
Alexey Bataev [Fri, 22 Sep 2017 16:56:13 +0000 (16:56 +0000)]
[OPENMP] Handle re-declaration of captured variables in CodeGen.

If the captured variable has re-declaration we may end up with the
situation where the captured variable is the re-declaration while the
referenced variable is the canonical declaration (or vice versa). In
this case we may generate wrong code. Patch fixes this situation.

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

7 years ago[Atomic][X8664] set max atomic inline width according to the target
Wei Mi [Fri, 22 Sep 2017 16:30:00 +0000 (16:30 +0000)]
[Atomic][X8664] set max atomic inline width according to the target

This is to fix PR31620. MaxAtomicInlineWidth is set to 128 for x86_64. However
for target without cx16 support, 128 atomic operation will generate __sync_*
libcalls. The patch set MaxAtomicInlineWidth to 64 if the target doesn't support
cx16.

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

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

7 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Fri, 22 Sep 2017 16:26:17 +0000 (16:26 +0000)]
Fix unused variable warning. NFCI.

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

7 years agoAdd Cross Translation Unit support library
Gabor Horvath [Fri, 22 Sep 2017 11:11:01 +0000 (11:11 +0000)]
Add Cross Translation Unit support library

This patch introduces a class that can help to build tools that require cross
translation unit facilities. This class allows function definitions to be loaded
from external AST files based on an index. In order to use this functionality an
index is required. The index format is a flat text file but it might be
replaced with a different solution in the near future. USRs are used as names to
look up the functions definitions. This class also does caching to avoid
redundant loading of AST files.

Right now only function defnitions can be loaded using this API because this is
what the in progress cross translation unit feature of the Static Analyzer
requires. In to future this might be extended to classes, types etc.

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

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

7 years ago[analyzer] Add new delete with non-virtual destructor check
Gabor Horvath [Fri, 22 Sep 2017 10:16:33 +0000 (10:16 +0000)]
[analyzer] Add new delete with non-virtual destructor check

Patch by: Reka Nikolett Kovacs

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

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

7 years ago[clang-format] Ignore case and stable sort using-declarations
Krasimir Georgiev [Fri, 22 Sep 2017 04:48:17 +0000 (04:48 +0000)]
[clang-format] Ignore case and stable sort using-declarations

Summary:
This ignores case while sorting using-declarations, fixing a case where `_` would appear between lowercase and uppercase characters.
It also applies stable sort, so that replacements for the exact same using declarations are not generated.

Reviewers: klimek, alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

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

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

7 years agoClosure types have no name (and can't have a typedef name for linkage
Richard Smith [Fri, 22 Sep 2017 04:33:20 +0000 (04:33 +0000)]
Closure types have no name (and can't have a typedef name for linkage
purposes), so they never formally have linkage.

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

7 years agoGive external linkage and mangling to lambdas inside inline variables and variable...
Richard Smith [Fri, 22 Sep 2017 04:25:05 +0000 (04:25 +0000)]
Give external linkage and mangling to lambdas inside inline variables and variable templates.

This implements the proposed approach in https://github.com/itanium-cxx-abi/cxx-abi/issues/33

This reinstates r313827, reverted in r313856, with a fix for the 'out-of-bounds
enumeration value' ubsan error in that change.

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

7 years agoDriver: remove support for libstdc++ from CrossWindows
Saleem Abdulrasool [Fri, 22 Sep 2017 04:01:12 +0000 (04:01 +0000)]
Driver: remove support for libstdc++ from CrossWindows

This code path is entirely untested and not really maintained.  The
expected use here is with libc++ only.

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

7 years agoClean up some mistreatment of enumerations.
Richard Smith [Fri, 22 Sep 2017 02:22:32 +0000 (02:22 +0000)]
Clean up some mistreatment of enumerations.

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

7 years agoAdd test cases that weren't committed in r313945.
Akira Hatanaka [Fri, 22 Sep 2017 01:54:36 +0000 (01:54 +0000)]
Add test cases that weren't committed in r313945.

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

7 years ago[Analyzer] Static analyzer script for updating reference results
George Karpenkov [Fri, 22 Sep 2017 01:43:12 +0000 (01:43 +0000)]
[Analyzer] Static analyzer script for updating reference results

The script updates reference results from the previous run, and stages them.

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

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

7 years ago[Analyzer] Refactor analyzer testing scripts.
George Karpenkov [Fri, 22 Sep 2017 01:41:16 +0000 (01:41 +0000)]
[Analyzer] Refactor analyzer testing scripts.

 - Exporting needed function for future reuse.
 - Idiomatic python: using with `file as f` instead of `try/finally`.
 - Fixing some indentation issues.
 - No need to reinvent python `multiprocessing.getCPUCount()`
 - Removing a function parameter which is always the same under all invocations.
 - Adding some docstrings.

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

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

7 years agoFix tracking of whether a destructor would be deleted.
Richard Smith [Fri, 22 Sep 2017 01:04:22 +0000 (01:04 +0000)]
Fix tracking of whether a destructor would be deleted.

I've been unable to find any cases whose behavior is actually changed by this,
but only because an implicitly deleted destructor also results in it being
impossible to have a trivial (non-deleted) copy constructor, which the place
where this really matters (choosing whether to pass a class in registers)
happens to also check.

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

7 years agoAdd support for attribute 'noescape'.
Akira Hatanaka [Fri, 22 Sep 2017 00:41:05 +0000 (00:41 +0000)]
Add support for attribute 'noescape'.

The attribute informs the compiler that the annotated pointer parameter
of a function cannot escape and enables IRGen to attach attribute
'nocapture' to parameters that are annotated with the attribute. That is
the only optimization that currently takes advantage of 'noescape', but
there are other optimizations that will be added later that improves
IRGen for ObjC blocks.

This recommits r313722, which was reverted in r313725 because clang
couldn't build compiler-rt. It failed to build because there were
function declarations that were missing 'noescape'. That has been fixed
in r313929.

rdar://problem/19886775

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

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

7 years ago[Analyzer] Log when auto-synthesized body is used.
George Karpenkov [Fri, 22 Sep 2017 00:37:12 +0000 (00:37 +0000)]
[Analyzer] Log when auto-synthesized body is used.

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

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

7 years agoExtend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData.
Richard Smith [Fri, 22 Sep 2017 00:11:15 +0000 (00:11 +0000)]
Extend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData.

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

7 years agoResubmit "[lit] Refactor out some more common lit configuration code."
Zachary Turner [Thu, 21 Sep 2017 22:16:40 +0000 (22:16 +0000)]
Resubmit "[lit] Refactor out some more common lit configuration code."

There were two issues, one Python 3 specific related to Unicode,
and another which is that the tool substitution for lld no longer
rejected matches where a / preceded the tool name.

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

7 years ago[Analyzer] Use CC environment variable to select analyzer path in SATestBuild.
George Karpenkov [Thu, 21 Sep 2017 22:12:49 +0000 (22:12 +0000)]
[Analyzer] Use CC environment variable to select analyzer path in SATestBuild.

This change is required to easily test the given checkout of the analyzer,
rather than the one bundled with a system compiler.

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

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

7 years ago[Analyzer] Add simple help to SATestAdd.py
George Karpenkov [Thu, 21 Sep 2017 21:47:33 +0000 (21:47 +0000)]
[Analyzer] Add simple help to SATestAdd.py

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

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

7 years ago[Analyzer] Remove dead code from CmpRuns.py.
George Karpenkov [Thu, 21 Sep 2017 21:47:13 +0000 (21:47 +0000)]
[Analyzer] Remove dead code from CmpRuns.py.

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

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

7 years agoRevert "[lit] Refactor out some more common lit configuration code."
Zachary Turner [Thu, 21 Sep 2017 21:45:45 +0000 (21:45 +0000)]
Revert "[lit] Refactor out some more common lit configuration code."

This is breaking several bots.  I have enough information to
investigate, so I'm reverting to green until I get it figured
out.

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

7 years ago[lit] Refactor out some more common lit configuration code.
Zachary Turner [Thu, 21 Sep 2017 21:27:31 +0000 (21:27 +0000)]
[lit] Refactor out some more common lit configuration code.

debuginfo-tests has need to reuse a lot of common configuration
from clang and lld, and in general it seems like all of the
projects which are tightly coupled (e.g. lld, clang, llvm, lldb,
etc) can benefit from knowing about one other.  For example,
lldb needs to know various things about how to run clang in its
test suite.  Since there's a lot of common substitutions and
operations that need to be shared among projects, sinking this
up into LLVM makes sense.

In addition, this patch introduces a function add_tool_substitution
which handles all the dirty intricacies of matching tool names
which was previously copied around the various config files.  This
is now a simple straightforward interface which is hard to mess
up.

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

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

7 years ago[libclang] Keep track of TranslationUnit instance when annotating tokens
Jonathan Coe [Thu, 21 Sep 2017 20:48:43 +0000 (20:48 +0000)]
[libclang] Keep track of TranslationUnit instance when annotating tokens

Summary:
Previously the `_tu` was not propagated to the returned cursor, leading to errors when calling any
method on that cursor (e.g. `cursor.referenced`).

Reviewers: jbcoe, rsmith

Reviewed By: jbcoe

Subscribers: cfe-commits

Tags: #clang

Patch by jklaehn (Johann Klähn)

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

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

7 years agoRemove svn-properties for file added in 313909 (NFC)
Erich Keane [Thu, 21 Sep 2017 20:31:01 +0000 (20:31 +0000)]
Remove svn-properties for file added in 313909 (NFC)

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

7 years agoAdd testcase I forgot to add in R313907.
Erich Keane [Thu, 21 Sep 2017 20:14:08 +0000 (20:14 +0000)]
Add testcase I forgot to add in R313907.

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

7 years agoSuppress Wsign-conversion for enums with matching underlying type
Erich Keane [Thu, 21 Sep 2017 19:58:55 +0000 (19:58 +0000)]
Suppress Wsign-conversion for enums with matching underlying type

As reported here: https://bugs.llvm.org/show_bug.cgi?id=34692

A non-defined enum with a backing type was always defaulting to
being treated as a signed type. IN the case where it IS defined,
the signed-ness of the actual items is used.

This patch uses the underlying type's signed-ness in the non-defined
case to test signed-comparision.

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

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

7 years ago[Sema] Prevent InstantiateClass from checking unrelated exception specs.
Volodymyr Sapsai [Thu, 21 Sep 2017 19:54:12 +0000 (19:54 +0000)]
[Sema] Prevent InstantiateClass from checking unrelated exception specs.

Sema::InstantiateClass should check only exception specs added during
class instantiation and ignore already present delayed specs. This fixes
a case where we instantiate a class before parsing member initializers,
check exceptions for a different class and fail to find a member
initializer. Which is required for comparing exception specs for
explicitly-defaulted and implicit default constructor. With the fix we
are still checking exception specs but only after member initializers
are present.

Removing errors in crash-unparsed-exception.cpp is acceptable according
to discussion in PR24000 because other compilers accept code in
crash-unparsed-exception.cpp as valid.

rdar://problem/34167492

Reviewers: davide, rsmith

Reviewed By: rsmith

Subscribers: dim, cfe-commits

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

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

7 years ago[CUDA] Fixed order of words in the names of shfl builtins.
Artem Belevich [Thu, 21 Sep 2017 18:46:39 +0000 (18:46 +0000)]
[CUDA] Fixed order of words in the names of shfl builtins.

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

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

7 years ago[NVPTX] Implemented bar.warp.sync, barrier.sync, and vote{.sync} instructions/intrins...
Artem Belevich [Thu, 21 Sep 2017 18:44:49 +0000 (18:44 +0000)]
[NVPTX] Implemented bar.warp.sync, barrier.sync, and vote{.sync} instructions/intrinsics/builtins.

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

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

7 years ago[Sema] Fix using old initializer during switch statement transformation.
Volodymyr Sapsai [Thu, 21 Sep 2017 17:58:27 +0000 (17:58 +0000)]
[Sema] Fix using old initializer during switch statement transformation.

It fixes a crash in CodeGen when we are trying to generate code for
initializer expression created before template instantiation, like

    CallExpr '<dependent type>'
    |-UnresolvedLookupExpr '<overloaded function type>' lvalue (ADL) = 'parse'
    `-DeclRefExpr 'Buffer<N>' lvalue ParmVar 'buffer' 'Buffer<N>'

rdar://problem/33888545

Reviewers: rsmith, ahatanak

Reviewed By: ahatanak

Subscribers: aemerson, kristof.beyls, cfe-commits

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

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

7 years ago[fixup][Sema] Allow in C to define tags inside enumerations.
Volodymyr Sapsai [Thu, 21 Sep 2017 17:41:30 +0000 (17:41 +0000)]
[fixup][Sema] Allow in C to define tags inside enumerations.

Fix for too aggressive error err_type_defined_in_enum introduced in
r313386. Defining tags inside enumerations is prohibited in C++ but
allowed in C.

Reviewers: aaron.ballman, rnk, doug.gregor

Reviewed By: rnk

Subscribers: alberto_magni, cfe-commits

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

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

7 years ago[lit] Rename lld and clang lit configs to end in .py
Zachary Turner [Thu, 21 Sep 2017 17:38:13 +0000 (17:38 +0000)]
[lit] Rename lld and clang lit configs to end in .py

This follows in line with a previous patch of renaming LLVM's.

Working on these files is difficult in certain operating systems
and/or environments that don't like handling python code with a
non .py file extension.

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

7 years ago[OPENMP] Use canonical declarations for redeclarations checks.
Alexey Bataev [Thu, 21 Sep 2017 14:06:59 +0000 (14:06 +0000)]
[OPENMP] Use canonical declarations for redeclarations checks.

If the captured variable has some redeclarations we may run into the
situation where the redeclaration is used instead of the canonical
declaration and we may consider this variable as one not captured
before.

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

7 years ago[analyzer] Fix an assertion fail in VirtualCallChecker
Gabor Horvath [Thu, 21 Sep 2017 08:18:59 +0000 (08:18 +0000)]
[analyzer] Fix an assertion fail in VirtualCallChecker

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

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

7 years agoRevert "Give external linkage and mangling to lambdas inside inline variables and...
Vitaly Buka [Thu, 21 Sep 2017 02:51:56 +0000 (02:51 +0000)]
Revert "Give external linkage and mangling to lambdas inside inline variables and variable templates."

To fix: runtime error: load of value 15, which is not a valid value for type 'clang::LVComputationKind'

This reverts commit r313827.

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

7 years ago[MSan] Disable sanitization for __sanitizer_dtor_callback.
Matt Morehouse [Wed, 20 Sep 2017 22:53:08 +0000 (22:53 +0000)]
[MSan] Disable sanitization for __sanitizer_dtor_callback.

Summary:
Eliminate unnecessary instrumentation at __sanitizer_dtor_callback
call sites.  Fixes https://github.com/google/sanitizers/issues/861.

Reviewers: eugenis, kcc

Reviewed By: eugenis

Subscribers: vitalybuka, llvm-commits, cfe-commits, hiraditya

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

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

7 years ago[MS Compat]Allow __interfaces to have properties.
Erich Keane [Wed, 20 Sep 2017 22:28:24 +0000 (22:28 +0000)]
[MS Compat]Allow __interfaces to have properties.

__interface types are allowed in MSVC to have "property" data members
(marked with declspec property). This patch alters Sema to allow property
data members.

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

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

7 years agoGive external linkage and mangling to lambdas inside inline variables and variable...
Richard Smith [Wed, 20 Sep 2017 22:17:55 +0000 (22:17 +0000)]
Give external linkage and mangling to lambdas inside inline variables and variable templates.

This implements the proposed approach in https://github.com/itanium-cxx-abi/cxx-abi/issues/33

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

7 years ago[NVPTX] Implemented shfl.sync instruction and supporting intrinsics/builtins.
Artem Belevich [Wed, 20 Sep 2017 21:23:07 +0000 (21:23 +0000)]
[NVPTX] Implemented shfl.sync instruction and supporting intrinsics/builtins.

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

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

7 years ago[OPENMP] Support for re-declarations when checking captured variables.
Alexey Bataev [Wed, 20 Sep 2017 20:11:31 +0000 (20:11 +0000)]
[OPENMP] Support for re-declarations when checking captured variables.

Need to check for variables re-declarations when checking that the
variable was already captured in the captured region.

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

7 years agoFixed unused variable warning introduced in r313796 causing build failure
Cameron Desrochers [Wed, 20 Sep 2017 19:37:37 +0000 (19:37 +0000)]
Fixed unused variable warning introduced in r313796 causing build failure

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

7 years ago[PCH] Fixed preamble breaking with BOM presence (and particularly, fluctuating BOM...
Cameron Desrochers [Wed, 20 Sep 2017 19:03:37 +0000 (19:03 +0000)]
[PCH] Fixed preamble breaking with BOM presence (and particularly, fluctuating BOM presence)

This patch fixes broken preamble-skipping when the preamble region includes a byte order mark (BOM). Previously, parsing would fail if preamble PCH generation was enabled and a BOM was present.

This also fixes preamble invalidation when a BOM appears or disappears. This may seem to be an obscure edge case, but it happens regularly with IDEs that pass buffer overrides that never (or always) have a BOM, yet the underlying file from the initial parse that generated a PCH might (or might not) have a BOM.

I've included a test case for these scenarios.

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

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

7 years agoRemove offset size check in nullptr arithmetic handling
Andrew Kaylor [Wed, 20 Sep 2017 18:06:44 +0000 (18:06 +0000)]
Remove offset size check in nullptr arithmetic handling

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

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

7 years agoPut target deduced from executable name at the start of argument list
Serge Pavlov [Wed, 20 Sep 2017 15:22:27 +0000 (15:22 +0000)]
Put target deduced from executable name at the start of argument list

When clang is called as 'target-clang', put deduced target option at
the start of argument list so that option '--target=' specified in command
line could override it.

This change fixes PR34671.

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

7 years agoReplace r313747, don't always warn on enums, rework testcases.
Roman Lebedev [Wed, 20 Sep 2017 13:50:01 +0000 (13:50 +0000)]
Replace r313747, don't always warn on enums, rework testcases.

As Aaron Ballman has pointed out, that is not really correct.
So the key problem there is the invalidity of the testcase.

Revert r313747, and rework testcase in such a way, so these
details (platform-specific default enum sigdness) are
accounted for.

Also, add a C++-specific testcase.

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

7 years ago[Sema] CheckTautologicalComparisonWithZero(): always complain about enums
Roman Lebedev [Wed, 20 Sep 2017 10:15:27 +0000 (10:15 +0000)]
[Sema] CheckTautologicalComparisonWithZero(): always complain about enums

Hopefully fixes test-clang-msc-x64-on-i686-linux-RA build.

The underlying problem is that the enum is signed there.
Yet still, it is invalid for it to contain negative values,
so the comparison is always tautological in this case.

No differential, but related to https://reviews.llvm.org/D37629

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

7 years ago[Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare
Roman Lebedev [Wed, 20 Sep 2017 09:54:47 +0000 (09:54 +0000)]
[Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare

Recommit. Original commit was reverted because buildbots broke.
The error was only reproducible in the build with assertions.
The problem was that the diagnostic expected true/false as
bool, while it was provided as string "true"/"false".

Summary:
As requested by Sam McCall:
> Enums (not new I guess). Typical case: if (enum < 0 || enum > MAX)
> The warning strongly suggests that the enum < 0 check has no effect
> (for enums with nonnegative ranges).
> Clang doesn't seem to optimize such checks out though, and they seem
> likely to catch bugs in some cases. Yes, only if there's UB elsewhere,
> but I assume not optimizing out these checks indicates a deliberate
> decision to stay somewhat compatible with a technically-incorrect
> mental model.
> If this is the case, should we move these to a
> -Wtautological-compare-enum subcategory?

Reviewers: rjmccall, rsmith, aaron.ballman, sammccall, bkramer, djasper

Reviewed By: aaron.ballman

Subscribers: jroelofs, cfe-commits

Tags: #clang

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

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

7 years agoclang-format clang-format.
Manuel Klimek [Wed, 20 Sep 2017 09:51:03 +0000 (09:51 +0000)]
clang-format clang-format.

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

7 years agoFix clang-format's detection of structured bindings.
Manuel Klimek [Wed, 20 Sep 2017 09:29:37 +0000 (09:29 +0000)]
Fix clang-format's detection of structured bindings.

Correctly determine when [ is part of a structured binding instead of a
lambda.

To be able to reuse the implementation already available, this patch also:
- sets the Previous link of FormatTokens in the UnwrappedLineParser
- moves the isCppStructuredBinding function into FormatToken

Before:
  auto const const &&[x, y] { A *i };

After:
  auto const const && [x, y]{A * i};

Fixing formatting of the type of the structured binding is still missing.

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

7 years agoImplement C++ [basic.link]p8.
Richard Smith [Wed, 20 Sep 2017 07:22:00 +0000 (07:22 +0000)]
Implement C++ [basic.link]p8.

If a function or variable has a type with no linkage (and is not extern "C"),
any use of it requires a definition within the same translation unit; the idea
is that it is not possible to define the entity elsewhere, so any such use is
necessarily an error.

There is an exception, though: some types formally have no linkage but
nonetheless can be referenced from other translation units (for example, this
happens to anonymous structures defined within inline functions). For entities
with those types, we suppress the diagnostic except under -pedantic.

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

7 years agoRevert "Add support for attribute 'noescape'."
Akira Hatanaka [Wed, 20 Sep 2017 06:55:43 +0000 (06:55 +0000)]
Revert "Add support for attribute 'noescape'."

This reverts commit r313722.

It looks like compiler-rt/lib/tsan/rtl/tsan_libdispatch_mac.cc cannot be
compiled because some of the functions declared in the file do not match
the ones in the SDK headers (which are annotated with 'noescape').

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

7 years agoAdd support for attribute 'noescape'.
Akira Hatanaka [Wed, 20 Sep 2017 06:32:45 +0000 (06:32 +0000)]
Add support for attribute 'noescape'.

The attribute informs the compiler that the annotated pointer parameter
of a function cannot escape and enables IRGen to attach attribute
'nocapture' to parameters that are annotated with the attribute. That is
the only optimization that currently takes advantage of 'noescape', but
there are other optimizations that will be added later that improves
IRGen for ObjC blocks.

rdar://problem/19886775

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

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

7 years agoRevert "Add support for attribute 'noescape'."
Akira Hatanaka [Wed, 20 Sep 2017 06:27:39 +0000 (06:27 +0000)]
Revert "Add support for attribute 'noescape'."

This reverts r313717.

I closed the wrong phabricator review.

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

7 years agoAdd support for attribute 'noescape'.
Akira Hatanaka [Wed, 20 Sep 2017 06:22:51 +0000 (06:22 +0000)]
Add support for attribute 'noescape'.

The attribute informs the compiler that the annotated pointer parameter
of a function cannot escape and enables IRGen to attach attribute
'nocapture' to parameters that are annotated with the attribute. That is
the only optimization that currently takes advantage of 'noescape', but
there are other optimizations that will be added later that improves
IRGen for ObjC blocks.

rdar://problem/19886775

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

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

7 years ago[Sema][ObjC] Warn about mismatches in attributes between overriding and
Akira Hatanaka [Wed, 20 Sep 2017 05:39:18 +0000 (05:39 +0000)]
[Sema][ObjC] Warn about mismatches in attributes between overriding and
overridden methods when compiling for non-ARC.

Previously, clang would error out when compiling for ARC, but didn't
print any diagnostics when compiling for non-ARC.

This was pointed out in the patch review for attribute noescape:

https://reviews.llvm.org/D32210

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

7 years agoAdd override for ClangDiagnosticHandler::isAnyRemarkEnabled()
Adam Nemet [Tue, 19 Sep 2017 23:00:59 +0000 (23:00 +0000)]
Add override for ClangDiagnosticHandler::isAnyRemarkEnabled()

This is used by the new closure-based variant of
OptimizationRemarkEmitter::emit().

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

7 years agoFix 32-bit buildbots by removing tests that are dependent on pointer-size comparisons.
Andrew Kaylor [Tue, 19 Sep 2017 21:43:01 +0000 (21:43 +0000)]
Fix 32-bit buildbots by removing tests that are dependent on pointer-size comparisons.

The recently behavior in the code that these tests were meant to be checking will be ammended as soon as a suitable change can be properly reviewed.

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

7 years agoRevert "[Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare"
Roman Lebedev [Tue, 19 Sep 2017 21:40:41 +0000 (21:40 +0000)]
Revert "[Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare"

This reverts commit r313677.

Buildbots fail with assertion failure
Failing Tests (7):
    Clang :: Analysis/null-deref-ps.c
    Clang :: CodeGen/enum.c
    Clang :: Sema/compare.c
    Clang :: Sema/outof-range-constant-compare.c
    Clang :: Sema/tautological-unsigned-enum-zero-compare.c
    Clang :: Sema/tautological-unsigned-zero-compare.c
    Clang :: SemaCXX/compare.cpp

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

7 years ago[Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare
Roman Lebedev [Tue, 19 Sep 2017 21:11:35 +0000 (21:11 +0000)]
[Sema] Move some stuff into -Wtautological-unsigned-enum-zero-compare

Summary:
As requested by Sam McCall:
> Enums (not new I guess). Typical case: if (enum < 0 || enum > MAX)
> The warning strongly suggests that the enum < 0 check has no effect
> (for enums with nonnegative ranges).
> Clang doesn't seem to optimize such checks out though, and they seem
> likely to catch bugs in some cases. Yes, only if there's UB elsewhere,
> but I assume not optimizing out these checks indicates a deliberate
> decision to stay somewhat compatible with a technically-incorrect
> mental model.
> If this is the case, should we move these to a
> -Wtautological-compare-enum subcategory?

Reviewers: rjmccall, rsmith, aaron.ballman, sammccall, bkramer, djasper

Reviewed By: aaron.ballman

Subscribers: jroelofs, cfe-commits

Tags: #clang

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

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

7 years ago[OpenMP] fix seg-faults printing diagnostics with invalid ordered(n) values
Rachel Craik [Tue, 19 Sep 2017 21:04:23 +0000 (21:04 +0000)]
[OpenMP] fix seg-faults printing diagnostics with invalid ordered(n) values

When the value specified for n in ordered(n) is larger than the number of loops a segmentation fault can occur in one of two ways when attempting to print out a diagnostic for an associated depend(sink : vec):
1) The iteration vector vec contains less than n items
2) The iteration vector vec contains a variable that is not a loop control variable
This patch addresses both of these issues.

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

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

7 years agoTeach clang to tolerate the 'p = nullptr + n' idiom used by glibc
Andrew Kaylor [Tue, 19 Sep 2017 20:26:40 +0000 (20:26 +0000)]
Teach clang to tolerate the 'p = nullptr + n' idiom used by glibc

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

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

7 years agoFix ClangDiagnosticHandler::is*RemarkEnabled members
Adam Nemet [Tue, 19 Sep 2017 17:59:40 +0000 (17:59 +0000)]
Fix ClangDiagnosticHandler::is*RemarkEnabled members

Apparently these weren't really working. I added test coverage and fixed the
typo in the name and the parameter.

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

7 years ago[Sema] Disallow assigning record lvalues with nested const-qualified fields.
Bjorn Pettersson [Tue, 19 Sep 2017 13:10:30 +0000 (13:10 +0000)]
[Sema] Disallow assigning record lvalues with nested const-qualified fields.

Summary:
According to C99 6.3.2.1p1, structs and unions with nested
const-qualified fields (that is, const-qualified fields
declared at some recursive level of the aggregate) are not
modifiable lvalues. However, Clang permits assignments of
these lvalues.

With this patch, we both prohibit the assignment of records
with const-qualified fields and emit a best-effort diagnostic.
This fixes https://bugs.llvm.org/show_bug.cgi?id=31796 .

Committing on behalf of bevinh (Bevin Hansson).

Reviewers: rtrieu, rsmith, bjope

Reviewed By: bjope

Subscribers: Ka-Ka, rogfer01, bjope, fhahn, cfe-commits

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

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

7 years agoLowering Mask Set1 intrinsics to LLVM IR
Jina Nahias [Tue, 19 Sep 2017 11:00:27 +0000 (11:00 +0000)]
Lowering Mask Set1 intrinsics to LLVM IR

This patch, together with a matching llvm patch (https://reviews.llvm.org/D37669), implements the lowering of X86 mask set1 intrinsics to IR.

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

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

7 years agoFix formatting of lambda introducers with initializers.
Manuel Klimek [Tue, 19 Sep 2017 09:59:30 +0000 (09:59 +0000)]
Fix formatting of lambda introducers with initializers.

Most of the work was already done when we introduced a look-behind based
lambda introducer detection.

This patch finishes the transition by completely relying on the simple
lambda introducer detection and simply recursing into normal
brace-parsing code to parse until the end of the introducer.

This fixes initializers in lambdas, including nested lambdas.

Before:
  auto a = [b = [c = 42]{}]{};
  auto b = [c = &i + 23]{};

After:
  auto a = [b = [c = 42] {}] {};
  auto b = [c = &i + 23] {};

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

7 years ago[Coverage] Remove deferred region for trailing return, fixes PR34611
Vedant Kumar [Tue, 19 Sep 2017 00:29:46 +0000 (00:29 +0000)]
[Coverage] Remove deferred region for trailing return, fixes PR34611

As a special case, throw away deferred regions for trailing returns.
This allows the closing curly brace to have a count, and is less
distracting.

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

7 years ago[Coverage] Use a new API to label gap areas
Vedant Kumar [Mon, 18 Sep 2017 23:37:30 +0000 (23:37 +0000)]
[Coverage] Use a new API to label gap areas

This will make it possible for llvm-cov to pick better line execution
counts, and is part of the fix for llvm.org/PR34612.

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

7 years ago[Docs] Document cache pruning support for gold
Yi Kong [Mon, 18 Sep 2017 23:24:01 +0000 (23:24 +0000)]
[Docs] Document cache pruning support for gold

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

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

7 years ago[lit] Update clang and lld to use new config helpers.
Zachary Turner [Mon, 18 Sep 2017 22:26:48 +0000 (22:26 +0000)]
[lit] Update clang and lld to use new config helpers.

NFC intended here, this only updates clang and lld's lit configs
to use some helper functionality in the lit.llvm submodule.

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

7 years ago[Sema] Fix a pair of crashes when generating exception specifiers with an
Erich Keane [Mon, 18 Sep 2017 21:28:55 +0000 (21:28 +0000)]
[Sema] Fix a pair of crashes when generating exception specifiers with an
error'ed field for a template class' default ctor.

The two examples in the test would both cause a compiler assert when attempting
to calculate the exception specifier for the default constructor for the
template classes. The problem was that dependents of this function expect that
Field->getInClassInitializer (including canThrow) is not nullptr. However, if
the template's initializer has an error, exactly that situation happens.

This patch simply sets the field to be invalid.

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

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

7 years agoAnother attempt to fix warning discovered by r313487. [-Wunused-lambda-capture]
Vitaly Buka [Mon, 18 Sep 2017 08:26:01 +0000 (08:26 +0000)]
Another attempt to fix warning discovered by r313487. [-Wunused-lambda-capture]

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

7 years agoRevert rL313511, "Fix a warning discovered by rL313487. [-Wunused-lambda-capture]"
NAKAMURA Takumi [Mon, 18 Sep 2017 05:52:57 +0000 (05:52 +0000)]
Revert rL313511, "Fix a warning discovered by rL313487. [-Wunused-lambda-capture]"

It was incompatible to msc.

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

7 years agoFix a warning discovered by rL313487. [-Wunused-lambda-capture]
NAKAMURA Takumi [Mon, 18 Sep 2017 04:55:33 +0000 (04:55 +0000)]
Fix a warning discovered by rL313487. [-Wunused-lambda-capture]

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

7 years agoReformat.
NAKAMURA Takumi [Mon, 18 Sep 2017 04:55:31 +0000 (04:55 +0000)]
Reformat.

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

7 years ago[X86] Move even more of our CPU to feature mapping switch to use fallthroughs
Craig Topper [Sun, 17 Sep 2017 19:05:46 +0000 (19:05 +0000)]
[X86] Move even more of our CPU to feature mapping switch to use fallthroughs

This arranges more of the Intel and AMD CPUs into fallthrough positions based on their features. We may be able to merge this new AMD set with the BTVER or BDVER sets but I didn't look that closely.

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

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

7 years agoFix the second half of PR34266: Don't implicitly capture '*this' if the members...
Faisal Vali [Sun, 17 Sep 2017 15:37:51 +0000 (15:37 +0000)]
Fix the second half of PR34266:  Don't implicitly capture '*this' if the members are found in a class unrelated to the enclosing class.

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

For e.g.
  struct A {
     void f(int);
     static void f(char);
  };
  struct B {
    auto foo() {
      return [&] (auto a) {
         A::f(a); // this should not cause a capture of '*this'
      };
    }
  };

The patch does the following:
1) It moves the check to attempt an implicit capture of '*this' by reference into the more logical location of when the call is actually built within ActOnCallExpr (as opposed to when the unresolved-member-lookup node is created).
  - Reminder: A capture of '*this' by value has to always be an explicit capture.

2) It additionally checks whether the naming class of the UnresolvedMemberExpr ('A' in the example above) is related to the enclosing class ('B' above).

P.S. If you have access to ISO-C++'s CWG reflector, see this thread for some potentially related discussion: http://lists.isocpp.org/core/2017/08/2851.php

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

7 years ago[X86] Remove unnecessary extra encodings from the CPU name enum in clang
Craig Topper [Sat, 16 Sep 2017 16:44:39 +0000 (16:44 +0000)]
[X86] Remove unnecessary extra encodings from the CPU name enum in clang

Summary:
For a lot of older CPUs we have a 1:1 mapping between CPU name and enum name. But many of them are effectively aliases of each other and as a result are always repeated together at every usage

This patch removes most of the duplication. It also uses StringSwitch::Cases to make the many to one mapping in the StringSwitch more obvious.

Reviewers: RKSimon, spatel, zvi, igorb

Reviewed By: RKSimon

Subscribers: cfe-commits

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

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

7 years agoRemove comment accidentally committed with D36642. NFC.
Vedant Kumar [Sat, 16 Sep 2017 06:26:51 +0000 (06:26 +0000)]
Remove comment accidentally committed with D36642. NFC.

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