]> granicus.if.org Git - clang/log
clang
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

7 years ago[c++2a] P0704R1: Allow pointers to const& member functions to be called on rvalues.
Richard Smith [Fri, 25 Aug 2017 01:47:55 +0000 (01:47 +0000)]
[c++2a] P0704R1: Allow pointers to const& member functions to be called on rvalues.

Patch by Blitz Rakete!

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

7 years agoRemove .gitattributes, add comment to lineendings.
Erich Keane [Thu, 24 Aug 2017 23:25:05 +0000 (23:25 +0000)]
Remove .gitattributes, add comment to lineendings.

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

7 years ago[clang] Remove unit test which uses reverse-iterate flag
Mandeep Singh Grang [Thu, 24 Aug 2017 22:40:32 +0000 (22:40 +0000)]
[clang] Remove unit test which uses reverse-iterate flag

Summary: This patch is in response to https://reviews.llvm.org/D35043 which removed -reverse-iterate flag.

Reviewers: dblaikie, mehdi_amini

Reviewed By: dblaikie

Subscribers: cfe-commits, llvm-commits

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

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

7 years ago[sanitizer-coverage] document -fsanitize-coverage=pc-table and -fsanitize-coverage...
Kostya Serebryany [Thu, 24 Aug 2017 22:40:03 +0000 (22:40 +0000)]
[sanitizer-coverage] document -fsanitize-coverage=pc-table and -fsanitize-coverage=inline-8bit-counters

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

7 years agoExpose -mllvm -accurate-sample-profile to clang.
Dehao Chen [Thu, 24 Aug 2017 21:37:33 +0000 (21:37 +0000)]
Expose -mllvm -accurate-sample-profile to clang.

Summary: With accurate sample profile, we can do more aggressive size optimization. For some size-critical application, this can reduce the text size by 20%

Reviewers: davidxl, rsmith

Reviewed By: davidxl, rsmith

Subscribers: mehdi_amini, eraman, sanjoy, cfe-commits

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

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

7 years ago[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens...
Richard Smith [Thu, 24 Aug 2017 20:10:33 +0000 (20:10 +0000)]
[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens to be a lambda call operator, use the lambda's 'this' pointer, not the captured enclosing 'this' pointer (if any).

Do not sanitize the 'this' pointer of a member call operator for a lambda with
no capture-default, since that call operator can legitimately be called with a
null this pointer from the static invoker function. Any actual call with a null
this pointer should still be caught in the caller (if it is being sanitized).

This reinstates r311589 (reverted in r311680) with the above fix.

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

7 years ago[Preprocessor] Correct internal token parsing of newline characters in CRLF
Erich Keane [Thu, 24 Aug 2017 18:36:07 +0000 (18:36 +0000)]
[Preprocessor] Correct internal token parsing of newline characters in CRLF

Discovered due to a goofy git setup, the test system-headerline-directive.c
(and a few others) failed because the token-consumption will consume only the
'\r' in CRLF, making the preprocessor's printed value give the wrong line number
when returning from an include. For example:

(line 1):#include <noline.h>\r\n

The "file exit" code causes the printer to try to print the 'returned to the
main file' line. It looks up what the current line number is. However, since the
current 'token' is the '\n' (since only the \r was consumed), it will give the
line number as '1", not '2'. This results in a few failed tests, but more
importantly, results in error messages being incorrect when compiling a
previously preprocessed file.

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

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

7 years agoRevert "[ubsan] PR34266: When sanitizing the 'this' value for a member function that...
Adrian Prantl [Thu, 24 Aug 2017 18:18:24 +0000 (18:18 +0000)]
Revert "[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens to be a lambda call operator, use the lambda's 'this' pointer, not the captured enclosing 'this' pointer (if any)."

This reverts commit r311589 because of bot breakage.
http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan_check/4115/consoleFull#15752874848254eaf0-7326-4999-85b0-388101f2d404.

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

7 years ago[clang-format] Emit absolute splits before lines for comments, try 2
Krasimir Georgiev [Thu, 24 Aug 2017 16:41:10 +0000 (16:41 +0000)]
[clang-format] Emit absolute splits before lines for comments, try 2

Summary:
This recommits https://reviews.llvm.org/D36956 with an update to the added test
case to not use raw string literals, since this makes gcc unhappy.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[mips] Introducing option -mabs=[legacy/2008]
Petar Jovanovic [Thu, 24 Aug 2017 16:06:30 +0000 (16:06 +0000)]
[mips] Introducing option -mabs=[legacy/2008]

In patch r205628 using abs.[ds] instruction is forced, as they should behave
in accordance with flags Has2008 and ABS2008. Unfortunately for revisions
prior mips32r6 and mips64r6, abs.[ds] is not generating correct result when
working with NaNs. To generate a sequence which always produce a correct
result but also to allow user more control on how his code is compiled,
option -mabs is added where user can choose legacy or 2008.
By default legacy mode is used on revisions prior R6. Mips32r6 and mips64r6
use abs2008 mode by default.

Patch by Aleksandar Beserminji

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

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

7 years agoFix use-after-free in Clang's ASTSelection unittest
Alex Lorenz [Thu, 24 Aug 2017 14:53:48 +0000 (14:53 +0000)]
Fix use-after-free in Clang's ASTSelection unittest

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

7 years ago[Driver][AArch64] Add tests for RDM feature.
Chad Rosier [Thu, 24 Aug 2017 14:32:55 +0000 (14:32 +0000)]
[Driver][AArch64] Add tests for RDM feature.

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

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

7 years agoAdd missing std::move call
Alex Lorenz [Thu, 24 Aug 2017 14:08:18 +0000 (14:08 +0000)]
Add missing std::move call

This should fix
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental_build/41578/

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

7 years ago[refactor] Add the AST source selection component
Alex Lorenz [Thu, 24 Aug 2017 13:51:09 +0000 (13:51 +0000)]
[refactor] Add the AST source selection component

This commit adds the base AST source selection component to the refactoring
library. AST selection is represented using a tree of SelectedASTNode values.
Each selected node gets its own selection kind, which can actually be None even
in the middle of tree (e.g. statement in a macro whose child is in a macro
argument). The initial version constructs a "raw" selection tree, without
applying filters and canonicalisation operations to the nodes.

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

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

7 years ago[Clang][x86][Inline Asm] support for GCC style inline asm - Y<x> constraints
Coby Tayree [Thu, 24 Aug 2017 09:07:34 +0000 (09:07 +0000)]
[Clang][x86][Inline Asm] support for GCC style inline asm - Y<x> constraints

This patch is intended to enable the use of basic double letter constraints used in GCC extended inline asm {Yi Y2 Yz Y0 Ym Yt}.
Supersedes D35205
llvm counterpart: D36369

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

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

7 years agoRevert "[clang-format] Break non-trailing block comments"
Krasimir Georgiev [Thu, 24 Aug 2017 08:55:07 +0000 (08:55 +0000)]
Revert "[clang-format] Break non-trailing block comments"

This reverts commit r311457. It reveals some dormant bugs in comment
reflowing, like breaking a single line jsdoc type annotation before a
parameter into multiple lines.

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

7 years agoFixups to FE tests affected by D36793
Coby Tayree [Thu, 24 Aug 2017 08:47:26 +0000 (08:47 +0000)]
Fixups to FE tests affected by D36793

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

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

7 years ago[Driver] Register effective triple before get arm float abi.
Leo Li [Thu, 24 Aug 2017 01:51:51 +0000 (01:51 +0000)]
[Driver] Register effective triple before get arm float abi.

Summary:
We need to register effective triple before calling `getARMFloatABI`.
Add missing code when `--print-libgcc-file-name` is passed.

Reviewers: atanasyan, rsmith, mgorny, peter.smith, kristof.beyls, compnerd, jroelofs

Reviewed By: compnerd

Subscribers: llvm-commits, aemerson, javed.absar, srhines, kristof.beyls, pirama

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

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

7 years agoFix ClangFormatFuzzer.
George Karpenkov [Thu, 24 Aug 2017 00:30:28 +0000 (00:30 +0000)]
Fix ClangFormatFuzzer.

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

7 years agoObjC++: decorate ObjC interfaces in MSABI properly
Saleem Abdulrasool [Wed, 23 Aug 2017 22:38:58 +0000 (22:38 +0000)]
ObjC++: decorate ObjC interfaces in MSABI properly

`id` needs to be handled specially since it is a `TypedefType` which is
sugar for an `ObjCObjectPointerType` whose pointee is an
`ObjCObjectType` with base `BuiltinType::ObjCIdType` and no protocols
and the first level of pointer gets it own type implementation.  `Class`
is similar with the `ObjCClassType` as the base instead.

The qualifiers on the base type of the `ObjCObjectType` need to be
dropped because the innermost `mangleType` will handle the qualifiers
itself.

`id` is desugared to `struct objc_object *` which should be encoded as
`PAUobjc_object@@`.  `Class` is desugared to `struct objc_class *` which
should be encoded as `PAUobjc_class@@`.

We were previously applying an extra modifier `A` which will be handled
during the recursive call.

This now properly decorates interface types as well as `Class` and `id`.
This corrects the interactions between C++ and ObjC++ for the type
specifier decoration.

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

7 years agoFix mangling for dependent "type { expr-list }" expressions, and add mangling for...
Richard Smith [Wed, 23 Aug 2017 22:12:08 +0000 (22:12 +0000)]
Fix mangling for dependent "type { expr-list }" expressions, and add mangling for designated initializers matching recent cxx-abi-dev discussion.

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

7 years agoFix a bug in CGDebugInfo::EmitInlineFunctionStart causing DILocations to be
Adrian Prantl [Wed, 23 Aug 2017 21:24:12 +0000 (21:24 +0000)]
Fix a bug in CGDebugInfo::EmitInlineFunctionStart causing DILocations to be
parented in function declarations.

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

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

7 years agoParse and print DIExpressions inline to ease IR and MIR testing
Reid Kleckner [Wed, 23 Aug 2017 20:31:27 +0000 (20:31 +0000)]
Parse and print DIExpressions inline to ease IR and MIR testing

Summary:
Most DIExpressions are empty or very simple. When they are complex, they
tend to be unique, so checking them inline is reasonable.

This also avoids the need for CodeGen passes to append to the
llvm.dbg.mir named md node.

See also PR22780, for making DIExpression not be an MDNode.

Reviewers: aprantl, dexonsmith, dblaikie

Subscribers: qcolombet, javed.absar, eraman, hiraditya, llvm-commits

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

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