Commit Graph

18602 Commits

Author SHA1 Message Date
Justin Bogner 0cd9248d9e Driver: Remove the Job class. NFC
We had a strange relationship here where we made a list of Jobs
inherit from a single Job, but there weren't actually any places where
this arbitrary nesting was used or needed.

Simplify all of this by removing Job entirely and updating all of the
users to either work with a JobList or a single Command.

llvm-svn: 241310
2015-07-02 22:52:08 +00:00
Justin Bogner 94817612e2 Driver: Don't use reserved names. NFC
llvm-svn: 241309
2015-07-02 22:52:04 +00:00
Benjamin Kramer 642f173ae9 Switch users of the 'for (StmtRange range = stmt->children(); range; ++range)‘ pattern to range for loops.
The pattern was born out of the lack of range-based for loops in C++98
and is somewhat obscure. No functionality change intended.

llvm-svn: 241300
2015-07-02 21:03:14 +00:00
Ben Langmuir a525400d37 [Modules] Be consistent about finding a module for framework headers
We use findModuleForHeader() in several places, but in header search we
were not calling it when a framework module didn't show up with the
expected name, which would then lead to unexpected non-modular includes.
Now we will find the module unconditionally for frameworks.  For regular
frameworks, we use the spelling of the module name from the module map
file, and for inferred ones we use the canonical directory name.

In the future we might want to lock down framework modules sufficiently
that these name mismatches cannot happen.

rdar://problem/20465870

llvm-svn: 241258
2015-07-02 13:19:48 +00:00
Aaron Ballman 9b869aa4a1 Implement an AST matcher for C++ exception catch handlers that can catch any exception type (...).
llvm-svn: 241256
2015-07-02 12:53:22 +00:00
Alexey Bataev 80909878ad [OPENMP 4.0] Initial support for 'omp cancel' construct.
Implemented parsing/sema analysis + (de)serialization.

llvm-svn: 241253
2015-07-02 11:25:17 +00:00
Nico Weber e4f974c6fb Revert 241171, 241187, 241199 (32-bit SEH).
It still doesn't produce quite the right code, test binaries built with this
enabled fail some tests.

llvm-svn: 241244
2015-07-02 06:10:53 +00:00
Ted Kremenek 2b41771909 Parse 'technical term' format specifier.
Objective-C format strings now support modifier flags
that can be attached to a '@' conversion.  Currently
the only one supported, as of iOS 9 and OS X 10.11,
is the new "technical term", denoted by the flag "tt",
for example:

  %[tt]@

instead of just:

  %@

The 'tt' stands for "technical term", which is used
by the string-localization facilities on Darwin to
add the appropriate spacing or quotation depending
the language locale.

Implements <rdar://problem/20374720>.

llvm-svn: 241243
2015-07-02 05:39:16 +00:00
Ted Kremenek 7a1ef0ddca Change OptionalFlag::setPosition() to set the flag as well.
This change reduces some unnecessary boilerplate
since all calls to 'setPosition' are currently paired
with setting the flag of OptionalFlag.

No functionality change.

llvm-svn: 241242
2015-07-02 05:39:10 +00:00
Yaron Keren 1c0070c65d Support mingw-w64 and mingw.org toolchains at any install location.
No more hardcoded paths: clang will use -sysroot as gcc root location if
provided. Otherwise, it will search for gcc on the path. If not found it
will use the driver installed location.

 http://reviews.llvm.org/D5268

Patch by Ruben Van Boxem, Martell Malone, Yaron Keren.
Reviewed by Reid Kleckner.

llvm-svn: 241241
2015-07-02 04:45:27 +00:00
Alexey Bataev 0039651304 [OPENMP] Introduced type trait "__builtin_omp_required_simd_align" for default simd alignment.
Adds type trait "__builtin_omp_required_simd_align" after discussions here http://reviews.llvm.org/D9894
Differential Revision: http://reviews.llvm.org/D10597

llvm-svn: 241237
2015-07-02 03:40:19 +00:00
Peter Collingbourne 581f438f4c Driver: add support for linking the UBSan runtime library on Windows.
On Windows the user may invoke the linker directly, so we might not have an
opportunity to add runtime library flags to the linker command line. Instead,
instruct the code generator to embed linker directive in the object file
that cause the required runtime libraries to be linked.

We might also want to do something similar for ASan, but it seems to have
its own special complexities which may make this infeasible.

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

llvm-svn: 241225
2015-07-02 01:48:12 +00:00
Reid Kleckner d0d9a1f63f [SEH] Add 32-bit lowering for SEH __try
This re-lands r236052 and adds support for __exception_code().

In 32-bit SEH, the exception code is not available in eax. It is only
available in the filter function, and now we arrange to load it and
store it into an escaped variable in the parent frame.

As a consequence, we have to disable the "catch i8* null" optimization
on 32-bit and always generate a filter function. We can re-enable the
optimization if we detect an __except block that doesn't use the
exception code, but this probably isn't worth optimizing.

Reviewers: majnemer

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

llvm-svn: 241171
2015-07-01 17:10:10 +00:00
Alexey Bataev 6d4ed05830 [OPENMP 4.0] Initial support for 'omp cancellation point' construct.
Add parsing and sema analysis for 'omp cancellation point' directive.

llvm-svn: 241145
2015-07-01 06:57:41 +00:00
Richard Smith 2aedca340c [modules] Before checking whether the controlling macro of a header is defined,
update the identifier in case we've imported a definition of the macro (and
thus the contents of the header) from a module.

Also fold ExternalIdentifierLookup into ExternalPreprocessorSource; it no longer
makes sense to keep these separate now that the only user of the former also
needs the latter.

llvm-svn: 241137
2015-07-01 02:29:35 +00:00
Richard Smith 035f6dc9d1 [modules] Make the include guard optimization fire a bit more when considering
re-entering a modular header.

When we do the include guard check, we're in the visibility state for the file
with the #include; the include guard may not be visible there, but we don't
actually need it to be: if we've already parsed the submodule we're considering
entering, it's always safe to skip it.

llvm-svn: 241135
2015-07-01 01:51:38 +00:00
Richard Smith 4df6093ca3 [modules] Make sure macros get made visible in the top-level file if we've got
local submodule visibility enabled; that top-level file might not actually be
the module includes buffer if use of prebuilt modules is disabled.

llvm-svn: 241120
2015-06-30 21:29:55 +00:00
Adrian Prantl 15bcf70cdf Add a function to ExternalASTSource that returns a descriptor that
abstracts the commonalities between modules and PCH files that are
needed to emit debug info for a module or precompiled header.

llvm-svn: 241083
2015-06-30 17:39:43 +00:00
Hubert Tong 375f00ad7b [CONCEPTS] Parsing of concept keyword
Summary: This change adds parsing for the concept keyword in a
declaration and tracks the location. Diagnostic testing added for
invalid use of concept keyword.

Reviewers: faisalv, fraggamuffin, rsmith, hubert.reinterpretcast

Reviewed By: rsmith, hubert.reinterpretcast

Subscribers: cfe-commits

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

Patch by Nathan Wilson!

llvm-svn: 241060
2015-06-30 12:14:52 +00:00
Michael Kuperstein a3c7b74208 [X86] Add FXSR intrinsics
Add intrinsics for the FXSR instructions (FXSAVE/FXSAVE64/FXRSTOR/FXRSTOR64)

These were previously declared in Intrin.h for MSVC compatibility, but now
that we have them implemented, these declarations can be removed.

llvm-svn: 241053
2015-06-30 09:45:38 +00:00
Adrian Prantl e74f525bc9 Pass HeaderSearchOptions and PreprocessorOptions into CodeGenModule.
In order to produce debug info for clang modules CGDebugInfo it needs
access to macros passed on the command line and the isysroot.

llvm-svn: 241035
2015-06-30 02:26:03 +00:00
Richard Smith 9ba0fec83e Rework parsing of pure-specifiers. Perform the grammar matching and
disambiguation in the parser rather than trying to do it in Sema.

llvm-svn: 241032
2015-06-30 01:28:56 +00:00
Eric Christopher d983270976 Add support for the x86 builtin __builtin_cpu_supports.
This matches the implementation of the gcc support for the same
feature, including checking the values set up by libgcc at runtime.
The structure looks like this:

  unsigned int __cpu_vendor;
  unsigned int __cpu_type;
  unsigned int __cpu_subtype;
  unsigned int __cpu_features[1];

with a set of enums to match various fields that are field out after
parsing the output of the cpuid instruction.
This also adds a set of errors checking for valid input (and cpu).

compiler-rt support for this and the other builtins in this family
(__builtin_cpu_init and __builtin_cpu_is) are forthcoming.

llvm-svn: 240994
2015-06-29 21:00:05 +00:00
Douglas Katzman 750cfc5711 Comment fixes. NFC.
- Hexagon options were physically next to to ones that had a
  preceding comment saying "Double dash options", which they aren't.

- The 'ld' tool classes are named Linker, not Link.

llvm-svn: 240980
2015-06-29 18:42:16 +00:00
Birunthan Mohanathas a0388a8af2 clang-format: Add option to break after definition return type for top-level functions only
Differential Revision: http://reviews.llvm.org/D10774

llvm-svn: 240959
2015-06-29 15:30:42 +00:00
Asaf Badouh a45b7cab7b [x86][AVX512CD] Add conflict and lzcnt intrinsics in their 512bit versions
include tests

review
http://reviews.llvm.org/D10795

llvm-svn: 240941
2015-06-29 12:51:53 +00:00
Asaf Badouh 4002ce4834 [X86][AVX512BW] Add more intrinsics support:
Blend, abs, packs, adds, subs, avg, max, min, permute.
 all the intrinsics are covered by tests

review:
http://reviews.llvm.org/D10799

llvm-svn: 240937
2015-06-29 12:16:40 +00:00
Elena Demikhovsky c563c2c61a AVX-512: Implemented AVX-512 FMA intrinsics and tests.
by Igor Breger

http://reviews.llvm.org/D10797

llvm-svn: 240928
2015-06-29 09:20:57 +00:00
Birunthan Mohanathas 5cff10fcf5 clang-format: Add missing members to FormatStyle::operator==
Summary: Depends on D10784.

Reviewers: djasper

Reviewed By: djasper

Subscribers: dblaikie, klimek, cfe-commits

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

llvm-svn: 240908
2015-06-28 14:52:01 +00:00
Birunthan Mohanathas 35cfbd7988 clang-format: Alphabetize FormatStyle members
Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 240907
2015-06-28 14:51:17 +00:00
Davide Italiano 43899d44c2 [Sema] Unions cannot have virtual functions.
PR:		PR23931
Differential Revision:	http://reviews.llvm.org/D10752
Reviewed by:  rsmith

llvm-svn: 240889
2015-06-27 19:18:55 +00:00
Birunthan Mohanathas b744e7210b clang-format: Fix language of DisableFormat description
This is a comment-only change to test commit access.

llvm-svn: 240879
2015-06-27 09:25:28 +00:00
Nemanja Ivanovic 2f1f926e34 Add missing builtins to altivec.h for ABI compliance (vol. 1)
This patch corresponds to review:
http://reviews.llvm.org/D10637

This is the first round of additions of missing builtins listed in the ABI document. More to come (this builds onto what seurer already addes). This patch adds:
vector signed long long vec_abs(vector signed long long)
vector double vec_abs(vector double)
vector signed long long vec_add(vector signed long long, vector signed long long)
vector unsigned long long vec_add(vector unsigned long long, vector unsigned long long)
vector double vec_add(vector double, vector double)
vector double vec_and(vector bool long long, vector double)
vector double vec_and(vector double, vector bool long long)
vector double vec_and(vector double, vector double)
vector signed long long vec_and(vector signed long long, vector signed long long)
vector double vec_andc(vector bool long long, vector double)
vector double vec_andc(vector double, vector bool long long)
vector double vec_andc(vector double, vector double)
vector signed long long vec_andc(vector signed long long, vector signed long long)
vector double vec_ceil(vector double)
vector bool long long vec_cmpeq(vector double, vector double)
vector bool long long vec_cmpge(vector double, vector double)
vector bool long long vec_cmpge(vector signed long long, vector signed long long)
vector bool long long vec_cmpge(vector unsigned long long, vector unsigned long long)
vector bool long long vec_cmpgt(vector double, vector double)
vector bool long long vec_cmple(vector double, vector double)
vector bool long long vec_cmple(vector signed long long, vector signed long long)
vector bool long long vec_cmple(vector unsigned long long, vector unsigned long long)
vector bool long long vec_cmplt(vector double, vector double)
vector bool long long vec_cmplt(vector signed long long, vector signed long long)
vector bool long long vec_cmplt(vector unsigned long long, vector unsigned long long)

llvm-svn: 240821
2015-06-26 19:27:20 +00:00
Alex Denisov fde64956f9 [ObjC] Add NSValue support for objc_boxed_expressions
Patch extends ObjCBoxedExpr to accept records (structs and unions):

typedef struct __attribute__((objc_boxable)) _Color {
  int r, g, b;
} Color;

Color color;
NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)];

llvm-svn: 240761
2015-06-26 05:28:36 +00:00
Meador Inge f0af05c4a5 [Parse] Allow 'constexpr' in condition declarations
This patch implements the functionality specified by DR948.
The changes are two fold.  First, the parser was modified
to allow 'constexpr's to appear in condition declarations
(which was a hard error before).  Second, Sema was modified
to cleanup maybe odr-used declarations by way of a call to
'ActOnFinishFullExpr'.  As 'constexpr's were not allowed in
condition declarations before the cleanup wasn't necessary
(such declarations were always odr-used).

This fixes PR22491.

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

llvm-svn: 240707
2015-06-25 22:06:40 +00:00
Richard Smith 396f18f302 [modules] Fix findDirectiveAtLoc to not call a member function on a null pointer.
This is exercised by existing tests, and fixes a failure with -fsanitize=null.
No observable change otherwise; the code happened to do the right thing in
practice under recent versions of Clang and GCC because
MacroDirective::getDefinition happens to check whether this == null.

llvm-svn: 240691
2015-06-25 20:48:44 +00:00
Chris Bieneman 79e8210e82 Add -miphonesimulator-version-min as alias to -ios-simulator-version-min.
Summary:
For better or worse the OS X command line tools refer to the iOS simulator as iphonesimucator. We should provide an alias flag -miphonesimulator-version-min that matches a consistent pattern with the other tools.

This is in the interest of making it easier for people to write platform-agnostic darwin build scripts.

Reviewers: bob.wilson, bogner

Subscribers: cfe-commits

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

llvm-svn: 240686
2015-06-25 20:25:43 +00:00
Artem Belevich 5fbe3ccb49 [NVPTX] Fixed a typo in __nvvm_atom_min_gen_l() type string.
Differential Revision: http://reviews.llvm.org/D10664

llvm-svn: 240659
2015-06-25 17:34:23 +00:00
Hubert Tong ec3cb573f5 [Concepts] Parsing of requires-clause in template-declaration
Summary:
This change implements parse-only acceptance of the optional
requires-clause in a template-declaration. Diagnostic testing is added
for cases where the grammar is ambiguous with the expectation that the
longest token sequence which matches the syntax of a
constraint-expression is consumed without backtracking.

Reviewers: faisalv, fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 240611
2015-06-25 00:23:39 +00:00
Douglas Gregor aea7afdc13 Replace __double_underscored type nullability qualifiers with _Uppercase_underscored
Addresses a conflict with glibc's __nonnull macro by renaming the type
nullability qualifiers as follows:

  __nonnull -> _Nonnull
  __nullable -> _Nullable
  __null_unspecified -> _Null_unspecified

This is the major part of rdar://problem/21530726, but does not yet
provide the Darwin-specific behavior for the old names.

llvm-svn: 240596
2015-06-24 22:02:08 +00:00
Bob Wilson 0c6ed3d29b Improve error handling for PR22560.
The ARM _MoveToCoprocessor and _MoveFromCoprocessor builtins require
integer constants for most arguments, but clang was not checking that.
With this change, we now report meaningful errors instead of crashing
in the backend.

llvm-svn: 240463
2015-06-23 21:10:24 +00:00
David Majnemer 08ef2ba113 [MS ABI] Account for the virtual inheritance quirk when mangling
Virtual inheritance member pointers are always relative to the vbindex,
even when the member pointer doesn't point into a virtual base.  This is
corrected by adjusting the non-virtual offset backwards from the vbptr
back to the top of the most derived class.  While we performed this
adjustment when manifesting member pointers as constants or when
performing conversions, we didn't perform the adjustment when mangling
them.

llvm-svn: 240453
2015-06-23 20:34:18 +00:00
Ben Langmuir cd98cb7312 [Modules] Consider -fmodule-feature in module hash and when loading
Any extra features from -fmodule-feature are part of the module hash and
need to get validated on load.  Also print them with -module-file-info.

llvm-svn: 240433
2015-06-23 18:20:18 +00:00
Alexey Bataev 1c2cfbc3ea [OPENMP] Initial support for 'depend' clause (4.0).
Parsing and sema analysis (without support for array sections in arguments) for 'depend' clause (used in 'task' directive, OpenMP 4.0).

llvm-svn: 240409
2015-06-23 14:25:19 +00:00
Aaron Ballman b440c4214d Moving r215806, r215807, and r215808 into AttrDocs.td. These changes were originally applied to the RST file that is automatically generated by the server, and so the changes were never properly reflected online once the server overwrote AttributeReference.rst.
llvm-svn: 240402
2015-06-23 13:41:03 +00:00
Aaron Ballman 8d3a7a56a9 Clarify pointer ownership semantics by hoisting the std::unique_ptr creation to the caller instead of hiding it in emitReport. NFC.
llvm-svn: 240400
2015-06-23 13:15:32 +00:00
David Majnemer c1709d387e [MS ABI] Rework member pointer conversion
Member pointers in the MS ABI are made complicated due to the following:
- Virtual methods in the most derived class (MDC) might live in a
  vftable in a virtual base.
- There are four different representations of member pointer: single
  inheritance, multiple inheritance, virtual inheritance and the "most
  general" representation.
- Bases might have a *more* general representation than classes which
  derived from them, a most surprising result.

We believed that we could treat all member pointers as-if they were a
degenerate case of the multiple inheritance model.  This fell apart once
we realized that implementing standard member pointers using this ABI
requires referencing members with a non-zero vbindex.

On a bright note, all but the virtual inheritance model operate rather
similarly.  The virtual inheritance member pointer representation
awkwardly requires a virtual base adjustment in order to refer to
entities in the MDC.

However, the first virtual base might be quite far from the start of the
virtual base.  This means that we must add a negative non-virtual
displacement.

However, things get even more complicated.  The most general
representation interprets vbindex zero differently from the virtual
inheritance model: it doesn't reference the vbtable at all.

It turns out that this complexity can increase for quite some time:
consider a derived to base conversion from the most general model to the
multiple inheritance model...

To manage this complexity we introduce a concept of "normalized" member
pointer which allows us to treat all three models as the most general
model.  Then we try to figure out how to map this generalized member
pointer onto the destination member pointer model.  I've done my best to
furnish the code with comments explaining why each adjustment is
performed.

This fixes PR23878.

llvm-svn: 240384
2015-06-23 07:31:11 +00:00
Alexey Bataev aac108a324 [OPENMP] Do not emit references to original variables in 'private' clause.
Currently if the variable is captured in captured region, capture record for this region stores reference to this variable for future use. But we don't need to provide the reference to the original variable if it was explicitly marked as private in the 'private' clause of the OpenMP construct, this variable is replaced by private copy.
Differential Revision: http://reviews.llvm.org/D9550

llvm-svn: 240377
2015-06-23 04:51:00 +00:00
Alexander Kornienko ab9db51042 Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").
llvm-svn: 240353
2015-06-22 23:07:51 +00:00
David Blaikie 69a1d8c646 Update for LLVM API change to return by InputArgList directly (rather than by pointer) from ParseArgs
llvm-svn: 240349
2015-06-22 22:07:27 +00:00