]> granicus.if.org Git - clang/log
clang
7 years ago[CodeGen] [CUDA] Add the ability set default attrs on functions in linked modules.
Justin Lebar [Wed, 25 Jan 2017 21:29:48 +0000 (21:29 +0000)]
[CodeGen] [CUDA] Add the ability set default attrs on functions in linked modules.

Summary:
Now when you ask clang to link in a bitcode module, you can tell it to
set attributes on that module's functions to match what we would have
set if we'd emitted those functions ourselves.

This is particularly important for fast-math attributes in CUDA
compilations.

Each CUDA compilation links in libdevice, a bitcode library provided by
nvidia as part of the CUDA distribution.  Without this patch, if we have
a user-function F that is compiled with -ffast-math that calls a
function G from libdevice, F will have the unsafe-fp-math=true (etc.)
attributes, but G will have no attributes.

Since F calls G, the inliner will merge G's attributes into F's.  It
considers the lack of an unsafe-fp-math=true attribute on G to be
tantamount to unsafe-fp-math=false, so it "merges" these by setting
unsafe-fp-math=false on F.

This then continues up the call graph, until every function that
(transitively) calls something in libdevice gets unsafe-fp-math=false
set, thus disabling fastmath in almost all CUDA code.

Reviewers: echristo

Subscribers: hfinkel, llvm-commits, mehdi_amini

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

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

7 years ago[OpenMP] Support for the proc_bind-clause on 'target parallel' on the NVPTX device.
Arpith Chacko Jacob [Wed, 25 Jan 2017 16:55:10 +0000 (16:55 +0000)]
[OpenMP] Support for the proc_bind-clause on 'target parallel' on the NVPTX device.

This patch adds support for the proc_bind clause on the Spmd construct
'target parallel' on the NVPTX device.  Since the parallel region is created
upon kernel launch, this clause can be safely ignored on the NVPTX device at
codegen time for level 0 parallelism.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29128

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

7 years agoClarify how to forward-declare __llvm_profile symbols.
Nico Weber [Wed, 25 Jan 2017 16:01:32 +0000 (16:01 +0000)]
Clarify how to forward-declare __llvm_profile symbols.

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

7 years ago[clang-format] Implement comment reflowing.
Krasimir Georgiev [Wed, 25 Jan 2017 13:58:58 +0000 (13:58 +0000)]
[clang-format] Implement comment reflowing.

Summary:
This presents a version of the comment reflowing with less mutable state inside
the comment breakable token subclasses. The state has been pushed into the
driving breakProtrudingToken method. For this, the API of BreakableToken is enriched
by the methods getSplitBefore and getLineLengthAfterSplitBefore.

Reviewers: klimek

Reviewed By: klimek

Subscribers: djasper, klimek, mgorny, cfe-commits, ioeric

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

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

7 years ago[test] Add HAVE_LIBZ to canonicalized booleans
Michal Gorny [Wed, 25 Jan 2017 13:31:53 +0000 (13:31 +0000)]
[test] Add HAVE_LIBZ to canonicalized booleans

Canonicalize HAVE_LIBZ as well to fix buildbot failures.

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

7 years ago[test] Port clang tests to canonicalized booleans
Michal Gorny [Wed, 25 Jan 2017 13:11:45 +0000 (13:11 +0000)]
[test] Port clang tests to canonicalized booleans

Use the new llvm_canonicalize_cmake_booleans() function to canonicalize
booleans for lit tests. Replace the duplicate ENABLE_CLANG* variables
used to hold canonicalized values with in-place canonicalization. Use
implicit logic in Python code to avoid overrelying on exact 0/1 values.

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

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

7 years ago[Driver] Prevent no-arc-exception-silence.m test from writing output.
Martin Bohme [Wed, 25 Jan 2017 12:55:53 +0000 (12:55 +0000)]
[Driver] Prevent no-arc-exception-silence.m test from writing output.

Summary: This enables the test to run on systems where output cannot be written.

Reviewers: compnerd

Subscribers: cfe-commits

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

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

7 years ago[OpenCL] Diagnose write_only image3d when extension is disabled
Anastasia Stulova [Wed, 25 Jan 2017 12:18:50 +0000 (12:18 +0000)]
[OpenCL] Diagnose write_only image3d when extension is disabled

Prior to OpenCL 2.0, image3d_t can only be used with the write_only
access qualifier when the cl_khr_3d_image_writes extension is enabled,
see e.g. OpenCL 1.1 s6.8b.

Require the extension for write_only image3d_t types and guard uses of
write_only image3d_t in the OpenCL header.

Patch by Sven van Haastregt!

Review: https://reviews.llvm.org/D28860

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

7 years ago[OpenMP] Support for thread_limit-clause on the 'target teams' directive.
Arpith Chacko Jacob [Wed, 25 Jan 2017 11:44:35 +0000 (11:44 +0000)]
[OpenMP] Support for thread_limit-clause on the 'target teams' directive.

The thread_limit-clause on the combined directive applies to the
'teams' region of this construct. We modify the ThreadLimitClause
class to capture the clause expression within the 'target' region.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29087

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

7 years ago[OpenMP] Support for num_teams-clause on the 'target teams' directive.
Arpith Chacko Jacob [Wed, 25 Jan 2017 11:28:18 +0000 (11:28 +0000)]
[OpenMP] Support for num_teams-clause on the 'target teams' directive.

The num_teams-clause on the combined directive applies to the
'teams' region of this construct. We modify the NumTeamsClause
class to capture the clause expression within the 'target' region.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29085

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

7 years ago[analyzer] Fix MacOSXAPIChecker fp with static locals seen from nested blocks.
Artem Dergachev [Wed, 25 Jan 2017 10:21:45 +0000 (10:21 +0000)]
[analyzer] Fix MacOSXAPIChecker fp with static locals seen from nested blocks.

This is an attempt to avoid new false positives caused by the reverted r292800,
however the scope of the fix is significantly reduced - some variables are still
in incorrect memory spaces.

Relevant test cases added.

rdar://problem/30105546
rdar://problem/30156693
Differential revision: https://reviews.llvm.org/D28946

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

7 years agoRevert "Use filename in linemarker when compiling preprocessed source"
Diana Picus [Wed, 25 Jan 2017 07:27:05 +0000 (07:27 +0000)]
Revert "Use filename in linemarker when compiling preprocessed source"

This reverts commit r293004 because it broke the buildbots with "unknown CPU"
errors. I tried to fix it in r293026, but that broke on Green Dragon with this
kind of error:

error: expected string not found in input
// CHECK: l{{ +}}df{{ +}}*ABS*{{ +}}{{0+}}{{.+}}preprocessed-input.c{{$}}
          ^
<stdin>:2:1: note: scanning from here
/Users/buildslave/jenkins/sharedspace/incremental@2/clang-build/tools/clang/test/Frontend/Output/preprocessed-input.c.tmp.o: file format Mach-O 64-bit x86-64
^
<stdin>:2:67: note: possible intended match here
/Users/buildslave/jenkins/sharedspace/incremental@2/clang-build/tools/clang/test/Frontend/Output/preprocessed-input.c.tmp.o: file format Mach-O 64-bit x86-64

I suppose this means that llvm-objdump doesn't support Mach-O, so the test
should indeed check for linux (but not for x86). I'll leave it to someone that
knows better.

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

7 years agoTry to fix test from r293004
Diana Picus [Wed, 25 Jan 2017 06:23:50 +0000 (06:23 +0000)]
Try to fix test from r293004

This test broke on a lot of non-x86 buildbots with "unknowm CPU" errors. I don't
see anything platform-specific about this test, and it seems to work fine on ARM
if we just remove the -triple i686 flags from the run line.

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

7 years agoDriver: ignore -fno-objc-arc-exception when -fno-objc-arc set
Saleem Abdulrasool [Wed, 25 Jan 2017 03:36:28 +0000 (03:36 +0000)]
Driver: ignore -fno-objc-arc-exception when -fno-objc-arc set

Sometime clang would be supplied -fobjc-arc -f(no)objc-arc-exceptions
and then later disable ARC with -fno-objc-arc, which only negate first
option, but not the latter, resulting usused argument warning.  Silence
this warning only when -fno-objc-arc option is present.

Patch by Onha Choe!

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

7 years ago[OpenMP] Codegen support for 'target teams' on the host.
Arpith Chacko Jacob [Wed, 25 Jan 2017 02:18:43 +0000 (02:18 +0000)]
[OpenMP] Codegen support for 'target teams' on the host.

This patch adds support for codegen of 'target teams' on the host.
This combined directive has two captured statements, one for the
'teams' region, and the other for the 'parallel'.

This target teams region is offloaded using the __tgt_target_teams()
call. The patch sets the number of teams as an argument to
this call.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29084

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

7 years agoUse filename in linemarker when compiling preprocessed source
David Callahan [Wed, 25 Jan 2017 01:55:28 +0000 (01:55 +0000)]
Use filename in linemarker when compiling preprocessed source

Summary:
Clang appears to always use name as specified on the command
line, whereas gcc uses the name as specified in the linemarker at the
first line when compiling a preprocessed source. This results mismatch
between two compilers in FILE symbol table entry. This patch makes clang
to resemble gcc's behavior in finding the original source file name and
use it as an input file name.

Even with this patch, values of FILE symbol table entry may still be
different because clang uses dirname+basename for the entry whlie gcc
uses basename only. I'll write a patch for that once this patch is
committed.

Reviewers: dblaikie, inglorion

Reviewed By: inglorion

Subscribers: inglorion, aprantl, bruno

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

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

7 years agoReverting commit because an NVPTX patch sneaked in. Break up into two
Arpith Chacko Jacob [Wed, 25 Jan 2017 01:45:59 +0000 (01:45 +0000)]
Reverting commit because an NVPTX patch sneaked in.  Break up into two
patches.

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

7 years ago[OpenMP] Codegen support for 'target teams' on the host.
Arpith Chacko Jacob [Wed, 25 Jan 2017 01:38:33 +0000 (01:38 +0000)]
[OpenMP] Codegen support for 'target teams' on the host.

This patch adds support for codegen of 'target teams' on the host.
This combined directive has two captured statements, one for the
'teams' region, and the other for the 'parallel'.

This target teams region is offloaded using the __tgt_target_teams()
call. The patch sets the number of teams as an argument to
this call.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29084

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

7 years ago[OpenMP] Support for the num_threads-clause on 'target parallel' on the NVPTX device.
Arpith Chacko Jacob [Wed, 25 Jan 2017 01:18:34 +0000 (01:18 +0000)]
[OpenMP] Support for the num_threads-clause on 'target parallel' on the NVPTX device.

This patch adds support for the Spmd construct 'target parallel' on the
NVPTX device. This involves ignoring the num_threads clause on the device
since the number of threads in this combined construct is already set on
the host through the call to __tgt_target_teams().

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29083

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

7 years ago[OpenMP] Support for the num_threads-clause on 'target parallel'.
Arpith Chacko Jacob [Wed, 25 Jan 2017 00:57:16 +0000 (00:57 +0000)]
[OpenMP] Support for the num_threads-clause on 'target parallel'.

The num_threads-clause on the combined directive applies to the
'parallel' region of this construct. We modify the NumThreadsClause
class to capture the clause expression within the 'target' region.

The offload runtime call for 'target parallel' is changed to
__tgt_target_teams() with 1 team and the number of threads set by
this clause or a default if none.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29082

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

7 years agoPR31742: Don't emit a bogus "zero size array" extwarn when initializing a
Richard Smith [Tue, 24 Jan 2017 23:18:28 +0000 (23:18 +0000)]
PR31742: Don't emit a bogus "zero size array" extwarn when initializing a
runtime-sized array from an empty list in an array new.

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

7 years agoStrengthen test from r292632 to also check we get the mangling correct for this case.
Richard Smith [Tue, 24 Jan 2017 21:03:48 +0000 (21:03 +0000)]
Strengthen test from r292632 to also check we get the mangling correct for this case.

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

7 years agoIRGen: Factor out function CodeGenAction::loadModule. NFCI.
Peter Collingbourne [Tue, 24 Jan 2017 19:55:38 +0000 (19:55 +0000)]
IRGen: Factor out function CodeGenAction::loadModule. NFCI.

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

7 years agoIRGen: Factor out function clang::FindThinLTOModule. NFCI.
Peter Collingbourne [Tue, 24 Jan 2017 19:54:37 +0000 (19:54 +0000)]
IRGen: Factor out function clang::FindThinLTOModule. NFCI.

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

7 years ago[docs] Add TableGen-based generator for command line argument documentation,
Richard Smith [Tue, 24 Jan 2017 19:39:46 +0000 (19:39 +0000)]
[docs] Add TableGen-based generator for command line argument documentation,
and generate documentation for all (non-hidden) options supported by the
'clang' driver.

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

7 years agoFix test/Driver/embed-bitcode.c on non-Darwin host by setting the target explicitly
Mehdi Amini [Tue, 24 Jan 2017 18:49:49 +0000 (18:49 +0000)]
Fix test/Driver/embed-bitcode.c on non-Darwin host by setting the target explicitly

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

7 years agoForward -bitcode_process_mode to ld64 in marker-only mode
Mehdi Amini [Tue, 24 Jan 2017 18:15:21 +0000 (18:15 +0000)]
Forward -bitcode_process_mode to ld64 in marker-only mode

Reviewers: steven_wu

Subscribers: cfe-commits

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

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

7 years agoSplit isUsingLTO() outside of embedBitcodeInObject() and embedBitcodeMarkerOnly().
Mehdi Amini [Tue, 24 Jan 2017 18:12:25 +0000 (18:12 +0000)]
Split isUsingLTO() outside of embedBitcodeInObject() and embedBitcodeMarkerOnly().

Summary: These accessors maps directly to the command line option.

Reviewers: steven_wu

Subscribers: cfe-commits

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

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

7 years ago[CodeCompletion] Ensure that ObjC root class completes instance
Alex Lorenz [Tue, 24 Jan 2017 14:15:08 +0000 (14:15 +0000)]
[CodeCompletion] Ensure that ObjC root class completes instance
methods from protocols and categories as well

Code completion results for class methods already include instance methods
from Objective-C root classes. This commit ensures that the results also include
instance methods from protocols that the root class implements and root class
categories as well.

rdar://28012953

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

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

7 years ago[Sema] Fix assumption about typo corrections containing no decl.
Benjamin Kramer [Tue, 24 Jan 2017 12:49:59 +0000 (12:49 +0000)]
[Sema] Fix assumption about typo corrections containing no decl.

This can happen when the typo correction is coming from an external sema
source. Test case will follow in clang-tools-extra.

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

7 years agoReplace use of chdir with llvm::sys::fs::set_current_path
Pavel Labath [Tue, 24 Jan 2017 11:14:29 +0000 (11:14 +0000)]
Replace use of chdir with llvm::sys::fs::set_current_path

NFCI

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

7 years agoRevert "[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`."
Greg Parker [Tue, 24 Jan 2017 08:57:17 +0000 (08:57 +0000)]
Revert "[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`."

The underlying `lit` change needs to be better-coordinated with libc++.

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

7 years ago[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`.
Greg Parker [Tue, 24 Jan 2017 08:47:25 +0000 (08:47 +0000)]
[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`.

Requires the new `lit` boolean expressions in LLVM r292896.

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

7 years agoRevert "[analyzer] Fix memory space of static locals seen from nested blocks."
Devin Coughlin [Tue, 24 Jan 2017 02:10:59 +0000 (02:10 +0000)]
Revert "[analyzer] Fix memory space of static locals seen from nested blocks."

This reverts commit r292800.

It is causing null pointer dereference false positives when a block that
captures a static local is evaluated at the top level.

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

7 years agoSwitch TableGen to emit calls to ASTRecordReader for AttrPCHRead.
David L. Jones [Tue, 24 Jan 2017 01:04:30 +0000 (01:04 +0000)]
Switch TableGen to emit calls to ASTRecordReader for AttrPCHRead.

Summary:
This patch changes TableGen-generated code in AttrPCHRead to call functions on
ASTRecordReader, instead of passing separate parameters to ASTReader. This is a
follow-up to r290217.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years ago[sanitizer-coverage] emit __sanitizer_cov_trace_pc_guard w/o a preceding 'if' by...
Kostya Serebryany [Tue, 24 Jan 2017 00:57:31 +0000 (00:57 +0000)]
[sanitizer-coverage] emit __sanitizer_cov_trace_pc_guard w/o a preceding 'if' by default. Update the docs, also add deprecation notes around other parts of sanitizer coverage

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

7 years agoRe-commit "Don't inline dllimport functions referencing non-imported methods"
Hans Wennborg [Mon, 23 Jan 2017 23:57:50 +0000 (23:57 +0000)]
Re-commit "Don't inline dllimport functions referencing non-imported methods"

This re-commits r292522 with the addition that it also handles calls
through pointer to member functions without crashing.

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

7 years agoAdd LF_ prefix to LibFunc enums in TargetLibraryInfo.
David L. Jones [Mon, 23 Jan 2017 23:16:58 +0000 (23:16 +0000)]
Add LF_ prefix to LibFunc enums in TargetLibraryInfo.

Summary:
The LibFunc::Func enum holds enumerators named for libc functions.
Unfortunately, there are real situations, including libc implementations, where
function names are actually macros (musl uses "#define fopen64 fopen", for
example; any other transitively visible macro would have similar effects).

Strictly speaking, a conforming C++ Standard Library should provide any such
macros as functions instead (via <cstdio>). However, there are some "library"
functions which are not part of the standard, and thus not subject to this
rule (fopen64, for example). So, in order to be both portable and consistent,
the enum should not use the bare function names.

The old enum naming used a namespace LibFunc and an enum Func, with bare
enumerators. This patch changes LibFunc to be an enum with enumerators prefixed
with "LF_". (Unfortunately, a scoped enum is not sufficient to override macros.)

These changes are for clang. See https://reviews.llvm.org/D28476 for LLVM.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoPR31692: Don't mark a declaration as invalid if we haven't necessarily emitted a...
Richard Smith [Mon, 23 Jan 2017 23:14:23 +0000 (23:14 +0000)]
PR31692: Don't mark a declaration as invalid if we haven't necessarily emitted a (user-visible) error.

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

7 years ago[APFloat] Switch from (PPCDoubleDoubleImpl, IEEEdouble) layout to (IEEEdouble, IEEEdo...
Tim Shen [Mon, 23 Jan 2017 22:39:35 +0000 (22:39 +0000)]
[APFloat] Switch from (PPCDoubleDoubleImpl, IEEEdouble) layout to (IEEEdouble, IEEEdouble)

Summary:
This patch changes the layout of DoubleAPFloat, and adjust all
operations to do either:
1) (IEEEdouble, IEEEdouble) -> (uint64_t, uint64_t) -> PPCDoubleDoubleImpl,
   then run the old algorithm.
2) Do the right thing directly.

1) includes multiply, divide, remainder, mod, fusedMultiplyAdd, roundToIntegral,
   convertFromString, next, convertToInteger, convertFromAPInt,
   convertFromSignExtendedInteger, convertFromZeroExtendedInteger,
   convertToHexString, toString, getExactInverse.
2) includes makeZero, makeLargest, makeSmallest, makeSmallestNormalized,
   compare, bitwiseIsEqual, bitcastToAPInt, isDenormal, isSmallest,
   isLargest, isInteger, ilogb, scalbn, frexp, hash_value, Profile.

I could split this into two patches, e.g. use
1) for all operatoins first, then incrementally change some of them to
2). I didn't do that, because 1) involves code that converts data between
PPCDoubleDoubleImpl and (IEEEdouble, IEEEdouble) back and forth, and may
pessimize the compiler. Instead, I find easy functions and use
approach 2) for them directly.

Next step is to implement move multiply and divide from 1) to 2). I don't
have plans for other functions in 1).

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

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

7 years agoAMDGPU: Update for changed subtarget feature name
Matt Arsenault [Mon, 23 Jan 2017 22:31:14 +0000 (22:31 +0000)]
AMDGPU: Update for changed subtarget feature name

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

7 years agoGuard __gnuc_va_list typedef.
Paul Robinson [Mon, 23 Jan 2017 19:09:21 +0000 (19:09 +0000)]
Guard __gnuc_va_list typedef.

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

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

7 years agoFix documentation typo from r292558.
Richard Smith [Mon, 23 Jan 2017 18:17:46 +0000 (18:17 +0000)]
Fix documentation typo from r292558.

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

7 years ago[Sema] UsingShadowDecl shouldn't be hidden by the UsingDecl that owns it
Alex Lorenz [Mon, 23 Jan 2017 17:23:23 +0000 (17:23 +0000)]
[Sema] UsingShadowDecl shouldn't be hidden by the UsingDecl that owns it

rdar://23454249

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

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

7 years ago[OpenCL] Improved enqueue_kernel diagnostic message
Anastasia Stulova [Mon, 23 Jan 2017 17:12:36 +0000 (17:12 +0000)]
[OpenCL] Improved enqueue_kernel diagnostic message

- Removed duplicated word typo.
- Made coherent across multiple similar diagnostics.

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

7 years agoRevert "DebugInfo: Omit class definitions even in the presence of available_externall...
David Blaikie [Mon, 23 Jan 2017 16:57:14 +0000 (16:57 +0000)]
Revert "DebugInfo: Omit class definitions even in the presence of available_externally vtables"

Patch crashing on a bootstrapping sanitizer bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/679

Reverting while I investigate.

This reverts commit r292768.

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

7 years ago[analyzer] Fix memory space of static locals seen from nested blocks.
Artem Dergachev [Mon, 23 Jan 2017 16:57:11 +0000 (16:57 +0000)]
[analyzer] Fix memory space of static locals seen from nested blocks.

When a block within a function accesses a function's static local variable,
this local is captured by reference rather than copied to the heap.

Therefore this variable's memory space is known: StaticGlobalSpaceRegion.
Used to be UnknownSpaceRegion, same as for stack locals.

Fixes a false positive in MacOSXAPIChecker.

rdar://problem/30105546
Differential revision: https://reviews.llvm.org/D28946

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

7 years ago[clang-format] Fix LanguageKind comments.
Krasimir Georgiev [Mon, 23 Jan 2017 16:21:06 +0000 (16:21 +0000)]
[clang-format] Fix LanguageKind comments.

Summary: With the introduction of LK_ObjC, the comment line for LK_Cpp became obsolete.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[OpenMP] DSAChecker bug fix for combined directives.
Arpith Chacko Jacob [Mon, 23 Jan 2017 15:38:49 +0000 (15:38 +0000)]
[OpenMP] DSAChecker bug fix for combined directives.

The DSAChecker code in SemaOpenMP looks at the captured statement
associated with an OpenMP directive.  A combined directive such as
'target parallel' has nested capture statements, which have to be
fully traversed before executing the DSAChecker.  This is a patch
to perform the traversal for such combined directives.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D29026

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

7 years agoRevert "IRGen: Start using the WriteThinLTOBitcode pass."
Martin Bohme [Mon, 23 Jan 2017 14:33:42 +0000 (14:33 +0000)]
Revert "IRGen: Start using the WriteThinLTOBitcode pass."

Summary:
This reverts commit r292662.

This change broke internal builds. Will provide a reproducer internally.

Subscribers: pcc, mehdi_amini, cfe-commits, mgorny

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

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

7 years agoclang-format: remove tests that assume no config file will be found as this is not...
Antonio Maiorano [Mon, 23 Jan 2017 13:20:23 +0000 (13:20 +0000)]
clang-format: remove tests that assume no config file will be found as this is not always the case

These tests fail for developers who place their build directories under the
llvm root directory because llvm's own .clang-format file will be found.
Anyway these cases are covered by FormatStyle.GetStyleOfFile tests
(FormatTest.cpp).

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

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

7 years agoASTImporter: fix tests on Windows with removing slashed parts of paths
Aleksei Sidorin [Mon, 23 Jan 2017 10:39:45 +0000 (10:39 +0000)]
ASTImporter: fix tests on Windows with removing slashed parts of paths

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

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

7 years agoASTImporter: quick test fix
Aleksei Sidorin [Mon, 23 Jan 2017 10:16:30 +0000 (10:16 +0000)]
ASTImporter: quick test fix

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

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

7 years agoASTImporter: add forgotten tests for rL292776
Aleksei Sidorin [Mon, 23 Jan 2017 09:45:29 +0000 (09:45 +0000)]
ASTImporter: add forgotten tests for rL292776

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

7 years agoASTImporter: improve support for C++ templates
Aleksei Sidorin [Mon, 23 Jan 2017 09:30:36 +0000 (09:30 +0000)]
ASTImporter: improve support for C++ templates

 * Support template partial specialization
 * Avoid infinite recursion in IsStructurallyEquivalent for TemplateArgument with implementing IsStructurallyEquivalent for TemplateName

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

7 years agoDebugInfo: Omit class definitions even in the presence of available_externally vtables
David Blaikie [Mon, 23 Jan 2017 02:24:03 +0000 (02:24 +0000)]
DebugInfo: Omit class definitions even in the presence of available_externally vtables

To ensure optimization level doesn't pessimize the -fstandalone-debug
vtable debug info optimization (where class definitions are only emitted
where the vtable is emitted - reducing redundant debug info) ensure the
debug info class definition is still omitted when an
available_externally vtable definition is emitted for optimization
purposes.

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

7 years ago[NVPTX] Auto-upgrade some NVPTX intrinsics to LLVM target-generic code.
Justin Lebar [Sat, 21 Jan 2017 01:00:32 +0000 (01:00 +0000)]
[NVPTX] Auto-upgrade some NVPTX intrinsics to LLVM target-generic code.

Summary:
Specifically, we upgrade llvm.nvvm.:

 * brev{32,64}
 * clz.{i,ll}
 * popc.{i,ll}
 * abs.{i,ll}
 * {min,max}.{i,ll,u,ull}
 * h2f

These either map directly to an existing LLVM target-generic
intrinsic or map to a simple LLVM target-generic idiom.

In all cases, we check that the code we generate is lowered to PTX as we
expect.

These builtins don't need to be backfilled in clang: They're not
accessible to user code from nvcc.

Reviewers: tra

Subscribers: majnemer, cfe-commits, llvm-commits, jholewinski

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

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

7 years ago[Basic] Remove the 32-bit x86 and ARM targets for Fuchsia
Petr Hosek [Fri, 20 Jan 2017 22:53:38 +0000 (22:53 +0000)]
[Basic] Remove the 32-bit x86 and ARM targets for Fuchsia

The 32-bit architectures are no longer supported by Fuchsia.

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

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

7 years agoIRGen: Start using the WriteThinLTOBitcode pass.
Peter Collingbourne [Fri, 20 Jan 2017 22:39:16 +0000 (22:39 +0000)]
IRGen: Start using the WriteThinLTOBitcode pass.

This is the final change necessary to support CFI with ThinLTO.

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

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

7 years ago[Altivec] Change vec_sl to a << (b % (sizeof(a) * 8))
Tim Shen [Fri, 20 Jan 2017 22:05:33 +0000 (22:05 +0000)]
[Altivec] Change vec_sl to a << (b % (sizeof(a) * 8))

For a << b (as original vec_sl does), if b >= sizeof(a) * 8, the
behavior is undefined. However, Power instructions do define the
behavior, which is equivalent to a << (b % (sizeof(a) * 8)).

This patch changes altivec.h to use a << (b % (sizeof(a) * 8)), to
ensure the consistent semantic of the instructions. Then it combines
the generated multiple instructions back to a single shift.

This patch handles left shift only. Right shift, on the other hand, is
more complicated, considering arithematic/logical right shift.

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

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

7 years agoRevert "Don't inline dllimport functions referencing non-imported methods"
Reid Kleckner [Fri, 20 Jan 2017 20:44:50 +0000 (20:44 +0000)]
Revert "Don't inline dllimport functions referencing non-imported methods"

This reverts commit r292522. It appears to be causing crashes in builds
using dllimport.

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

7 years agoRevert r292508 given that we intend to remove driver options for cxx modules.
Manman Ren [Fri, 20 Jan 2017 20:03:00 +0000 (20:03 +0000)]
Revert r292508 given that we intend to remove driver options for cxx modules.

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

7 years ago[docs] Regenerate DiagnosticsReference.rst. We don't have automatic generation of...
Richard Smith [Fri, 20 Jan 2017 19:27:09 +0000 (19:27 +0000)]
[docs] Regenerate DiagnosticsReference.rst. We don't have automatic generation of this set up server-side yet.

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

7 years agoAMDGPU: Add builtin for getreg intrinsic
Matt Arsenault [Fri, 20 Jan 2017 19:24:22 +0000 (19:24 +0000)]
AMDGPU: Add builtin for getreg intrinsic

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

7 years ago[Sema] Remove dead typedef
Bruno Cardoso Lopes [Fri, 20 Jan 2017 19:04:01 +0000 (19:04 +0000)]
[Sema] Remove dead typedef

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

7 years agoFix actually-reachable llvm_unreachable.
Richard Smith [Fri, 20 Jan 2017 18:50:12 +0000 (18:50 +0000)]
Fix actually-reachable llvm_unreachable.

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

7 years ago[Frontend] The macro that describes the Objective-C bool type should
Alex Lorenz [Fri, 20 Jan 2017 16:48:25 +0000 (16:48 +0000)]
[Frontend] The macro that describes the Objective-C bool type should
be defined for non Objective-C code as well

rdar://29794915

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

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

7 years ago[Sema] Improve the error diagnostic for dot destructor calls on pointer objects
Alex Lorenz [Fri, 20 Jan 2017 15:38:58 +0000 (15:38 +0000)]
[Sema] Improve the error diagnostic for dot destructor calls on pointer objects

This commit improves the mismatched destructor type error by detecting when the
destructor call has used a '.' instead of a '->' on a pointer to the destructed
type. The diagnostic now suggests to use '->' instead of '.', and adds a fixit
where appropriate.

rdar://28766702

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

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

7 years ago[clang-format] Remove redundant test in style-on-command-line.cpp
Krasimir Georgiev [Fri, 20 Jan 2017 12:39:05 +0000 (12:39 +0000)]
[clang-format] Remove redundant test in style-on-command-line.cpp

Summary:
rL292562 added a fix to always format if the fallback style is set to "none".
In test/Format/style-on-command-line.cpp:19 is redundant, since -fallback-style
has a default value of LLVM set in ClangFormat.cpp:72.

@amaiorano: I believe that the rest of the test cases still cover your change in
case the fallback style is explicitly set to "none". Please, if this is not the
case, initiate a discussion.

Reviewers: ioeric, bkramer

Reviewed By: ioeric

Subscribers: cfe-commits, klimek, amaiorano

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

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

7 years agoRemove 'RUN: false' from Driver/response-file.c
Krasimir Georgiev [Fri, 20 Jan 2017 11:06:58 +0000 (11:06 +0000)]
Remove 'RUN: false' from Driver/response-file.c

Summary:
It seems that rL292518 introduced a RUN: false, but the continuation rL292545
forgot to remove it back.

This has flown under the radar, because it's a long test and doesn't get
executed by default during sanity testing.

To test:
$ cd llvm_build
$ ./bin/llvm-lit --param run_long_tests=true tools/clang/test/Driver/response-file.c

@rsmith: have a look if this change is OK please.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, rsmith

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

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

7 years agoFix documentation typo.
Malcolm Parsons [Fri, 20 Jan 2017 09:54:26 +0000 (09:54 +0000)]
Fix documentation typo.

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

7 years agoUse UTF-8 for all communication with clang-format
Philipp Stephani [Fri, 20 Jan 2017 09:37:50 +0000 (09:37 +0000)]
Use UTF-8 for all communication with clang-format

Summary: Instead of picking the buffer file coding system, always use utf-8-unix for communicating with clang-format.  This is fine because clang-format never actually reads the file to be formatted, only standard input.  This is a bit simpler (process coding system is now a constant) and potentially faster, as utf-8-unix is Emacs's internal coding system.  Also add an end-to-end test that actually invokes clang-format.

Reviewers: klimek

Reviewed By: klimek

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

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

7 years ago[OPENMP] Fix for PR31643: Clang crashes when compiling code on Windows
Alexey Bataev [Fri, 20 Jan 2017 08:57:28 +0000 (08:57 +0000)]
[OPENMP] Fix for PR31643: Clang crashes when compiling code on Windows
with SEH and openmp

In some cituations (during codegen for Windows SEH constructs)
CodeGenFunction instance may have CurFn equal to nullptr. OpenMP related
code does not expect such situation during cleanup.

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

7 years ago[AST Printer] Print attributes on enum constants
Jordan Rose [Fri, 20 Jan 2017 03:33:42 +0000 (03:33 +0000)]
[AST Printer] Print attributes on enum constants

The AST printer was dropping attributes on enumerators (enum
constants). Now it's not.

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

7 years ago[test] Remove an unwanted match for `UNSUPPORTED:`.
Greg Parker [Fri, 20 Jan 2017 02:12:22 +0000 (02:12 +0000)]
[test] Remove an unwanted match for `UNSUPPORTED:`.

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

7 years agoclang-format: fix fallback style set to "none" not always formatting
Antonio Maiorano [Fri, 20 Jan 2017 01:22:42 +0000 (01:22 +0000)]
clang-format: fix fallback style set to "none" not always formatting

This fixes clang-format not formatting if fallback-style is explicitly set to
"none", and either a config file is found or YAML is passed in without a
"BasedOnStyle". With this change, passing "none" in these cases will have no
affect, and LLVM style will be used as the base style.

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

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

7 years agoPR31701: Fix crash on invalid caused by parsing a dependent initializer when we
Richard Smith [Fri, 20 Jan 2017 01:19:46 +0000 (01:19 +0000)]
PR31701: Fix crash on invalid caused by parsing a dependent initializer when we
don't know we're in a dependent context.

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

7 years agoFix documentation typo.
Richard Smith [Fri, 20 Jan 2017 01:08:15 +0000 (01:08 +0000)]
Fix documentation typo.

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

7 years agoAdd documentation for constexpr string builtin support.
Richard Smith [Fri, 20 Jan 2017 00:57:59 +0000 (00:57 +0000)]
Add documentation for constexpr string builtin support.

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

7 years agoP0426: Make the library implementation of constexpr char_traits a little easier
Richard Smith [Fri, 20 Jan 2017 00:45:35 +0000 (00:45 +0000)]
P0426: Make the library implementation of constexpr char_traits a little easier
by providing a memchr builtin that returns char* instead of void*.

Also add a __has_feature flag to indicate the presence of constexpr forms of
the relevant <string> functions.

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

7 years agoFinish implementation of C++ DR1310 (http://wg21.link/cwg1310).
Richard Smith [Fri, 20 Jan 2017 00:20:39 +0000 (00:20 +0000)]
Finish implementation of C++ DR1310 (http://wg21.link/cwg1310).

Diagnose the case when a dependent template name instantiates to an
injected-class-name outside a nested-name-specifier.

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

7 years agoDon't inline dllimport functions referencing non-imported methods
Hans Wennborg [Thu, 19 Jan 2017 21:33:13 +0000 (21:33 +0000)]
Don't inline dllimport functions referencing non-imported methods

This is another follow-up to r246338. I had assumed methods were already
handled by the AST visitor, but turns out they weren't.

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

7 years agoPR13403 (+duplicates): implement C++ DR1310 (http://wg21.link/cwg1310).
Richard Smith [Thu, 19 Jan 2017 21:00:13 +0000 (21:00 +0000)]
PR13403 (+duplicates): implement C++ DR1310 (http://wg21.link/cwg1310).

Under this defect resolution, the injected-class-name of a class or class
template cannot be used except in very limited circumstances (when declaring a
constructor, in a nested-name-specifier, in a base-specifier, or in an
elaborated-type-specifier). This is apparently done to make parsing easier, but
it's a pain for us since we don't know whether a template-id using the
injected-class-name is valid at the point when we annotate it (we don't yet
know whether the template-id will become part of an elaborated-type-specifier).

As a tentative resolution to a perceived language defect, mem-initializer-ids
are added to the list of exceptions here (they generally follow the same rules
as base-specifiers).

When the reference to the injected-class-name uses the 'typename' or 'template'
keywords, we permit it to be used to name a type or template as an extension;
other compilers also accept some cases in this area. There are also a couple of
corner cases with dependent template names that we do not yet diagnose, but
which will also get this treatment.

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

7 years agoModule: Improve diagnostic message when cxx modules are disabled and @import is used...
Manman Ren [Thu, 19 Jan 2017 19:05:55 +0000 (19:05 +0000)]
Module: Improve diagnostic message when cxx modules are disabled and @import is used in Objective CXX.

rdar://problem/19399671

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

7 years ago[Sema] Reword unused lambda capture warning
Malcolm Parsons [Thu, 19 Jan 2017 17:19:22 +0000 (17:19 +0000)]
[Sema] Reword unused lambda capture warning

Summary:
The warning doesn't know why the variable was looked up but not
odr-used, so reword it to not claim that it was used in an unevaluated
context.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

7 years ago[Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode
Alex Lorenz [Thu, 19 Jan 2017 17:17:57 +0000 (17:17 +0000)]
[Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode

rdar://28532840

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

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

7 years ago[Hexagon] Linux linker does not support .gnu-hash
Sumanth Gundapaneni [Thu, 19 Jan 2017 16:54:04 +0000 (16:54 +0000)]
[Hexagon] Linux linker does not support .gnu-hash

Hexagon Linux dynamic loader does not use (in fact does not support)
.gnu-hash

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

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

7 years ago[docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing
Malcolm Parsons [Thu, 19 Jan 2017 09:27:45 +0000 (09:27 +0000)]
[docs] Tell Doxygen to expand LLVM_ALIGNAS to nothing

Summary:
Docs for clang::Decl and clang::TemplateSpecializationType have
not been generated since LLVM_ALIGNAS was added to them.

Tell Doxygen to expand LLVM_ALIGNAS to nothing as described at
https://www.stack.nl/~dimitri/doxygen/manual/preprocessing.html

Reviewers: aaron.ballman, klimek, alexfh

Subscribers: ioeric, cfe-commits

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

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

7 years agoAdd -fdebug-info-for-profiling to emit more debug info for sample pgo profile collection
Dehao Chen [Thu, 19 Jan 2017 00:44:21 +0000 (00:44 +0000)]
Add -fdebug-info-for-profiling to emit more debug info for sample pgo profile collection

Summary:
SamplePGO uses profile with debug info to collect profile. Unlike the traditional debugging purpose, sample pgo needs more accurate debug info to represent the profile. We add -femit-accurate-debug-info for this purpose. It can be combined with all debugging modes (-g, -gmlt, etc). It makes sure that the following pieces of info is always emitted:

* start line of all subprograms
* linkage name of all subprograms
* standalone subprograms (functions that has neither inlined nor been inlined)

The impact on speccpu2006 binary size (size increase comparing with -g0 binary, also includes data for -g binary, which does not change with this patch):

               -gmlt(orig) -gmlt(patched) -g
433.milc       4.68%       5.40%          19.73%
444.namd       8.45%       8.93%          45.99%
447.dealII     97.43%      115.21%        374.89%
450.soplex     27.75%      31.88%         126.04%
453.povray     21.81%      26.16%         92.03%
470.lbm        0.60%       0.67%          1.96%
482.sphinx3    5.77%       6.47%          26.17%
400.perlbench  17.81%      19.43%         73.08%
401.bzip2      3.73%       3.92%          12.18%
403.gcc        31.75%      34.48%         122.75%
429.mcf        0.78%       0.88%          3.89%
445.gobmk      6.08%       7.92%          42.27%
456.hmmer      10.36%      11.25%         35.23%
458.sjeng      5.08%       5.42%          14.36%
462.libquantum 1.71%       1.96%          6.36%
464.h264ref    15.61%      16.56%         43.92%
471.omnetpp    11.93%      15.84%         60.09%
473.astar      3.11%       3.69%          14.18%
483.xalancbmk  56.29%      81.63%         353.22%
geomean        15.60%      18.30%         57.81%

Debug info size change for -gmlt binary with this patch:

433.milc       13.46%
444.namd       5.35%
447.dealII     18.21%
450.soplex     14.68%
453.povray     19.65%
470.lbm        6.03%
482.sphinx3    11.21%
400.perlbench  8.91%
401.bzip2      4.41%
403.gcc        8.56%
429.mcf        8.24%
445.gobmk      29.47%
456.hmmer      8.19%
458.sjeng      6.05%
462.libquantum 11.23%
464.h264ref    5.93%
471.omnetpp    31.89%
473.astar      16.20%
483.xalancbmk  44.62%
geomean        16.83%

Reviewers: davidxl, andreadb, rob.lougher, dblaikie, echristo

Reviewed By: dblaikie, echristo

Subscribers: hfinkel, rob.lougher, andreadb, gbedwell, cfe-commits, probinson, llvm-commits, mehdi_amini

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

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

7 years agoAdd llvm-dis dependency to check-clang.
Peter Collingbourne [Thu, 19 Jan 2017 00:04:44 +0000 (00:04 +0000)]
Add llvm-dis dependency to check-clang.

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

7 years agoMove vtable type metadata emission behind a cc1-level flag.
Peter Collingbourne [Wed, 18 Jan 2017 23:55:27 +0000 (23:55 +0000)]
Move vtable type metadata emission behind a cc1-level flag.

In ThinLTO mode, type metadata will require the module to be written as a
multi-module bitcode file, which is currently incompatible with the Darwin
linker. It is also useful to be able to enable or disable multi-module bitcode
for testing purposes. This introduces a cc1-level flag, -f{,no-}lto-unit,
which is used by the driver to enable multi-module bitcode on all but
Darwin+ThinLTO, and can also be used to enable/disable the feature manually.

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

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

7 years agoRemove now redundant code that ensured debug info for class definitions was emitted...
David Blaikie [Wed, 18 Jan 2017 21:15:18 +0000 (21:15 +0000)]
Remove now redundant code that ensured debug info for class definitions was emitted under certain circumstances

Introduced in r181561 - it may've been subsumed by work done to allow
emission of declarations for vtable types while still emitting some of
their member functions correctly for those declarations. Whatever the
reason, the tests pass without this code now.

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

7 years ago[OpenMP] Support for the if-clause on the combined directive 'target parallel'.
Arpith Chacko Jacob [Wed, 18 Jan 2017 20:40:48 +0000 (20:40 +0000)]
[OpenMP] Support for the if-clause on the combined directive 'target parallel'.

The if-clause on the combined directive potentially applies to both the
'target' and the 'parallel' regions.  Codegen'ing the if-clause on the
combined directive requires additional support because the expression in
the clause must be captured by the 'target' capture statement but not
the 'parallel' capture statement.  Note that this situation arises for
other clauses such as num_threads.

The OMPIfClause class inherits OMPClauseWithPreInit to support capturing
of expressions in the clause.  A member CaptureRegion is added to
OMPClauseWithPreInit to indicate which captured statement (in this case
'target' but not 'parallel') captures these expressions.

To ensure correct codegen of captured expressions in the presence of
combined 'target' directives, OMPParallelScope was added to 'parallel'
codegen.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D28781

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

7 years ago[ASTReader] Add a DeserializationListener callback for IMPORTED_MODULES
Graydon Hoare [Wed, 18 Jan 2017 20:36:59 +0000 (20:36 +0000)]
[ASTReader] Add a DeserializationListener callback for IMPORTED_MODULES

Summary:
Add a callback from ASTReader to DeserializationListener when the former
reads an IMPORTED_MODULES block. This supports Swift in using PCH for
bridging headers.

Reviewers: doug.gregor, manmanren, bruno

Reviewed By: manmanren

Subscribers: cfe-commits

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

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

7 years ago[Modules] Correct test comment from obsolete earlier version of code. NFC
Graydon Hoare [Wed, 18 Jan 2017 20:34:44 +0000 (20:34 +0000)]
[Modules] Correct test comment from obsolete earlier version of code. NFC

Summary:
Code committed in rL290219 went through a few iterations; test wound up with
stale comment.

Reviewers: doug.gregor, manmanren

Reviewed By: manmanren

Subscribers: cfe-commits

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

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

7 years ago[OpenMP] Codegen for the 'target parallel' directive on the NVPTX device.
Arpith Chacko Jacob [Wed, 18 Jan 2017 19:35:00 +0000 (19:35 +0000)]
[OpenMP] Codegen for the 'target parallel' directive on the NVPTX device.

This patch adds codegen for the 'target parallel' directive on the NVPTX
device.  We term offload OpenMP directives such as 'target parallel' and
'target teams distribute parallel for' as SPMD constructs.  SPMD constructs,
in contrast to Generic ones like the plain 'target', can never contain
a serial region.

SPMD constructs can be handled more efficiently on the GPU and do not
require the Warp Loop of the Generic codegen scheme. This patch adds
SPMD codegen support for 'target parallel' on the NVPTX device and can
be reused for other SPMD constructs.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D28755

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

7 years agoPR9551: Implement DR1004 (http://wg21.link/cwg1004).
Richard Smith [Wed, 18 Jan 2017 19:19:22 +0000 (19:19 +0000)]
PR9551: Implement DR1004 (http://wg21.link/cwg1004).

This rule permits the injected-class-name of a class template to be used as
both a template type argument and a template template argument, with no extra
syntax required to disambiguate.

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

7 years ago[OpenMP] Codegen support for 'target parallel' on the host.
Arpith Chacko Jacob [Wed, 18 Jan 2017 18:18:53 +0000 (18:18 +0000)]
[OpenMP] Codegen support for 'target parallel' on the host.

This patch adds support for codegen of 'target parallel' on the host.
It is also the first combined directive that requires two or more
captured statements.  Support for this functionality is included in
the patch.

A combined directive such as 'target parallel' has two captured
statements, one for the 'target' and the other for the 'parallel'
region.  Two captured statements are required because each has
different implicit parameters (see SemaOpenMP.cpp).  For example,
the 'parallel' has 'global_tid' and 'bound_tid' while the 'target'
does not.  The patch adds support for handling multiple captured
statements based on the combined directive.

When codegen'ing the 'target parallel' directive, the 'target'
outlined function is created using the outer captured statement
and the 'parallel' outlined function is created using the inner
captured statement.

Reviewers: ABataev
Differential Revision: https://reviews.llvm.org/D28753

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

7 years ago[ASTUnit] Reset diag state when creating the ASTUnit.
Benjamin Kramer [Wed, 18 Jan 2017 16:25:48 +0000 (16:25 +0000)]
[ASTUnit] Reset diag state when creating the ASTUnit.

A client could call this with a dirty diagnostic engine, don't crash.

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

7 years ago[Basic] Remove source manager references from diag state points.
Benjamin Kramer [Wed, 18 Jan 2017 15:50:26 +0000 (15:50 +0000)]
[Basic] Remove source manager references from diag state points.

This is just wasted space, we don't support state points from multiple
source managers. Validate that there's no state when resetting the
source manager and use the 'global' reference to the sourcemanager
instead of the ones in the diag state.

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