Craig Topper [Tue, 17 Feb 2015 07:18:01 +0000 (07:18 +0000)]
[X86] Convert palignr builtin handling to use shuffle form of right shift instead of intrinsics. This should allow the instrinsics to removed from the backend.
Craig Topper [Tue, 17 Feb 2015 06:22:50 +0000 (06:22 +0000)]
[X86] Remove code that does custom handling of the builtin for MMX palignr. This code is unreachable since its already marked for non-custom handling in llvm's IntrinsicsX86.td file.
[Objctive-C sema]. Do not do the unused-getter-return-value
warning when property getter is used in direct method call
and return value of property is unused. rdar://19773512
Nico Weber [Mon, 16 Feb 2015 22:32:46 +0000 (22:32 +0000)]
For variables with dependent type, don't crash on `var->::new` or `var->__super`
ParsePostfixExpressionSuffix() for '->' (or '.') postfixes first calls
ActOnStartCXXMemberReference() to inform sema that a member reference is about
to start, and that function lets the parser know if sema thinks that the
base expression's type could allow a pseudo destructor from a semantic point of
view (for example, if the the base expression has a dependent type).
ParsePostfixExpressionSuffix() then calls ParseOptionalCXXScopeSpecifier() and
passes MayBePseudoDestructor on to that function, expecting the function to
set it to false if a pseudo destructor is impossible from a syntactic point of
view (due to a lack of '~' sigil). However, ParseOptionalCXXScopeSpecifier()
had early-outs for ::new and __super, so MayBePseudoDestructor stayed true,
so we tried to parse a pseudo dtor, and then became confused since we couldn't
find a '~'. Move the snippet in ParseOptionalCXXScopeSpecifier() that sets
MayBePseudoDestructor to false above the early exits.
Sema: diagnose use of unscoped deprecated prior to C++14
The deprecated attribute was adopted as part of the C++14, however, there is a
GNU version available in C++11. When using C++ earlier than C++14, diagnose the
use of the attribute without the GNU scope, but only when using the generalised
attribute syntax.
Parse: return true from ParseCXX11AttributeArgs if an attribute was added
In the case that we diagnosed an invalid attribute due to missing or present
arguments, we would return false, indicating to the caller that the parsing
failed. However, we would have added the attribute in ParseAttributeArgsCommon
(which may have been called indirectly through ParseGNUAttributeArgs).
Returning true in this case ensures that a second copy of the attribute is not
added.
I haven't added a test case for this as the existing test will cover this with
the next commit which diagnoses a C++14 attribute applied in C++11 mode. Rather
than duplicating the existing test case, allow the tree to remain without a test
between this and the next change. We would see double warnings in the
[[deprecated()]] applied to a declaration in C++11 mode, which will cause an
error in the cxx0x-attributes test.
Clang tries to create ObjCBoxedExpression of type 'NSNumber'
when 'NSNumber' has only forward declaration, this cause a crash later,
when 'Sema' refers to a nil QualType of the whole expression.
Please, refer to the bug report for the better explanation.
Fix quoting of #pragma comment for MS compat, clang part.
For #pragma comment(linker, ...) MSVC expects the comment string to be quoted, but for #pragma comment(lib, ...) the compiler itself quotes the library name.
Since this distinction disappears by the time the directive reaches the backend, move quoting for the "lib" version to the frontend.
Richard Smith [Mon, 16 Feb 2015 04:42:59 +0000 (04:42 +0000)]
DR1467: If aggregate initialization encounters an initializer list for which
subobject initialization is not possible, be sure to note the overall
initialization as having failed so that overload resolution knows that the
relevant candidate is not viable.
Craig Topper [Mon, 16 Feb 2015 00:42:49 +0000 (00:42 +0000)]
[X86] Teach clang to lower __builtin_ia32_psrldqi256 and __builtin_ia32_pslldqi256 to vector shuffles the backend recognizes. This is a step towards removing the corresponding intrinsics from the backend.
Larisse Voufo [Sun, 15 Feb 2015 08:47:30 +0000 (08:47 +0000)]
Don't crash on `struct ::, struct ::` (and the same for enums).
The first part of that line doesn't parse correctly and ParseClassSpecifier() for
some reason skips to tok::comma to recover, and then
ParseDeclarationSpecifiers() sees the next struct and calls
ParseClassSpecifier() again with the same DeclSpec object.
However, the first call already called ActOnCXXGlobalScopeSpecifier() on the
DeclSpec's CXXScopeSpec, and sema gets confused when this gets called again.
As a fix, let ParseClassSpecifier() (and ParseEnumSpecifier()) call
ParseOptionalCXXScopeSpec() with a temporary CXXScopeSpec object, and only
copy it into the DeclSpec if things work out. (This is also how all the other
functions that set the DeclSpec's TypeSpecScope set it.)
Nico Weber [Sun, 15 Feb 2015 07:26:13 +0000 (07:26 +0000)]
Don't crash on `struct ::, struct ::` (and the same for enums).
The first part of that line doesn't parse correctly and ParseClassSpecifier() for
some reason skips to tok::comma to recover, and then
ParseDeclarationSpecifiers() sees the next struct and calls
ParseClassSpecifier() again with the same DeclSpec object.
However, the first call already called ActOnCXXGlobalScopeSpecifier() on the
DeclSpec's CXXScopeSpec, and sema gets confused when this gets called again.
As a fix, let ParseClassSpecifier() (and ParseEnumSpecifier()) call
ParseOptionalCXXScopeSpec() with a temporary CXXScopeSpec object, and only
copy it into the DeclSpec if things work out. (This is also how all the other
functions that set the DeclSpec's TypeSpecScope set it.)
Larisse Voufo [Sat, 14 Feb 2015 05:42:57 +0000 (05:42 +0000)]
Revise the implementation logic of sized deallocation: Do not automatically generate weak definitions of the sized operator delete (in terms of unsized operator delete). Instead, provide the funcitonality via a new compiler flag, -fdef-sized-delete.
The current implementation causes link-time ODR violations when the delete symbols are exported into the dynamic table.
Richard Smith [Sat, 14 Feb 2015 01:52:20 +0000 (01:52 +0000)]
DR1748: the reserved placement allocation functions have undefined behavior if
they're given a null pointer as an argument, so we do not need to emit null
checks on their results.
David Blaikie [Sat, 14 Feb 2015 00:41:07 +0000 (00:41 +0000)]
Update test case to be compatible with auto-migration to new getelementptr syntax coming in the near future
The first change won't touch GEPOperators such as these, but the update
script only identifies them by the leading '(' after getelementptr or
'getelementptr inbounds', so update this test to at least have those
features to allow auto-migrating.
Richard Smith [Fri, 13 Feb 2015 23:50:20 +0000 (23:50 +0000)]
[modules] If we have a choice between including a file textually and importing
a prebuilt form from a module, prefer the modular form, all else being equal.
Richard Smith [Fri, 13 Feb 2015 22:43:51 +0000 (22:43 +0000)]
[modules] Guard against recursively re-entering diagnosing ODR violations while
in the middle of emitting an ODR violation diagnostic. I don't yet have a
reduced testcase for this issue, working on it...
Chandler Carruth [Fri, 13 Feb 2015 09:47:49 +0000 (09:47 +0000)]
[PM] Move away from the old llvm/PassManager.h header and its using
declarations and just use the legacy namespace qualifier in this file
and the permanent header name.
The old wrapper header is going away to make LLVM's build more modular,
and without updating Clang I can't easily start to add usage of the new
pass manager to Clang. This should make it more clear in the code which
set of types is doing what.
David Majnemer [Fri, 13 Feb 2015 07:55:47 +0000 (07:55 +0000)]
MS ABI: Implement /volatile:ms
The /volatile:ms semantics turn volatile loads and stores into atomic
acquire and release operations. This distinction is important because
volatile memory operations do not form a happens-before relationship
with non-atomic memory. This means that a volatile store is not
sufficient for implementing a mutex unlock routine.
Craig Topper [Fri, 13 Feb 2015 06:27:39 +0000 (06:27 +0000)]
[X86] Fix test cases that I foolishly copied and modified from another file that had optimizations on. This caused the check patterns to not quite match.
Richard Smith [Thu, 12 Feb 2015 23:21:45 +0000 (23:21 +0000)]
[modules] When collecting declarations to complete a redeclaration chain for an
entity, put the originally-canonical decl IDs in the right places in the redecl
chain rather than reordering them all to the start. If we don't ensure that the
redecl chain order is consistent with the topological module order, we can fail
to make a declaration visible if later declarations are in more IDNSs than
earlier ones (for instance, because the earlier decls are invisible friends).
Ben Langmuir [Thu, 12 Feb 2015 21:51:31 +0000 (21:51 +0000)]
Mangle the IsSystem bit into the .pcm file name
When mangling the module map path into a .pcm file name, also mangle the
IsSystem bit, which can also depend on the header search paths. For
example, the user may change from -I to -isystem. This can affect
diagnostics in the importing TU.
Greg Bedwell [Thu, 12 Feb 2015 12:41:28 +0000 (12:41 +0000)]
Fix dependency generation crash test to run clang and clean up after itself.
Previously the test did not have a RUN: prefix for the clang command.
In addition it was leaving behind a tmp file with no permissions causing issues when
deleting the build directory on Windows.
[mips] Partially revert r223927: Removing __SIZEOF_INT128__ macro for MIPS64
Partially revert r223927 because LLVM gained support for 128-bit integers
in r227089. Modify and keep the tests that verify the definition of the
macro __SIZEOF_INT128__ for MIPS64 BE & LE in the preprocessor.
If the linker is gcc (the default for Generic_ELF toolchains), we end up
passing most of the arguments to the linker.
Some tests were failing to account for this in their usage of *-NOT: lines
and would fail if compiled with
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-unknown
Steven Wu [Thu, 12 Feb 2015 02:06:55 +0000 (02:06 +0000)]
Add InlineAsmDiagnosticHandler for bitcode input
Summary:
This patch installs an InlineAsmDiagnosticsHandler to avoid the crash
report when the input is bitcode and the bitcode contains invalid inline
assembly. The handler will simply print the same error message that will
print from the backend.
Richard Smith [Thu, 12 Feb 2015 01:55:09 +0000 (01:55 +0000)]
More for DR1467: In C++, when initializing an element of an aggregate,
always use the normal copy-initialization rules. Remove a special case that
tries to stay within the list initialization checker here; that makes us do the
wrong thing when list-initialization of an aggregate would not perform
aggregate initialization.
Richard Smith [Thu, 12 Feb 2015 01:50:05 +0000 (01:50 +0000)]
Improve the "braces around scalar init" warning to determine whether to warn
based on whether "redundant" braces are ever reasonable as part of the
initialization of the entity, rather than whether the initialization is
"top-level". In passing, add a warning flag for it.
Adrian Prantl [Wed, 11 Feb 2015 17:45:15 +0000 (17:45 +0000)]
Fix PR19351. While building up a composite type it is important to use
a non-uniqueable temporary node that is only turned into a permanent
unique or distinct node after it is finished.
Otherwise an intermediate node may get accidentally uniqued with another
node as illustrated by the testcase.