Commit Graph

40387 Commits

Author SHA1 Message Date
Aaron Ballman 9ec96a2f3f Fix #pragma redefine_extname when there is a local variable of the same name. The local should not be renamed, only the externally-available declaration should be.
Patch by Andrey Bokhanko!

llvm-svn: 240653
2015-06-25 15:37:16 +00:00
Daniel Marjamaki 0dadfa8d05 Fix a crash by division by zero in analyzer
Patch by takeshi-yoshimura!

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

llvm-svn: 240643
2015-06-25 14:06:02 +00:00
Jay Foad e967dd0420 Teach Clang about the PPC64 memory sanitizer implementation.
Summary:
This is the Clang part of the PPC64 memory sanitizer implementation in
D10648.

Reviewers: kcc, eugenis, willschm, wschmidt, samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

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

llvm-svn: 240628
2015-06-25 10:35:19 +00:00
Daniel Jasper 23d3bcfe5b clang-format: [Proto] Don't treat "operator" as keyword.
Before:
  optional string operator= 1;

After:
  optional string operator = 1;

llvm-svn: 240624
2015-06-25 08:38:46 +00:00
Steven Wu 7a1372ce34 Update darwin SDK version parsing to support OSX and simulator
This re-commits r226005 with a tweak. The origin attempt failed because
Darwin bot sets up SDKROOT and clang can deduce SDK version from them
after this patch. That broke many driver tests due to the change of
deployment target version. Now the tests should not complain after
r240574.

llvm-svn: 240619
2015-06-25 01:59:35 +00:00
Alexey Samsonov 1d4cff2cdc [UBSan] Allow to use -fsanitize=vptr only on Mac OS 10.9+
See https://llvm.org/bugs/show_bug.cgi?id=23539 for why this
is necessary.

llvm-svn: 240618
2015-06-25 00:58:02 +00:00
Hubert Tong 3280b3307f Consolidate and unify initializer list deduction
Summary:
This patch reduces duplication in the template argument deduction code
for handling deduction from initializer lists in a function call. This
extends the fix for PR12119 to also apply to the case where the
corresponding parameter is a trailing parameter pack.

Test Plan:
A test for deduction from nested initializer lists where the
corresponding parameter is a trailing parameter pack is added in
`clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp`.

Reviewers: fraggamuffin, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 240612
2015-06-25 00:25:49 +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
Ranjeet Singh ac08e53f3a [ARM] The bits set in the variable HW_FP could get unset
when iterating through the Features vector if we don't
keep track of what's already been set. This could lead to
the macro __ARM_FP getting the wrong value. This patch
fixes this issue by keeping track of the bits that have
already been set in the loop.

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

llvm-svn: 240607
2015-06-24 23:39:25 +00:00
Derek Schuff 5ec5128f64 update comment
llvm-svn: 240601
2015-06-24 22:36:38 +00:00
Derek Schuff 3c6a48d119 Relax assertion in x86_64 byval argument handling for 32-bit pointers
Summary:
Byval argument pair formation assumes that if a type is less than 8 bytes
it must be an integer and not a pointer, which is not true for x32 and NaCl.

Relax the assertion and add a test for a codegen case that triggered it.

Reviewers: jvoung

Subscribers: jfb, cfe-commits

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

llvm-svn: 240600
2015-06-24 22:36:36 +00:00
Douglas Gregor 59e3d75537 Add __nonnull/__nullable/__null_unspecified predefines for Darwin.
Addresses the rest of rdar://problem/21530726.

llvm-svn: 240597
2015-06-24 22:02:16 +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
Jordan Rose a46bfa6b83 [Preprocessor] Iterating over all macros should include those from modules.
So, iterate over the list of macros mentioned in modules, and make sure those
are in the master table.

This isn't particularly efficient, but hopefully it's something that isn't
done too often.

PR23929 and rdar://problem/21480635

llvm-svn: 240571
2015-06-24 19:27:02 +00:00
Daniel Jasper 6b8d26c209 clang-format: [JS] Support regex literals containing quotes (' and ").
llvm-svn: 240548
2015-06-24 16:01:02 +00:00
Douglas Katzman 26eabf6d0f Express Driver::GetFilePath more concisely.
llvm-svn: 240545
2015-06-24 15:10:30 +00:00
Alexey Bataev 1d2353d4f3 [OPENMP] Codegen for 'depend' clause (OpenMP 4.0).
If task directive has associated 'depend' clause then function kmp_int32 __kmpc_omp_task_with_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_task_t * new_task, kmp_int32 ndeps, kmp_depend_info_t *dep_list,kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list) must be called instead of __kmpc_omp_task().
If this directive has associated 'if' clause then also before a call of kmpc_omp_task_begin_if0() a function void __kmpc_omp_wait_deps ( ident_t *loc_ref, kmp_int32 gtid, kmp_int32 ndeps, kmp_depend_info_t *dep_list, kmp_int32 ndeps_noalias, kmp_depend_info_t *noalias_dep_list) must be called.
Array sections are not supported yet.

llvm-svn: 240532
2015-06-24 11:01:36 +00:00
Chandler Carruth c026e39451 Remove a limited and somewhat questionable DenseMapInfo specialization
for StringRef now that the core DenseMap library provides this facility.

llvm-svn: 240530
2015-06-24 10:24:30 +00:00
Bob Wilson 63c931443d Move the special-case check from r240462 into ARM-specific code.
This fixes a serious bug in r240462: checking the BuiltinID for
ARM::BI_MoveToCoprocessor* in EmitBuiltinExpr() ignores the fact that
each target has an overlapping range of the BuiltinID values. That check
can trigger for builtins from other targets, leading to very bad
behavior.

Part of the reason I did not implement r240462 this way to begin with is
the special handling of the last argument for Neon builtins. In this
change, I have factored out the check to see which builtins have that
extra argument into a new HasExtraNeonArgument() function. There is still
some awkwardness in having to check for those builtins in two separate
places, i.e., once to see if the extra argument is present and once to
generate the appropriate IR, but this seems much cleaner than my previous
patch.

llvm-svn: 240522
2015-06-24 06:05:20 +00:00
Alexey Bataev d157d47062 Proper changing/restoring for CapturedStmtInfo, NFC.
Added special RAII class for proper values changing/restoring in CodeGenFunction::CapturedStmtInfo.

llvm-svn: 240517
2015-06-24 03:35:38 +00:00
Douglas Katzman 51fe7bf227 Use range-based loops when handling OPT_print_search_dirs.
llvm-svn: 240476
2015-06-23 22:43:50 +00:00
Benjamin Kramer 452695e08a [Driver] Give GnuTool LLVM_LIBRARY_VISIBILITY.
This is consistent with all other classes in Tools.h.

llvm-svn: 240464
2015-06-23 21:15:15 +00:00
Bob Wilson 09aa90bbe1 PR22560: Fix argument order for ARM _MoveToCoprocessor builtins.
The Microsoft-extension _MoveToCoprocessor and _MoveToCoprocessor2
builtins take the register value to be moved as the first argument,
but the corresponding mcr and mcr2 LLVM intrinsics expect that value
to be the third argument. Handle this as a special case, while still
leaving those intrinsics as generic MSBuiltins. I considered the
alternative of handling these in EmitARMBuiltinExpr, but that does
not work well for the follow-up change that I'm going to make to improve
the error handling for PR22560 -- we need the GetBuiltinType() checks
for ICEArguments, and the ARM version of that code is only used for
Neon intrinsics where the last argument is special and not
checked in the normal way.

llvm-svn: 240462
2015-06-23 21:10:15 +00:00
Douglas Katzman 9535429270 Pedantically rename all Tool subclasses to be nouns, not verbs. NFC
Classes in Tools.h inherit ultimately from Tool, which is a noun,
but subclasses of Tool were named for their operation, such as "Compile",
wherein the constructor call "Compile(args...)" could be misconstrued
as actually causing a compile to happen.

Likewise various other methods were not harmonious with their effect,
in that "BuildLinker()" returned a "new namespace::Link(...)"
instead of a "new namespace::Linker(...)" which it now does.

Exceptions: Clang and ClangAs are un-renamed. Those are their rightful names.
And there is no particulary great way to name the "Lipo-er" and a few others.

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

llvm-svn: 240455
2015-06-23 20:42:09 +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
Justin Bogner e44dd6dbd0 InstrProf: Fix a crash when an implicit def appears in a macro
llvm-svn: 240452
2015-06-23 20:29:09 +00:00
Kaelyn Takata 72d16a581b Make the typo resolution in r240441 apply to all function calls.
Regular function calls (such as to cabs()) run into the same problem
with handling dependent exprs, not just builtins with custom type
checking.

Fixes PR23775.

llvm-svn: 240443
2015-06-23 19:13:17 +00:00
Kaelyn Takata e53f0f9019 Ensure delayed typos have been corrected in calls to builtins before
checking those calls when not in C++ mode, since those code paths can't
handle dependent exprs.

Fixes PR23740.

llvm-svn: 240441
2015-06-23 18:42:21 +00:00
Ben Langmuir d4a667a4c0 Use AddString/ReadString instead of doing it manually NFC
llvm-svn: 240434
2015-06-23 18:20:23 +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
Jim Grosbach c78c2bcb2a Driver: Pass -I options to cc1as for .include search paths.
llvm-svn: 240432
2015-06-23 18:20:13 +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
Rafael Espindola b633d20d36 Update for LLVM api change.
llvm-svn: 240406
2015-06-23 13:59:36 +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
NAKAMURA Takumi 0332edac98 Fix a warning. [-Wsign-compare]
FIXME: Should "Level" be unsigned?
llvm-svn: 240391
2015-06-23 10:01:20 +00:00
Yaron Keren b76cb044f1 Silence VC warning C4715: '`anonymous namespace'::getNativeVectorSizeForA VXABI' :
not all control paths return a value.

llvm-svn: 240389
2015-06-23 09:45:42 +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
David Majnemer 5ca193c333 [MS ABI] Refactor member pointer generation
The MS ABI has very complicated member pointers.  Don't attempt to
synthesize the final member pointer ab ovo usque ad mala in one go.

Instead, start with a member pointer which points to the declaration in
question as-if it's decl context was the target class.  Then, utilize
our conversion logical to convert it to the target type.

This allows us to simplify how we think about member pointers because we
don't need to consider non-zero nv adjustments before we even generate
the member pointer.  Furthermore, it gives our adjustment logic more
exposure by utilizing it in a common path.

llvm-svn: 240383
2015-06-23 07:31:07 +00:00
David Majnemer e2be95b55b [CodeGen] Rename EmitMemberPointer to EmitMemberFunctionPointer
llvm-svn: 240382
2015-06-23 07:31:01 +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
Douglas Katzman 9ad0ec295f Eliminate "enumeration value not handled in switch" warnings
(Caused by r240370)

llvm-svn: 240376
2015-06-23 04:20:44 +00:00
Douglas Katzman 7e37afb77e Change some if/else chains to 'switch' statements. NFC
Differential Revision: http://reviews.llvm.org/D10612

llvm-svn: 240370
2015-06-23 03:02:39 +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
Richard Smith 2f633e7c3c [modules] When building a module, if there are multiple matches for a header
file in the loaded module maps and one of them is from the current module,
that's the right match.

llvm-svn: 240350
2015-06-22 22:20:47 +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
Ahmed Bougacha 0b938284da [CodeGen] Teach X86_64ABIInfo about AVX512.
As specified in the SysV AVX512 ABI drafts. It follows the same scheme
as AVX2: 

    Arguments of type __m512 are split into eight eightbyte chunks.
    The least significant one belongs to class SSE and all the others
    to class SSEUP.

This also means we change the OpenMP SIMD default alignment on AVX512.

Based on r240337.
Differential Revision: http://reviews.llvm.org/D9894

llvm-svn: 240338
2015-06-22 21:31:43 +00:00
Ahmed Bougacha d39a4151b3 [CodeGen] Use enum for AVX level in X86*TargetCodeGenInfo. NFCI.
Follow-up to r237989: expressing the AVX level as an enum makes it
simple to extend it with AVX512.

llvm-svn: 240337
2015-06-22 21:30:39 +00:00
Richard Smith 529ecb237a [modules] Add a flag to disable the feature that permits conflicting redefinitions of internal-linkage symbols that are not visible.
Such conflicts are an accident waiting to happen, and this feature conflicts
with the desire to include existing headers into multiple modules and merge the
results. (In an ideal world, it should not be possible to export internal
linkage symbols from a module, but sadly the glibc and libstdc++ headers
provide 'static inline' functions in a few cases.)

llvm-svn: 240335
2015-06-22 21:15:01 +00:00
Douglas Katzman a5df0c8d54 Add comment about the importance of being adjacent. NFC
llvm-svn: 240328
2015-06-22 20:55:31 +00:00
Richard Smith a2eb4099b6 [modules] Include merged definition information in AST dumps.
llvm-svn: 240313
2015-06-22 18:47:01 +00:00