]> granicus.if.org Git - clang/log
clang
7 years ago[RecursiveASTVisitor] Fix post-order traversal of UnaryOperator
Malcolm Parsons [Wed, 7 Dec 2016 17:39:04 +0000 (17:39 +0000)]
[RecursiveASTVisitor] Fix post-order traversal of UnaryOperator

Reviewers: aaron.ballman, klimek, doug.gregor, teemperor, rsmith

Subscribers: cfe-commits

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

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

7 years ago[analyzer] Fix typo in nullability checker diagnostic
Devin Coughlin [Wed, 7 Dec 2016 17:36:27 +0000 (17:36 +0000)]
[analyzer] Fix typo in nullability checker diagnostic

'infered' --> 'inferred'

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

7 years ago[analyzer] Remove an unused enum value in RetainCountChecker.
Artem Dergachev [Wed, 7 Dec 2016 16:51:54 +0000 (16:51 +0000)]
[analyzer] Remove an unused enum value in RetainCountChecker.

No functional change intended.

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

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

7 years ago[analyzer] pr31226: Disable CastSizeChecker in C++ because it's not quite ready.
Artem Dergachev [Wed, 7 Dec 2016 16:12:26 +0000 (16:12 +0000)]
[analyzer] pr31226: Disable CastSizeChecker in C++ because it's not quite ready.

Avoids a crash and a related false positive.

Investigation by Daniel Krupp!

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

7 years agoImplement the -Wstrict-prototypes warning
Alex Lorenz [Wed, 7 Dec 2016 10:52:18 +0000 (10:52 +0000)]
Implement the -Wstrict-prototypes warning

This commit fixes PR20796. It implements the C only -Wstrict-prototypes warning.
Clang now emits a warning for function declarations which have no parameters
specified and for K&R function definitions with more than 0 parameters that are
not preceded by a previous prototype declaration.

The patch was originally submitted by Paul Titei!

rdar://15060615

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

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

7 years ago[ObjC++] Don't enter a C++ declarator scope when the current context is
Alex Lorenz [Wed, 7 Dec 2016 10:24:44 +0000 (10:24 +0000)]
[ObjC++] Don't enter a C++ declarator scope when the current context is
an Objective-C declaration

This commit ensures that Sema won't enter a C++ declarator scope when the
current context is an Objective-C declaration. This prevents an assertion
failure in EnterDeclaratorContext that's used to ensure that current context
will be restored correctly after exiting the declarator context.

rdar://20560175

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

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

7 years agoCompilation database test: don't try to output to CWD
Sam McCall [Wed, 7 Dec 2016 09:19:07 +0000 (09:19 +0000)]
Compilation database test: don't try to output to CWD

Summary:
Write output from compilation database test to %T rather than the working dir.
Sometimes CWD isn't writable!
Also specify no-canonical-prefixes so that clang has 'clang' in the name.

Reviewers: bkramer

Subscribers: joerg, cfe-commits

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

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

7 years ago[OpenCL] Added a LIT test for ensuring address space mangling is done the same both...
Alexey Bader [Wed, 7 Dec 2016 08:43:49 +0000 (08:43 +0000)]
[OpenCL] Added a LIT test for ensuring address space mangling is done the same both in OpenCL1.2 and OpenCL2.0.

Patch by Egor Churaev (echuraev).

Reviewers: Anastasia

Subscribers: yaxunl, cfe-commits, bader

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

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

7 years ago[OpenCL] Fix SPIR version generation.
Alexey Bader [Wed, 7 Dec 2016 08:38:24 +0000 (08:38 +0000)]
[OpenCL] Fix SPIR version generation.

Patch by Egor Churaev (echuraev).

Reviewers: Anastasia

Subscribers: bader, yaxunl, cfe-commits

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

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

7 years agoDriver: Remove support for -fobjc-gc*
Duncan P. N. Exon Smith [Wed, 7 Dec 2016 00:31:10 +0000 (00:31 +0000)]
Driver: Remove support for -fobjc-gc*

As a first step toward removing Objective-C garbage collection from
Clang, remove support from the driver.  I'm hoping this will flush out
any expected bots/configurations/whatever that might rely on it.

I've left the options behind temporarily in -cc1 to keep tests passing.
I'll kill them off entirely in a follow up when I've had a chance to
update/delete the rest of Clang.

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

7 years agoFix test.
Richard Smith [Wed, 7 Dec 2016 00:24:40 +0000 (00:24 +0000)]
Fix test.

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

7 years ago[MS-ABI]V-base dtor called more than needed when throw happens in v-base ctor in...
Erich Keane [Wed, 7 Dec 2016 00:21:45 +0000 (00:21 +0000)]
[MS-ABI]V-base dtor called more than needed when throw happens in v-base ctor in window. Need add "complete object flag" check in eh cleanup code.

The problem only happen on window ( A MS-ABI issuer )

The nature of the problem is virtual base dtor called more than it is needed after exception throw in inheriting base class(with virtual bases) ctor.

The root problem is when throw happen, not all virtual base classes have been contructed, so not all virtual base dtors are need to call for ehcleanup.

clang has code to handle vbase initialization: basically add check for "complete object flag" before call to v-base ctor.
But that part is missing for cleanup code.

To fix this add similar code as v-base init to cleanup code, same algorithm.

1> Add new routine:
EmitDtorCompleteObjectHandler

With corresponding to EmitCtorCompleteObjectHandler

2> In the EmitDestructorCal
Call EmitDtorCompleteObjectHandler when generate ehcleanup inside ctor.

Just add check for "complete object flag" before call to v-base dtor.

Without my change:
ehcleanup: ; preds = %ctor.skip_vbases

%13 = cleanuppad within none [], !dbg !66
%14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66
%15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66
%16 = bitcast i8* %15 to %struct.class_2*, !dbg !66
call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token

%13) ], !dbg !66

cleanupret from %13 unwind to caller, !dbg !66

with my change:
ehcleanup: ; preds = %ctor.skip_vbases

%13 = cleanuppad within none [], !dbg !66
%14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66
%15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66
%16 = bitcast i8* %15 to %struct.class_2*, !dbg !66
%is_complete_object4 = icmp ne i32 %is_most_derived2, 0, !dbg !66
br i1 %is_complete_object4, label %Dtor.dtor_vbase, label %Dtor.skip_vbase, !d

bg !66

Dtor.dtor_vbase: ; preds = %ehcleanup

call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token

%13) ], !dbg !66

br label %Dtor.skip_vbase, !dbg !66

Dtor.skip_vbase: ; preds = %Dtor.dtor_vbase, %ehcleanup

cleanupret from %13 unwind to caller, !dbg !66

Please let me know you need more info.

Patch by Jennifer Yu.

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

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

7 years agoAddress review feedback by adding comments about ${:uid}
Reid Kleckner [Wed, 7 Dec 2016 00:17:18 +0000 (00:17 +0000)]
Address review feedback by adding comments about ${:uid}

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

7 years ago[c++17] P0135R1: Guaranteed copy elision.
Richard Smith [Tue, 6 Dec 2016 23:52:28 +0000 (23:52 +0000)]
[c++17] P0135R1: Guaranteed copy elision.

When an object of class type is initialized from a prvalue of the same type
(ignoring cv qualifications), use the prvalue to initialize the object directly
instead of inserting a redundant elidable call to a copy constructor.

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

7 years ago[OpenMP] Fix typo in the run command in the test case. NFC.
Kelvin Li [Tue, 6 Dec 2016 23:18:06 +0000 (23:18 +0000)]
[OpenMP] Fix typo in the run command in the test case. NFC.

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

7 years agoDisable -Wweak-vtables when there are no key functions
Reid Kleckner [Tue, 6 Dec 2016 21:44:41 +0000 (21:44 +0000)]
Disable -Wweak-vtables when there are no key functions

Our -Wweak-vtables diagnostic is powered by our key function
calculation, which checks if key functions are enabled. We won't find
any key functions in C++ ABIs that lack key functions, so -Wweak-vtables
was warning on every dynamic class before this change. So, turn off this
warning in ABIs without key functions.

Addresses PR31220

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

7 years ago[OpenMP] Fix typo in the test case. NFC.
Kelvin Li [Tue, 6 Dec 2016 18:50:20 +0000 (18:50 +0000)]
[OpenMP] Fix typo in the test case. NFC.

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

7 years agoFix FileCheck pattern.
Joerg Sonnenberger [Tue, 6 Dec 2016 17:06:33 +0000 (17:06 +0000)]
Fix FileCheck pattern.

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

7 years agoAllow additional output since e.g. OSX appends flags like
Joerg Sonnenberger [Tue, 6 Dec 2016 17:02:41 +0000 (17:02 +0000)]
Allow additional output since e.g. OSX appends flags like
"-mlinker-version=264.3.102" automatically. Wiring down a target on the
other hand is problematic as this actually needs to run codegen and
doesn't work with -###.

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

7 years ago[MS ABI] Implement more of the Itanium mangling rules
David Majnemer [Tue, 6 Dec 2016 17:01:02 +0000 (17:01 +0000)]
[MS ABI] Implement more of the Itanium mangling rules

We didn't implement handle corner cases like:
 - lambdas used to initialize a field
 - lambdas in default argument initializers

This fixes PR31197.

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

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

7 years agoMake test case slightly more robust by explicitly passing --sysroot.
Joerg Sonnenberger [Tue, 6 Dec 2016 16:47:00 +0000 (16:47 +0000)]
Make test case slightly more robust by explicitly passing --sysroot.
Otherwise it would change when DEFAULT_SYSROOT is provided.

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

7 years agoIf clang was configured for a DEFAULT_SYSROOT and no --sysroot argument
Joerg Sonnenberger [Tue, 6 Dec 2016 16:40:57 +0000 (16:40 +0000)]
If clang was configured for a DEFAULT_SYSROOT and no --sysroot argument
is seen, record one with the implicit default.

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

7 years agoAllow clang to write compilation database records.
Joerg Sonnenberger [Tue, 6 Dec 2016 16:33:22 +0000 (16:33 +0000)]
Allow clang to write compilation database records.

When integrating compilation database output into existing build
systems, two approaches dominate so far. Ad-hoc implementation of the
JSON output rules or using compiler wrappers. This patch adds a new
option "-MJ foo.json" which gives a slightly cleaned up compilation
record. The output is a fragment, i.e. you still need to add the array
markers, but it allows multiple files to be easy merged.

This way the only change in a build system is adding the option with
potentially a per-target output file and merging the files with
something like
  (echo '['; cat *.o.json; echo ']' > compilation_database.json
or some additional filtering to remove the trailing comma for strict
JSON compliance.

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

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

7 years agoFix doc string typo: s/@__yes/@__objc_yes/
Jonathan Roelofs [Tue, 6 Dec 2016 15:45:41 +0000 (15:45 +0000)]
Fix doc string typo: s/@__yes/@__objc_yes/

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

7 years agoFix two clang-tidy misc-move-forwarding-reference warnings
Malcolm Parsons [Tue, 6 Dec 2016 14:49:18 +0000 (14:49 +0000)]
Fix two clang-tidy misc-move-forwarding-reference warnings

Patch by Michael Sharpe.

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

7 years agoAlso recognize -std=iso9899:201x
Benjamin Kramer [Tue, 6 Dec 2016 10:23:07 +0000 (10:23 +0000)]
Also recognize -std=iso9899:201x

It should already be handled but a typo in the LANGSTANDARD() definition
was introduced in r147220.

Patch by Alexander Richardson, test case by me.

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

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

7 years ago[clang] Fix D26214: Move error handling out of MC and to the callers.
Mandeep Singh Grang [Tue, 6 Dec 2016 02:49:16 +0000 (02:49 +0000)]
[clang] Fix D26214: Move error handling out of MC and to the callers.

Summary: Related llvm patch: https://reviews.llvm.org/D27359

Reviewers: echristo, t.p.northover, rengolin, grosbach, compnerd

Subscribers: mehdi_amini, cfe-commits, llvm-commits

Tags: #clang-c

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

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

7 years agoClean up some Sema checking code. NFC
Richard Trieu [Tue, 6 Dec 2016 01:42:28 +0000 (01:42 +0000)]
Clean up some Sema checking code.  NFC

- Rename CheckMinZero to CheckMaxUnsignedZero to reflect its actual purpose.
- Remove unused parameters from CheckAbsoluteValueFunction and
  CheckMaxUnsignedZero functions.
- Refactor the function name check so both functions can use the same one.

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

7 years agoRevert r288626, which reverts r288449. Original commit message:
Richard Smith [Tue, 6 Dec 2016 00:40:17 +0000 (00:40 +0000)]
Revert r288626, which reverts r288449. Original commit message:

Recover better from an incompatible .pcm file being provided by -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually.

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

7 years agoAdd test for r288732, warn on unsigned zero in std::max
Richard Trieu [Tue, 6 Dec 2016 00:27:21 +0000 (00:27 +0000)]
Add test for r288732, warn on unsigned zero in std::max

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

7 years agoAdditional test file missed from r288737.
Richard Smith [Tue, 6 Dec 2016 00:14:22 +0000 (00:14 +0000)]
Additional test file missed from r288737.

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

7 years ago[modules] Use the "redundant #include" diagnostic rather than the "module
Richard Smith [Tue, 6 Dec 2016 00:12:39 +0000 (00:12 +0000)]
[modules] Use the "redundant #include" diagnostic rather than the "module
import can't appear here" diagnostic if an already-visible module is textually
entered (because we have the module map but not the AST file) within a
function/namespace scope.

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

7 years agoWarn on unsigned zero in call to std::max
Richard Trieu [Mon, 5 Dec 2016 23:41:46 +0000 (23:41 +0000)]
Warn on unsigned zero in call to std::max

New default warning that triggers when an unsigned zero is used in a call to
std::max.  For unsigned values, zero is the minimum value, so any call to
std::max is always equal to the other value.  A common pattern was to take
the max of zero and the difference of two unsigned values, not taking into
account that unsigned values wrap around below zero.  This warning also emits
a note with a fixit hint to remove the zero and call to std::max.

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

7 years ago[docs] Use x86_64 and i386 instead of x86 as arch for triples.
Florian Hahn [Mon, 5 Dec 2016 22:52:20 +0000 (22:52 +0000)]
[docs] Use x86_64 and i386 instead of x86 as arch for triples.

Summary: x86 is not a valid arch for target triples, but x86_64 and i386 are.

Reviewers: rengolin, silvas

Subscribers: cfe-commits

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

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

7 years agoCodeGen: fix windows itanium RTTI in EH mode
Saleem Abdulrasool [Mon, 5 Dec 2016 22:40:20 +0000 (22:40 +0000)]
CodeGen: fix windows itanium RTTI in EH mode

When emitting RTTI for EH only, we would mark the locally defined (LinkOnceODR)
RTTI definition as dllimport, which is incorrect.  Ensure that if we are
generating the type information for EH only, it is marked as LinkOnceODR and we
do not make it dllimport.

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

7 years ago[analyzer] Print type for SymbolRegionValues when dumping to stream
Dominic Chen [Mon, 5 Dec 2016 20:30:11 +0000 (20:30 +0000)]
[analyzer] Print type for SymbolRegionValues when dumping to stream

Reviewers: NoQ, dcoughlin, zaks.anna

Subscribers: cfe-commits

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

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

7 years agoFix stack-use-after-scope in CheckExplicitlyDefaultedMemberExceptionSpec
Vitaly Buka [Mon, 5 Dec 2016 19:25:00 +0000 (19:25 +0000)]
Fix stack-use-after-scope in CheckExplicitlyDefaultedMemberExceptionSpec

Summary:
Similar to r288685.
getExceptionSpec returned structure with pointers to temporarily object created
by computeImplicitExceptionSpec.

Reviewers: rsmith

Subscribers: aizatsky, cfe-commits

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

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

7 years agoFix stack-use-after-scope in EvaluateImplicitExceptionSpec
Vitaly Buka [Mon, 5 Dec 2016 18:30:22 +0000 (18:30 +0000)]
Fix stack-use-after-scope in EvaluateImplicitExceptionSpec

Summary:
getExceptionSpec returns structure with pointers to temporarily object created
by computeImplicitExceptionSpec.

Reviewers: rsmith

Subscribers: aizatsky, cfe-commits

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

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

7 years ago[Sema] Respect DLL attributes more faithfully
Shoaib Meenai [Mon, 5 Dec 2016 18:01:35 +0000 (18:01 +0000)]
[Sema] Respect DLL attributes more faithfully

On MSVC, if an implicit instantiation already exists and an explicit
instantiation definition with a DLL attribute is created, the DLL
attribute still takes effect. Make clang match this behavior for
exporting.

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

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

7 years ago[analyzer] ObjCGenerics: Warn only on mismatch for invariant type parameters
Devin Coughlin [Mon, 5 Dec 2016 16:28:47 +0000 (16:28 +0000)]
[analyzer] ObjCGenerics: Warn only on mismatch for invariant type parameters

On a method call, the ObjCGenerics checker uses the type tracked by
DynamicTypePropagation for the receiver to to infer substituted parmeter types
for the called methods and warns when the argument type does not match the
parameter.

Unfortunately, using the tracked type can result in false positives when the
receiver has a non-invariant type parameter and has been intentionally upcast.
For example, becaue NSArray's type parameter is covaraint, the following code
is perfectly safe:

NSArray<NSString *> *allStrings = ...
NSDate *date = ...;
NSArray<NSObject *> *allObjects = allStrings;
NSArray<NSObject *> *moreObjects = [allObjects arrayByAddingObject:date];

but the checker currently warns that the date parameter is not an NSString *.

To avoid this kind of false positive, the checker will now only warn when
the class defining the called method has only invariant type parameters.

rdar://problem/28803951

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

7 years agoCFGBuilder: Fix crash when visiting delete expression on dependent type
Martin Bohme [Mon, 5 Dec 2016 11:33:19 +0000 (11:33 +0000)]
CFGBuilder: Fix crash when visiting delete expression on dependent type

Summary:
CXXDeleteExpr::getDestroyedType() can return a null QualType if the destroyed
type is a dependent type. This patch protects against this.

Reviewers: klimek

Subscribers: cfe-commits

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

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

7 years agoClean out unused diagnostics. NFC.
Benjamin Kramer [Mon, 5 Dec 2016 11:30:24 +0000 (11:30 +0000)]
Clean out unused diagnostics. NFC.

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

7 years agoDR1213: element access on an array xvalue or prvalue produces an xvalue. In the
Richard Smith [Mon, 5 Dec 2016 07:49:14 +0000 (07:49 +0000)]
DR1213: element access on an array xvalue or prvalue produces an xvalue. In the
latter case, a temporary array object is materialized, and can be
lifetime-extended by binding a reference to the member access. Likewise, in an
array-to-pointer decay, an rvalue array is materialized before being converted
into a pointer.

This caused IR generation to stop treating file-scope array compound literals
as having static storage duration in some cases in C++; that has been rectified
by modeling such a compound literal as an lvalue. This also improves clang's
compatibility with GCC for those cases.

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

7 years agoAdapt to llvm/TableGen DagInit changes.
Matthias Braun [Mon, 5 Dec 2016 06:00:51 +0000 (06:00 +0000)]
Adapt to llvm/TableGen DagInit changes.

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

7 years agoIRGen: Remove an unused overload of CreateAlignedLoad.
Peter Collingbourne [Mon, 5 Dec 2016 00:02:18 +0000 (00:02 +0000)]
IRGen: Remove an unused overload of CreateAlignedLoad.

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

7 years agoRevert "Recover better from an incompatible .pcm file being provided by -fmodule...
Daniel Jasper [Sun, 4 Dec 2016 22:34:37 +0000 (22:34 +0000)]
Revert "Recover better from an incompatible .pcm file being provided by -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually."

This reverts commit r288449.

I believe that this is currently faulty wrt. modules being imported
inside namespaces. Adding these lines to the new test:

  namespace n {
  #include "foo.h"
  }

Makes it break with

  fatal error: import of module 'M' appears within namespace 'n'

However, I believe it should fail with

  error: redundant #include of module 'M' appears within namespace 'n'

I have tracked this down to us now inserting a tok::annot_module_begin
instead of a tok::annot_module_include in
Preprocessor::HandleIncludeDirective() and then later in
Parser::parseMisplacedModuleImport(), we hit the code path for
tok::annot_module_begin, which doesn't set FromInclude of
checkModuleImportContext to true (thus leading to the "wrong"
diagnostic).

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

7 years agoTableGen: Adapt to llvm r288612
Matthias Braun [Sun, 4 Dec 2016 05:55:09 +0000 (05:55 +0000)]
TableGen: Adapt to llvm r288612

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

7 years agoAdd the --no-color option to the git call in the doc when using clang-format-diff
Sylvestre Ledru [Sat, 3 Dec 2016 23:22:45 +0000 (23:22 +0000)]
Add the --no-color option to the git call in the doc when using clang-format-diff

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

7 years ago[WebAssembly] Revert r288447.
Dan Gohman [Sat, 3 Dec 2016 23:03:52 +0000 (23:03 +0000)]
[WebAssembly] Revert r288447.

Revert r288447 which introduced -mdirect. It turns out we don't need a
custom flag for this, as the information we need is in the target triple.

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

7 years ago[libclang] Fix python tests
Sergey Kalinichev [Sat, 3 Dec 2016 12:53:06 +0000 (12:53 +0000)]
[libclang] Fix python tests

It was broken in r286421

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

7 years agoSema: delay the DLL exported member referencing
Saleem Abdulrasool [Sat, 3 Dec 2016 01:57:47 +0000 (01:57 +0000)]
Sema: delay the DLL exported member referencing

An explicit template specialization can cause the implicit template
specialization of a type which inherits the attributes.  In such a case, we
would end up with a delayed template specialization for a dll exported type
which we would fail to reference.  This would trigger an assertion.

We now propagate the dll storage attributes through the inheritance
chain.  Only after having done so do we reference the delayed template
specializations.  This allows any implicit specializations which inherit dll
storage to also be referenced.

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

7 years ago[Sema] Don't perform aggregate initialization for types with explicit constructors
Eric Fiselier [Sat, 3 Dec 2016 01:26:47 +0000 (01:26 +0000)]
[Sema] Don't perform aggregate initialization for types with explicit constructors

Summary:
The C++17 rules for aggregate initialization changed to disallow types with explicit constructors [dcl.init.aggr]p1. This patch implements that new rule.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoDR616, and part of P0135R1: member access (or pointer-to-member access) on a
Richard Smith [Sat, 3 Dec 2016 01:14:32 +0000 (01:14 +0000)]
DR616, and part of P0135R1: member access (or pointer-to-member access) on a
temporary produces an xvalue, not a prvalue. Support this by materializing the
temporary prior to performing the member access.

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

7 years agoPR31244: Use the exception specification from the callee's type directly to
Richard Smith [Sat, 3 Dec 2016 00:29:06 +0000 (00:29 +0000)]
PR31244: Use the exception specification from the callee's type directly to
compute whether a call is noexcept, even if we can't map the callee expression
to a called declaration.

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

7 years agoMore diagnostic name fixups: w_ -> warn_, warning_ -> warn_, not_ -> note_.
Richard Smith [Fri, 2 Dec 2016 23:00:28 +0000 (23:00 +0000)]
More diagnostic name fixups: w_ -> warn_, warning_ -> warn_, not_ -> note_.
In passing, add a warning group for "ignored qualifier in inline assembly" warnings.

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

7 years agoCodeGen: export typeinfo and typeinfo name on itanium
Saleem Abdulrasool [Fri, 2 Dec 2016 22:46:18 +0000 (22:46 +0000)]
CodeGen: export typeinfo and typeinfo name on itanium

When a C++ record is marked with dllexport mark both the typeinfo and the
typeinfo name as being exported.  Handle dllimport as the inverse.  This applies
to the itanium environment and not the MinGW environment.

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

7 years agoMass-rename the handful of error_* diagnostics to err_*.
Richard Smith [Fri, 2 Dec 2016 22:38:31 +0000 (22:38 +0000)]
Mass-rename the handful of error_* diagnostics to err_*.

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

7 years ago[Sema] Reset a BumpPtrAllocator on clear(). NFC.
George Burgess IV [Fri, 2 Dec 2016 21:00:12 +0000 (21:00 +0000)]
[Sema] Reset a BumpPtrAllocator on clear(). NFC.

Looks like the reset() call was omitted by accident.

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

7 years agoWith LTO and profile-use, enable hotness info in opt remarks
Adam Nemet [Fri, 2 Dec 2016 17:54:34 +0000 (17:54 +0000)]
With LTO and profile-use, enable hotness info in opt remarks

This is to match the behavior of non-LTO;
when -fsave-optimization-record is passed and PGO is available we enable
the generation of hotness information in the optimization records.

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

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

7 years ago[CUDA] Forward sanitizer support to host toolchain
Jason Henline [Fri, 2 Dec 2016 17:32:18 +0000 (17:32 +0000)]
[CUDA] Forward sanitizer support to host toolchain

Summary:
This is an improvement on rL288448 where address sanitization was listed
as supported for the CudaToolChain. Since the intent is for the
CudaToolChain not to reject any flags supported by the host compiler,
this patch switches to forwarding the CudaToolChain sanitizer support to
the host toolchain rather than explicitly whitelisting address
sanitization.

Thanks to hfinkel for this suggestion.

Reviewers: jlebar

Subscribers: hfinkel, cfe-commits

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

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

7 years ago[ClangFormat] Only insert #include into the #include block in the beginning of the...
Eric Liu [Fri, 2 Dec 2016 11:01:43 +0000 (11:01 +0000)]
[ClangFormat] Only insert #include into the #include block in the beginning of the file.

Summary:
This avoid inserting #include into:
- raw string literals containing #include.
- #if block.
- Special #include among declarations (e.g. functions).

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[Frontend] Fix an issue where a quoted search path is incorrectly
Alex Lorenz [Fri, 2 Dec 2016 09:51:51 +0000 (09:51 +0000)]
[Frontend] Fix an issue where a quoted search path is incorrectly
removed as a duplicate header search path

The commit r126167 started passing the First index into RemoveDuplicates, but
forgot to update 0 to First in the loop that looks for the duplicate. This
resulted in a bug where an -iquoted search path was incorrectly removed if you
passed in the same path into -iquote and more than one time into -isystem.

rdar://23991350

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

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

7 years agoclang/test/Driver/defsym.s: Appease targeting msc. It is incapable of external assemb...
NAKAMURA Takumi [Fri, 2 Dec 2016 05:09:21 +0000 (05:09 +0000)]
clang/test/Driver/defsym.s: Appease targeting msc. It is incapable of external assembler in trunk.

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

7 years ago[CUDA] Fix faulty test from rL288448
Jason Henline [Fri, 2 Dec 2016 02:04:43 +0000 (02:04 +0000)]
[CUDA] Fix faulty test from rL288448

Summary:
The test introduced by rL288448 is currently failing because
unimportant but unexpected errors appear as output from a test compile
line. This patch looks for a more specific error message, in order to
avoid false positives.

Reviewers: jlebar

Subscribers: cfe-commits

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

Switch to more specific error

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

7 years agop0012r1: define corresponding feature test macro
Richard Smith [Fri, 2 Dec 2016 02:02:23 +0000 (02:02 +0000)]
p0012r1: define corresponding feature test macro

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

7 years agoRecover better from an incompatible .pcm file being provided by -fmodule-file=.
Richard Smith [Fri, 2 Dec 2016 01:52:28 +0000 (01:52 +0000)]
Recover better from an incompatible .pcm file being provided by -fmodule-file=.
We try to include the headers of the module textually in this case, still
enforcing the modules semantic rules. In order to make that work, we need to
still track that we're entering and leaving the module. Also, if the module was
also marked as unavailable (perhaps because it was missing a file), we
shouldn't mark the module unavailable -- we don't need the module to be
complete if we're going to enter it textually.

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

7 years ago[CUDA] "Support" ASAN arguments in CudaToolChain
Jason Henline [Fri, 2 Dec 2016 01:42:54 +0000 (01:42 +0000)]
[CUDA] "Support" ASAN arguments in CudaToolChain

This fixes a bug that was introduced in rL287285. The bug made it
illegal to pass -fsanitize=address during CUDA compilation because the
CudaToolChain class was switched from deriving from the Linux toolchain
class to deriving directly from the ToolChain toolchain class. When
CudaToolChain derived from Linux, it used Linux's getSupportedSanitizers
method, and that method allowed ASAN, but when it switched to deriving
directly from ToolChain, it inherited a getSupportedSanitizers method
that didn't allow for ASAN.

This patch fixes that bug by creating a getSupportedSanitizers method
for CudaToolChain that supports ASAN.

This patch also fixes the test that checks that -fsanitize=address is
passed correctly for CUDA builds. That test didn't used to notice if an
error message was emitted, and that's why it didn't catch this bug when
it was first introduced. With the fix from this patch, that test will
now catch any similar bug in the future.

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

7 years ago[WebAssembly] Add an -mdirect flag for the direct wasm object feature.
Dan Gohman [Fri, 2 Dec 2016 01:12:40 +0000 (01:12 +0000)]
[WebAssembly] Add an -mdirect flag for the direct wasm object feature.

Add a target flag for enabling the new direct wasm object emission
feature.

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

7 years agoDelete tautological assertion.
Jonathan Roelofs [Fri, 2 Dec 2016 00:51:58 +0000 (00:51 +0000)]
Delete tautological assertion.

After r256463, both the LHS and RHS now refer to the same variable. Before,
they referred to the member, the parameter respectively. Now GCC6's
-Wtautological-compare complains.

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

7 years agoStruct GEPs must use i32, not whatever size_t is. It should be safe
John McCall [Thu, 1 Dec 2016 23:51:30 +0000 (23:51 +0000)]
Struct GEPs must use i32, not whatever size_t is.  It should be safe
to do this unconditionally, given that the indices will always be small
constant integers anyway.

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

7 years ago[libclang] Add APIs to check the result of an integer expression in CXEvalResult...
Argyrios Kyrtzidis [Thu, 1 Dec 2016 23:41:27 +0000 (23:41 +0000)]
[libclang] Add APIs to check the result of an integer expression in CXEvalResult without overflow

Patch by Emilio Cobos Álvarez!
See https://reviews.llvm.org/D26788

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

7 years agoExtend CompilationDatabase by a field for the output filename
Joerg Sonnenberger [Thu, 1 Dec 2016 23:37:45 +0000 (23:37 +0000)]
Extend CompilationDatabase by a field for the output filename

In bigger projects like an Operating System, the same source code is
often compiled in slightly different ways. This could be the difference
between PIC and non-PIC code for static vs dynamic libraries, it could
also be the difference between size optimised versions of tools for
ramdisk images. At the moment, the compilation database has no way to
distinguish such cases. As first step, add a field in the JSON format
for it and process it accordingly.

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

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

7 years agoAdd a space in a run line. NFC.
George Burgess IV [Thu, 1 Dec 2016 20:16:56 +0000 (20:16 +0000)]
Add a space in a run line. NFC.

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

7 years agoSend compiler output to /dev/null in defsym.s test.
Artem Belevich [Thu, 1 Dec 2016 19:34:35 +0000 (19:34 +0000)]
Send compiler output to /dev/null in defsym.s test.

Fixes test failures if tests are run in a read-only source tree.

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

7 years ago[CodeGen][ARM] Make sure the value and type used to create a bitcast
Akira Hatanaka [Thu, 1 Dec 2016 19:25:14 +0000 (19:25 +0000)]
[CodeGen][ARM] Make sure the value and type used to create a bitcast
have the same size.

This fixes an asset that is triggered when an address of a boolean
variable is passed to __builtin_arm_ldrex or __builtin_arm_strex.

rdar://problem/29269006

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

7 years ago[clang] Implement support for -defsym assembler option
Mandeep Singh Grang [Thu, 1 Dec 2016 18:42:16 +0000 (18:42 +0000)]
[clang] Implement support for -defsym assembler option

Summary:
Adds support for -Wa,-defsym,abc=1 option.

Related llvm patch: https://reviews.llvm.org/D26214

Reviewers: rafael, t.p.northover, colinl, echristo, compnerd, rengolin

Subscribers: mehdi_amini

Tags: #clang-c

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

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

7 years agoswiftcc: Add an api to query whether a target ABI stores swifterror in a register
Arnold Schwaighofer [Thu, 1 Dec 2016 18:07:38 +0000 (18:07 +0000)]
swiftcc: Add an api to query whether a target ABI stores swifterror in a register

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

7 years agoFix VS2015 build of clang-format-vsix by using NuGet to pull in required assemblies
Hans Wennborg [Thu, 1 Dec 2016 18:05:41 +0000 (18:05 +0000)]
Fix VS2015 build of clang-format-vsix by using NuGet to pull in required assemblies

Also added a gitignore to help track the right items to commit.

Patch by Antonio Maiorano <amaiorano@gmail.com>!

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

7 years ago[TableGen] Ignore fake args for parsing-related arg counts.
George Burgess IV [Thu, 1 Dec 2016 17:52:39 +0000 (17:52 +0000)]
[TableGen] Ignore fake args for parsing-related arg counts.

We should complain about the following:

```
void foo() __attribute__((unavailable("a", "b")));
```

Instead, we currently just ignore "b". (...We also end up ignoring "a",
because we assume elsewhere that this attribute can only have 1 or 0
args.)

This happens because `unavailable` has a fake enum arg, and
`AttributeList::{getMinArgs,getMaxArgs}` include fake args in their
counts.

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

7 years ago[analyzer] Drop explicit mention of range constraint solver
Dominic Chen [Thu, 1 Dec 2016 17:06:39 +0000 (17:06 +0000)]
[analyzer] Drop explicit mention of range constraint solver

Summary: The basic constraint solver was dropped in rL162384, leaving the range constraint solver as the default and only constraint solver. Explicitly specifying it is unnecessary, and makes it difficult to test with other solver backends.

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

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

7 years agoAdds hasUnqualifiedDesugaredType to allow matching through type sugar.
Manuel Klimek [Thu, 1 Dec 2016 15:45:06 +0000 (15:45 +0000)]
Adds hasUnqualifiedDesugaredType to allow matching through type sugar.

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

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

7 years ago[ObjC] Avoid a @try/@finally/@autoreleasepool fixit when parsing an expression
Alex Lorenz [Thu, 1 Dec 2016 12:14:38 +0000 (12:14 +0000)]
[ObjC] Avoid a @try/@finally/@autoreleasepool fixit when parsing an expression

This patch ensures that the typo fixit for the @try/@finally/@autoreleasepool {}
directive is shown only when we're parsing an actual statement where such
directives can actually be present.

rdar://19669565

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

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

7 years ago[OpenCL] Refactor read_only/write_only pipes.
Joey Gouly [Thu, 1 Dec 2016 11:30:49 +0000 (11:30 +0000)]
[OpenCL] Refactor read_only/write_only pipes.

This adds the access qualifier to the Pipe Type, rather than using a class
hierarchy.

It also fixes mergeTypes for Pipes, by disallowing merges. Only identical
pipe types can be merged. The test case in invalid-pipes-cl2.0.cl is added
to check that.

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

7 years agoFix crash with unsupported architectures in Linux/Gnu target triples.
Florian Hahn [Thu, 1 Dec 2016 11:02:59 +0000 (11:02 +0000)]
Fix crash with unsupported architectures in Linux/Gnu target triples.

Summary: This patch adds a check and an error message to gnutools::Linker::ConstructJob in case the architecture is not supported. For most other operating systems, the error message is created in lib/Basic/Targets.cpp:AllocateTarget, but when construction the linker arguments for the gnutools linker a supported architecture is required.

Reviewers: rafael, joerg, echristo

Subscribers: mehdi_amini, joerg, dschuff, cfe-commits

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

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

7 years agoTeach ConstantBuilder how to emit a reference to the current position
John McCall [Thu, 1 Dec 2016 05:33:30 +0000 (05:33 +0000)]
Teach ConstantBuilder how to emit a reference to the current position
that will be filled in when the initializer is set.

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

7 years agoP0012R1: add Itanium ABI support for throwing non-noexcept function pointers and...
Richard Smith [Thu, 1 Dec 2016 03:32:42 +0000 (03:32 +0000)]
P0012R1: add Itanium ABI support for throwing non-noexcept function pointers and catching as noexcept.

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

7 years agoRevert r285664, cxx-abi-dev chose to go in a different direction for the ABI here.
Richard Smith [Thu, 1 Dec 2016 03:04:07 +0000 (03:04 +0000)]
Revert r285664, cxx-abi-dev chose to go in a different direction for the ABI here.

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

7 years agoPR31081: ignore exception specifications when deducing function template
Richard Smith [Thu, 1 Dec 2016 02:11:49 +0000 (02:11 +0000)]
PR31081: ignore exception specifications when deducing function template
arguments from a declaration; despite what the standard says, this form of
deduction should not be considering exception specifications.

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

7 years ago[TableGen] Minor clean-ups. NFC.
George Burgess IV [Thu, 1 Dec 2016 00:13:18 +0000 (00:13 +0000)]
[TableGen] Minor clean-ups. NFC.

Primarily: try to use DenseSet<StringRef> instead of
std::set<std::string>, and use pretty range algos where we can.

Small sizes were arbitrarily chosen.

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

7 years agoClean up CGObjCMac's APIs for deriving class references. NFC.
John McCall [Wed, 30 Nov 2016 23:54:50 +0000 (23:54 +0000)]
Clean up CGObjCMac's APIs for deriving class references.  NFC.

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

7 years ago[OpenMP] Sema and parsing for 'teams distribute parallel for simd' pragma
Kelvin Li [Wed, 30 Nov 2016 23:51:03 +0000 (23:51 +0000)]
[OpenMP] Sema and parsing for 'teams distribute parallel for simd' pragma

This patch is to implement sema and parsing for 'teams distribute parallel for simd' pragma.

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

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

7 years agoIntroduce a type-safe enum for ForDefinition.
John McCall [Wed, 30 Nov 2016 23:25:13 +0000 (23:25 +0000)]
Introduce a type-safe enum for ForDefinition.

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

7 years agoFix some layering violations where CGObjCMac's NSString emission was
John McCall [Wed, 30 Nov 2016 23:15:55 +0000 (23:15 +0000)]
Fix some layering violations where CGObjCMac's NSString emission was
performed at the CodeGenModule level.

Would be NFC except we now also use a different uniquing structure so
that we don't get spurious conflicts if you ask for both an NSString
and a CFString for the same content (which is possible with builtins).

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

7 years agoProspective MSVC workaround.
John McCall [Wed, 30 Nov 2016 20:46:55 +0000 (20:46 +0000)]
Prospective MSVC workaround.

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

7 years agoFinish adopting ConstantInitBuilder in CGObjCGNU. NFC.
John McCall [Wed, 30 Nov 2016 20:19:46 +0000 (20:19 +0000)]
Finish adopting ConstantInitBuilder in CGObjCGNU.  NFC.

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

7 years ago[Sema] Teach -Wcast-align to look at the aligned attribute of the
Akira Hatanaka [Wed, 30 Nov 2016 19:42:03 +0000 (19:42 +0000)]
[Sema] Teach -Wcast-align to look at the aligned attribute of the
declared variables.

Teach Sema to check the aligned attribute attached to variable
declarations so that it doesn't issue spurious warnings.

rdar://problem/26517471

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

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

7 years ago[analyzer] Construct temporary objects of correct types, destroy them properly.
Artem Dergachev [Wed, 30 Nov 2016 19:02:44 +0000 (19:02 +0000)]
[analyzer] Construct temporary objects of correct types, destroy them properly.

When constructing a temporary object region, which represents the result of
MaterializeTemporaryExpr, track down the sub-expression for which the temporary
is necessary with a trick similar to the approach used in CodeGen, namely
by using Expr::skipRValueSubobjectAdjustments().

Then, create the temporary object region with type of that sub-expression.
That type would propagate further in a path-sensitive manner.

During destruction of lifetime-extened temporaries, consult the type of
the temporary object region, rather than the type of the lifetime-extending
variable, in order to call the correct destructor (fixes pr17001) and,
at least, not to crash by trying to call a destructor of a plain type
(fixes pr19539).

rdar://problem/29131302
rdar://problem/29131576

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

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

7 years ago[analyzer] SValExplainer: Support ObjC ivars and __block variables.
Artem Dergachev [Wed, 30 Nov 2016 18:26:43 +0000 (18:26 +0000)]
[analyzer] SValExplainer: Support ObjC ivars and __block variables.

Additionally, explain the difference between normal and heap-based
symbolic regions.

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

7 years ago[analyzer] Minor fixes and improvements to debug.ExprInspection
Artem Dergachev [Wed, 30 Nov 2016 17:57:18 +0000 (17:57 +0000)]
[analyzer] Minor fixes and improvements to debug.ExprInspection

- Fix the bug with transition handling in ExprInspectionChecker's
  checkDeadSymbols implementation.

- Test this bug by adding a new function clang_analyzer_numTimesReached() to
  catch number of passes through the code, which should be handy for testing
  against unintended state splits.

- Add two more functions should help debugging issues quickly without running
  the debugger or dumping exploded graphs - clang_analyzer_dump() which dump()s
  an SVal argument to a warning message, and clang_analyzer_printState(), which
  dump()s the current program state to stderr.

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

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

7 years agoProspective GCC build fix: the unelaborated form of this friend
John McCall [Wed, 30 Nov 2016 04:18:19 +0000 (04:18 +0000)]
Prospective GCC build fix: the unelaborated form of this friend
declaration should find the right type, assuming it's supported
evenly across all our hosts.

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