Commit Graph

23967 Commits

Author SHA1 Message Date
Chandler Carruth c2f9ea7847 Add a test that ensures the Clang driver behaves itself when the PATH
environment variable is changed to strange things out from under it.
Prior to r223099 in LLVM, these test cases would crash in various ways
(assert fails, stack exhaustion, etc.).

llvm-svn: 223100
2014-12-02 00:53:20 +00:00
Bob Wilson 5f4346d538 Remove special case for aarch64 static vs. PIC code in iOS kernel code.
I added this check a while back but then made a note to myself that it
should be completely unnecessary since iOS always uses PIC code-gen for
aarch64. Since I could never come up with any reason why it would be
necessary, I'm just going to remove it and we'll see if anything breaks.
rdar://problem/13627985

llvm-svn: 223097
2014-12-02 00:27:35 +00:00
Richard Smith 3c1a41ad99 [modules] Track how 'header' directives were written in module map files,
rather than trying to extract this information from the FileEntry after the
fact.

This has a number of beneficial effects. For instance, diagnostic messages for
failed module builds give a path relative to the "module root" rather than an
absolute file path, and the contents of the module includes file is no longer
dependent on what files the including TU happened to inspect prior to
triggering the module build.

llvm-svn: 223095
2014-12-02 00:08:08 +00:00
Nikola Smiljanic fce370eb52 Perform correct lookup when '__super' is used in class with dependent base.
llvm-svn: 223090
2014-12-01 23:15:01 +00:00
Nico Weber 4af55faa19 Add a test for devirtualization of virtual operator calls.
There was no test coverage for this before: Modifiying
EmitCXXOperatorMemberCallee() to not call CanDevirtualizeMemberFunctionCall()
didn't make any test fail.

llvm-svn: 223056
2014-12-01 17:48:04 +00:00
Arnaud A. de Grandmaison f3470cc979 Revert "Remove threshold for lifetime marker insertion of named temporaries"
Revert r222993 while I investigate some MemorySanitizer failures.

llvm-svn: 222995
2014-12-01 09:30:16 +00:00
Arnaud A. de Grandmaison f2730e2d22 Remove threshold for lifetime marker insertion of named temporaries
Now that TailRecursionElimination has been fixed with r222354, the
threshold on size for lifetime marker insertion can be removed. This
only affects named temporary though, as the patch for unnamed temporaries
is still in progress.

llvm-svn: 222993
2014-12-01 09:13:54 +00:00
NAKAMURA Takumi ddd125a3f9 clang/test/CodeGenOpenCL/opencl_types.cl: Appease i686-msvc.
llvm-svn: 222969
2014-11-30 00:32:02 +00:00
NAKAMURA Takumi c3ee2c5a77 Tweak clang/test/CodeGenOpenCL/opencl_types.cl to appease msvc since r222941.
llvm-svn: 222956
2014-11-29 17:27:07 +00:00
David Majnemer eea02eefe7 AST: Consider pseudo-struct builtin types as substitutable
We didn't consider types like ObjCSel as a substitution candidate.

This fixes PR21688.

llvm-svn: 222941
2014-11-28 22:22:46 +00:00
Richard Barton 3b0dcc160a Add additional arguments for -mfpu options
Add neon-vfpv3 to allow specifying both at the same time. This is not an
option that GCC supports, but follows the same track and should be
non-controversial.

Change-Id: Id9ec157c835937d7d11ad0f49dbe5171fac17658
llvm-svn: 222933
2014-11-28 20:39:59 +00:00
Richard Barton 09b60b2a63 Add -mfpu=neon-vfpv4
This enables user to architecturally specify ARMv7A + VFPv4 + NEON.

Change-Id: I779b01fef5c47e5e4ac702ae24ed2f76a0e4c63f
llvm-svn: 222932
2014-11-28 20:39:54 +00:00
Alexey Bataev f33eba6573 [OPENMP] Additional processing of 'omp atomic write' directive.
According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic write' is allowed to be used only for expression statements of form 'x = expr;', where x is a lvalue expression and expr is an expression with scalar type. Patch adds checks for it.

llvm-svn: 222913
2014-11-28 07:21:40 +00:00
Alexis Hunt 724f14e75c Create a new 'flag_enum' attribute.
This attribute serves as a hint to improve warnings about the ranges of
enumerators used as flag types. It currently has no working C++ implementation
due to different semantics for enums in C++. For more explanation, see the docs
and testcases.

Reviewed by Aaron Ballman.

llvm-svn: 222906
2014-11-28 00:53:20 +00:00
Tim Northover b047bfae32 AArch64: simplify PCS mapping.
Now that LLVM can count the registers needed to implement AAPCS rules, we don't
need to duplicate that logic here. This means we can drop the explicit padding
and also use more natural types in many cases (e.g. "struct { float arr[3]; }"
used to end up as "[2 x double]" to avoid holes on the stack.

The one wrinkle is that AAPCS va_arg was also using the register counting
machinery. But the local replacement isn't too bad.

llvm-svn: 222904
2014-11-27 21:02:49 +00:00
Richard Smith 83d3f150c8 [c++1z] Remove terse range-based for loops; they've been removed from
consideration for C++17 for now. Update C++ status page to match.

llvm-svn: 222865
2014-11-27 01:54:27 +00:00
Richard Trieu c321b931c0 When checking for uninitialized values, do not confuse "std::move" with every
other function named "move".

llvm-svn: 222863
2014-11-27 01:29:32 +00:00
Tim Northover 8603941057 OpenCL: fix test for lack of names in release builds
llvm-svn: 222853
2014-11-26 22:33:04 +00:00
Richard Smith 42ea81f655 Fix buildbot failure on LLP64 platforms like MSVC x86_64.
llvm-svn: 222848
2014-11-26 19:37:39 +00:00
Aaron Ballman eda0373900 Adding an explicit triple to this test to get it to pass all build bots.
llvm-svn: 222837
2014-11-26 16:17:20 +00:00
Anastasia Stulova 5d8ad8a7b8 [OpenCL] Implemented restrictions for pointer conversions specified in OpenCL v2.0.
OpenCL v2.0 s6.5.5 restricts conversion of pointers to different address spaces:
- the named address spaces (__global, __local, and __private) => __generic - implicitly converted;
- __generic => named - with an explicit cast;
- named <=> named - disallowed;
- __constant <=> any other - disallowed.

llvm-svn: 222834
2014-11-26 15:36:41 +00:00
Anastasia Stulova 248f1e5156 [OpenCL] Generic address space parsing and diagnostics test (forgotten previously)
llvm-svn: 222832
2014-11-26 14:14:05 +00:00
Richard Smith 410cc89374 [c++1z] Most of N4268 (allow constant evaluation for non-type template arguments).
We don't yet support pointer-to-member template arguments that have undergone
pointer-to-member conversions, mostly because we don't have a mangling for them yet.

llvm-svn: 222807
2014-11-26 03:26:53 +00:00
David Majnemer 659be55daa CodeGen: Fix emission of __atomic_compare_exchange
We (wrongly) discarded the return value of the call.

llvm-svn: 222798
2014-11-25 23:44:32 +00:00
Kaelyn Takata 443d61d62a Ensure that any TypoExprs in the arguments to bultins with custom type
checking are handled before the custom type checking is performed.

Fixes PR21669.

llvm-svn: 222797
2014-11-25 23:04:09 +00:00
Paul Robinson 18bc77f66c Try to fix a ppc64 bot. What is this 'signext' stuff anyway?
No wonder most people use specific triples.

llvm-svn: 222769
2014-11-25 17:28:54 +00:00
Chandler Carruth cc75b75b9d Update Clang tests that run the LLVM optimizer to reflect the changed
canonicalization in r222748. No interesting functionality changed here.

llvm-svn: 222749
2014-11-25 10:10:37 +00:00
Daniel Jasper 21a0f55755 Add flag -f(no-)modules-implicit-maps.
This suppresses the implicit search for files called 'module.modulemap' and
similar.

llvm-svn: 222745
2014-11-25 09:45:48 +00:00
Sergey Dmitrouk 745f530446 [ARM] Define __ARM_FEATURE_DSP macro for CPUs that have DSP instructions
Summary:
This resolves [[ http://llvm.org/bugs/show_bug.cgi?id=17391 | PR17391 ]].

GCC's sources were used as a guide (couldn't find much information in ARM documentation).

Reviewers: doug.gregor, asl

Reviewed By: asl

Subscribers: asl, aemerson, cfe-commits

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

llvm-svn: 222741
2014-11-25 08:57:36 +00:00
Paul Robinson 4e21001bac See if this fixes Mips bot; ignore contents of parameter lists.
llvm-svn: 222708
2014-11-24 23:30:12 +00:00
Kaelyn Takata 13da33fdfe Force the correction of delayed typos in casts in non-C++ code.
Fixes PR21656, which is fallout from r222551 caused by an untested/missed
code path.

llvm-svn: 222694
2014-11-24 21:46:59 +00:00
Tim Northover bdcc1ed66d testing: make test use FileCheck
The "grep internal | count" was fragile when your source or remote paths could
contain the word "internal".

llvm-svn: 222685
2014-11-24 21:03:34 +00:00
Paul Robinson 4ece682586 Correctly remove OptimizeForSize from functions marked OptimizeNone.
This allows using __attribute__((optnone)) and the -Os/-Oz options.
Fixes PR21604.

llvm-svn: 222683
2014-11-24 20:51:42 +00:00
Saleem Abdulrasool aca550fdb5 CodeGen: make i686-windows-itanium more similar to msvc
The itanium environment follows the system calling convention for structures.
Pass small aggregates via registers.

llvm-svn: 222680
2014-11-24 20:14:29 +00:00
Nico Rieck dfff5d22e6 Fix crash when using __if_exists in C mode
llvm-svn: 222665
2014-11-24 17:29:35 +00:00
Saleem Abdulrasool ec5c624550 CodeGen: tweak struct ABI handling
Cygwin and MinGW fail to conform to the underlying system's structure passing
ABI.  Make the check more precise to ensure that we correctly generate code for
the itanium environment.

llvm-svn: 222626
2014-11-23 02:16:24 +00:00
Daniel Sanders 1f07d06d61 Support matching signext attribute in the parallel_num_threads_codegen test to appease clang-cmake-mips builder.
The Mips target adds the signext attribute to signed 32-bit integers in order
to support the N32/N64 correctly. Integers must be promoted to 64-bit bit on
these ABI's.

llvm-svn: 222618
2014-11-22 16:21:18 +00:00
Daniel Sanders 8ff9e737af Support matching signext attribute in vla-lambda-capturing test to appease clang-cmake-mips builder.
The Mips target adds the signext attribute to signed 32-bit integers in order
to support the N32/N64 correctly. Integers must be promoted to 64-bit bit on
these ABI's.

llvm-svn: 222617
2014-11-22 16:08:56 +00:00
David Majnemer d8cd8f7b6e CodeGen: Make atomic operations play nice with address spaces
We were being a little sloppy with our pointer/address space casts.

This fixes PR21643.

llvm-svn: 222615
2014-11-22 10:44:12 +00:00
Richard Smith 88f45490a0 Delay checking overrides for exception specifications if the overridden
specification has not yet been parsed.

llvm-svn: 222603
2014-11-22 03:09:05 +00:00
David Majnemer 125efd8d4f MS ABI: Mangle u8 string literals
UTF8 string literals are mangled just like ASCII string literals.

llvm-svn: 222591
2014-11-21 23:56:50 +00:00
Fariborz Jahanian ac1c5120c6 Objective-C ARC. Fixes a crash when checking for 'weak' propery
whose base is not an expression. rdar://19053620

llvm-svn: 222570
2014-11-21 21:12:11 +00:00
David Majnemer 6f3150a7d2 Sema: Don't permit variably modified types in typeid
GCC and ICC both reject this and the 'Runtime-sized arrays with
automatic storage duration' (N3639) paper forbade this as well.
Previously, we would crash on our way to mangling.

This fixes PR21632.

llvm-svn: 222569
2014-11-21 21:09:12 +00:00
Roman Divacky d517801493 Implement -Wcast-qual, fixing #13772.
Many thanks to dblaikie for his advices and suggestions!

llvm-svn: 222568
2014-11-21 21:03:10 +00:00
David Majnemer 98e77a2512 MS ABI: Mangle char16_t and char32_t string literals
We previously had support for char and wchar_t string literals.  VS 2015
added support for char16_t and char32_t.

String literals must be mangled in the MS ABI in order for them to be
deduplicated across translation units: their linker has no notion of
mergeable section.  Instead, they use the mangled name to make a COMDAT
for the string literal; the COMDAT will merge with other COMDATs in
other object files.

This allows strings in object files generated by clang to get merged
with strings in object files generated by MSVC.

llvm-svn: 222564
2014-11-21 19:57:25 +00:00
Kaelyn Takata 1586782767 Enable ActOnIdExpression to use delayed typo correction for non-C++ code
when calling DiagnoseEmptyLookup.

llvm-svn: 222551
2014-11-21 18:48:04 +00:00
Kaelyn Takata 4c3ffc4fef Properly correct initializer expressions based on whether they would be valid.
llvm-svn: 222550
2014-11-21 18:48:00 +00:00
Kaelyn Takata 5ca2ecd2b2 Use the full-Expr filter to disambiguate equidistant correction
candidates.

llvm-svn: 222549
2014-11-21 18:47:58 +00:00
Dmitry Vyukov 45bac8d4e8 Fix test after r222526.
llvm-svn: 222530
2014-11-21 12:48:43 +00:00
David Majnemer eca5a201f4 MS ABI: Mangle char16_t and char32_t types
These mangling make clang more compatible with MSVC 2015.
Correctly mangling char16_t and char32_t will take a little more work.

llvm-svn: 222515
2014-11-21 09:06:49 +00:00
Bob Wilson d8f4165b0d Fix missing diagnostic for unsupported TLS for some thread_local variables.
Clang r181627 moved a check for block-scope variables into this code for
handling thread storage class specifiers, but in the process, it broke the
logic for checking if the target supports TLS. Fix this with some simple
restructuring of the code. rdar://problem/18796883

llvm-svn: 222512
2014-11-21 06:52:52 +00:00
Richard Smith 5b39075668 [modules] When explicitly importing a module, it's fine for the imported module
to be newer than we were expecting. That happens if .pcm's get moved between
file systems during a distributed build. (It's still not OK for them to actually
be different, though, so we still check the size and signature matches.)

llvm-svn: 222507
2014-11-21 05:37:20 +00:00
Richard Trieu 3630c39972 Extend -Wuninitialized to warn when accessing uninitialized base classes in a
constructor.

llvm-svn: 222503
2014-11-21 03:10:30 +00:00
Adrian Prantl ebd1ef82ad relax this testcase to not depend on a specific alignment.
llvm-svn: 222490
2014-11-21 00:48:22 +00:00
Adrian Prantl 88eec39460 Debug info for blocks: Fix a bug caught by the Verifier.
When emitting nested block definitions, the insert-at-point variant of
DIBuilder::insertDeclare() could be called with the insertion point set
to the end-of-BasicBlock sentinel, causing the parent pointer of the
CallInst to be set to the intentionally bogus value of the sentinel.

Fixed by conditionally invoking the correct version of insertDeclare().
rdar://problem/19034882

llvm-svn: 222487
2014-11-21 00:35:25 +00:00
David Blaikie af08085c86 DebugInfo: Fix another case of r222377 when we do have a definition of the variable, but we might not be emitting it (such as templates)
llvm-svn: 222485
2014-11-21 00:20:58 +00:00
Richard Smith 01014cee76 Remove code that tries to avoid transforming non-dependent call operator types
for lambda expressions. That can't ever work; we need to transform the
parameters in order to create new ones in the new call operator context.

Fixes a rejects-valid when transforming a context containing a
lambda-expression that uses its function parameters in C++14 mode.

llvm-svn: 222482
2014-11-20 23:53:14 +00:00
Richard Smith 4764e9bf79 Move test from r222476 to a better place; this was reduced to the point that it
no longer contained a generic lambda.

llvm-svn: 222477
2014-11-20 23:00:25 +00:00
Richard Smith 069ecf65e5 Fix crash-on-valid if a lambda-expression appears lexically directly within a
local class inside a template.

llvm-svn: 222476
2014-11-20 22:56:34 +00:00
Richard Smith 3ef3e899a9 PR21565: Further refine the conditions for enabling eager parsing of
std::X::swap exception specifications (allowing parsing of non-conforming code
in libstdc++). The old conditions also matched the functions in MSVC's STL,
which were relying on deferred parsing here.

llvm-svn: 222471
2014-11-20 22:32:11 +00:00
Kaelyn Takata 57e07c950d Ensure all TypoExprs are diagnosed by the tree transform.
If there is more than one TypoExpr within the expr being transformed and
any but the last TypoExpr seen don't have any viable candidates, the
tree transform will be aborted early and the remaining TypoExprs are
never seen and hence never diagnosed. This adds a simple
RecursiveASTVisitor to find all of the TypoExprs to be diagnosed in the
case where typo correction of the entire expr fails (and the result of
the tree transform is an ExprError).

llvm-svn: 222465
2014-11-20 22:06:44 +00:00
Kaelyn Takata b16e632c64 Wire up delayed typo correction to DiagnoseEmptyLookup and set up
Sema::ActOnIdExpression to use the new functionality.

Among other things, this allows recovery in several cases where it
wasn't possible before (e.g. correcting a mistyped static_cast<>).

llvm-svn: 222464
2014-11-20 22:06:40 +00:00
Anastasia Stulova 561e0aa180 Extended list of valid frontend options with '-cl-std=CL2.0'.
This option sets language mode for the compilation of a source file to be OpenCL v2.0.

Example: clang -cc1 -cl-std=CL2.0 myfile.cl
llvm-svn: 222444
2014-11-20 19:25:00 +00:00
Timur Iskhodzhanov f0934fa708 Convert CR+LF -> LF in a test file
llvm-svn: 222429
2014-11-20 12:59:14 +00:00
Alexey Bataev cc37cc1db2 [OPENMP] Codegen for "omp flush" directive.
For each "omp flush" directive a call to "void kmpc_flush(ident_t *, ...)" function is generated.
Directive "omp flush" may have an associated list of variables to flush, but currently runtime function ignores them. So the patch generates just "call kmpc_flush(ident_t *<loc>, i32 0)".
Differential Revision: http://reviews.llvm.org/D6292

llvm-svn: 222409
2014-11-20 04:34:54 +00:00
Richard Smith 30ef77a780 Fix buildbots.
llvm-svn: 222408
2014-11-20 04:09:55 +00:00
Richard Smith e9f130cfdf Preserve numeric literal suffixes during type canonicalization.
Patch by Pierre Gousseau! Test cases altered significantly by me.

llvm-svn: 222404
2014-11-20 03:37:32 +00:00
Richard Smith c8b9badef7 Avoid earlier test interfering with later one.
llvm-svn: 222403
2014-11-20 01:50:37 +00:00
Richard Smith 6adb42e1ac When mangling member-expressions, skip implicit accesses of anonymous union
objects. This is consistent with GCC's behavior. Patch by Tomasz Miąsko!

llvm-svn: 222402
2014-11-20 01:35:11 +00:00
Alexey Samsonov cfb97aa620 Remove support for undocumented SpecialCaseList entries.
"global-init", "global-init-src" and "global-init-type" were originally
used to blacklist entities in ASan init-order checker. However, they
were never documented, and later were replaced by "=init" category.

Old blacklist entries should be converted as follows:
  * global-init:foo -> global:foo=init
  * global-init-src:bar -> src:bar=init
  * global-init-type:baz -> type:baz=init

llvm-svn: 222401
2014-11-20 01:27:19 +00:00
Richard Smith 5b555da775 PR21531: fix crash on invalid with unexpanded pack in case value.
llvm-svn: 222400
2014-11-20 01:24:12 +00:00
Chad Rosier 36577d037f Revert "[Reassociate] Update test cases due to r222142."
This reverts commit r222144.  Commit r222142 is being reverted due to
a spec2006/gcc execution-time regression.

Update mips-varargs test as well.

llvm-svn: 222397
2014-11-19 23:20:35 +00:00
Richard Smith be6dd818fb Fix bug where a trivial constexpr copy/move operation couldn't copy from an
empty non-constexpr object. Such a copy doesn't break any of the constexpr
rules.

llvm-svn: 222387
2014-11-19 21:27:17 +00:00
David Blaikie 423eb5a6a5 DebugInfo: Don't emit a 'global variable' when a static member declaration is referenced without a definition, just ensure the enclosing class (with the static member declaration) is emitted.
Addresses PR21511 by emitting appropriate metadata rather than
faux-global definitions for a variable that doesn't have a definition.

llvm-svn: 222377
2014-11-19 19:42:40 +00:00
Saleem Abdulrasool 4325aaa6d9 Driver: correct typo
Fix a typo in the search path identified by Justin Bogner.

llvm-svn: 222371
2014-11-19 17:59:00 +00:00
Daniel Sanders 59229dcb29 Allow EmitVAArg() to promote types and use this to fix some N32/N64 vararg issues for Mips.
Summary:
With this patch, passing a va_list to another function and reading 10 int's from
it works correctly on a big-endian target.

Based on a pair of patches by David Chisnall, one of which I've reworked
for the current trunk.

Reviewers: theraven, atanasyan

Reviewed By: theraven, atanasyan

Subscribers: cfe-commits

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

llvm-svn: 222339
2014-11-19 10:01:35 +00:00
Richard Trieu 791b86ec55 Add the exception for strings in logical and expressions to -Wstring-conversion
for C code.

llvm-svn: 222327
2014-11-19 06:08:18 +00:00
Eric Christopher 8be702dbaa This test also requires an aarch64 target.
llvm-svn: 222268
2014-11-18 22:36:11 +00:00
Fariborz Jahanian ef202d96c7 [Sema] Patch to issue warning on comparing parameters with
nonnull attribute when comparison is always true/false. 
Original patch by Steven Wu. I have added extra code to prevent issuing of
warning  when the nonnull parameter is modified prior to the comparison.
This addition prevents false positives in the most obvious cases.
There may still be false positive warnings in some cases (as one of my tests
indicates), but benefit far outweighs such cases. rdar://18712242

llvm-svn: 222264
2014-11-18 21:57:54 +00:00
Alexey Bataev 62cec44ca4 [OPENMP] Additional processing of 'omp atomic read' directive.
According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic read' is allowed to be used only for expression statements of form 'v = x;', where x and v (as applicable) are both l-value expressions with scalar type. Patch adds checks for it.

llvm-svn: 222231
2014-11-18 10:14:22 +00:00
Justin Hibbits 90ca05e5e5 Add PIC-level support to Clang.
Summary:
This distinguishes between -fpic and -fPIC now, with the additions in LLVM for
PIC level support.

Test Plan: No regressions

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rnk, emaste, llvm-commits

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

llvm-svn: 222227
2014-11-18 06:17:20 +00:00
Frederic Riss d253ed6565 Fully handle globals and functions in CGDebugInfo::getDeclarationOrDefinition()
Currently this function would return nothing for functions or globals that
haven't seen a definition yet. Make it return a forward declaration that will
get RAUWed with the definition if one is seen at a later point. The strategy
used to implement this is similar to what's done for types: the forward
declarations are stored in a vector and post processed upon finilization to
perform the required RAUWs.

For now the only user of getDeclarationOrDefinition() is EmitUsingDecl(), thus
this patch allows to emit correct imported declarations even in the absence of
an actual definition of the imported entity.

(Another user will be the debug info generation for argument default values
that I need to resurect).

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

llvm-svn: 222220
2014-11-18 03:40:51 +00:00
Justin Bogner 94d384e423 InstrProf: Don't emit coverage for uninstantiated templates
We include unused functions and methods in -fcoverage-mapping so that
we can differentiate between uninstrumented and unused. This can cause
problems for uninstantiated templates though, since they may involve
an incomplete type that can't be mangled. This shows up in things like
libc++'s <unordered_map> and makes coverage unusable.

Avoid the issue by skipping uninstantiated methods of a templated
class.

llvm-svn: 222204
2014-11-18 00:34:46 +00:00
Manman Ren 408549644d Debug Info: context field of a global variable is DIScopeRef.
Paired commit with r222195.

llvm-svn: 222196
2014-11-18 00:29:32 +00:00
John McCall 0d8d6c094f Fix an assertion when ending a function definition.
The bug is that ExprCleanupObjects isn't always empty
in a fresh evaluation context.  New evaluation contexts just
track the current depth of the stack.

The assertion will misfire whenever we finish processing
a function body inside an expression that contained an earlier
block literal with non-trivial captures.  That's actually
a lot less likely than you'd think, though, because it has
to be a real function declaration, not just another block.
Mixed block/lambda code would work, as would a template
instantiation or a local class definition.

The code works correctly if the assertion is disabled.

rdar://16356628

llvm-svn: 222194
2014-11-18 00:19:01 +00:00
Reid Kleckner d60b82f93e Handle use of default member initializers before end of outermost class
Specifically, when we have this situation:
  struct A {
    template <typename T> struct B {
      int m1 = sizeof(A);
    };
    B<int> m2;
  };

We can't parse m1's initializer eagerly because we need A to be
complete.  Therefore we wait until the end of A's class scope to parse
it. However, we can trigger instantiation of B before the end of A,
which will attempt to instantiate the field decls eagerly, and it would
build a bad field decl instantiation that said it had an initializer but
actually lacked one.

Fixed by deferring instantiation of default member initializers until
they are needed during constructor analysis. This addresses a long
standing FIXME in the code.

Fixes PR19195.

Reviewed By: rsmith

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

llvm-svn: 222192
2014-11-17 23:36:45 +00:00
Hans Wennborg 6164753e81 clang-cl: Allow /Fo without an argument (PR21589)
When it's used without an argument, the default file name is
used. The same goes for /Fe.

Also, allow using /Fo, /Fa and /Fe with multiple inputs if they
don't have an argument.

llvm-svn: 222164
2014-11-17 19:16:36 +00:00
Hans Wennborg 767e6a4333 test/Driver/cl-outputs.c: tweak some check prefixes; NFC.
These tests deal with the /o option; rename to better reflect that.

llvm-svn: 222157
2014-11-17 18:40:45 +00:00
Chad Rosier 0837f63fd2 [Reassociate] Update test cases due to r222142.
llvm-svn: 222144
2014-11-17 16:34:47 +00:00
Alexey Samsonov 1e715a66d7 [Sanitizer] Parse and produce all sanitizer-relevant arguments in SanitizerArgs.
In particular, make SanitizerArgs responsible for parsing
and passing down to frontend -fsanitize-recover and
-fsanitize-undefined-trap-on-error flags.

Simplify parsing -f(no-)sanitize= flags parsing: get rid of
too complex filterUnsupportedKinds function.

No functionality change.

llvm-svn: 222105
2014-11-16 20:53:53 +00:00
Reid Kleckner b1be683074 Fix IRGen for passing transparent unions
We have had a test for this for a long time with a FIXME saying what we
should be doing. This just does it.

Fixes PR21573.

llvm-svn: 222074
2014-11-15 01:41:41 +00:00
Fariborz Jahanian 68e7938361 This patch fixes couple of bugs for predefined expression
used inside blocks. It fixes a crash in naming code
for __func__ etc. when used in a block declared globally.
It also brings back old naming convention for
predefined expression which was broken. rdar://18961148

llvm-svn: 222065
2014-11-14 23:55:27 +00:00
Aaron Ballman 43f40103f0 [c++1z] Support [[deprecated]] attributes on namespaces. Note that it only applies to situations where the namespace is mentioned. Thus, use on anonymous namespaces is diagnosed.
llvm-svn: 222054
2014-11-14 22:34:56 +00:00
Anton Korobeynikov 5f951ee8bd Recommit r222044 with a test fix - it does not make sense to hunt
for a typedef before arithmetic conversion in all rare corner cases.

llvm-svn: 222049
2014-11-14 22:09:15 +00:00
Anton Korobeynikov 50fc68f2d9 Again revert r222044 to resolve darwin objc test fails.
llvm-svn: 222047
2014-11-14 21:54:46 +00:00
Anton Korobeynikov dc12b367bc Follow-up to D6217
Summary:
Ok, here is somewhat addition to D6217 aiming to preserve old darwin behavior wrt the typedefed types. The actual change to SemaChecking turned out to be pretty gross, in particular:
  1. We need to extract the typedef'ed type for proper diagnostics
  2. We need to walk over paren expressions as well

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 222044
2014-11-14 21:41:07 +00:00
Hans Wennborg 05d50a9645 clang-cl: Ignore the new /Zo[-] option (PR21571)
Also fix the ignored options test which didn't fail properly on
unknown options.

llvm-svn: 222013
2014-11-14 18:24:08 +00:00
Fariborz Jahanian b7859ddf9b [Sema]. Warn when logical expression is a pointer
which evaluates to true. rdar://18716393.
Reviewed by Richard Trieu

llvm-svn: 222009
2014-11-14 17:12:50 +00:00
Aaron Ballman a0344c5d7b Complete support for the SD-6 standing document (based off N4200) with support for __has_cpp_attribute.
llvm-svn: 221991
2014-11-14 13:44:02 +00:00
Bill Schmidt 8ff672d397 [PowerPC] Enable vec_perm for long long and double vector types for VSX
VSX makes the "vector long long" and "vector double" types available.
This patch enables the vec_perm interface for these types.  The same
builtin is generated regardless of the specified type, so no
additional work or testing is needed in the back end.  Tests are added
to ensure this builtin is generated by the front end.

llvm-svn: 221988
2014-11-14 13:10:13 +00:00
Bill Schmidt cee13a2712 [PowerPC] Add VSX builtins for vec_div
This patch adds builtin support for xvdivdp and xvdivsp, along with a
new test case.  The builtins are accessed using vec_div in altivec.h.
Builtins are listed (mostly) alphabetically there, so inserting these
changed the line numbers for deprecation warnings tested in
test/Headers/altivec-intrin.c.

There is a companion patch for LLVM.

llvm-svn: 221984
2014-11-14 12:10:51 +00:00
Alexey Bataev 9aba41c822 [OPENMP] Temporary fix for processing of global variables in loops.
Currently there is a bug in processing of global variables used as loop control variables in 'omp for/simd' constructs: these globals must be captured as private variables, but currently they are nor. This is a temporary bug fix for this problem until the correct solution is prepared. If a global var used as lcv without explicit mark as a private/linear/lastprivate the error message is emitted.

llvm-svn: 221970
2014-11-14 04:08:45 +00:00
Reid Kleckner e070b99b84 Remove -fseh-exceptions in favor of checking the triple
This option was misleading because it looked like it enabled the
language feature of SEH (__try / __except), when this option was really
controlling which EH personality function to use. Mingw only supports
SEH and SjLj EH on x86_64, so we can simply do away with this flag.

llvm-svn: 221963
2014-11-14 02:01:10 +00:00
Richard Smith 6403e937d6 PR21565 Add an egregious hack to support broken libstdc++ headers that declare
a member named 'swap' and then expect unqualified lookup for the name 'swap' in
its exception specification to find anything else.

Without delay-parsed exception specifications, this was ill-formed (NDR) by
[basic.scope.class]p1, rule 2. With delay-parsed exception specifications, the
call to 'swap' unambiguously finds the function being declared, which then
fails because the arguments don't work for that function.

llvm-svn: 221955
2014-11-14 00:37:55 +00:00
Alexey Samsonov cbbd2fd8d6 [Profile] Always build profile runtime library with -fPIC.
This change removes libclang_rt.profile-pic-<arch>.a version of
profile runtime. Instead, it's sufficient to always build
libclang_rt.profile-<arch>.a with -fPIC, as it can be linked into
both executables and shared objects.

llvm-svn: 221952
2014-11-14 00:16:26 +00:00
Reid Kleckner 92493e5e96 -Wsentinel: Suggest nullptr in C++11 instead of NULL
llvm-svn: 221945
2014-11-13 23:19:36 +00:00
Richard Smith 98710fc4f5 Fix assert/crash on invalid with __builtin_constant_p conditionals in constant expressions.
llvm-svn: 221942
2014-11-13 23:03:19 +00:00
Fariborz Jahanian c62d16f304 Objective-C. Fixes a regression caused by implementation
of new warning for deprecated method call for receiver
of type 'id'. This addresses rdar://18960378 where
unintended warnings being issued.

llvm-svn: 221933
2014-11-13 22:27:05 +00:00
Richard Smith 0b3a46247e PR21437, final part of DR1330: delay-parsing of exception-specifications. This
is a re-commit of Doug's r154844 (modernized and updated to fit into current
Clang).

llvm-svn: 221918
2014-11-13 20:01:57 +00:00
Ed Maste 6a9eda5e3d Hook up FreeBSD AArch64 support
Patch from Andrew Turner.

llvm-svn: 221900
2014-11-13 16:55:42 +00:00
Argyrios Kyrtzidis cde7069ce4 [libclang] Make sure to visit the body of a CXXForRangeStmt.
llvm-svn: 221881
2014-11-13 09:50:19 +00:00
Argyrios Kyrtzidis 998912453d [liblang] Handle CXXForRangeStmt during AST visitation.
llvm-svn: 221874
2014-11-13 09:03:21 +00:00
Hans Wennborg c4f5b046ad CMake: Set HOST_LINK_VERSION on Darwin (PR21268)
The Autoconf build already does this, but it was never ported to
CMake. The host linker version affects the flags that Clang pass
to the linker, notably whether it passes -demangle or not.

http://reviews.llvm.org/D6239

llvm-svn: 221844
2014-11-13 00:35:23 +00:00
Fariborz Jahanian ef7c578d3c Fixes test.
llvm-svn: 221843
2014-11-13 00:19:30 +00:00
Richard Smith 5357c0813b Another test for PR19372, showing why we need to keep checking arguments after a pack expansion.
llvm-svn: 221838
2014-11-12 23:50:13 +00:00
Richard Smith 316c6dc1cb Add another testcase.
llvm-svn: 221833
2014-11-12 23:43:08 +00:00
Richard Smith 96d71c3936 PR19372: Keep checking template arguments after we see an argument pack
expansion into a parameter pack; we know that we're still filling in that
parameter's arguments. Previously, if we hit this case for an alias template,
we'd try to substitute using non-canonical template arguments.

llvm-svn: 221832
2014-11-12 23:38:38 +00:00
Anton Korobeynikov 50a3cbd7c0 Temporary revert r221818 until all the problems
with objc stuff will be resolved.

llvm-svn: 221829
2014-11-12 23:15:38 +00:00
Anton Korobeynikov 04348de5d3 Now really fix the typo in the test
llvm-svn: 221825
2014-11-12 22:58:08 +00:00
Anton Korobeynikov c427e3de77 Update the tests to handle proper result type of (?:)
llvm-svn: 221824
2014-11-12 22:48:38 +00:00
Fariborz Jahanian 800821a3b2 [Objective-C++ IRGen] do not generate .cxx_construct
for class that contains trivially-constructible struct ivar.
rdar://18950072

llvm-svn: 221823
2014-11-12 22:37:43 +00:00
Anton Korobeynikov 0140aa8756 Fix fallout from r219557
Summary:
Consider the following nifty 1 liner: (0 ? csqrtl(2.0f) : sqrtl(2.0f)). One can easily obtain such code from e.g. tgmath. Right now it produces an assertion because we fail to do the promotion real => _Complex real.

The case was properly handled previously (old handleOtherComplexFloatConversion routine), but was forgotten in the current version. This seems to be about fallout from r219557

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221821
2014-11-12 22:19:06 +00:00
Reid Kleckner 6d829bdbef Fix brace init of unions with unnamed struct members
The check for unnamed members was intended to skip unnamed bitfields,
but it ended up skipping unnamed structs. This lead to an assertion in
IRGen.

llvm-svn: 221818
2014-11-12 21:30:23 +00:00
Richard Smith 38af8561f9 Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,
which we don't yet implement).

llvm-svn: 221816
2014-11-12 21:16:38 +00:00
Fariborz Jahanian f122f4b99d Check for IRGen output when varag is used
in -funknown-anytype  mode (in lldb use).

llvm-svn: 221796
2014-11-12 17:54:11 +00:00
Nico Weber 83a63877dc Mark TypeDecls used in explicit destructor calls as referenced.
Fixes PR21221. Patch by Axel Naumann, test by me.

llvm-svn: 221771
2014-11-12 04:33:52 +00:00
Bill Schmidt 9ec8cea02b [PowerPC] Add vec_vsx_ld and vec_vsx_st intrinsics
This patch enables the vec_vsx_ld and vec_vsx_st intrinsics for
PowerPC, which provide programmer access to the lxvd2x, lxvw4x,
stxvd2x, and stxvw4x instructions.

New code in altivec.h defines these in terms of new builtins, which
are themselves defined in BuiltinsPPC.def.  The builtins are converted
to LLVM intrinsics in CGBuiltin.cpp.  Additional code is added to
builtins-ppc-vsx.c to verify the correct generation of the intrinsics.

Note that I moved the other VSX builtins so all VSX builtins will be
alphabetical in their own section in BuiltinsPPC.def.

There is a companion patch for LLVM.

llvm-svn: 221768
2014-11-12 04:19:56 +00:00
Nico Weber 28309185b2 Mark TypeDecls used in member initializers as referenced.
Without this, -Wunused-local-typedef would incorrectly warn on the two typedefs
in this program:

void foo() {
  struct A {};
  struct B : public A {
    typedef A INHERITED;
    B() : INHERITED() {}

    typedef B SELF;
    B(int) : SELF() {}
  };
}

llvm-svn: 221765
2014-11-12 03:52:25 +00:00
Richard Smith 2e32155b58 Instantiate exception specifications when instantiating function types (other
than the type of a function declaration). We previously didn't instantiate
these at all! This also covers the pathological case where the only mention of
a parameter pack is within the exception specification; this gives us a second
way (other than alias templates) to reach the horrible state where a type
contains an unexpanded pack, but its canonical type does not.


This is a re-commit of r219977:

r219977 was reverted in r220038 because it hit a wrong-code bug in GCC 4.7.2.
(That's gcc.gnu.org/PR56135, and affects any implicit lambda-capture of
'this' within a template.)


r219977 was a re-commit of r217995, r218011, and r218053:

r217995 was reverted in r218058 because it hit a rejects-valid bug in MSVC.
(Incorrect overload resolution in the presence of using-declarations.)
It was re-committed in r219977 with a workaround for the MSVC rejects-valid.

r218011 was a workaround for an MSVC parser bug. (Incorrect desugaring of
unbraced range-based for loop).

llvm-svn: 221750
2014-11-12 02:00:47 +00:00
Richard Smith d8a52a7831 PR21536: Fix a corner case where we'd get confused by a pack expanding into the
penultimate parameter of a template parameter list, where the last parameter is
itself a pack, and build a bogus empty final pack argument.

llvm-svn: 221748
2014-11-12 01:43:45 +00:00
NAKAMURA Takumi 12fb0057d1 clang/test/CodeGenCXX/debug-info-cxx1y.cpp: Add %itanium_abi_triple for incompatible MS targets.
llvm-svn: 221741
2014-11-11 23:51:53 +00:00
Kostya Serebryany 4133eabb45 [clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field-padding >= 1
Summary: If we've added poisoned paddings to a type do not emit memcpy for operator=.

Test Plan: regression tests.

Reviewers: majnemer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221739
2014-11-11 23:38:13 +00:00
Kostya Serebryany 75b4f9e1e6 Introduce -fsanitize-coverage=N flag
Summary:
This change makes the asan-coverge (formerly -mllvm -asan-coverge)
accessible via a clang flag.
Companion patch to LLVM is http://reviews.llvm.org/D6152

Test Plan: regression tests, chromium

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

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

llvm-svn: 221719
2014-11-11 22:15:07 +00:00
Alexey Samsonov e396bfc064 Bundle conditions checked by UBSan with sanitizer kinds they implement.
Summary:
This change makes CodeGenFunction::EmitCheck() take several
conditions that needs to be checked (all of them need to be true),
together with sanitizer kinds these checks are for. This would allow
to split one call into UBSan runtime into several calls in case
different sanitizer kinds would have different recoverability
settings.

Tests should be fixed accordingly, I'm working on it.

Test Plan: regression test suite.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 221716
2014-11-11 22:03:54 +00:00
Fariborz Jahanian 902edb9a2b Remove this test too.
llvm-svn: 221715
2014-11-11 21:54:53 +00:00
Fariborz Jahanian 3365bfc609 Revert r221702 until I address Richard Trieu's
comments.

llvm-svn: 221714
2014-11-11 21:54:19 +00:00
Alexey Samsonov cfc9d3fe17 Simplify the test by using multiple --check-prefix arguments
llvm-svn: 221713
2014-11-11 21:50:44 +00:00
David Blaikie 42edade9d9 PR16091 continued: Debug Info for member functions with undeduced return types.
So DWARF5 specs out auto deduced return types as DW_TAG_unspecified_type
with DW_AT_name "auto", and GCC implements this somewhat, but it
presents a few problems to do this with Clang.

GCC's implementation only applies to member functions where the auto
return type isn't deduced immediately (ie: member functions of templates
or member functions defined out of line). In the common case of an
inline deduced return type function, GCC emits the DW_AT_type as the
deduced return type.

Currently GDB doesn't seem to behave too well with this debug info - it
treats the return type as 'void', even though the definition of the
function has the correctly deduced return type (I guess it sees the
return type the declaration has, doesn't understand it, and assumes
void). This means the function's ABI might be broken (non-trivial return
types, etc), etc.

Clang, on the other hand doesn't track this particular case of a
deducable return type that is deduced immediately versus one that is
deduced 'later'. So if we implement the DWARF5 representation, all
deducible return type functions would get adverse GDB behavior
(including deduced return type lambda functions, inline deduced return
type functions, etc).

Also, we can't just do this for auto types that are not deduced -
because Clang marks even the declaration's return type as deduced (&
provides the underlying type) once a definition is seen that allows the
deduction. So we have to ignore even deduced types - but we can't do
that for auto variables (because this representation only applies to
function declarations - variables and function definitions need the real
type so the function can be called, etc) so we'd need to add an extra
flag to the type unwrapping/creation code to indicate when we want to
see through deduced types and when we don't. It's also not as simple as
just checking at the top level when building a function type (for one
thing, we reuse the function type building for building function pointer
types which might also have 'auto' in them - but be the type of a
variable instead) because the auto might be arbitrarily deeply nested
("auto &", "auto (*)()", etc...)

So, with all that said, let's do the simple thing that works in existing
debuggers for now and treat these functions the same way we do function
templates and implicit special members: omit them from the member list,
since they can't be correctly called anyway (without knowing the return
type the ABI isn't know and a function call could put the arguments in
the wrong place) so they're not much use to the user.

At some point in the future, when GDB understands the DWARF5
representation better it might be worth plumbing through the extra type
builder handling to avoid looking through AutoType for some callers,
etc...

llvm-svn: 221704
2014-11-11 20:44:45 +00:00
Fariborz Jahanian c5fd4844da Patch to warn when logical evaluation of operand evalutes to a true value;
That this is a c-only patch. c++ already has this warning.
This addresses rdar://18716393

llvm-svn: 221702
2014-11-11 19:59:16 +00:00
Richard Smith 57e18ac96d First half of CWG1962: decltype(__func__) should not be a reference type,
because __func__ is supposed to act like a local static variable.

llvm-svn: 221698
2014-11-11 19:30:41 +00:00
Fariborz Jahanian a29986c0b0 This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to  something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
(patch reapplied after lldb issue was fixed in r221660).

llvm-svn: 221691
2014-11-11 16:56:21 +00:00
Alexey Bataev 9772000a22 [OPENMP] Codegen for threadprivate variables
For all threadprivate variables which have constructor/destructor emit call to void __kmpc_threadprivate_register(ident_t * <Current Location>, void *<Original Global Addr>, kmpc_ctor <Constructor>, kmpc_cctor NULL, kmpc_dtor <Destructor>); 
In expressions all references to such variables are replaced by calls to void *__kmpc_threadprivate_cached(ident_t *<Current Location>, kmp_int32 <Current Thread Id>, void *<Original Global Addr>, size_t <Size of Data>, void ***<Pointer to autogenerated cache – array of private copies of threadprivate variable>);
Test test/OpenMP/threadprivate_codegen.cpp checks that codegen is correct. Also it checks that codegen is correct after serialization/deserialization and one of passes verifies debug info.
Differential Revision: http://reviews.llvm.org/D4002

llvm-svn: 221663
2014-11-11 04:05:39 +00:00
Richard Smith ea97e36dfc Fix parsing of fold-expressions within a cast expression. We parse the
parenthesized expression a bit differently in this case, just in case the
commas have special meaning.

llvm-svn: 221661
2014-11-11 03:28:50 +00:00
Argyrios Kyrtzidis 6cc5f73e38 [libclang] When initializing an ObjC object via the "[[ClassName alloc] init*]" pattern,
report the 'init*' invocation as non-dynamic via clang_Cursor_isDynamicCall.

Of course it is dynamic at runtime, but for purposes of indexing we can treat as an invocation to ClassName's init*.

Addresses rdar://18916871.

llvm-svn: 221641
2014-11-10 23:21:35 +00:00
Ben Langmuir acb803e807 Validate user headers even if -fmodules-validate-once-per-build-session
is enabled. Unlike system headers, we want to be more careful about
modifications to user headers, because it's still easy to edit a header
while you're building.

llvm-svn: 221634
2014-11-10 22:13:10 +00:00
Tim Northover 642e770f68 AArch64: set all processor features from -arch if nothing else present
Darwin's "-arch arm64" option implies full Cyclone CPU, for both architectural
and tuning purposes. So if neither of the explicit options have been given,
forward that on to the proper invocation.

rdar://problem/18906227

llvm-svn: 221631
2014-11-10 21:17:23 +00:00
Richard Smith 99c464c3f3 Improve diagnostics if _Noreturn is placed after a function declarator. (This sometimes happens when a macro is used that expands to either the GNU noreturn attribute or _Noreturn.)
llvm-svn: 221630
2014-11-10 21:10:32 +00:00
Richard Smith 8e6923b7f2 Update fold-expression mangling to match cxx-abi-dev discussion.
llvm-svn: 221623
2014-11-10 19:44:15 +00:00
Aaron Ballman 0de6a9b5bf Missing testcase from r221581.
llvm-svn: 221582
2014-11-08 17:09:50 +00:00
Aaron Ballman c0ae7dfe75 Updated the wording for a diagnostic to be more grammatically correct, and use a %select. Also ensure that nested namespace definitions are diagnosed properly. Both changes are motivated by post-commit feedback from r221580.
llvm-svn: 221581
2014-11-08 17:07:15 +00:00
Aaron Ballman 730476b50e [c++1z] Support for attributes on namespaces and enumerators.
llvm-svn: 221580
2014-11-08 15:33:35 +00:00
Richard Smith 3e3a705062 [c++1z] Support for u8 character literals.
llvm-svn: 221576
2014-11-08 06:08:42 +00:00
Richard Smith 13307f5f24 [c++1z] Implement nested-namespace-definitions.
This allows 'namespace A::B { ... }' as a shorthand for 'namespace A {
namespace B { ... } }'. We already supported this correctly for error recovery;
promote that support to a full implementation.

This is not the right implementation: we do not maintain source fidelity
because we desugar the nested namespace definition in the parser. This is
tricky to avoid, since the definition genuinely does inject one named
entity per level in the namespace name.

llvm-svn: 221574
2014-11-08 05:37:34 +00:00
Richard Smith 0f0af19b05 [c++1z] N4295: fold-expressions.
This is a new form of expression of the form:

  (expr op ... op expr)

where one of the exprs is a parameter pack. It expands into

  (expr1 op (expr2onwards op ... op expr))

(and likewise if the pack is on the right). The non-pack operand can be
omitted; in that case, an empty pack gives a fallback value or an error,
depending on the operator.

llvm-svn: 221573
2014-11-08 05:07:16 +00:00
Ben Langmuir ed98258482 Check module signature when the module has already been loaded
We may need to verify the signature on subsequent imports as well, just
like we verify the size/modtime:
@import A;
@import B; // imports A
@import C; // imports A

llvm-svn: 221569
2014-11-08 00:34:30 +00:00
Fariborz Jahanian e531d27cd1 Fixed a buildbot failure.
llvm-svn: 221568
2014-11-08 00:23:55 +00:00
Fariborz Jahanian 05e77f8349 [Objective-C Sema]. Issue availability/deprecated warning when
there is a uinque method found when message is sent to receiver 
of 'id' type. // rdar://18848183

llvm-svn: 221562
2014-11-07 23:51:15 +00:00
Tim Northover 5a1558ec31 ARM ABI: simplify decisions on whether args can be expanded.
Homogeneous aggregates on AAPCS_VFP ARM need to be passed *without* being
flattened (e.g. [2 x float] rather than "float, float") for various weird ABI
reasons. However, this isn't the case for anything else; further, we know at
the ABIArgInfo::getDirect callsites whether this flattening is allowed.

So, we can get more unified ARM code, with a simpler Clang, by just using that
knowledge directly.

llvm-svn: 221559
2014-11-07 22:30:50 +00:00
Samuel Antao c909c9918f Fix clash of gcc toolchains in hexagon driver regression tests.
If clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by -ccc-install-dir. This causes several regression tests to fail as they will be using an unexpected path. Adding the switch --gcc-toolchain="" in each test command is not enough as the hexagon toolchain implementation in the driver is not evaluating this argument. This commit modifies the hexagon toolchain to take the --gcc-toolchain="" argument into account when deciding the toolchain path, similarly to what is already done for other targets toolchains. Additionally, the faulty regression tests are modified in order to --gcc-toolchain="" be passed to the commands.

llvm-svn: 221535
2014-11-07 17:48:03 +00:00
Fariborz Jahanian c48f7e76fa Revert r221404 which caused lldb to not display
vararg expressions.

llvm-svn: 221533
2014-11-07 16:47:05 +00:00
Timur Iskhodzhanov 5750f56a2b Improve comments in vtordisp tests: fix a typo, add a bit more clarity
llvm-svn: 221524
2014-11-07 14:11:14 +00:00
David Majnemer 1fb1a044e5 CodeGen, Itanium: Properly dllimport RTTI data
We would blindly assume that RTTI data should have the same linkage as
the vtable because we didn't think the RTTI data was external.  This
oversight stemmed because we didn't take dllimport into account.

This fixes PR21512.

llvm-svn: 221511
2014-11-07 07:26:38 +00:00
Rafael Espindola 8b27bdb6c2 Don't manually insert L prefixes.
Simply marking the symbol private conveys the desire to hide them to LLVM.

llvm-svn: 221451
2014-11-06 13:30:38 +00:00
Andrea Di Biagio 9760a44d1a [X86] Slightly refactor default features for AMD bdver cpus (NFC). Also add missing checks to test for target features.
This patch simplifies how default target features are set for AMD bdver2
and bdver1. In particular, method 'getDefaultFeatures' now implements a
fallthrough from case 'CK_BDVER2' to case 'CK_BDVER1'.
That is because 'bdver2' has the same features available in bdver1 plus
BMI, FMA, F16C and TBM.

This patch also adds missing checks for predefined macros in test
predefined-arch-macros.c. In the case of BTVER2, the test now also checks 
for F16C, BMI and PCLMUL. In the case of BDVER3 and BDVER4, the test now
also checks for the presence of FSGSBASE.

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

llvm-svn: 221449
2014-11-06 12:08:57 +00:00
Alexey Bataev 73983918c4 Fix for exception specification mismatch in explicit instantiation.
According to C++ standard if an exception-specification is specified in an explicit instantiation directive, it shall be compatible with the exception-specifications of other declarations of that function. This patch adds checks for this.
Differential Revision: http://reviews.llvm.org/D5822

llvm-svn: 221448
2014-11-06 10:10:50 +00:00
Rafael Espindola ee2b96b230 Use FileCheck.
llvm-svn: 221435
2014-11-06 04:56:05 +00:00
Rafael Espindola 3be19cefa4 Delete dead test.
llvm-svn: 221434
2014-11-06 04:48:05 +00:00
Fariborz Jahanian 5a29e6aadb Patch for small addition to availability attribute.
This is to accept "NA" in place of vesion number for availability
attribute. Used on introduced=NA to mean unavailable
and deprecated=NA to mean nothing (not deprecated).
rdar://18804883

llvm-svn: 221417
2014-11-05 23:58:55 +00:00
Fariborz Jahanian 1839abdabe This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to  something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
John McCall, please review post-commit. 

llvm-svn: 221404
2014-11-05 21:50:22 +00:00
Frederic Riss b1ab28c949 [DebugInfo] Do not record artificial global initializer functions in the DeclCache.
When we are generating the global initializer functions, we call
CGDebugInfo::EmitFunctionStart() with a valid decl which is describing
the initialized global variable. Do not update the DeclCache with this
key as it will overwrite the the cached variable DIGlobalVariable with
the newly created artificial DISubprogram.

One could wonder if we should put artificial subprograms in the DIE tree
at all (there are vaild uses for them carrying line information though).

llvm-svn: 221385
2014-11-05 19:19:04 +00:00
Ben Langmuir 6caebfda78 Remove superceded warning warn_forgotten_module_header
This DefaultIgnore warning under -Wincomplete-module was firing on
any module map files that happened to be parsed (it's only supposed to
fire on headers), and it has been superceded by
-Wnon-modular-include-in-module anyway.

For compatibility, I rewired -Wincomplete-module to imply
-Wnon-modular-include-in-module.

llvm-svn: 221357
2014-11-05 16:43:18 +00:00
Will Wilson 5f38367c72 MS ABI: Correctly mangle CV qualifiers from typedefs
llvm-svn: 221344
2014-11-05 13:54:21 +00:00
NAKAMURA Takumi ee5e690c0a Mark darwin-debug-flags.c as REQUIRES:shell, due to quoting issue.
llvm-svn: 221332
2014-11-05 05:04:00 +00:00
Adrian Prantl 65d5d00cb7 Debug info: Emit the correct type for the __FuncPtr field in a block
descriptor.

rdar://problem/15984431

llvm-svn: 221326
2014-11-05 01:01:30 +00:00
Kaelyn Takata 445b0657a5 Filter out non-static class members when correcting non-member-references.
llvm-svn: 221319
2014-11-05 00:09:29 +00:00
Kuba Brecka e899e799b5 Fix the test failure on Windows introduced by r221279.
http://reviews.llvm.org/D6018

llvm-svn: 221316
2014-11-04 23:38:57 +00:00
Bob Wilson d5aad2a1e0 Use backslashes to escape spaces and other backslashes in -dwarf-debug-flags.
The command line options are specified in a space-separated list that is an
argument to -dwarf-debug-flags, so that breaks if there are spaces in the
options. This feature came from Apple's internal version of GCC, so I went back
to check how llvm-gcc handled this and matched that behavior.
rdar://problem/18775420

llvm-svn: 221309
2014-11-04 22:28:48 +00:00
Roman Divacky 5cd8df6d1d Since the file has both ppc and ppc64 tests in it rename it.
llvm-svn: 221285
2014-11-04 18:49:15 +00:00
Roman Divacky c294022900 Rewrite the test to not require asserts.
llvm-svn: 221284
2014-11-04 18:48:20 +00:00
Kuba Brecka 9ff912db22 Use @rpath as LC_ID_DYLIB for ASan dylib on OS X
Change the LC_ID_DYLIB of ASan's dynamic libraries on OS X to be set to "@rpath/libclang_rt.asan_osx_dynamic.dylib" and similarly for iossim. Clang driver then sets the "-rpath" to be the real path to where clang currently has the dylib (because clang uses the relative path to its current executable). This means if you move the compiler or install the binary release, -fsanitize=address will link to the proper library.

Reviewed at http://reviews.llvm.org/D6018

llvm-svn: 221279
2014-11-04 17:35:17 +00:00
Yaron Keren 3c4c9fed08 Re-enable this test on Windows since it passes with GnuWin32 env.exe.
llvm-svn: 221271
2014-11-04 14:54:37 +00:00
NAKAMURA Takumi 06ac98299f Remove "REQUIRES:shell" from tests. They work for me.
llvm-svn: 221269
2014-11-04 13:41:33 +00:00
NAKAMURA Takumi 69e32f4562 clang/test/Tooling: Remove mention to PR15590 out of a couple of tests. They are suppressed with another issue.
llvm-svn: 221267
2014-11-04 13:32:29 +00:00
NAKAMURA Takumi 83910ae5b6 clang/test/Tooling: [PR15590] Avoid backslashes in JSON. Should work on win32.
llvm-svn: 221266
2014-11-04 13:32:17 +00:00
NAKAMURA Takumi cf15c170d5 clang/test/VFS/umbrella-mismatch.m: Let it work on win32 to avoid backslashes in yaml.
FIXME: Is it intentional? s;OUT_DIR;%/S/Inputs;
llvm-svn: 221264
2014-11-04 13:05:23 +00:00
NAKAMURA Takumi bf37ee795c clang/test/Coverage/html-diagnostics.c: Use find(1) to avoid globbing.
llvm-svn: 221263
2014-11-04 13:05:10 +00:00
NAKAMURA Takumi ed7e1cbc4c clang/test/Modules: Remove "REQUIRES:shell" since they work for me.
llvm-svn: 221261
2014-11-04 12:59:18 +00:00
Reid Kleckner 06ea7d6213 Lower __builtin_fabs* to @llvm.fabs.*
mingw64's headers implement fabs by calling __builtin_fabs, so using the
library call results in an infinite loop. If the backend legalizes
@llvm.fabs as a call to fabs later, things should work out, as the crt
provides a definition.

llvm-svn: 221206
2014-11-03 23:52:09 +00:00
Rafael Espindola 234d3bce01 Remove local handling of ASAN_OPTIONS and UBSAN_OPTIONS.
They are now forwarded by TestingConfig.py.

llvm-svn: 221200
2014-11-03 23:09:25 +00:00
Reid Kleckner 899baf3625 Move the no-prototype calling conv check after decl merging
Now we don't warn on this code:
  void __stdcall f(void);
  void __stdcall f();

My previous commit regressed this functionality because I didn't update
the relevant test case which used a definition.

llvm-svn: 221188
2014-11-03 21:56:03 +00:00
Reid Kleckner 1eaa844f3e Don't diagnose no-prototype callee-cleanup function definitions
We already have a warning on the call sites of code like this:
  void f() { }
  void g() { f(1, 2, 3); }
t.c:2:21: warning: too many arguments in call to 'f'

We can limit ourselves to diagnosing unprototyped forward declarations
of f to cut down on noise.

llvm-svn: 221184
2014-11-03 21:24:50 +00:00
Roman Divacky 1ae35b902b Require asserts to unbreak the buildbots.
llvm-svn: 221174
2014-11-03 19:50:48 +00:00
Fariborz Jahanian e3db7784b6 Further restrict issuance of 'override' warning if method
is argument to a macro which is defined in system header.

llvm-svn: 221172
2014-11-03 19:46:18 +00:00
Roman Divacky 8a12d84264 Implement vaarg lowering for ppc32. Lowering of scalars and aggregates
is supported. Complex numbers are not.

llvm-svn: 221170
2014-11-03 18:32:54 +00:00
Fariborz Jahanian d6efd3e0d0 This patch reverts r220496 which issues warning on comparing
parameters with nonnull attribute when comparison is always
true/false. Patch causes false positive when parameter is
modified in the function.

llvm-svn: 221163
2014-11-03 17:03:07 +00:00
Matt Arsenault 3f6469b4c6 Emit OpenCL local global variables without zeorinitializer
Local variables are not initialized, and every target has
been (incorrectly) ignoring the unnecessary request for
zero initialization.

llvm-svn: 221162
2014-11-03 16:51:53 +00:00
Hans Wennborg 8313c76836 Don't allow dllimport/export on classes with internal linkage (PR21399)
Trying to import or export such classes doesn't make sense, and Clang
would assert trying to export vtables for them.

This is consistent with how we treat functions with internal linkage,
but it is stricter than MSVC so we may have to back down if it breaks
real code.

llvm-svn: 221160
2014-11-03 16:09:16 +00:00
Hans Wennborg 606bd6dcc5 Don't dllimport inline functions when targeting MinGW (PR21366)
It turns out that MinGW never dllimports of exports inline functions.
This means that code compiled with Clang would fail to link with
MinGW-compiled libraries since we might try to import functions that
are not imported.

To fix this, make Clang never dllimport inline functions when targeting
MinGW.

llvm-svn: 221154
2014-11-03 14:24:45 +00:00
Craig Topper 8c7f251e98 Add FSGSBASE intrinsics to x86 intrinsic headers.
llvm-svn: 221130
2014-11-03 06:51:41 +00:00
Craig Topper 554797f255 Remove definitions from Intrin.h that already exist in one of the other x86 intrinsic headers. Add a run line with Broadwell as the cpu type to ms-intrin.cpp test to catch some of these in the future.
llvm-svn: 221127
2014-11-03 04:19:58 +00:00