]> granicus.if.org Git - clang/log
clang
7 years ago[CMake] Include LLVMFuzzer in Fuchsia toolchain
Petr Hosek [Tue, 15 Aug 2017 00:22:00 +0000 (00:22 +0000)]
[CMake] Include LLVMFuzzer in Fuchsia toolchain

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

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

7 years agoFix LLVMgold plugin name/path for non-Linux.
Dan Albert [Mon, 14 Aug 2017 23:19:38 +0000 (23:19 +0000)]
Fix LLVMgold plugin name/path for non-Linux.

Summary:
It's only named LLVMgold.so on Linux. Fix the name for Windows and
Darwin.

Also fix the path for Windows so binutils doesn't have to.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: cfe-commits

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

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

7 years ago[analyzer] Fix SimpleSValBuilder::simplifySVal
Alexander Shaposhnikov [Mon, 14 Aug 2017 21:23:08 +0000 (21:23 +0000)]
[analyzer] Fix SimpleSValBuilder::simplifySVal

This diff fixes a crash (triggered assert) on the newly added test case.
In the method Simplifier::VisitSymbolData we check the type of S and return
Loc/NonLoc accordingly.

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

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

7 years ago[Sema] Improve some -Wunguarded-availability diagnostics
Erik Pilkington [Mon, 14 Aug 2017 19:49:12 +0000 (19:49 +0000)]
[Sema] Improve some -Wunguarded-availability diagnostics

rdar://33543523
Differential revision: https://reviews.llvm.org/D36200

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

7 years ago[OPENMP] Fix for PR33922: New ident_t flags for
Alexey Bataev [Mon, 14 Aug 2017 17:56:13 +0000 (17:56 +0000)]
[OPENMP] Fix for PR33922: New ident_t flags for
__kmpc_for_static_init().

OpenMP 5.0 will include OpenMP Tools interface that requires distinguishing different worksharing constructs.

Since the same entry point (__kmp_for_static_init(ident_t *loc,
kmp_int32 global_tid,........)) is called in case static
loop/sections/distribute it is suggested using 'flags' field of the
ident_t structure to pass the type of the construct.

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

7 years ago[rename] Introduce symbol occurrences
Alex Lorenz [Mon, 14 Aug 2017 16:19:24 +0000 (16:19 +0000)]
[rename] Introduce symbol occurrences

Symbol occurrences store the results of local rename and will also be used for
the global, indexed rename results. Their kind is used to determine whether they
should be renamed automatically or not. They can be converted to a set of
AtomicChanges as well.

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

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

7 years agoclang-format: [JS] wrap optional properties in type aliases.
Martin Probst [Mon, 14 Aug 2017 16:09:08 +0000 (16:09 +0000)]
clang-format: [JS] wrap optional properties in type aliases.

Summary:
clang-format wraps object literal keys in an object literal if they are
marked as `TT_SelectorName`s and/or the colon is marked as
`TT_DictLiteral`. Previously, clang-format would accidentally work
because colons in type aliases were marked as `TT_DictLiteral`. r310367
fixed this to assing `TT_JsTypeColon`, which broke wrapping in certain
situations. However the root cause was that clang-format incorrectly
didn't skip questionmarks when detecting selector name.

This change fixes both locations to (1) assign `TT_SelectorName` and (2)
treat `TT_JsTypeColon` like `TT_DictLiteral`.

Previously:

    type X = {
      a: string, b?: string,
    };

Now:

    type X = {
      a: string,
      b?: string,
    };

Reviewers: djasper, sammccall

Subscribers: cfe-commits, klimek

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

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

7 years agoclang-format: [JS] do not insert whitespace in call positions.
Martin Probst [Mon, 14 Aug 2017 16:08:16 +0000 (16:08 +0000)]
clang-format: [JS] do not insert whitespace in call positions.

Summary:
In JavaScript, may keywords can be used in method names and thus call sites:

    foo.delete();
    foo.instanceof();

clang-format would previously insert whitespace after the `instanceof`. This
change generically skips inserting whitespace between a keyword and a
parenthesis if preceded by a dot, i.e. in a callsite.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[OPENMP][DEBUG] Fix for PR33676: Debug info for OpenMP region is broken.
Alexey Bataev [Mon, 14 Aug 2017 16:03:47 +0000 (16:03 +0000)]
[OPENMP][DEBUG] Fix for PR33676: Debug info for OpenMP region is broken.

After some changes in clang/LLVM debug info for task-based regions was
not generated at all. Patch fixes this problem.

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

7 years ago[OPENMP] Generalization of calls of the outlined functions.
Alexey Bataev [Mon, 14 Aug 2017 15:01:03 +0000 (15:01 +0000)]
[OPENMP] Generalization of calls of the outlined functions.

General improvement of the outlined functions calls.

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

7 years ago[Parse] Fix typo in header docs (NFC)
Brian Gesiak [Mon, 14 Aug 2017 14:29:11 +0000 (14:29 +0000)]
[Parse] Fix typo in header docs (NFC)

Summary:
Fix typo "delcarations", added in rL310609 and rL310627.

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

7 years agoFixes a typo in a comment; NFC.
Aaron Ballman [Mon, 14 Aug 2017 14:16:00 +0000 (14:16 +0000)]
Fixes a typo in a comment; NFC.

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

7 years agoclang-format: Fix left pointer alignment after delctype/typeof
Krasimir Georgiev [Mon, 14 Aug 2017 11:06:07 +0000 (11:06 +0000)]
clang-format: Fix left pointer alignment after delctype/typeof

Change 272124* introduced a regression in spaceRequiredBetween for left aligned pointers to decltype and typeof expressions. This fix adds logic to fix this. The test added is based on a related test in determineStarAmpUsage. Also add test cases for the regression.

http://llvm.org/viewvc/llvm-project?view=revision&revision=272124
LLVM bug tracker: https://bugs.llvm.org/show_bug.cgi?id=30407

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

Fix contributed by euhlmann!

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

7 years agoSet the lexical context for dummy tag decl inside createTagFromNewDecl
Alex Lorenz [Mon, 14 Aug 2017 10:59:44 +0000 (10:59 +0000)]
Set the lexical context for dummy tag decl inside createTagFromNewDecl

This is a follow-up to r310706. This change has been recommended by
Bruno Cardoso Lopes and Richard Smith.

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

7 years ago[analyzer] Rename functions responsible for CFG-based suppress-on-sink.
Artem Dergachev [Mon, 14 Aug 2017 08:38:47 +0000 (08:38 +0000)]
[analyzer] Rename functions responsible for CFG-based suppress-on-sink.

Update comments. No functional change intended.

Addresses Devin's post-commit review comments in https://reviews.llvm.org/D35673
and https://reviews.llvm.org/D35674.

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

7 years agoFix memory leak in ToolChain::TranslateOpenMPTargetArgs
Jonas Hahnfeld [Mon, 14 Aug 2017 07:44:05 +0000 (07:44 +0000)]
Fix memory leak in ToolChain::TranslateOpenMPTargetArgs

rL310433 introduced a code path where DAL is not returned and must be freed.
This change allows to run openmp-offload.c when Clang is built with ASan.

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

7 years agoRename cxx1z -> cxx17 across all diagnostic IDs.
Richard Smith [Sun, 13 Aug 2017 23:37:29 +0000 (23:37 +0000)]
Rename cxx1z -> cxx17 across all diagnostic IDs.

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

7 years agoReplace remaining user-visible mentions of C++1z with C++17.
Richard Smith [Sun, 13 Aug 2017 22:26:53 +0000 (22:26 +0000)]
Replace remaining user-visible mentions of C++1z with C++17.

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

7 years ago[c++2a] Treat 'concept' and 'requires' as keywords, add compat warning for C++17...
Richard Smith [Sun, 13 Aug 2017 21:32:33 +0000 (21:32 +0000)]
[c++2a] Treat 'concept' and 'requires' as keywords, add compat warning for C++17 and before.

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

7 years ago[AArch64] Add support for a MinGW AArch64 target
Martin Storsjo [Sun, 13 Aug 2017 19:42:17 +0000 (19:42 +0000)]
[AArch64] Add support for a MinGW AArch64 target

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

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

7 years agoclang-format: add an option -verbose to list the files being processed
Sylvestre Ledru [Sat, 12 Aug 2017 15:15:10 +0000 (15:15 +0000)]
clang-format: add an option -verbose to list the files being processed

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

Tags: #clang

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

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

7 years agoPR34163: Don't cache an incorrect key function for a class if queried between
Richard Smith [Sat, 12 Aug 2017 01:46:03 +0000 (01:46 +0000)]
PR34163: Don't cache an incorrect key function for a class if queried between
the class becoming complete and its inline methods being parsed.

This replaces the hack of using the "late parsed template" flag to track member
functions with bodies we've not parsed yet; instead we now use the "will have
body" flag, which carries the desired implication that the function declaration
*is* a definition, and that we've just not parsed its body yet.

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

7 years agoRevert "[Modules] Prevent #import to reenter header if not building a module."
Bruno Cardoso Lopes [Sat, 12 Aug 2017 01:38:26 +0000 (01:38 +0000)]
Revert "[Modules] Prevent #import to reenter header if not building a module."

This reverts commit r310605. Richard pointed out a better way to achieve
this, which I'll post a patch for soon.

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

7 years agoAdd a Dockerfile for clang-proto-fuzzer
Kostya Serebryany [Sat, 12 Aug 2017 01:27:10 +0000 (01:27 +0000)]
Add a Dockerfile for clang-proto-fuzzer

Summary: Add a Dockerfile for clang-proto-fuzzer

Reviewers: morehouse, vitalybuka

Reviewed By: morehouse

Subscribers: hintonda, cfe-commits

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

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

7 years agoDisabling openmp-offload.c on linux until it is stabilized on all local configurations.
Alex Shlyapnikov [Fri, 11 Aug 2017 23:10:39 +0000 (23:10 +0000)]
Disabling openmp-offload.c on linux until it is stabilized on all local configurations.

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

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

7 years ago[OpenMP] Move failing flag tests to disabled GPU
Gheorghe-Teodor Bercea [Fri, 11 Aug 2017 21:17:50 +0000 (21:17 +0000)]
[OpenMP] Move failing flag tests to disabled GPU
offloading test file. This should prevent further errors
with the sanitizer.

Diff: D29660

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

7 years agoAdd -fsanitize=fuzzer-no-link flag to the driver.
George Karpenkov [Fri, 11 Aug 2017 17:22:58 +0000 (17:22 +0000)]
Add -fsanitize=fuzzer-no-link flag to the driver.

The flag will perform instrumentation necessary to the fuzzing,
but will NOT link libLLVMFuzzer.a library.
Necessary when modifying CFLAGS for projects which may produce
executables as well as a fuzzable target.

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

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

7 years ago[OpenMP] Enable previously successful offloading tests.
Gheorghe-Teodor Bercea [Fri, 11 Aug 2017 15:46:22 +0000 (15:46 +0000)]
[OpenMP] Enable previously successful offloading tests.

Create a separate test file to contain all tests for OpenMP
offloading to GPUs.

Make libdevice checking more robust by accounting for
the case in which no libdevice is found.

This changes are in connrection with diff: D29660

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

7 years ago[mips] Add missing mips-registered-target to mips test.
Simon Dardis [Fri, 11 Aug 2017 15:23:23 +0000 (15:23 +0000)]
[mips] Add missing mips-registered-target to mips test.

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

7 years ago[mips] Support implicit gpopt with N64 when using -fno-pic
Simon Dardis [Fri, 11 Aug 2017 15:01:34 +0000 (15:01 +0000)]
[mips] Support implicit gpopt with N64 when using -fno-pic

As clang defaults to -mno-abicalls when using -fno-pic for N64, implicitly use
-mgpopt in that case.

Reviewers: atanasyan

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

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

7 years ago[modules] Set the lexical DC for dummy tag decls that refer to hidden
Alex Lorenz [Fri, 11 Aug 2017 12:06:52 +0000 (12:06 +0000)]
[modules] Set the lexical DC for dummy tag decls that refer to hidden
declarations that are made visible after the dummy is parsed and ODR verified

Prior to this commit the
"(getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one."),"
assertion failure was triggered during semantic analysis of the dummy
tag declaration that was declared in another tag declaration because its
lexical context did not point to the outer tag decl.

rdar://32292196

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

7 years agoRevert r302670 for the upcoming 5.0.0 release
Stefan Maksimovic [Fri, 11 Aug 2017 11:39:07 +0000 (11:39 +0000)]
Revert r302670 for the upcoming 5.0.0 release

This is causing failures when compiling clang with -O3
as one of the structures used by clang is passed by
value and uses the fastcc calling convention.

Faliures manifest for stage2 mips build.

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

7 years agoRevert r310057
Stefan Maksimovic [Fri, 11 Aug 2017 11:03:54 +0000 (11:03 +0000)]
Revert r310057

Bring back changes which r304953 introduced since
they were in fact not the cause of failures described
in r310057 commit message.

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

7 years ago[Bash-autocompletion] Add --autocomplete flag to 5.0 release notes
Yuka Takahashi [Fri, 11 Aug 2017 09:44:42 +0000 (09:44 +0000)]
[Bash-autocompletion] Add --autocomplete flag to 5.0 release notes

Summary:
I thought we should add this information to release notes, because we
added a new flag to clang driver.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits

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

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

7 years agoRevert "Thread Safety Analysis: warn on nonsensical attributes."
Josh Gao [Fri, 11 Aug 2017 07:54:35 +0000 (07:54 +0000)]
Revert "Thread Safety Analysis: warn on nonsensical attributes."

This reverts commit rL310403, which caused spurious warnings in libc++,
because it didn't properly handle templated scoped lockable types.

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

7 years agoImplement latest feature test macro recommendations, P0096R4.
Richard Smith [Fri, 11 Aug 2017 03:39:40 +0000 (03:39 +0000)]
Implement latest feature test macro recommendations, P0096R4.

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

7 years agoUpdate cxx_status to mention the upcoming Clang 5 release.
Richard Smith [Fri, 11 Aug 2017 03:16:11 +0000 (03:16 +0000)]
Update cxx_status to mention the upcoming Clang 5 release.

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

7 years agoPR33850: Update cxx_dr_status for Clang 5 branch.
Richard Smith [Fri, 11 Aug 2017 03:14:20 +0000 (03:14 +0000)]
PR33850: Update cxx_dr_status for Clang 5 branch.

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

7 years agoPR33489: A function-style cast to a deduced class template specialization type is...
Richard Smith [Fri, 11 Aug 2017 02:04:19 +0000 (02:04 +0000)]
PR33489: A function-style cast to a deduced class template specialization type is type-dependent if it can't be resolved due to a type-dependent argument.

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

7 years ago[Sema][ObjC] Fix spurious -Wcast-qual warnings.
Akira Hatanaka [Fri, 11 Aug 2017 00:06:49 +0000 (00:06 +0000)]
[Sema][ObjC] Fix spurious -Wcast-qual warnings.

We do not meaningfully track object const-ness of Objective-C object
types. Silence the -Wcast-qual warning that is issued when casting to or
from Objective-C object types results in losing const qualification.

rdar://problem/33807915

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

7 years ago[X86] Implement __builtin_cpu_is
Craig Topper [Thu, 10 Aug 2017 20:28:30 +0000 (20:28 +0000)]
[X86] Implement __builtin_cpu_is

This patch adds support for __builtin_cpu_is. I've tried to match the strings supported to the latest version of gcc.

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

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

7 years agoEnable bunch of sanitizers on NetBSD/X86 and X86_64
Kamil Rytarowski [Thu, 10 Aug 2017 18:53:52 +0000 (18:53 +0000)]
Enable bunch of sanitizers on NetBSD/X86 and X86_64

Summary:
Enable more sanitizers:
 - i386 and amd64:
 * SanitizerKind::Vptr;
 * SanitizerKind::Leak;
 * SanitizerKind::SafeStack;
 * SanitizerKind::Function;

 - amd64 only:
 * SanitizerKind::Thread;

These sanitizers are in the process of upstreaming to LLVM projects.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dim, vitalybuka, kcc, filcab, fjricci

Reviewed By: vitalybuka

Subscribers: #sanitizers, cfe-commits

Tags: #sanitizers

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

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

7 years agoDisabling openmp-offload.c on linux until it is stabilized on all local configurations.
Alex Shlyapnikov [Thu, 10 Aug 2017 17:55:01 +0000 (17:55 +0000)]
Disabling openmp-offload.c on linux until it is stabilized on all local configurations.

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

7 years ago[Parse] Document Parser::SkipFunctionBodies
Brian Gesiak [Thu, 10 Aug 2017 17:02:04 +0000 (17:02 +0000)]
[Parse] Document Parser::SkipFunctionBodies

Reviewers: erikjv, doug.gregor

Subscribers: cfe-commits

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

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

7 years ago[OpenMP] Delete tests in openmp-offload.c which cuase failures
Gheorghe-Teodor Bercea [Thu, 10 Aug 2017 16:56:59 +0000 (16:56 +0000)]
[OpenMP] Delete tests in openmp-offload.c which cuase failures
until a better way to perform these tests is figured out.

Change connected to diff: D29654

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

7 years agoAdd a getName accessor for ModuleMacros.
Bob Wilson [Thu, 10 Aug 2017 16:42:46 +0000 (16:42 +0000)]
Add a getName accessor for ModuleMacros.

Swift would like to be able to access the name of a ModuleMacro.
There was some discussion of this in
https://github.com/apple/swift-clang/pull/93, suggesting that it makes
sense to have this accessor in Clang.

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

7 years agoFixed a race condition in PrecompiledPreamble.
Ilya Biryukov [Thu, 10 Aug 2017 16:10:40 +0000 (16:10 +0000)]
Fixed a race condition in PrecompiledPreamble.

Summary:
Two PrecompiledPreambles, used in parallel on separate threads,
could be writing preamble to the same temporary file.

Reviewers: bkramer, krasimir, klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

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

7 years agoPlace implictly declared functions at block scope
Momchil Velikov [Thu, 10 Aug 2017 15:43:06 +0000 (15:43 +0000)]
Place implictly declared functions at block scope

Such implicitly declared functions behave as if the enclosing block
contained the declaration extern int name() (C90, 6.3.3.2 Function calls),
thus their names should have block scope (C90, 6.1.2.1 Scope of identifiers).

This patch fixes https://bugs.llvm.org/show_bug.cgi?id=33224

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

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

7 years ago[mips] Group all `-mabicalls` related checks in the single place. NFC
Simon Atanasyan [Thu, 10 Aug 2017 15:42:31 +0000 (15:42 +0000)]
[mips] Group all `-mabicalls` related checks in the single place. NFC

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

7 years ago[mips] Show warning in case of mixing -mlong-calls and -mabicalls options
Simon Atanasyan [Thu, 10 Aug 2017 15:42:25 +0000 (15:42 +0000)]
[mips] Show warning in case of mixing -mlong-calls and -mabicalls options

While we do not support `-mshared / -mno-shared` properly, show warning
and ignore `-mlong-calls` option in case of implicitly or explicitly
provided `-mabicalls` option.

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

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

7 years ago[mips] Notify user that `-mabicalls` is ignored on non-PIC N64 ABI
Simon Atanasyan [Thu, 10 Aug 2017 15:42:16 +0000 (15:42 +0000)]
[mips] Notify user that `-mabicalls` is ignored on non-PIC N64 ABI

The -mabicalls option does not make sense in the case of non position
independent code for the N64 ABI. After this change the driver shows a
warning that -mabicalls is ignored in that case.

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

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

7 years ago[Parse] Document PrintStats, SkipFunctionBodies
Brian Gesiak [Thu, 10 Aug 2017 15:30:35 +0000 (15:30 +0000)]
[Parse] Document PrintStats, SkipFunctionBodies

Summary:
Add documentation for `clang::ParseAST` parameters `PrintStats` and
`SkipFunctionBodies`. Also, remove a tiny bit of trailing whitespace.

Reviewers: craig.topper, doug.gregor, erikjv

Subscribers: cfe-commits

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

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

7 years ago[Modules] Prevent #import to reenter header if not building a module.
Bruno Cardoso Lopes [Thu, 10 Aug 2017 15:16:24 +0000 (15:16 +0000)]
[Modules] Prevent #import to reenter header if not building a module.

When non-modular headers are imported while not building a module but
in -fmodules mode, be conservative and preserve the default #import
semantic: do not reenter headers.

rdar://problem/33745031

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

7 years ago[sanitizer-coverage] Change cmp instrumentation to distinguish const operands
Alexander Potapenko [Thu, 10 Aug 2017 15:00:13 +0000 (15:00 +0000)]
[sanitizer-coverage] Change cmp instrumentation to distinguish const operands

This implementation of SanitizerCoverage instrumentation inserts different
callbacks depending on constantness of operands:

  1. If both operands are non-const, then a usual
     __sanitizer_cov_trace_cmp[1248] call is inserted.
  2. If exactly one operand is const, then a
     __sanitizer_cov_trace_const_cmp[1248] call is inserted. The first
     argument of the call is always the constant one.
  3. If both operands are const, then no callback is inserted.

This separation comes useful in fuzzing when tasks like "find one operand
of the comparison in input arguments and replace it with the other one"
have to be done. The new instrumentation allows us to not waste time on
searching the constant operands in the input.

Patch by Victor Chibotaru.

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

7 years ago[ValueTracking] Enabling ValueTracking patch by default (recommit). Part 1.
Nikolai Bozhenov [Thu, 10 Aug 2017 11:22:52 +0000 (11:22 +0000)]
[ValueTracking] Enabling ValueTracking patch by default (recommit). Part 1.

The original patch was an improvement to IR ValueTracking on non-negative
integers. It has been checked in to trunk (D18777, r284022). But was disabled by
default due to performance regressions.
Perf impact has improved. The patch would be enabled by default.

Reviewers: reames, hfinkel

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

Patch by: Olga Chupina <olga.chupina@intel.com>

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

7 years agoRevert r310489 and follow-up commits r310505, r310519, r310537 and r310549
Alex Lorenz [Thu, 10 Aug 2017 10:34:46 +0000 (10:34 +0000)]
Revert r310489 and follow-up commits r310505, r310519, r310537 and r310549

Commit r310489 caused 'openmp-offload.c' test failures on Darwin and other
platforms:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/39230/testReport/junit/Clang/Driver/openmp_offload_c/

The follow-up commits tried to fix the test, but the test is still failing.

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

7 years ago[Lexer] Finding beginning of token with escaped new line
Alexander Kornienko [Thu, 10 Aug 2017 10:06:16 +0000 (10:06 +0000)]
[Lexer] Finding beginning of token with escaped new line

Summary:
Lexer::GetBeginningOfToken produced invalid location when
backtracking across escaped new lines.

This fixes PR26228

Reviewers: akyrtzi, alexfh, rsmith, doug.gregor

Reviewed By: alexfh

Subscribers: alexfh, cfe-commits

Patch by PaweĹ‚ Ĺ»ukowski!

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

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

7 years ago[OpenMP] Provide a default GPU arch that is supported by
Gheorghe-Teodor Bercea [Thu, 10 Aug 2017 05:01:42 +0000 (05:01 +0000)]
[OpenMP] Provide a default GPU arch that is supported by
the underlying hardware.

This fixes a bug triggered by diff: D29660

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

7 years ago[Driver] Search compiler-rt paths in -print-file-name=
Petr Hosek [Thu, 10 Aug 2017 04:16:38 +0000 (04:16 +0000)]
[Driver] Search compiler-rt paths in -print-file-name=

This makes it possible to print the name of compiler-rt libraries
by using simply clang -print-file-name=libclang_rt.${runtime}-${arch}.so
same as other libraries, without having to know the details of the
resource directory organization.

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

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

7 years ago[clang-format] let PointerAlignment dictate spacing of function ref qualifiers
Jacob Bandes-Storch [Thu, 10 Aug 2017 01:30:22 +0000 (01:30 +0000)]
[clang-format] let PointerAlignment dictate spacing of function ref qualifiers

Summary: The original changes for ref qualifiers in rL272537 and rL272548 allowed function const+ref qualifier spacing to diverge from the spacing used for variables. It seems more consistent for `T const& x;` to match `void foo() const&;`.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoRemove unused function
Matt Arsenault [Thu, 10 Aug 2017 00:19:43 +0000 (00:19 +0000)]
Remove unused function

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

7 years agoclang-format: Fix bug with ENAS_DontAlign and empty lines
Jacob Bandes-Storch [Thu, 10 Aug 2017 00:15:31 +0000 (00:15 +0000)]
clang-format: Fix bug with ENAS_DontAlign and empty lines

This fixes a bug in `ENAS_DontAlign` (introduced in D32733) where blank lines had an EscapedNewlineColumn of 0, causing a subtraction to overflow when converted back to unsigned and leading to runaway memory allocation.

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

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

7 years ago[OpenMP] Remove offending test.
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 23:47:41 +0000 (23:47 +0000)]
[OpenMP] Remove offending test.

Diff: D29660

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

7 years ago[X86][Asm] Allow negative immediate to appear before bracketed expression
Coby Tayree [Wed, 9 Aug 2017 21:50:22 +0000 (21:50 +0000)]
[X86][Asm] Allow negative immediate to appear before bracketed expression

Currently, only non-negative immediate is allowed prior to a brac expression (memory reference).
MASM / GAS does not have any problem cope with the left side of the real line, so we should be able to as well.

llvm: D36229

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

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

7 years agoAMDGPU: Use direct struct returns and arguments
Matt Arsenault [Wed, 9 Aug 2017 21:44:58 +0000 (21:44 +0000)]
AMDGPU: Use direct struct returns and arguments

This is an improvement over always using byval for
structs.

This will use registers until ~16 are used, and then
switch back to byval. This needs more work, since I'm
not sure it ever really makes sense to use byval. If
the register limit is exceeded, the arguments still
end up passed on the stack, but with a different ABI.
It also may make sense to base this on number of
registers used for non-struct arguments, rather than
just arguments that appear first in the argument list.

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

7 years agoUse unsigned instead of an enum for map keys
George Burgess IV [Wed, 9 Aug 2017 21:20:41 +0000 (21:20 +0000)]
Use unsigned instead of an enum for map keys

ubsan's enum sanitizer doesn't like the latter, and we had to have
out-of-bounds values for DenseMapInfo's tombstone/empty keys.

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

7 years ago[Sema] Assign new flag -Wenum-compare-switch to switch-related parts of -Wenum-compare
Gabor Horvath [Wed, 9 Aug 2017 20:56:43 +0000 (20:56 +0000)]
[Sema] Assign new flag -Wenum-compare-switch to switch-related parts of -Wenum-compare

Patch by: Reka Nikolett Kovacs

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

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

7 years ago[OpenMP] Fix failing test for D29660.
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 20:52:58 +0000 (20:52 +0000)]
[OpenMP] Fix failing test for D29660.

Non-functional change.

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

7 years agoMake -std=c++17 an alias of -std=c++1z
Hans Wennborg [Wed, 9 Aug 2017 20:12:53 +0000 (20:12 +0000)]
Make -std=c++17 an alias of -std=c++1z

As suggested on PR33912.

Trying to keep this small to make it easy to merge to the 5.0 branch. We
can do a follow-up with more thorough renaming (diagnostic text,
options, ids, etc.) later.

(For C++14 this was done in r215982, and I think a smaller patch for the
3.5 branch:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20140818/113013.html)

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

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

7 years ago[OpenMP] Enable executable lookup into driver directory.
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 19:52:28 +0000 (19:52 +0000)]
[OpenMP] Enable executable lookup into driver directory.

Summary: Invoking the compiler inside a script causes the clang-offload-bundler executable to not be found. This patch enables the lookup for executables in the driver directory where the clang-offload-bundler resides.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, ABataev, caomhin

Reviewed By: hfinkel

Subscribers: cfe-commits

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

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

7 years ago[OPENMP] Emit non-debug version of outlined functions with original
Alexey Bataev [Wed, 9 Aug 2017 19:38:53 +0000 (19:38 +0000)]
[OPENMP] Emit non-debug version of outlined functions with original
name.

If the host code is compiled with the debug info, while the target
without, there is a problem that the compiler is unable to find the
debug wrapper. Patch fixes this problem by emitting special name for the
debug version of the code.

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

7 years agoPointerLikeTypeTraits: class->struct to match LLVM change
David Blaikie [Wed, 9 Aug 2017 18:34:22 +0000 (18:34 +0000)]
PointerLikeTypeTraits: class->struct to match LLVM change

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

7 years ago[OpenMP] Make the PTX version tests general enough to work on all toolchains.
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 18:25:52 +0000 (18:25 +0000)]
[OpenMP] Make the PTX version tests general enough to work on all toolchains.

Add explicit test for Darwin and PowerPC. Clean-up tests.

Non-functional change.

Original diff: D29660

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

7 years ago[OpenMP] Add flag for overwriting default PTX version for OpenMP targets
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 15:56:54 +0000 (15:56 +0000)]
[OpenMP] Add flag for overwriting default PTX version for OpenMP targets

Summary:
This flag "--fopenmp-ptx=" enables the overwriting of the default PTX version used for GPU offloaded OpenMP target regions: "+ptx42".

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: ABataev

Subscribers: rengolin, cfe-commits

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

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

7 years ago[OpenMP] Add flag for disabling the default generation of relocatable OpenMP target...
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 15:27:39 +0000 (15:27 +0000)]
[OpenMP] Add flag for disabling the default generation of relocatable OpenMP target code for NVIDIA GPUs.

Summary: Previously we have added the "-c" flag which gets passed to PTXAS by default to generate relocatable OpenMP target code by default. This set of flags exposes control over this behaviour.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: ABataev

Subscribers: Hahnfeld, rengolin, cfe-commits

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

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

7 years agoFix broken getAttributeSpellingListIndex for pragma attributes
Erich Keane [Wed, 9 Aug 2017 15:27:36 +0000 (15:27 +0000)]
Fix broken getAttributeSpellingListIndex for pragma attributes

We noticed when implementing a new pragma that the TableGen-generated function
getAttributeSpellingListIndex() did not work for pragma attributes. It relies
on the values in the enum AttributeList::Syntax and a new value
AS_ContextSensitiveKeyword was added changing the value for AS_Pragma.
Apparently no tests failed since no pragmas currently make use of the
generated function.

To fix this we can move AS_Pragma back to the value that TableGen code expects.
Also to prevent changes in the enum from breaking that routine again I added
calls to getAttributeSpellingListIndex() in the unroll pragma code. That will
cause some lit test failures if the order is changed. I added a comment to
remind of this issue in the future.

This assumes we don’t need/want full TableGen support for
AS_ContextSensitiveKeyword. It currently only appears in getAttrKind and no
other TableGen-generated routines.

Patch by: mikerice

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

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

7 years agoclang-format: [JS] detect ASI after closing parens.
Martin Probst [Wed, 9 Aug 2017 15:19:16 +0000 (15:19 +0000)]
clang-format: [JS] detect ASI after closing parens.

Summary: A closing parenthesis followed by a declaration or statement should always terminate the current statement.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 14:59:35 +0000 (14:59 +0000)]
[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default

Original Diff: D29642

This patch was previously reverted due to an error with patch D29654
that this depends on.

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

7 years agoReapply Sema: allow imaginary constants via GNU extension if UDL overloads not present.
Tim Northover [Wed, 9 Aug 2017 14:56:48 +0000 (14:56 +0000)]
Reapply Sema: allow imaginary constants via GNU extension if UDL overloads not present.

C++14 added user-defined literal support for complex numbers so that you
can write something like "complex<double> val = 2i". However, there is
an existing GNU extension supporting this syntax and interpreting the
result as a _Complex type.

This changes parsing so that such literals are interpreted in terms of
C++14's operators if an overload is present but otherwise falls back to
the original GNU extension.

(We now have more robust diagnostics for implicit conversions so the
libc++ test that caused the original revert still passes).

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

7 years ago[OpenCL] Minor refactoring to reduce copy/pasted code
Joey Gouly [Wed, 9 Aug 2017 14:52:47 +0000 (14:52 +0000)]
[OpenCL] Minor refactoring to reduce copy/pasted code

Set the type of TheCall inside SemaBuiltinReserveRWPipe to reduce
duplicated code.

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

7 years ago[X86][Ms-InlineAsm] Extend MS Dot operator to accept "this" + struct/class pointers...
Coby Tayree [Wed, 9 Aug 2017 13:31:41 +0000 (13:31 +0000)]
[X86][Ms-InlineAsm] Extend MS Dot operator to accept "this" + struct/class pointers aliases

MS InlineAsm Dot operator accepts "Bases" such as "this" (cpp) and class/struct pointer typedef.
This patch enhance its implementation with this behavior.

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

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

7 years ago[Sema] -Wenum-compare no longer warn on anonymous enums in switch statements
Gabor Horvath [Wed, 9 Aug 2017 12:34:58 +0000 (12:34 +0000)]
[Sema] -Wenum-compare no longer warn on anonymous enums in switch statements

Patch by: Reka Nikolett Kovacs

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

7 years agoRevert "PR19668, PR23034: Fix handling of move constructors and deleted copy construc...
Diana Picus [Wed, 9 Aug 2017 12:22:25 +0000 (12:22 +0000)]
Revert "PR19668, PR23034: Fix handling of move constructors and deleted copy constructors when deciding whether classes should be passed indirectly."

This reverts commit r310401 because it seems to have broken some ARM
bot(s).

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

7 years ago[clang-format] Put '/**' and '*/' on own lines in jsdocs ending in comment pragmas
Krasimir Georgiev [Wed, 9 Aug 2017 09:42:32 +0000 (09:42 +0000)]
[clang-format] Put '/**' and '*/' on own lines in jsdocs ending in comment pragmas

Summary:
This handles a case where the trailing '*/' of a multiline jsdoc eding in a
comment pragma wouldn't be put on a new line.

Reviewers: mprobst

Reviewed By: mprobst

Subscribers: cfe-commits, klimek

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

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

7 years ago[Sema] Extend -Wenum-compare to handle mixed enum comparisons in switch statements
Gabor Horvath [Wed, 9 Aug 2017 08:57:09 +0000 (08:57 +0000)]
[Sema] Extend -Wenum-compare to handle mixed enum comparisons in switch statements

Patch by: Reka Nikolett Kovacs

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

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

7 years agoAttempt #2 to appease buildbots
George Burgess IV [Wed, 9 Aug 2017 06:07:08 +0000 (06:07 +0000)]
Attempt #2 to appease buildbots

"error: unable to create target: 'No available targets are compatible
with this triple.'"

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

7 years agoAttempt to appease msc buildbot
George Burgess IV [Wed, 9 Aug 2017 05:20:05 +0000 (05:20 +0000)]
Attempt to appease msc buildbot

It was timing out on this test, but for reasons unrelated to the
specific bug it was testing for. Randomly breaking in gdb with `clang
-target i686-windows -fmsc-version=1700` reveals *many* frames from
MicrosoftCXXNameMangler. So, it would seem that some caching is needed
there, as well...

Fingers crossed that specifying a triple is sufficient to work around
this.

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

7 years ago[clang-fuzzer] Resolve proto dependencies
Vitaly Buka [Wed, 9 Aug 2017 04:45:00 +0000 (04:45 +0000)]
[clang-fuzzer] Resolve proto dependencies

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

7 years ago[AST] Cache intermediate visibility/linkage results
George Burgess IV [Wed, 9 Aug 2017 04:12:17 +0000 (04:12 +0000)]
[AST] Cache intermediate visibility/linkage results

This is a follow-up to r310436 with actual functional changes. Please
see that commit message for a description of why a cache is appearing
here.

Suggestions for less-bad ways of testing this are appreciated. :)

This fixes PR29160.

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

7 years ago[AST] Move visibility computations into a class; NFC
George Burgess IV [Wed, 9 Aug 2017 04:02:49 +0000 (04:02 +0000)]
[AST] Move visibility computations into a class; NFC

This is patch 1 in a 2 patch series that aims to fix PR29160. Its goal
is to cache decl visibility/linkage for the duration of each
visibility+linkage query.

The simplest way I can see to do this is to put the visibility
calculation code that needs to (transitively) access this cache into a
class, which is what this patch does. Actual caching will come in patch
2. (Another way would be to keep the cache in ASTContext + manually
invalidate it or something, but that felt way too subtle to me.)

Caching visibility results across multiple queries seems a bit tricky,
since the user can add visibility attributes ~whenever they want, and
these attributes can apparently have far-reaching effects (e.g. class
visibility extends to its members, ...). Because a cache that's dropped
at the end of each top-level query seems to work nearly as well and
doesn't require any eviction logic, I opted for that design.

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

7 years agoAllow operator delete to be an invalid Decl.
Richard Trieu [Wed, 9 Aug 2017 02:03:59 +0000 (02:03 +0000)]
Allow operator delete to be an invalid Decl.

Do not discard invalid Decl when searching for the operator delete function.
The lookup for this function always expects to find a result, so sometimes the
invalid Decl is the only choice possible.  This fixes PR34109.

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

7 years ago[OpenMP] Fix bug regarding cubin integration into host binary
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 01:02:19 +0000 (01:02 +0000)]
[OpenMP] Fix bug regarding cubin integration into host binary
when a BindArchAction is used.

This is not a functional change.

Original Diff: D29654

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

7 years agoSema: disable implicit conversion from _Complex to real types in C++.
Tim Northover [Tue, 8 Aug 2017 23:18:05 +0000 (23:18 +0000)]
Sema: disable implicit conversion from _Complex to real types in C++.

Converting a _Complex type to a real one simply discards the imaginary part.
This can easily lead to loss of information so for safety (and GCC
compatibility) this patch disallows that when the conversion would be implicit.

The one exception is bool, which actually compares both real and imaginary
parts and so is safe.

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

7 years agoRevert "Lexer: always allow imaginary constants in GNU mode."
Tim Northover [Tue, 8 Aug 2017 23:17:51 +0000 (23:17 +0000)]
Revert "Lexer: always allow imaginary constants in GNU mode."

This reverts r310423. It was committed by mistake, I intended to commit the
improved diagnostics for implicit conversions instead.

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

7 years agoLexer: always allow imaginary constants in GNU mode.
Tim Northover [Tue, 8 Aug 2017 22:03:54 +0000 (22:03 +0000)]
Lexer: always allow imaginary constants in GNU mode.

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

7 years ago[mips] Enable `long_call/short_call` attributes on MIPS64
Simon Atanasyan [Tue, 8 Aug 2017 21:17:33 +0000 (21:17 +0000)]
[mips] Enable `long_call/short_call` attributes on MIPS64

This change enables `long_call/short_call/far/near` attributes on
MIPS64 targets.

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

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

7 years ago[codeview] Emit nested enums and typedefs from classes
Reid Kleckner [Tue, 8 Aug 2017 20:30:14 +0000 (20:30 +0000)]
[codeview] Emit nested enums and typedefs from classes

Previously we limited ourselves to only emitting nested classes, but we
need other kinds of types as well.

This fixes the Visual Studio STL visualizers, so that users can
visualize std::string and other objects.

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

7 years ago[sanitizer-coverage] -fsanitize-coverage=bb,inline-8bit-counters
Kostya Serebryany [Tue, 8 Aug 2017 20:20:40 +0000 (20:20 +0000)]
[sanitizer-coverage] -fsanitize-coverage=bb,inline-8bit-counters

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

7 years agoIntegrate Kostya's clang-proto-fuzzer with LLVM.
Matt Morehouse [Tue, 8 Aug 2017 20:15:04 +0000 (20:15 +0000)]
Integrate Kostya's clang-proto-fuzzer with LLVM.

Summary:
The clang-proto-fuzzer models a subset of C++ as a protobuf and
uses libprotobuf-mutator to generate interesting mutations of C++
programs.  Clang-proto-fuzzer has already found several bugs in
Clang (e.g., https://bugs.llvm.org/show_bug.cgi?id=33747,
https://bugs.llvm.org/show_bug.cgi?id=33749).

As with clang-fuzzer, clang-proto-fuzzer requires the following
cmake flags:
- CMAKE_C_COMPILER=clang
- CMAKE_CXX_COMPILER=clang++
- LLVM_USE_SANITIZE_COVERAGE=YES  // needed for libFuzzer
- LLVM_USE_SANITIZER=Address  // needed for libFuzzer

In addition, clang-proto-fuzzer requires:
- CLANG_ENABLE_PROTO_FUZZER=ON

clang-proto-fuzzer also requires the following dependencies:
- binutils  // needed for libprotobuf-mutator
- liblzma-dev  // needed for libprotobuf-mutator
- libz-dev  // needed for libprotobuf-mutator
- docbook2x  // needed for libprotobuf-mutator
- Recent version of protobuf [3.3.0 is known to work]

A working version of libprotobuf-mutator will automatically be
downloaded and built as an external project.

Implementation of clang-proto-fuzzer provided by Kostya
Serebryany.

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

Reviewers: kcc, vitalybuka, bogner

Reviewed By: kcc, vitalybuka

Subscribers: thakis, mgorny, cfe-commits

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

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

7 years ago[coverage] Special-case calls to noreturn functions.
Eli Friedman [Tue, 8 Aug 2017 20:10:14 +0000 (20:10 +0000)]
[coverage] Special-case calls to noreturn functions.

The code after a noreturn call doesn't execute.

The pattern in the testcase is pretty common in LLVM (a switch with
a default case that calls llvm_unreachable).

The original version of this patch was reverted in r309995 due to a
crash. This version includes a fix for that crash (testcase in
test/CoverageMapping/md.cpp).

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

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