]> granicus.if.org Git - clang/log
clang
7 years agoSuppress -Wdelete-non-virtual-dtor warnings about classes defined in system headers.
Nico Weber [Thu, 31 Aug 2017 06:17:08 +0000 (06:17 +0000)]
Suppress -Wdelete-non-virtual-dtor warnings about classes defined in system headers.

r312167 made it so that we emit Wdelete-non-virtual-dtor from delete statements
that are in system headers (e.g. std::unique_ptr). That works great on Linux
and macOS, but on Windows there are non-final classes that are defined in
system headers that have virtual methods but non-virtual destructors and yet
get deleted through a base class pointer (e.g. ATL::CAccessToken::CRevert). So
paddle back a bit and don't emit the warning if it's about a class defined in a
system header.

https://reviews.llvm.org/D37324

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

7 years agoFix the test fix from r312181
Hans Wennborg [Wed, 30 Aug 2017 23:26:38 +0000 (23:26 +0000)]
Fix the test fix from r312181

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

7 years ago[cxx_status] Update to describe current status a bit better.
Richard Smith [Wed, 30 Aug 2017 23:10:31 +0000 (23:10 +0000)]
[cxx_status] Update to describe current status a bit better.

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

7 years ago[Sema] Make SpecialMemberDecl a PointerIntPair so we can stash it in a SmallPtrSet.
Benjamin Kramer [Wed, 30 Aug 2017 22:51:50 +0000 (22:51 +0000)]
[Sema] Make SpecialMemberDecl a PointerIntPair so we can stash it in a SmallPtrSet.

We have enough spare bits in the alignment of CXXRecordDecl. No
functionality change intended.

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

7 years ago[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Matt Morehouse [Wed, 30 Aug 2017 22:49:31 +0000 (22:49 +0000)]
[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer

Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.
- Only enable on Linux.

Reviewers: vitalybuka, kcc, george.karpenkov

Reviewed By: kcc

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

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

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

7 years agoFix tests for ARM targets
Douglas Yung [Wed, 30 Aug 2017 22:30:08 +0000 (22:30 +0000)]
Fix tests for ARM targets

Tests fail on ARM targets due to ABI name between define and void. Added reg ex to skip.

Patch by Glenn Howe (and expanded on by Douglas Yung)!

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

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

7 years agoTest-case golfing.
Adrian Prantl [Wed, 30 Aug 2017 21:31:16 +0000 (21:31 +0000)]
Test-case golfing.

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

7 years ago[CodeGen][x86_64] Enable 'force_align_arg_pointer' attribute at x86_64
Erich Keane [Wed, 30 Aug 2017 21:17:40 +0000 (21:17 +0000)]
[CodeGen][x86_64] Enable 'force_align_arg_pointer' attribute at x86_64

This attribute is useful in OS development when we jump from 32 to 64 bit
code and expect that 64bit function forces correct stack alignment.

Related discussion: http://lists.llvm.org/pipermail/cfe-dev/2017-June/054358.html

Patch By: anatol.pomozov (anatol.pomozov@gmail.com)

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

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

7 years agoLet -Wdelete-non-virtual-dtor fire in system headers too.
Nico Weber [Wed, 30 Aug 2017 20:25:22 +0000 (20:25 +0000)]
Let -Wdelete-non-virtual-dtor fire in system headers too.

Makes the warning useful again in a std::unique_ptr world, PR28460.

Also make the warning not fire in unevaluated contexts, since system libraries
(e.g. libc++) do do that. This would've been a good change before we started
emitting this warning in system headers too, but "normal" code seems to be less
template-heavy, so we didn't notice until now.

https://reviews.llvm.org/D37235

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

7 years agodocs: typo fix
Hans Wennborg [Wed, 30 Aug 2017 18:35:44 +0000 (18:35 +0000)]
docs: typo fix

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

7 years agoAdapt testcases to LLVM change r312144 in DIGlobalVariableExpression
Adrian Prantl [Wed, 30 Aug 2017 18:22:23 +0000 (18:22 +0000)]
Adapt testcases to LLVM change r312144 in DIGlobalVariableExpression

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

7 years ago[X86] Implement broadcastf32x2 and broadcasti32x2 intrinsics using __builtin_shufflev...
Craig Topper [Wed, 30 Aug 2017 16:15:12 +0000 (16:15 +0000)]
[X86] Implement broadcastf32x2 and broadcasti32x2 intrinsics using __builtin_shufflevector instead builtins

This patch implements the broadcastf32x2/broadcasti32x2 intrinsics using __builtin_shufflevector.

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

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

7 years agoAvoid 'size_t' typedef in the unittest ObjC code
Alex Lorenz [Wed, 30 Aug 2017 15:37:30 +0000 (15:37 +0000)]
Avoid 'size_t' typedef in the unittest ObjC code

This should fix
http://bb.pgr.jp/builders/test-clang-msc-x64-on-i686-linux-RA

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

7 years agoRecommit r312127: [refactor] AST selection tree should contain syntactic
Alex Lorenz [Wed, 30 Aug 2017 15:28:01 +0000 (15:28 +0000)]
Recommit r312127: [refactor] AST selection tree should contain syntactic
form of PseudoObjectExpr

The new commit adjusts unittest test code compilation options so that the
Objective-C code in the unittest can be parsed on non-macOS platforms.

Original message:

The AST selection finder now constructs a selection tree that contains only the
syntactic form of PseudoObjectExpr. This form of selection tree is more
meaningful when doing downstream analysis as we're interested in the syntactic
features of the AST and the correct lexical parent relation.

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

7 years agoRevert r312127 as the ObjC unittest code fails to compile on Linux
Alex Lorenz [Wed, 30 Aug 2017 15:11:45 +0000 (15:11 +0000)]
Revert r312127 as the ObjC unittest code fails to compile on Linux

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

7 years ago[refactor] AST selection tree should contain syntactic form
Alex Lorenz [Wed, 30 Aug 2017 15:00:27 +0000 (15:00 +0000)]
[refactor] AST selection tree should contain syntactic form
of PseudoObjectExpr

The AST selection finder now constructs a selection tree that contains only the
syntactic form of PseudoObjectExpr. This form of selection tree is more
meaningful when doing downstream analysis as we're interested in the syntactic
features of the AST and the correct lexical parent relation.

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

7 years agoclang-format: Add preprocessor directive indentation
Krasimir Georgiev [Wed, 30 Aug 2017 14:34:57 +0000 (14:34 +0000)]
clang-format: Add preprocessor directive indentation

Summary:
This is an implementation for [bug 17362](https://bugs.llvm.org/attachment.cgi?bugid=17362) which adds support for indenting preprocessor statements inside if/ifdef/endif. This takes previous work from fmauch (https://github.com/fmauch/clang/tree/preprocessor_indent) and makes it into a full feature.
The context of this patch is that I'm a VMware intern, and I implemented this because VMware needs the feature. As such, some decisions were made based on what VMware wants, and I would appreciate suggestions on expanding this if necessary to use-cases other people may want.

This adds a new enum config option, `IndentPPDirectives`. Values are:

* `PPDIS_None` (in config: `None`):
```
    #if FOO
    #if BAR
    #include <foo>
    #endif
    #endif
```
* `PPDIS_AfterHash` (in config: `AfterHash`):
```
    #if FOO
    #  if BAR
    #    include <foo>
    #  endif
    #endif
```
This is meant to work whether spaces or tabs are used for indentation. Preprocessor indentation is independent of indentation for non-preprocessor lines.

Preprocessor indentation also attempts to ignore include guards with the checks:
1. Include guards cover the entire file
2. Include guards don't have `#else`
3. Include guards begin with
```
#ifndef <var>
#define <var>
```

This patch allows `UnwrappedLineParser::PPBranchLevel` to be decremented to -1 (the initial value is -1) so the variable can be used for indent tracking.

Defects:
* This patch does not handle the case where there's code between the `#ifndef` and `#define` but all other conditions hold. This is because when the #define line is parsed, `UnwrappedLineParser::Lines` doesn't hold the previous code line yet, so we can't detect it. This is out of the scope of this patch.

* This patch does not handle cases where legitimate lines may be outside an include guard. Examples are `#pragma once` and `#pragma GCC diagnostic`, or anything else that does not change the meaning of the file if it's included multiple times.

* This does not detect when there is a single non-preprocessor line in front of an include-guard-like structure where other conditions hold because `ScopedLineState` hides the line.

* Preprocessor indentation throws off `TokenAnnotator::setCommentLineLevels` so the indentation of comments immediately before indented preprocessor lines is toggled on each run. Fixing this issue appears to be a major change and too much complexity for this patch.

Contributed by @euhlmann!

Reviewers: djasper, klimek, krasimir

Reviewed By: djasper, krasimir

Subscribers: krasimir, mzeren-vmw, cfe-commits

Tags: #clang

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

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

7 years agoDriver: out-of-line static analyzer flag handling (NFC)
Saleem Abdulrasool [Wed, 30 Aug 2017 14:18:08 +0000 (14:18 +0000)]
Driver: out-of-line static analyzer flag handling (NFC)

Extract the analyzer flag handling into its own function to reduce the
overall complexity of the construction of the clang compiler arguments.
NFC.

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

7 years ago[refactor] Examine the whole range for ObjC @implementation decls
Alex Lorenz [Wed, 30 Aug 2017 13:24:37 +0000 (13:24 +0000)]
[refactor] Examine the whole range for ObjC @implementation decls
when computing the AST selection

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

7 years agoRevert r312105 [modules] Add ability to specify module name to module file mapping
Victor Leschuk [Wed, 30 Aug 2017 11:31:56 +0000 (11:31 +0000)]
Revert r312105 [modules] Add ability to specify module name to module file mapping

Looks like it breaks win10 builder.

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

7 years agoAdd test case that was broken by r311970.
Martin Bohme [Wed, 30 Aug 2017 10:44:51 +0000 (10:44 +0000)]
Add test case that was broken by r311970.

See also discussion here:
https://reviews.llvm.org/rL301963

As far as I can tell, this discussion was never resolved.

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

7 years agoRevert "Improve constant expression evaluation of arrays of unknown bound."
Martin Bohme [Wed, 30 Aug 2017 10:44:46 +0000 (10:44 +0000)]
Revert "Improve constant expression evaluation of arrays of unknown bound."

This reverts commit r311970.

Breaks internal tests.

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

7 years ago[docs] Regenerate command line options reference
Boris Kolpackov [Wed, 30 Aug 2017 09:15:53 +0000 (09:15 +0000)]
[docs] Regenerate command line options reference

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

7 years ago[modules] Add ability to specify module name to module file mapping
Boris Kolpackov [Wed, 30 Aug 2017 08:45:59 +0000 (08:45 +0000)]
[modules] Add ability to specify module name to module file mapping

Extend the -fmodule-file option to support the [<name>=]<file> value format.
If the name is omitted, then the old semantics is preserved (the module file
is loaded whether needed or not). If the name is specified, then the mapping
is treated as just another prebuilt module search mechanism, similar to
-fprebuilt-module-path, and the module file is only loaded if actually used
(e.g., via import). With one exception: this mapping also overrides module
file references embedded in other modules (which can be useful if module files
are moved/renamed as often happens during remote compilation).

This override semantics requires some extra work: we now store the module name
in addition to the file name in the serialized AST representation.

Reviewed By: rsmith

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

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

7 years agoGive a better error if auto deduction fails due to inconsistent element types in...
Richard Smith [Wed, 30 Aug 2017 00:44:08 +0000 (00:44 +0000)]
Give a better error if auto deduction fails due to inconsistent element types in a braced initializer list.

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

7 years agoDriver: refactor SSP argument handling (NFC)
Saleem Abdulrasool [Tue, 29 Aug 2017 23:59:08 +0000 (23:59 +0000)]
Driver: refactor SSP argument handling (NFC)

Out-of-line the SSP argument handling for the sake of readability.  Pass
along some state information to avoid re-computing the command line
flags.

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

7 years agoDriver: refactor OpenCL argument forwarding
Saleem Abdulrasool [Tue, 29 Aug 2017 23:59:07 +0000 (23:59 +0000)]
Driver: refactor OpenCL argument forwarding

Extract the argument forwarding for OpenCL arguments.  Make this more
data driven as we are just repeating the argument name and spelling.
This costs a slight bit more memory due to the string duplication, but
makes it easier to follow.  It should be possible to forward the
internal string representation from the TableGen data to avoid this.
But, this makes the code simpler to follow for now.

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

7 years agoDriver: reuse existing `D` variable (NFC)
Saleem Abdulrasool [Tue, 29 Aug 2017 23:59:06 +0000 (23:59 +0000)]
Driver: reuse existing `D` variable (NFC)

Change the rest of the function to use the `D` variable for the driver
instance.  NFC.

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

7 years agoDriver: hoist a local variable (NFC)
Saleem Abdulrasool [Tue, 29 Aug 2017 23:59:05 +0000 (23:59 +0000)]
Driver: hoist a local variable (NFC)

Hoist the `getToolChain().getTriple()` to a variable rather than
re-fetching it every time.  NFC.

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

7 years agoPR10147: When substituting a template template argument, substitute in the most
Richard Smith [Tue, 29 Aug 2017 22:14:43 +0000 (22:14 +0000)]
PR10147: When substituting a template template argument, substitute in the most
recent (non-friend) declaration to pick up the right set of default template
arguments.

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

7 years agoRestore clang_rt library name on i686-android.
Evgeniy Stepanov [Tue, 29 Aug 2017 22:12:31 +0000 (22:12 +0000)]
Restore clang_rt library name on i686-android.

Summary:
Recent changes canonicalized clang_rt library names to refer to
"i386" on all x86 targets. Android historically uses i686.

This change adds a special case to keep i686 in all clang_rt
libraries when targeting Android.

Reviewers: hans, mgorny, beanz

Subscribers: srhines, cfe-commits, llvm-commits

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

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

7 years agoRevert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"
Matt Morehouse [Tue, 29 Aug 2017 21:56:56 +0000 (21:56 +0000)]
Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"

This reverts r312026 due to bot breakage.

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

7 years agoRe-enable stack depth instrumentation on Windows.
Matt Morehouse [Tue, 29 Aug 2017 21:15:33 +0000 (21:15 +0000)]
Re-enable stack depth instrumentation on Windows.

Specified tls_model attribute properly. Should compile on Windows
now.

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

7 years agoDisable stack depth tracking on Windows.
Matt Morehouse [Tue, 29 Aug 2017 20:44:41 +0000 (20:44 +0000)]
Disable stack depth tracking on Windows.

Windows doesn't support the tls_model attribute.

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

7 years agoMinimal runtime for UBSan.
Evgeniy Stepanov [Tue, 29 Aug 2017 20:03:51 +0000 (20:03 +0000)]
Minimal runtime for UBSan.

Summary:
An implementation of ubsan runtime library suitable for use in production.

Minimal attack surface.
* No stack traces.
* Definitely no C++ demangling.
* No UBSAN_OPTIONS=log_file=/path (very suid-unfriendly). And no UBSAN_OPTIONS in general.
* as simple as possible

Minimal CPU and RAM overhead.
* Source locations unnecessary in the presence of (split) debug info.
* Values and types (as in A+B overflows T) can be reconstructed from register/stack dumps, once you know what type of error you are looking at.
* above two items save 3% binary size.

When UBSan is used with -ftrap-function=abort, sometimes it is hard to reason about failures. This library replaces abort with a slightly more informative message without much extra overhead. Since ubsan interface in not stable, this code must reside in compiler-rt.

Reviewers: pcc, kcc

Subscribers: srhines, mgorny, aprantl, krytarowski, llvm-commits

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

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

7 years ago[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Matt Morehouse [Tue, 29 Aug 2017 19:48:12 +0000 (19:48 +0000)]
[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer

Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.
- Disable stack depth tracking on Mac.

Reviewers: vitalybuka, kcc, george.karpenkov

Reviewed By: kcc

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

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

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

7 years ago[OPENMP] Capture global variables in all target executable regions.
Alexey Bataev [Tue, 29 Aug 2017 19:30:57 +0000 (19:30 +0000)]
[OPENMP] Capture global variables in all target executable regions.

Capturing of the global variables occurs only in target regions. Patch
fixes it and allows capturing of globals in all target executable
directives.

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

7 years ago[Bash-autocomplete] Refactor autocomplete code into own function
Yuka Takahashi [Tue, 29 Aug 2017 17:46:46 +0000 (17:46 +0000)]
[Bash-autocomplete] Refactor autocomplete code into own function

Summary:
We wrote many codes in HandleImediateArgs, so I've refactored it into
handleAutocompletions.

Reviewers: v.g.vassilev, teemperor

Subscribers: cfe-commits

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

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

7 years ago[ms] Fix vbtable index for covariant overrides of vbase methods
Reid Kleckner [Tue, 29 Aug 2017 17:40:04 +0000 (17:40 +0000)]
[ms] Fix vbtable index for covariant overrides of vbase methods

Overriding a method from a virtual base with a covariant return type
consumes a slot from the vftable in the virtual base. This can make it
impossible to implement certain diamond inheritance hierarchies, but we
have to follow along for compatibility in the simple cases.

This patch only affects our vtable dumper and member pointer function
mangling, since all other callers of getMethodVFTableLocation seem to
recompute VBTableIndex instead of using the one in the method location.

Patch by David Majnemer

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

7 years ago[modules-ts] Omit submodule semantics for TS modules
Boris Kolpackov [Tue, 29 Aug 2017 15:30:18 +0000 (15:30 +0000)]
[modules-ts] Omit submodule semantics for TS modules

If a TS module name has more than one component (e.g., foo.bar) then we
erroneously activated the submodule semantics when encountering a module
declaration in the module implementation unit (e.g., 'module foo.bar;').

Reviewed By: rsmith

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

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

7 years ago[clang-format] Refactor likely xml a bit, NFC
Krasimir Georgiev [Tue, 29 Aug 2017 13:57:31 +0000 (13:57 +0000)]
[clang-format] Refactor likely xml a bit, NFC

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

7 years ago[clang-format] Do not format likely xml
Krasimir Georgiev [Tue, 29 Aug 2017 13:51:38 +0000 (13:51 +0000)]
[clang-format] Do not format likely xml

Summary:
This patch detects the leading '<' in likely xml files and stops formatting in
that case. A recent use of a Qt xml file with a .ts extension triggered this:
http://doc.qt.io/qt-4.8/linguist-ts-file-format.html

Reviewers: djasper

Reviewed By: djasper

Subscribers: sammccall, cfe-commits, klimek

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

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

7 years ago[clang-format] Fixed typedef enum brace wrapping
Krasimir Georgiev [Tue, 29 Aug 2017 13:32:30 +0000 (13:32 +0000)]
[clang-format] Fixed typedef enum brace wrapping

Summary:
Bug: https://bugs.llvm.org/show_bug.cgi?id=34016 - **Typedef enum part**

**Problem:**

Clang format does not allow the flag **BraceWrapping.AfterEnum** control the case when our **enum** is preceded by **typedef** keyword (what is common in C language).

**Patch description:**

Added case to the **"AfterEnum"** flag when our enum does not start a line - is preceded by **typedef** keyword.

**After fix:**

**CONFIG:**
```
BreakBeforeBraces: Custom
BraceWrapping: {
AfterClass: true, AfterControlStatement: true, AfterEnum: true, AfterFunction: true, AfterNamespace: false, AfterStruct: true, AfterUnion: true, BeforeCatch: true, BeforeElse: true
}
```

**BEFORE:**
```
typedef enum
{
    a,
    b,
    c
} SomeEnum;
```

**AFTER:**

```
typedef enum
{
    a,
    b,
    c
} SomeEnum;
```

Contributed by @PriMee!

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[modules] Add test for using declaration in classes.
Raphael Isemann [Tue, 29 Aug 2017 09:27:41 +0000 (09:27 +0000)]
[modules] Add test for using declaration in classes.

Summary:
This adds a test that checks if the using declaration in classes still works as intended with modules.

The motivation for this is that we tried to add a shortcut to `removeDecl` that would skip the removal of declarations from the lookup table if they are hidden. This optimization passed the clang test suite but actually broke the using declaration in combination with -fmodules-local-submodule-visibility. In this mode we hide all decls from other modules such as by chance the parent method, in which case don't remove the parent method from the lookup table and get ambiguous lookup errors. After this patch we now correctly see if this behavior is broken by a patch like this in the test suite.

Reviewers: v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

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

7 years ago[libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*
Erik Verbruggen [Tue, 29 Aug 2017 09:08:02 +0000 (09:08 +0000)]
[libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*

Looks like this one was forgotten for clang_parseTranslationUnit*, as
LIBCLANG_NOTHREADS is checked for/in:

clang_saveTranslationUnit()
clang_reparseTranslationUnit()
clang_codeCompleteAt()
clang_indexTranslationUnit()
clang_indexSourceFile()

Patch by Nikolai Kosjar!

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

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

7 years agoclang-format: [JS] simplify template string wrapping.
Martin Probst [Tue, 29 Aug 2017 08:30:07 +0000 (08:30 +0000)]
clang-format: [JS] simplify template string wrapping.

Summary:
Previously, clang-format would try to wrap template string substitutions
by indenting relative to the openening `${`. This helped with
indenting structured strings, such as strings containing HTML, as the
substitutions would be aligned according to the structure of the string.

However it turns out that the overwhelming majority of template string +
substitution usages are for substitutions into non-structured strings,
e.g. URLs or just plain messages. For these situations, clang-format
would often produce very ugly indents, in particular for strings
containing no line breaks:

    return `<a href='http://google3/${file}?l=${row}'>${file}</a>(${
                                                                    row
                                                                  },${
                                                                      col
                                                                    }): `;

This change makes clang-format indent template string substitutions as
if they were string concatenation operations. It wraps +4 on overlong
lines and keeps all operands on the same line:

    return `<a href='http://google3/${file}?l=${row}'>${file}</a>(${
        row},${col}): `;

While this breaks some lexical continuity between the `${` and `row}`
here, the overall effects are still a huge improvement, and users can
still manually break the string using `+` if desired.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoUse class to pass information about executable name
Serge Pavlov [Tue, 29 Aug 2017 05:22:26 +0000 (05:22 +0000)]
Use class to pass information about executable name

Information about clang executable name components, such as target and
driver mode, was passes in std::pair. With this change it is passed in
a special structure. It improves readability and makes access to this
information more convenient.

NFC.

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

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

7 years agorevert r311839 (ongoing cwg discussion)
Faisal Vali [Tue, 29 Aug 2017 03:04:13 +0000 (03:04 +0000)]
revert r311839 (ongoing cwg discussion)

apologies.

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

7 years ago[Bash-autocompletion] Add support for -std=
Yuka Takahashi [Tue, 29 Aug 2017 02:01:56 +0000 (02:01 +0000)]
[Bash-autocompletion] Add support for -std=

Summary:
Add support for autocompleting values of -std= by including
LangStandards.def. This patch relies on D36782, and is using two-stage
code generation.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits

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

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

7 years agoImprove constant expression evaluation of arrays of unknown bound.
Richard Smith [Tue, 29 Aug 2017 01:52:13 +0000 (01:52 +0000)]
Improve constant expression evaluation of arrays of unknown bound.

The standard is not clear on how these are supposed to be handled, so we
conservatively treat as non-constant any cases whose value is unknown or whose
evaluation might result in undefined behavior.

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

7 years agoRevert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"
Yuka Takahashi [Tue, 29 Aug 2017 00:09:31 +0000 (00:09 +0000)]
Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags"

This reverts commit 7c46b80c022e18d43c1fdafb117b0c409c5a6d1e.

r311552 broke lld buildbot because I've changed OptionInfos type from
ArrayRef to vector. However the bug is fixed, so I'll commit this again.

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

7 years ago[analyzer] Adjust ptr arithmetic test
Alexander Shaposhnikov [Mon, 28 Aug 2017 22:58:54 +0000 (22:58 +0000)]
[analyzer] Adjust ptr arithmetic test

Replace "long" with __UINTPTR_TYPE__
to make the test added in rL311935 Windows-friendly.
Caught by the buildbot llvm-clang-x86_64-expensive-checks-win.

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

7 years agoRemove trailing space.
Rui Ueyama [Mon, 28 Aug 2017 21:38:14 +0000 (21:38 +0000)]
Remove trailing space.

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

7 years ago[analyzer] Fix crash in modeling arithmetic
Alexander Shaposhnikov [Mon, 28 Aug 2017 21:15:21 +0000 (21:15 +0000)]
[analyzer] Fix crash in modeling arithmetic

This diff fixes modeling of arithmetic
expressions where pointers are treated as integers
(i.e. via C-style / reinterpret casts).
For now we return UnknownVal unless the operation is a comparison.

Test plan: make check-all

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

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

7 years agoReland r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)
Michal Gorny [Mon, 28 Aug 2017 20:29:52 +0000 (20:29 +0000)]
Reland r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)

Use llvm::Triple::getArchTypeName() when looking for compiler-rt
libraries, rather than the exact arch string from the triple. This is
more correct as it matches the values used when building compiler-rt
(builtin-config-ix.cmake) which are the subset of the values allowed
in triples.

For example, this fixes an issue when the compiler set for
i686-pc-linux-gnu triple would not find an i386 compiler-rt library,
while this is the exact arch that is detected by compiler-rt. The same
applies to any other i?86 variant allowed by LLVM.

This also makes the special case for MSVC unnecessary, since now i386
will be used reliably for all 32-bit x86 variants.

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

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

7 years ago[OPENMP] Remove unused header files, NFC.
Alexey Bataev [Mon, 28 Aug 2017 19:26:54 +0000 (19:26 +0000)]
[OPENMP] Remove unused header files, NFC.

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

7 years agoChange Diagnostic Category size error from runtime to compiletime
Erich Keane [Mon, 28 Aug 2017 18:53:17 +0000 (18:53 +0000)]
Change Diagnostic Category size error from runtime to compiletime

Diagnostic Categories are fairly annoying, and are only enforced
by a runtime-debug-only assert. This puts in a touch more work
to get this all done at compile-time with static asserts

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

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

7 years agoFix inaccurate comment about -fdelayed-template-parsing and MSVC
Reid Kleckner [Mon, 28 Aug 2017 17:59:24 +0000 (17:59 +0000)]
Fix inaccurate comment about -fdelayed-template-parsing and MSVC

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

7 years agoRevert r311857 "Emit static constexpr member as available_externally definition"
Hans Wennborg [Mon, 28 Aug 2017 17:53:00 +0000 (17:53 +0000)]
Revert r311857 "Emit static constexpr member as available_externally definition"

It caused PR759744.

> Emit static constexpr member as available_externally definition
>
> By exposing the constant initializer, the optimizer can fold many
> of these constructs.
>
> Differential Revision: https://reviews.llvm.org/D34992

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

7 years agoAvoid missing std error code in RefactoringActionRulesTest.cpp
Alex Lorenz [Mon, 28 Aug 2017 12:03:08 +0000 (12:03 +0000)]
Avoid missing std error code in RefactoringActionRulesTest.cpp

This should fix this bot:
http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux

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

7 years ago[refactor] initial support for refactoring action rules
Alex Lorenz [Mon, 28 Aug 2017 11:12:05 +0000 (11:12 +0000)]
[refactor] initial support for refactoring action rules

This patch implements the initial support for refactoring action rules. The
first rule that's supported is a "source change" rule that returns a set of
atomic changes. This patch is based on the ideas presented in my RFC:

http://lists.llvm.org/pipermail/cfe-dev/2017-July/054831.html

The following pieces from the RFC are added by this patch:

- `createRefactoringRule` (known as `apply` in the RFC)
- `requiredSelection` refactoring action rule requirement.
- `selection::SourceSelectionRange` selection constraint.

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

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

7 years ago[StaticAnalyzer] LoopUnrolling: Keep track the maximum number of steps for each loop
Peter Szecsi [Mon, 28 Aug 2017 10:50:28 +0000 (10:50 +0000)]
[StaticAnalyzer] LoopUnrolling: Keep track the maximum number of steps for each loop

This way the unrolling can be restricted for loops which will take at most a
given number of steps. It is defined as 128 in this patch and it seems to have
a good number for that purpose.

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

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

7 years ago[StaticAnalyzer] LoopUnrolling: Excluding loops which splits the state
Peter Szecsi [Mon, 28 Aug 2017 10:34:50 +0000 (10:34 +0000)]
[StaticAnalyzer] LoopUnrolling: Excluding loops which splits the state

Added check if the execution of the last step of the given unrolled loop has
generated more branches. If yes, than treat it as a normal (non-unrolled) loop
in the remaining part of the analysis.

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

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

7 years ago[StaticAnalyzer] LoopUnrolling fixes
Peter Szecsi [Mon, 28 Aug 2017 10:21:24 +0000 (10:21 +0000)]
[StaticAnalyzer] LoopUnrolling fixes

1. The LoopUnrolling feature needs the LoopExit included in the CFG so added this
dependency via the config options
2. The LoopExit element can be encountered even if we haven't encountered the
block of the corresponding LoopStmt. So the asserts were not right.
3. If we are caching out the Node then we get a nullptr from generateNode which
case was not handled.

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

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

7 years ago[analyzer][GSoC] Re-implemente current virtual calls checker in a path-sensitive way
Gabor Horvath [Mon, 28 Aug 2017 08:44:43 +0000 (08:44 +0000)]
[analyzer][GSoC] Re-implemente current virtual calls checker in a path-sensitive way

Patch by: Xin Wang

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

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

7 years ago[X86] Add support for __builtin_cpu_init
Craig Topper [Mon, 28 Aug 2017 05:43:23 +0000 (05:43 +0000)]
[X86] Add support for __builtin_cpu_init

This adds builtin_cpu_init which will emit a call to cpu_indicator_init in libgcc or compiler-rt.

This is needed to support builtin_cpu_supports/builtin_cpu_is in an ifunc resolver.

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

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

7 years agoAdd test for -Wc++17-compat warning for P0683R1.
Richard Smith [Mon, 28 Aug 2017 00:31:35 +0000 (00:31 +0000)]
Add test for -Wc++17-compat warning for P0683R1.

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

7 years ago[c++2a] P0683R1: Permit default member initializers for bit-fields.
Richard Smith [Mon, 28 Aug 2017 00:28:14 +0000 (00:28 +0000)]
[c++2a] P0683R1: Permit default member initializers for bit-fields.

This would be trivial, except that our in-memory and serialized representations
for FieldDecls assumed that this can't happen.

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

7 years ago[clang-diff] Treat CXXCtorInitializer as a node
Johannes Altmanninger [Sun, 27 Aug 2017 22:52:20 +0000 (22:52 +0000)]
[clang-diff] Treat CXXCtorInitializer as a node

Reviewers: arphaman

Subscribers: cfe-commits, klimek

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

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

7 years agoRevert r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)
Michal Gorny [Sun, 27 Aug 2017 20:38:43 +0000 (20:38 +0000)]
Revert r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)

This causes a breakage on the Android build bot. Let's revert it until
we figure out the correct solution there.

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

7 years agoCMake: only try to find the Z3 package when `CLANG_ANALYZER_BUILD_Z3` is ON
Mehdi Amini [Sun, 27 Aug 2017 20:24:23 +0000 (20:24 +0000)]
CMake: only try to find the Z3 package when `CLANG_ANALYZER_BUILD_Z3` is ON

This avoids the spurious message:

 Could NOT find Z3 (missing:  Z3_LIBRARIES Z3_INCLUDE_DIR) (Required is at least version "4.5")

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

7 years agoEmit static constexpr member as available_externally definition
Mehdi Amini [Sun, 27 Aug 2017 20:24:09 +0000 (20:24 +0000)]
Emit static constexpr member as available_externally definition

By exposing the constant initializer, the optimizer can fold many
of these constructs.

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

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

7 years agorevert changes from r311851.
Faisal Vali [Sun, 27 Aug 2017 19:00:08 +0000 (19:00 +0000)]
revert changes from r311851.

The right answers here (and how clang needs to be tweaked) require further analysis (ongoing cwg thread).

sorry.

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

7 years agoFix two typos in the doc. Patch by kamleshbhalui on github
Sylvestre Ledru [Sun, 27 Aug 2017 17:34:06 +0000 (17:34 +0000)]
Fix two typos in the doc. Patch by kamleshbhalui on github

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

7 years agoDon't see through 'using member-declarations' when determining the relation of any...
Faisal Vali [Sun, 27 Aug 2017 16:49:47 +0000 (16:49 +0000)]
Don't see through 'using member-declarations' when determining the relation of any potential implicit object expression to the parent class of the member function containing the function call.

Prior to this patch clang would not error here:

  template <class T> struct B;

  template <class T> struct A {
    void foo();
    void foo2();

    void test1() {
      B<T>::foo();  // OK, foo is declared in A<int> - matches type of 'this'.
      B<T>::foo2(); // This should be an error!
                    // foo2 is found in B<int>, 'base unrelated' to 'this'.
    }
  };

  template <class T> struct B : A<T> {
    using A<T>::foo2;
  };

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

7 years agoClangCodeGenTests: Update libdeps.
NAKAMURA Takumi [Sun, 27 Aug 2017 11:46:05 +0000 (11:46 +0000)]
ClangCodeGenTests: Update libdeps.

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

7 years agoAdd forgotten file in r311844.
Vassil Vassilev [Sun, 27 Aug 2017 11:31:01 +0000 (11:31 +0000)]
Add forgotten file in r311844.

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

7 years agoD34059: Get the file name for the symbol from the Module, not the SourceManager.
Vassil Vassilev [Sun, 27 Aug 2017 11:27:30 +0000 (11:27 +0000)]
D34059: Get the file name for the symbol from the Module, not the SourceManager.

This allows multi-module / incremental compilation environments to have unique
initializer symbols.

Patch by Axel Naumann with minor modifications by me!

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

7 years agoD34444: Teach codegen to work in incremental processing mode.
Vassil Vassilev [Sun, 27 Aug 2017 10:58:03 +0000 (10:58 +0000)]
D34444: Teach codegen to work in incremental processing mode.

When isIncrementalProcessingEnabled is on we might want to produce multiple
llvm::Modules. This patch allows the clients to start a new llvm::Module,
allowing CodeGen to continue working after a HandleEndOfTranslationUnit call.

This should give the necessary facilities to write a unittest for D34059.

As discussed in the review this is meant to give us a way to proceed forward
in our efforts to upstream our interpreter-related patches. The design of this
will likely change soon.

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

7 years agoPass the correct object argument when a member call to an 'unrelated' class is made.
Faisal Vali [Sun, 27 Aug 2017 02:21:21 +0000 (02:21 +0000)]
Pass the correct object argument when a member call to an 'unrelated' class is made.

Prior to this patch, clang would do the wrong thing here (see inline comments for pre-patch behavior):

  struct A {
    void bar(int) { }
    static void bar(double) { }

    void g(int*);
    static void g(char *);
  };

  struct B {
    void f() {
      A::bar(3);  // selects (double) ??!!
      A::g((int*)0); // Instead of no object argument, states conversion error?!!
    }
  };

The fix is as follows:  When we detect that what appears to be an implicit member function call (A::bar) is actually a call to a member of a class (A) unrelated to the type (B) that contains the member function (B::f) from which the call is being made, don't treat it (A::bar) as an Implicit Member Call Expression.

P.S. I wonder if there is an existing bug report related to this? (Surprisingly, a cursory search did not find one).

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

7 years ago[Driver] Use arch type to find compiler-rt libraries (on Linux)
Michal Gorny [Sat, 26 Aug 2017 21:35:11 +0000 (21:35 +0000)]
[Driver] Use arch type to find compiler-rt libraries (on Linux)

Use llvm::Triple::getArchTypeName() when looking for compiler-rt
libraries, rather than the exact arch string from the triple. This is
more correct as it matches the values used when building compiler-rt
(builtin-config-ix.cmake) which are the subset of the values allowed
in triples.

For example, this fixes an issue when the compiler set for
i686-pc-linux-gnu triple would not find an i386 compiler-rt library,
while this is the exact arch that is detected by compiler-rt. The same
applies to any other i?86 variant allowed by LLVM.

This also makes the special case for MSVC unnecessary, since now i386
will be used reliably for all 32-bit x86 variants.

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

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

7 years agoAdd flag to request Clang is ABI-compatible with older versions of itself
Richard Smith [Sat, 26 Aug 2017 01:04:35 +0000 (01:04 +0000)]
Add flag to request Clang is ABI-compatible with older versions of itself

This patch adds a flag -fclang-abi-compat that can be used to request that
Clang attempts to be ABI-compatible with some older version of itself.

This is provided on a best-effort basis; right now, this can be used to undo
the ABI change in r310401, reverting Clang to its prior C++ ABI for pass/return
by value of class types affected by that change, and to undo the ABI change in
r262688, reverting Clang to using integer registers rather than SSE registers
for passing <1 x long long> vectors. The intent is that we will maintain this
backwards compatibility path as we make ABI-breaking fixes in future.

The reversion to the old behavior for r310401 is also applied to the PS4 target
since that change is not part of its platform ABI (which is essentially to do
whatever Clang 3.2 did).

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

7 years agoRevert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"
Matt Morehouse [Fri, 25 Aug 2017 22:01:21 +0000 (22:01 +0000)]
Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"

This reverts r311801 due to a bot failure.

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

7 years ago[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer
Matt Morehouse [Fri, 25 Aug 2017 21:18:29 +0000 (21:18 +0000)]
[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer

Summary:
- Don't sanitize __sancov_lowest_stack.
- Don't instrument leaf functions.
- Add CoverageStackDepth to Fuzzer and FuzzerNoLink.

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: cfe-commits, llvm-commits, hiraditya

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

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

7 years ago[sanitizer-coverage] extend fsanitize-coverage=pc-table with flags for every PC
Kostya Serebryany [Fri, 25 Aug 2017 19:29:47 +0000 (19:29 +0000)]
[sanitizer-coverage] extend fsanitize-coverage=pc-table with flags for every PC

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

7 years ago[Format] Invert nestingAndIndentLevel pair in WhitespaceManager used for
Daniel Jasper [Fri, 25 Aug 2017 19:14:53 +0000 (19:14 +0000)]
[Format] Invert nestingAndIndentLevel pair in WhitespaceManager used for
alignments

Indent should be compared before nesting level to determine if a token
is on the same scope as the one we align with. Because it was inverted,
clang-format sometimes tried to align tokens with tokens from outer
scopes, causing the assert(Shift >= 0) to fire.

This fixes bug #33507. Patch by Beren Minor, thank you!

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

7 years agoFix typo in comment, no behavior change.
Nico Weber [Fri, 25 Aug 2017 18:41:41 +0000 (18:41 +0000)]
Fix typo in comment, no behavior change.

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

7 years ago[NFC] Remove a cstyle cast and replace some uses of Decl with NamedDecl during the...
Faisal Vali [Fri, 25 Aug 2017 18:24:20 +0000 (18:24 +0000)]
[NFC] Remove a cstyle cast and replace some uses of Decl with NamedDecl during the processing of TemplateParameterLists.

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

7 years ago[Frontend] Fix printing policy for AST context loaded from file
Vedant Kumar [Fri, 25 Aug 2017 18:07:03 +0000 (18:07 +0000)]
[Frontend] Fix printing policy for AST context loaded from file

In ASTUnit::LoadFromASTFile, the context object is set up using
default-constructed LangOptions (which only later get populated). As the
language options are used in the constructor of PrintingPolicy, this
needs to be updated explicitly after the language options are available.

Patch by Johann Klähn!

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

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

7 years ago[ObjC] Add a -Wobjc-messaging-id warning
Alex Lorenz [Fri, 25 Aug 2017 16:12:17 +0000 (16:12 +0000)]
[ObjC] Add a -Wobjc-messaging-id warning

-Wobjc-messaging-id is a new, non-default warning that warns about
message sends to unqualified id in Objective-C. This warning is useful
for projects that would like to avoid any potential future compiler
errors/warnings, as the system frameworks might add a method with the same
selector which could make the message send to id ambiguous.

rdar://33303354

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

7 years ago[Basic] Add a DiagnosticError llvm::ErrorInfo subclass
Alex Lorenz [Fri, 25 Aug 2017 15:48:00 +0000 (15:48 +0000)]
[Basic] Add a DiagnosticError llvm::ErrorInfo subclass

Clang's DiagnosticError is an llvm::Error payload that stores a partial
diagnostic and its location. I'll be using it in the refactoring engine.

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

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

7 years ago[OPENMP] Fix for PR34321: ustom OpenMP reduction in C++ template causes
Alexey Bataev [Fri, 25 Aug 2017 15:43:55 +0000 (15:43 +0000)]
[OPENMP] Fix for PR34321: ustom OpenMP reduction in C++ template causes
SEGFAULT at compile time

Compiler crashed when tried to rebuild non-template expression in
dependent context.

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

7 years ago[IRGen] Evaluate constant static variables referenced through member
Alex Lorenz [Fri, 25 Aug 2017 10:07:00 +0000 (10:07 +0000)]
[IRGen] Evaluate constant static variables referenced through member
expressions

C++ allows us to reference static variables through member expressions. Prior to
this commit, non-integer static variables that were referenced using a member
expression were always emitted using lvalue loads. The old behaviour introduced
an inconsistency between regular uses of static variables and member expressions
uses. For example, the following program compiled and linked successfully:

struct Foo {
   constexpr static const char *name = "foo";
};
int main() {
  return Foo::name[0] == 'f';
}

but this program failed to link because "Foo::name" wasn't found:

struct Foo {
   constexpr static const char *name = "foo";
};
int main() {
  Foo f;
  return f.name[0] == 'f';
}

This commit ensures that constant static variables referenced through member
expressions are emitted in the same way as ordinary static variable references.

rdar://33942261

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

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

7 years ago[clang-diff] Remove NodeCountVisitor, NFC
Johannes Altmanninger [Fri, 25 Aug 2017 09:49:49 +0000 (09:49 +0000)]
[clang-diff] Remove NodeCountVisitor, NFC

Subscribers: klimek, cfe-commits

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

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

7 years agoRemove the old meeting links. Also available from the link: http://llvm.org/devmtg/
Sylvestre Ledru [Fri, 25 Aug 2017 08:47:57 +0000 (08:47 +0000)]
link: http://llvm.org/devmtg/
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311767 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang also supports C++14 & 17 + remove trailing whitespaces
Sylvestre Ledru [Fri, 25 Aug 2017 08:44:56 +0000 (08:44 +0000)]
clang also supports C++14 & 17 + remove trailing whitespaces

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

7 years ago[coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control...
Gor Nishanov [Fri, 25 Aug 2017 04:46:54 +0000 (04:46 +0000)]
[coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control transfer)

Summary:
If await_suspend returns a coroutine_handle, as in the example below:
```
  coroutine_handle<> await_suspend(coroutine_handle<> h) {
    coro.promise().waiter = h;
    return coro;
  }
```
suspensionExpression processing will resume the coroutine pointed at by that handle.
Related LLVM change rL311751 makes resume calls of this kind `musttail` at any optimization level.

This enables unlimited symmetric control transfer from coroutine to coroutine without blowing up the stack.

Reviewers: GorNishanov

Reviewed By: GorNishanov

Subscribers: rsmith, EricWF, cfe-commits

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

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

7 years agoRename diagnostic groups from CXX1z to CXX17. No functionality change.
Richard Smith [Fri, 25 Aug 2017 02:39:05 +0000 (02:39 +0000)]
Rename diagnostic groups from CXX1z to CXX17. No functionality change.

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

7 years agoFix up the -Wc++XX-compat warnings to properly handle C++2a.
Richard Smith [Fri, 25 Aug 2017 02:25:07 +0000 (02:25 +0000)]
Fix up the -Wc++XX-compat warnings to properly handle C++2a.

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

7 years agoFix MSVC bots which include '__attribute__((thiscall))' in pretty-printed member...
Richard Smith [Fri, 25 Aug 2017 01:55:50 +0000 (01:55 +0000)]
Fix MSVC bots which include '__attribute__((thiscall))' in pretty-printed member function types.

We really shouldn't be including inferred calling conventions here, but let's get the bots green first...

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