Commit Graph

66672 Commits

Author SHA1 Message Date
David Gross 1118d591dc [DebugInfo] Add support for __fp16, float, and double constants.
Summary:
Partial fix for PR26619.

Prior to this change, a DIGlobalVariable corresponding to a static
const was marked with an expression corresponding to its constant
value only if it is of integral type.  With this change, we now do the
same if it is of __fp16, float, or double type (that is,
floating-point types that do not exceed 64 bits in size, and hence are
supported easily by the existing LLVM machinery for creating constant
expressions in debug info).

Reviewers: llvm-commits

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

llvm-svn: 289094
2016-12-08 20:02:46 +00:00
Artem Belevich 64135c35f7 [CUDA] Ignore implicit target attributes during function template instantiation.
Some functions and templates are treated as __host__ __device__ even
when they don't have explicitly specified target attributes.
What's worse, this treatment may change depending on command line
options (-fno-cuda-host-device-constexpr) or
#pragma clang force_cuda_host_device.

Combined with strict checking for matching function target that comes
with D25809(r288962), it makes it hard to write code which would
explicitly instantiate or specialize some functions regardless of
pragmas or command line options in effect.

This patch changes the way we match target attributes of base template
vs attributes used in explicit instantiation or specialization so that
only explicitly specified attributes are considered. This makes base
template selection behave consistently regardless of pragma of command
line options that may affect CUDA target.

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

llvm-svn: 289091
2016-12-08 19:38:13 +00:00
Ekaterina Romanova a8fde7ce8b [DOXYGEN] Improved doxygen comments.
Improved doxygen comments for __wmmintrin_pclmul.h and ammintrin.h intrinsics by taagging parameter names with \a doxygen command to display parameters in italics.

Formatted comments to fit into 80 chars.

llvm-svn: 289083
2016-12-08 17:57:23 +00:00
Douglas Yung eebed6229a Fixing test to work when the compiler defaults to a different C++ standard version.
Differential Revision: https://reviews.llvm.org/D27488

llvm-svn: 289075
2016-12-08 17:27:20 +00:00
Alex Lorenz 71ecb07ed1 [CodeCompletion][ObjC] Use a parameterized NSSet return type for
keyPathsForValuesAffecting* KVO completion results

rdar://23791701

llvm-svn: 289068
2016-12-08 16:49:05 +00:00
Alex Lorenz feafdf6be4 [CodeCompletion] Provide Objective-C class property completion results
This commit provides class property code completion results. It supports
explicit and implicit class properties, but the special block completion is done
only for explicit properties right now.

rdar://25636195

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

llvm-svn: 289058
2016-12-08 15:09:40 +00:00
Alex Lorenz 660195f024 [Sema] Avoid "case value not in enumerated type" warning for C++11 opaque enums
This commit ensures that the switch warning "case value not in enumerated type"
isn't shown for opaque enums. We don't know the actual list of values in opaque
enums, so that warning is incorrect.

rdar://29230764

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

llvm-svn: 289055
2016-12-08 14:46:05 +00:00
Artem Dergachev a4e2541a70 [analyzer] Add dispatch_data_create as a special case in RetainCountChecker.
This function receives a callback block. The analyzer suspects that this block
may be used to take care of releasing the libdispatch object returned from
the function. In fact, it doesn't - it only releases the raw data buffer.
Inform the analyzer about that. Fixes the resulting false negatives.

rdar://problem/22280098

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

llvm-svn: 289047
2016-12-08 14:05:48 +00:00
Malcolm Parsons 77f039bf58 [ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmType
Summary: Needed for https://reviews.llvm.org/D27166

Reviewers: sbenza, bkramer, klimek

Subscribers: aemerson, cfe-commits

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

llvm-svn: 289042
2016-12-08 11:46:22 +00:00
Ekaterina Romanova d6042197db [DOXYGEN] Improved doxygen comments for avxintrin.h intrinsics.
Tagged parameter names with \a doxygen command to display them in italics.
Formatted comments to fit into 80 chars.

llvm-svn: 289022
2016-12-08 04:09:17 +00:00
Richard Smith 208732e954 [c++1z] P0490R0, NB comment GB 20: if std::tuple_size<T> is complete, use the
tuple-like interpretation of decomposition declaration even if there is no
::value member. We already did this, anticipating this resolution, just update
comments and tweak a testcase.

llvm-svn: 289021
2016-12-08 03:24:55 +00:00
Richard Smith 82da19ddb3 [c++1z] P0003R5: Removing dynamic exception specifications.
We continue to support dynamic exception specifications in C++1z as an
extension, but produce an error-by-default warning when we encounter one. This
allows users to opt back into the feature with a warning flag, and implicitly
opts system headers back into the feature should they happen to use it.

There is one semantic change implied by P0003R5 but not implemented here:
violating a throw() exception specification should now call std::terminate
directly instead of calling std::unexpected(), but since P0003R5 also removes
std::unexpected() and std::set_unexpected, and the default unexpected handler
calls std::terminate(), a conforming C++1z program cannot tell that we are
still calling it. The upside of this strategy is perfect backwards
compatibility; the downside is that we don't get the more efficient 'noexcept'
codegen for 'throw()'.

llvm-svn: 289019
2016-12-08 02:49:07 +00:00
Bruno Cardoso Lopes d93779da15 [Headers] Enable #include_next<float.h> on Darwin
Allows darwin targets to provide additional definitions and
implementation specifc values for float.h

rdar://problem/21961491

llvm-svn: 289018
2016-12-08 02:13:56 +00:00
David L. Jones b4b88fdc75 Loosen checks for _MSC_FULL_VER under -fms-extensions.
Summary:
On actual Windows hosts :-) , this could report something other than the
fallback, with a non-zero minor/build number.

Reviewers: rnk, llvm-commits

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

llvm-svn: 289011
2016-12-08 01:11:41 +00:00
Bruno Cardoso Lopes cfd183ee7e [Driver][Darwin] Disable default stack protector levels in freestanding mode.
Currently -fstack-protector is on by default when using -ffreestanding.
Change the default behavior to have it off when using -ffreestanding.

rdar://problem/14089363

llvm-svn: 289005
2016-12-08 00:22:06 +00:00
David L. Jones 24fb20c13d Refactor how the MSVC toolchain searches for a compatibility version.
Summary:
The MSVC toolchain and Clang driver combination currently uses a fairly complex
sequence of steps to determine the MS compatibility version to pass to cc1.
There is some oddness in this sequence currently, with some code which inspects
flags in the toolchain, and some code which inspects the triple and local
environment in the driver code.

This change is an attempt to consolidate most of this logic so that
Win32-specific code lives in MSVCToolChain.cpp. I'm not 100% happy with the
split, so any suggestions are welcome.

There are a few things you might want to watch for for specifically:

 - On all platforms, if MSVC compatibility flags are provided (and valid), use
   those.
 - The fallback sequence should be the same as before, but is now consolidated
   into MSVCToolChain::getMSVCVersion:
   - Otherwise, try to use the Triple.
   - Otherwise, on Windows, check the executable.
   - Otherwise, on Windows or with --fms-extensions, default to 18.
   - Otherwise, we can't determine the version.
 - MSVCToolChain::ComputeEffectiveTriple no longer calls the base
   ToolChain::ComputeEffectiveClangTriple. The only thing it would change for
   Windows the architecture, which we don't care about for the compatibility
   version.
    - I'm not sure whether this is philosophically correct (but it should
      be easy to add back to MSVCToolChain::getMSVCVersionFromTriple if not).
    - Previously, Tools.cpp just called getTriple() anyhow, so it doesn't look
      like the effective triple was always being used previously anyhow.

Reviewers: hans, compnerd, llvm-commits, rnk

Subscribers: amccarth

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

llvm-svn: 288998
2016-12-07 23:41:58 +00:00
David L. Jones 62cd86863a Add more tests for MSVC version handling.
Summary:
This change adds more test cases for the default MSVC compatibility version:
 1. When -fms-extensions is supplied, but -fmsc-version and
    -fms-compatibility-version are not.
 2. With the target triple specifies an MSVC environment, but no other
    -fms* flags.

Reviewers: rnk, llvm-commits

Subscribers: hans, compnerd, amccarth

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

llvm-svn: 288997
2016-12-07 23:39:44 +00:00
Bruno Cardoso Lopes 77bb405330 [Driver] Add tests for default stack protector values on Darwin
llvm-svn: 288994
2016-12-07 23:20:30 +00:00
Malcolm Parsons a29d98fcb5 [RecursiveASTVisitor] Improve post-order traversal unit test
llvm-svn: 288976
2016-12-07 20:38:20 +00:00
Artem Belevich 13e9b4d768 [CUDA] Improve target attribute checking for function templates.
* __host__ __device__ functions are no longer considered to be
  redeclarations of __host__ or __device__ functions. This prevents
  unintentional merging of target attributes across them.
* Function target attributes are not considered (and must match) during
  explicit instantiation and specialization of function templates.

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

llvm-svn: 288962
2016-12-07 19:27:16 +00:00
Malcolm Parsons b2b0cb7ca8 [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

llvm-svn: 288923
2016-12-07 17:39:04 +00:00
Devin Coughlin c894ac8163 [analyzer] Fix typo in nullability checker diagnostic
'infered' --> 'inferred'

llvm-svn: 288922
2016-12-07 17:36:27 +00:00
Artem Dergachev 5b6ff3f43a [analyzer] Remove an unused enum value in RetainCountChecker.
No functional change intended.

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

llvm-svn: 288917
2016-12-07 16:51:54 +00:00
Artem Dergachev d69e01297f [analyzer] pr31226: Disable CastSizeChecker in C++ because it's not quite ready.
Avoids a crash and a related false positive.

Investigation by Daniel Krupp!

llvm-svn: 288914
2016-12-07 16:12:26 +00:00
Alex Lorenz 840f8df677 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

llvm-svn: 288896
2016-12-07 10:52:18 +00:00
Alex Lorenz e151f010de [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

llvm-svn: 288893
2016-12-07 10:24:44 +00:00
Sam McCall 59336a0a45 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

llvm-svn: 288892
2016-12-07 09:19:07 +00:00
Alexey Bader a60db59d6f [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

llvm-svn: 288891
2016-12-07 08:43:49 +00:00
Alexey Bader b3190829e5 [OpenCL] Fix SPIR version generation.
Patch by Egor Churaev (echuraev).

Reviewers: Anastasia

Subscribers: bader, yaxunl, cfe-commits

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

llvm-svn: 288890
2016-12-07 08:38:24 +00:00
Duncan P. N. Exon Smith c9073fa806 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.

llvm-svn: 288872
2016-12-07 00:31:10 +00:00
Richard Smith 60a6bbe605 Fix test.
llvm-svn: 288870
2016-12-07 00:24:40 +00:00
Erich Keane 13c7ec5c65 [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

llvm-svn: 288869
2016-12-07 00:21:45 +00:00
Reid Kleckner 36c201a65a Address review feedback by adding comments about ${:uid}
llvm-svn: 288868
2016-12-07 00:17:18 +00:00
Richard Smith 122f88d481 [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.

llvm-svn: 288866
2016-12-06 23:52:28 +00:00
Kelvin Li 9965d22334 [OpenMP] Fix typo in the run command in the test case. NFC.
llvm-svn: 288862
2016-12-06 23:18:06 +00:00
Reid Kleckner b792e0694b 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

llvm-svn: 288850
2016-12-06 21:44:41 +00:00
Kelvin Li 8bd9107fb9 [OpenMP] Fix typo in the test case. NFC.
llvm-svn: 288838
2016-12-06 18:50:20 +00:00
Joerg Sonnenberger 3661087111 Fix FileCheck pattern.
llvm-svn: 288828
2016-12-06 17:06:33 +00:00
Joerg Sonnenberger a53561f60e 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 -###.

llvm-svn: 288827
2016-12-06 17:02:41 +00:00
David Majnemer 984498ff9d [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

llvm-svn: 288826
2016-12-06 17:01:02 +00:00
Joerg Sonnenberger d4435e331a Make test case slightly more robust by explicitly passing --sysroot.
Otherwise it would change when DEFAULT_SYSROOT is provided.

llvm-svn: 288823
2016-12-06 16:47:00 +00:00
Joerg Sonnenberger 0599a935e5 If clang was configured for a DEFAULT_SYSROOT and no --sysroot argument
is seen, record one with the implicit default.

llvm-svn: 288822
2016-12-06 16:40:57 +00:00
Joerg Sonnenberger cbc872549c 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

llvm-svn: 288821
2016-12-06 16:33:22 +00:00
Jonathan Roelofs 667f04a6e0 Fix doc string typo: s/@__yes/@__objc_yes/
llvm-svn: 288818
2016-12-06 15:45:41 +00:00
Malcolm Parsons f92d44c673 Fix two clang-tidy misc-move-forwarding-reference warnings
Patch by Michael Sharpe.

llvm-svn: 288813
2016-12-06 14:49:18 +00:00
Benjamin Kramer 6aeb249891 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

llvm-svn: 288793
2016-12-06 10:23:07 +00:00
Mandeep Singh Grang 6d1d36c4b7 [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

llvm-svn: 288762
2016-12-06 02:49:16 +00:00
Richard Trieu a7f30b1af1 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.

llvm-svn: 288756
2016-12-06 01:42:28 +00:00
Richard Smith a114c46e87 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.

llvm-svn: 288741
2016-12-06 00:40:17 +00:00
Richard Trieu 5165a741a2 Add test for r288732, warn on unsigned zero in std::max
llvm-svn: 288740
2016-12-06 00:27:21 +00:00
Richard Smith 8893f35a89 Additional test file missed from r288737.
llvm-svn: 288738
2016-12-06 00:14:22 +00:00
Richard Smith b9d0193e59 [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.

llvm-svn: 288737
2016-12-06 00:12:39 +00:00
Richard Trieu 67c0071517 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.

llvm-svn: 288732
2016-12-05 23:41:46 +00:00
Florian Hahn f7913ec68d [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

llvm-svn: 288723
2016-12-05 22:52:20 +00:00
Saleem Abdulrasool 317dcc3f2f 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.

llvm-svn: 288721
2016-12-05 22:40:20 +00:00
Dominic Chen 0dd2306538 [analyzer] Print type for SymbolRegionValues when dumping to stream
Reviewers: NoQ, dcoughlin, zaks.anna

Subscribers: cfe-commits

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

llvm-svn: 288696
2016-12-05 20:30:11 +00:00
Vitaly Buka 846b8f79d4 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

llvm-svn: 288689
2016-12-05 19:25:00 +00:00
Vitaly Buka ac10dcc281 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

llvm-svn: 288685
2016-12-05 18:30:22 +00:00
Shoaib Meenai fc78d7cb8e [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

llvm-svn: 288682
2016-12-05 18:01:35 +00:00
Devin Coughlin ab139a9e79 [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

llvm-svn: 288677
2016-12-05 16:28:47 +00:00
Martin Bohme f44cde8b73 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

llvm-svn: 288665
2016-12-05 11:33:19 +00:00
Benjamin Kramer 9ac117ea1c Clean out unused diagnostics. NFC.
llvm-svn: 288664
2016-12-05 11:30:24 +00:00
Richard Smith b3189a1802 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.

llvm-svn: 288654
2016-12-05 07:49:14 +00:00
Matthias Braun f1b01996ef Adapt to llvm/TableGen DagInit changes.
llvm-svn: 288645
2016-12-05 06:00:51 +00:00
Peter Collingbourne abf7ebec3d IRGen: Remove an unused overload of CreateAlignedLoad.
llvm-svn: 288629
2016-12-05 00:02:18 +00:00
Daniel Jasper ad3ba6be31 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).

llvm-svn: 288626
2016-12-04 22:34:37 +00:00
Matthias Braun bbbf5d4286 TableGen: Adapt to llvm r288612
llvm-svn: 288614
2016-12-04 05:55:09 +00:00
Sylvestre Ledru f421403650 Add the --no-color option to the git call in the doc when using clang-format-diff
llvm-svn: 288605
2016-12-03 23:22:45 +00:00
Dan Gohman c819d0169d [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.

llvm-svn: 288604
2016-12-03 23:03:52 +00:00
Sergey Kalinichev bbcf74f585 [libclang] Fix python tests
It was broken in r286421

llvm-svn: 288582
2016-12-03 12:53:06 +00:00
Saleem Abdulrasool 25dbdfa0ac 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.

llvm-svn: 288570
2016-12-03 01:57:47 +00:00
Eric Fiselier 283d8d45db [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

llvm-svn: 288565
2016-12-03 01:26:47 +00:00
Richard Smith 4baaa5ab52 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.

llvm-svn: 288563
2016-12-03 01:14:32 +00:00
Richard Smith 3a8f13ac23 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.

llvm-svn: 288558
2016-12-03 00:29:06 +00:00
Richard Smith 01d96986d8 More diagnostic name fixups: w_ -> warn_, warning_ -> warn_, not_ -> note_.
In passing, add a warning group for "ignored qualifier in inline assembly" warnings.

llvm-svn: 288548
2016-12-02 23:00:28 +00:00
Saleem Abdulrasool 1882002c91 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.

llvm-svn: 288546
2016-12-02 22:46:18 +00:00
Richard Smith f881267db9 Mass-rename the handful of error_* diagnostics to err_*.
llvm-svn: 288545
2016-12-02 22:38:31 +00:00
George Burgess IV bc7f44cb28 [Sema] Reset a BumpPtrAllocator on clear(). NFC.
Looks like the reset() call was omitted by accident.

llvm-svn: 288534
2016-12-02 21:00:12 +00:00
Adam Nemet fc9e246463 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

llvm-svn: 288520
2016-12-02 17:54:34 +00:00
Jason Henline 531f5221ba [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

llvm-svn: 288512
2016-12-02 17:32:18 +00:00
Eric Liu 964782adbb [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

llvm-svn: 288493
2016-12-02 11:01:43 +00:00
Alex Lorenz 8c1b5c9ea9 [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

llvm-svn: 288491
2016-12-02 09:51:51 +00:00
NAKAMURA Takumi 91a5fa1b6f clang/test/Driver/defsym.s: Appease targeting msc. It is incapable of external assembler in trunk.
llvm-svn: 288478
2016-12-02 05:09:21 +00:00
Jason Henline 13bba6966f [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

llvm-svn: 288453
2016-12-02 02:04:43 +00:00
Richard Smith 6cc02c2fcd p0012r1: define corresponding feature test macro
llvm-svn: 288452
2016-12-02 02:02:23 +00:00
Richard Smith 444e6f3d82 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.

llvm-svn: 288449
2016-12-02 01:52:28 +00:00
Jason Henline c3e24403f0 [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.

llvm-svn: 288448
2016-12-02 01:42:54 +00:00
Dan Gohman d0eed81dc0 [WebAssembly] Add an -mdirect flag for the direct wasm object feature.
Add a target flag for enabling the new direct wasm object emission
feature.

llvm-svn: 288447
2016-12-02 01:12:40 +00:00
Jonathan Roelofs 28b9668db3 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.

llvm-svn: 288444
2016-12-02 00:51:58 +00:00
John McCall 8986361fa1 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.

llvm-svn: 288440
2016-12-01 23:51:30 +00:00
Argyrios Kyrtzidis 5dda1128f1 [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

llvm-svn: 288438
2016-12-01 23:41:27 +00:00
Joerg Sonnenberger 399aea300f 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

llvm-svn: 288436
2016-12-01 23:37:45 +00:00
George Burgess IV bf1a70f1c9 Add a space in a run line. NFC.
llvm-svn: 288414
2016-12-01 20:16:56 +00:00
Artem Belevich 5fb9b5e1c9 Send compiler output to /dev/null in defsym.s test.
Fixes test failures if tests are run in a read-only source tree.

llvm-svn: 288406
2016-12-01 19:34:35 +00:00
Akira Hatanaka 6c299ca6e7 [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

llvm-svn: 288404
2016-12-01 19:25:14 +00:00
Mandeep Singh Grang 358faec6ab [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

llvm-svn: 288397
2016-12-01 18:42:16 +00:00
Arnold Schwaighofer b0f2c33920 swiftcc: Add an api to query whether a target ABI stores swifterror in a register
llvm-svn: 288394
2016-12-01 18:07:38 +00:00
Hans Wennborg 043d9e369f 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>!

llvm-svn: 288393
2016-12-01 18:05:41 +00:00
George Burgess IV 8a36ace5b1 [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.

llvm-svn: 288388
2016-12-01 17:52:39 +00:00
Dominic Chen 1a154e082c [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

llvm-svn: 288372
2016-12-01 17:06:39 +00:00
Manuel Klimek a37e110def Adds hasUnqualifiedDesugaredType to allow matching through type sugar.
Differential Revision: https://reviews.llvm.org/D27207

llvm-svn: 288366
2016-12-01 15:45:06 +00:00
Alex Lorenz a589abc353 [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

llvm-svn: 288334
2016-12-01 12:14:38 +00:00
Joey Gouly e3c85de6df [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.

llvm-svn: 288332
2016-12-01 11:30:49 +00:00
Florian Hahn 15be03a922 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

llvm-svn: 288327
2016-12-01 11:02:59 +00:00
John McCall e5f23fb9ea Teach ConstantBuilder how to emit a reference to the current position
that will be filled in when the initializer is set.

llvm-svn: 288313
2016-12-01 05:33:30 +00:00
Richard Smith a7d9378761 P0012R1: add Itanium ABI support for throwing non-noexcept function pointers and catching as noexcept.
llvm-svn: 288305
2016-12-01 03:32:42 +00:00
Richard Smith b17d6fa5b3 Revert r285664, cxx-abi-dev chose to go in a different direction for the ABI here.
llvm-svn: 288304
2016-12-01 03:04:07 +00:00
Richard Smith baa4783d31 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.

llvm-svn: 288301
2016-12-01 02:11:49 +00:00
George Burgess IV 1881a573e9 [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.

llvm-svn: 288297
2016-12-01 00:13:18 +00:00
John McCall dba63a7e5c Clean up CGObjCMac's APIs for deriving class references. NFC.
llvm-svn: 288295
2016-11-30 23:54:50 +00:00
Kelvin Li 579e41ced2 [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

llvm-svn: 288294
2016-11-30 23:51:03 +00:00
John McCall d195d4c520 Introduce a type-safe enum for ForDefinition.
llvm-svn: 288289
2016-11-30 23:25:13 +00:00
John McCall cd21d54139 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).

llvm-svn: 288287
2016-11-30 23:15:55 +00:00
John McCall f00e2c09be Prospective MSVC workaround.
llvm-svn: 288272
2016-11-30 20:46:55 +00:00
John McCall ecee86faa1 Finish adopting ConstantInitBuilder in CGObjCGNU. NFC.
llvm-svn: 288269
2016-11-30 20:19:46 +00:00
Akira Hatanaka 21e5fdd89e [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

llvm-svn: 288267
2016-11-30 19:42:03 +00:00
Artem Dergachev 28ee2d1b09 [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

llvm-svn: 288263
2016-11-30 19:02:44 +00:00
Artem Dergachev 7b75e3266c [analyzer] SValExplainer: Support ObjC ivars and __block variables.
Additionally, explain the difference between normal and heap-based
symbolic regions.

llvm-svn: 288260
2016-11-30 18:26:43 +00:00
Artem Dergachev 30ed5467a4 [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

llvm-svn: 288257
2016-11-30 17:57:18 +00:00
John McCall c4ae1dd193 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.

llvm-svn: 288231
2016-11-30 04:18:19 +00:00
Bob Haarman 2fae56fce4 make -fprofile-instr-generate and -fprofile-instr-use work with clang-cl
Summary: Makes -fprofile-instr-generate and -fprofile-instr-use work
with clang-cl so that profile-guided optimization can be used.

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

llvm-svn: 288230
2016-11-30 03:25:36 +00:00
John McCall 176f892fa7 Switch CGObjCMac to use ConstantInitBuilder. Whew.
Not strictly NFC because I did change the order of emission of
some global constants, but it shouldn't make any difference.

llvm-svn: 288229
2016-11-30 02:39:18 +00:00
Reid Kleckner 68c4bb5dda Fix -Winconsistent-missing-override in CodeGenAction.cpp
llvm-svn: 288227
2016-11-30 01:32:53 +00:00
Hans Wennborg 86bd29afda Fix formatting issue from r288207
llvm-svn: 288223
2016-11-30 00:31:39 +00:00
Reid Kleckner 6fd35373ea Give this test that uses Itanium mangling a triple
llvm-svn: 288222
2016-11-30 00:31:16 +00:00
Reid Kleckner 15241ba4dd Stop handling interesting deserialized decls after HandleTranslationUnit
Other AST consumers can deserialize interesting decls that we might
codegen, but they won't make it to the final object file and can trigger
assertions in debug information generation after finalization.

llvm-svn: 288221
2016-11-30 00:25:36 +00:00
Richard Smith 13b40bcc03 [c++1z] Improve support for -fno-exceptions: we can't just ignore exception
specifications in this mode in C++17, since they're part of the function type,
so check and diagnose them like we would if exceptions were enabled.

Better ideas welcome.

llvm-svn: 288220
2016-11-30 00:13:55 +00:00
Eugene Zelenko 58ab22fe48 Fix some Clang-tidy and Include What You Use warnings; other minor fixes (NFC).
This preparation to remove SetVector.h dependency on SmallSet.h.

llvm-svn: 288213
2016-11-29 22:44:24 +00:00
Richard Smith 6564006a38 [c++1z] PR31210: ignore exception specification when matching the type of a
builtin with the type of an explicit declaration of the same function.

llvm-svn: 288208
2016-11-29 22:32:05 +00:00
Hans Wennborg a6714922d1 Don't try to merge DLL attributes on redeclaration of invalid decl (PR31069)
llvm-svn: 288207
2016-11-29 22:31:00 +00:00
John McCall 843dfccdc5 getObjCEncodingForMethodDecl cannot fail. Simplify. NFC.
llvm-svn: 288203
2016-11-29 21:57:00 +00:00
Reid Kleckner aab2aae8ee Don't declare IsEnumDeclComplete as extern
Otherwise MSVC and clang-cl will see "extern inline" after merging
redeclarations and emit it in all TUs that include Type.h and Decl.h.

Noticed by inspection, since it's always the first thing to get emitted.

llvm-svn: 288197
2016-11-29 20:46:24 +00:00
Richard Smith 8110c9df22 Support constant expression evaluation for wchar_t versions of simple string
functions, in order to support constexpr std::char_traits<wchar_t>.

llvm-svn: 288193
2016-11-29 19:45:17 +00:00
Anastasia Stulova e4a1c38109 [OpenCL] Prevent generation of globals in non-constant AS for OpenCL.
Avoid using shortcut for const qualified non-constant address space
aggregate variables while generating them on the stack such that
the alloca object is used instead of a global variable containing
initializer.

Review: https://reviews.llvm.org/D27109
llvm-svn: 288163
2016-11-29 17:01:19 +00:00
Benjamin Kramer 7fff35479c [AST] Use static_assert to verify types instead of undefined classes.
No functionliaty change intended.

llvm-svn: 288133
2016-11-29 12:41:21 +00:00
Alexey Bader c211c6c884 [OpenCL] Prohibit using reserve_id_t in program scope.
Patch by Egor Churaev (echuraev).

Reviewers: Anastasia

Subscribers: cfe-commits, yaxunl, bader

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

llvm-svn: 288126
2016-11-29 10:21:40 +00:00
Krasimir Georgiev bba2d59ea4 Removed DEBUG_TYPE from TokenAnalyzer.h
Summary:
Defining DEBUG_TYPE in a header file doesn't make sense.
It is already defined in the corresponding source file.

Reviewers: klimek, ioeric

Subscribers: klimek

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

llvm-svn: 288125
2016-11-29 10:21:28 +00:00
Yaron Keren 633e14aa42 Correct comment: we are creating a canonicla decltypetype.
llvm-svn: 288124
2016-11-29 10:08:20 +00:00
Daniel Jasper e98e58111b clang-format: [JS] Properly format dict literals that skip labels.
llvm-svn: 288121
2016-11-29 09:40:36 +00:00
Daniel Jasper 22ed262c23 clang-format: Wrap complex binary expressions on the RHS of a comma.
Specifically, if the RHS of a comma is a complex binary expression and
spans multiple lines, insert a line break before it. This usually is
often more readable compared to producing a hanging indent. See changes
in FormatTest.cpp for examples.

llvm-svn: 288120
2016-11-29 09:40:32 +00:00
Daniel Jasper 35e4122f48 clang-format: Fix unnnecessary line break.
Before:
  aaaaaaaaaa(aaaa(aaaa,
		  aaaa), //
	     aaaa,
             aaaaa);

After:
  aaaaaaaaaa(aaaa(aaaa,
		  aaaa), //
	     aaaa, aaaaa);

llvm-svn: 288119
2016-11-29 09:40:01 +00:00
Richard Smith 9bb192ed99 Add a warning for 'main' returning 'true' or 'false'.
Patch by Joshua Hurwitz!

llvm-svn: 288097
2016-11-29 01:35:17 +00:00
Reid Kleckner fec0f32ea9 Use ${:uid} to generate unique MS asm labels, not {:uid}
llvm-svn: 288093
2016-11-29 00:39:37 +00:00
Reid Kleckner 9e749f6636 Avoid lambdas in default member initializers to work around clang bug
On Windows, Clang is mangling lambdas in default member initializers
incorrectly. See PR31197.

This is causing redness on the self-host bots. Work around the problem
locally so we aren't blind to further issues.

llvm-svn: 288089
2016-11-28 23:58:04 +00:00
Peter Collingbourne b367c567d9 IRGen: Remove all uses of CreateDefaultAlignedLoad.
Differential Revision: https://reviews.llvm.org/D27157

llvm-svn: 288083
2016-11-28 22:30:21 +00:00
John McCall 9c6cb7642e Make CGVTables use ConstantInitBuilder. NFC.
llvm-svn: 288081
2016-11-28 22:18:33 +00:00
John McCall f1788639c5 Hide the result of building a constant initializer. NFC.
llvm-svn: 288080
2016-11-28 22:18:30 +00:00
John McCall 23c9dc6585 ConstantBuilder -> ConstantInitBuilder for clarity, and
move the member classes up to top level to allow forward
declarations to name them.  NFC.

llvm-svn: 288079
2016-11-28 22:18:27 +00:00
Michal Gorny 593970f1a7 [Driver] Add unit tests for Distro detection
Add a set of unit tests for the distro detection code. The tests use an
in-memory virtual filesystems resembling release files for various
distributions supported. All release files are provided (not only the
ones directly used) in order to guarantee that one of the rules will not
mistakenly recognize the distribution incorrectly due to the additional
files (e.g. Ubuntu as Debian).

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

llvm-svn: 288062
2016-11-28 21:11:22 +00:00
Michal Gorny 047e099a2e [Driver] Fix recognizing newer OpenSUSE versions
Fix recognizing newer OpenSUSE versions that combine the two version
components into 'VERSION = x.y'. The check was written against an older
version that kept those two split as VERSION and PATCHLEVEL.

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

llvm-svn: 288061
2016-11-28 21:11:18 +00:00