Richard Smith [Fri, 23 Jan 2015 00:01:13 +0000 (00:01 +0000)]
PR22299: Relocate code for handling -fmodule-map-file= so that we don't try to
produce diagnostics with source locations before the diagnostics system is
ready for them.
Richard Smith [Thu, 22 Jan 2015 23:07:47 +0000 (23:07 +0000)]
Reorganize test/Modules:
* Put all input files under Inputs/, move corresponding tests into test/Modules.
* Rename a modulemap test file to [...].modulemap, and teach lit that such files are tests.
Alexey Bataev [Thu, 22 Jan 2015 06:17:56 +0000 (06:17 +0000)]
[OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".)
Differential Revision: http://reviews.llvm.org/D6431
Alexey Bataev [Thu, 22 Jan 2015 05:44:37 +0000 (05:44 +0000)]
[OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".)
Differential Revision: http://reviews.llvm.org/D6431
Alexey Bataev [Thu, 22 Jan 2015 05:29:28 +0000 (05:29 +0000)]
[OPENMP] CodeGen for "omp atomic read [seq_cst]" directive.
"omp atomic read [seq_cst]" accepts expressions "v=x;". In this patch we perform
an atomic load of "x" (using builtin atomic loading instructions or a call to
"atomic_load()" for simple lvalues and "kmpc_atomic_start();load
<x>;kmpc_atomic_end();" for other lvalues), convert the result of loading to
type of "v" (using EmitScalarConversion() for simple types and
EmitComplexToScalarConversion() for conversions from complex to scalar) and then
store the result in "v".
Differential Revision: http://reviews.llvm.org/D6431
Richard Smith [Thu, 22 Jan 2015 03:50:31 +0000 (03:50 +0000)]
[modules] If we add an implicit special member to a class through an update
record, and that class declaration is not the canonical definition of the
class, be sure to add the class to the list of classes that are consulted when
we look up a special member in the canonical definition.
Richard Smith [Thu, 22 Jan 2015 02:21:23 +0000 (02:21 +0000)]
[modules] If we load two declarations with typedef names for linkage purposes
on top of a local declaration of the same entity, we still need to remember
that we loaded the first one or we may fail to merge the second one properly.
Justin Bogner [Thu, 22 Jan 2015 02:17:23 +0000 (02:17 +0000)]
InstrProf: Avoid creating profile names for symbols in system headers
We don't emit any coverage mapping for uncovered functions that come
from system headers, but we were creating a GlobalVariable with each
of their names. This is wasteful since the linker will need to dead
strip the unused symbols, and it can lead to issues when merging
coverage with others TUs that do have coverage for those functions.
Richard Smith [Thu, 22 Jan 2015 01:41:56 +0000 (01:41 +0000)]
[modules] It's possible to merge into the pattern of a class template before we
load the definition data from the declaration itself. In that case, merge
properly; don't assume the prior definition is the same as our own.
Reid Kleckner [Thu, 22 Jan 2015 01:36:17 +0000 (01:36 +0000)]
Initial support for Win64 SEH IR emission
The lowering looks a lot like normal EH lowering, with the exception
that the exceptions are caught by executing filter expression code
instead of matching typeinfo globals. The filter expressions are
outlined into functions which are used in landingpad clauses where
typeinfo would normally go.
Major aspects that still need work:
- Non-call exceptions in __try bodies won't work yet. The plan is to
outline the __try block in the frontend to keep things simple.
- Filter expressions cannot use local variables until capturing is
implemented.
- __finally blocks will not run after exceptions. Fixing this requires
work in the LLVM SEH preparation pass.
The IR lowering looks like this:
// C code:
bool safe_div(int n, int d, int *r) {
__try {
*r = normal_div(n, d);
} __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) {
return false;
}
return true;
}
Hans Wennborg [Thu, 22 Jan 2015 00:45:20 +0000 (00:45 +0000)]
Fix compiler_builtins.m test to not rely on including system stdlib.h and malloc.h
Importing _Builtin_intrinsics.sse and avx would transitively pull in those
headers, and the test would fail when building in an environment where
they were not available on the include path.
Chris Bieneman [Wed, 21 Jan 2015 23:26:11 +0000 (23:26 +0000)]
Adopt new cl::HideUnrelatedOptions API added r226729.
Summary: cl::HideUnrelatedOptions allows tools to hide all options not part of a specific OptionCategory. This is the common use case for cl::getRegisteredOptions, which should be deprecated in the future because it exposes implementation details of command line parsing.
David Blaikie [Wed, 21 Jan 2015 23:08:17 +0000 (23:08 +0000)]
DebugInfo: Remove forced column-info workaround for inlined calls
This workaround was to provide unique call sites to ensure LLVM's inline
debug info handling would properly unique two calls to the same function
on the same line. Instead, this has now been fixed in LLVM (r226736) and
the workaround here can be removed.
Originally committed in r176895, but this isn't a straight revert due to
all the changes since then. I just searched for anything ForcedColumn*
related and removed them.
We could test this - but it didn't strike me as terribly valuable once
we're no longer adding this workaround everything just works as expected
& it's no longer a special case to test for.
David Blaikie [Wed, 21 Jan 2015 22:57:22 +0000 (22:57 +0000)]
DebugInfo: Remove distinct-call-inlining test case as this is being fixed in LLVM.
This test will start failing shortly once this bug is fixed in LLVM. At
that point this behavior is no longer required in Clang and will be
removed. In the interim, remove this test just to avoid the race between
the LLVM and Clang commits.
After the LLVM commit, I'll cleanup the workaround behavior in Clang.
Reid Kleckner [Wed, 21 Jan 2015 22:18:17 +0000 (22:18 +0000)]
Add the "thunk" attribute to MS ABI virtual member pointers
This attribute implies indicates that the function musttail calls
another function and returns whatever it returns. The return type of the
thunk is meaningless, as the thunk can dynamically call different
functions with different return types. So long as the callers bitcast
the thunk with the correct type, behavior is well defined.
This attribute was necessary to fix PR20944, where the indirect call
combiner noticed that the thunk returned void and replaced the results
of the indirect call instruction with undef.
The improved completion in call context now works with:
- Functions.
- Member functions.
- Constructors.
- New expressions.
- Function call expressions.
- Template variants of the previous.
There are still rough edges to be fixed:
- Provide support for optional parameters. (fix known)
- Provide support for member initializers. (fix known)
- Provide support for variadic template functions. (fix unknown)
- Others?
David Majnemer [Wed, 21 Jan 2015 10:54:38 +0000 (10:54 +0000)]
AST: Don't ignore alignas on EnumDecls when calculating alignment
We didn't consider any alignment attributes on an EnumDecl when
calculating alignment.
While we are here, ignore alignment specifications on typedef types if
one is used as the underlying type. Otherwise, weird things happen:
enum Y : int;
Y y;
typedef int __attribute__((aligned(64))) u;
enum Y : u {};
What is the alignment of 'Y'? It would be more consistent with the
overall design of enums with fixed underlying types to consider the
underlying type's UnqualifiedDesugaredType.
Kaelyn Takata [Wed, 21 Jan 2015 00:04:19 +0000 (00:04 +0000)]
Correct all typos in the initialization arguments, even if one could not
be corrected.
This fixes PR22250, which exposed the bug where if there's more than one
TypoExpr in the arguments, once one failed to be corrected none of the
TypoExprs after it would be handled at all thanks to an early return.
Kaelyn Takata [Tue, 20 Jan 2015 20:15:29 +0000 (20:15 +0000)]
Add the test that was supposed to be included with r223162.
The test case is based on the reduction from PR21679 and has to be
freestanding to work correctly, since some of the expected errors (and
some of the problems that were fixed) only occur when the end of the
file is reached.
Re-apply "r226548 - Introduce SPIR calling conventions" reverted in r226558.
The test was fixed after a discussion with the revision author: the check
pattern was made more flexible as the "%call" part is not what we actually want
to check strictly there.
The original patch description:
===
Introduce SPIR calling conventions.
This implements Section 3.7 from the SPIR 1.2 spec:
SPIR kernels should use "spir_kernel" calling convention.
Non-kernel functions use "spir_func" calling convention. All
other calling conventions are disallowed.
The patch works only for OpenCL source. Any other uses will need
to ensure that kernels are assigned the spir_kernel calling
convention correctly.
===
Alexey Bataev [Tue, 20 Jan 2015 07:03:46 +0000 (07:03 +0000)]
[OPENMP] Fixed DSA processing for predetermined shared variables.
This patch allows to use predetermined shared variables in private clauses in
parallel or tasks regions.
This implements Section 3.7 from the SPIR 1.2 spec:
SPIR kernels should use "spir_kernel" calling convention.
Non-kernel functions use "spir_func" calling convention. All
other calling conventions are disallowed.
The patch works only for OpenCL source. Any other uses will need
to ensure that kernels are assigned the spir_kernel calling
convention correctly.
Manuel Klimek [Mon, 19 Jan 2015 10:48:04 +0000 (10:48 +0000)]
Make clang-format work in emacs buffers with unicode characters.
Emacs functions by default use character positions; convert characters
to offsets when handing parameters to clang-format and convert byte
offsets we get from clang-format back to character positions.
Reworked the code a bit so the 0-based to 1-based offset calculations
are done in the same place where we do the multi-byte to offset mapping.
Craig Topper [Mon, 19 Jan 2015 06:08:02 +0000 (06:08 +0000)]
[X86] Change AVX512 intrinsics to take a 8-bit immediate for the comparision kind instead of a 32-bit immediate. This matches an equivalent change in llvm.
Alexey Bataev [Mon, 19 Jan 2015 05:20:46 +0000 (05:20 +0000)]
[OPENMP] Disable copyprivate an nowait clauses in 'single' directive.
The copyprivate clause must not be used with the nowait clause in single
directive.
Serge Pavlov [Sun, 18 Jan 2015 19:05:48 +0000 (19:05 +0000)]
Update error message text.
Previously if an enumeration was used in a nested name specifier in pre-C++11
language dialect, error message was 'XXX is not a class, namespace, or scoped
enumeration'. This patch removes the word 'scoped' as in C++11 any enumeration
may be used in this context.
David Blaikie [Sun, 18 Jan 2015 00:14:21 +0000 (00:14 +0000)]
Recommit r225083 (reverted in r225361) now that calls to aggregate initializers from in class non-static data members are explicitly attributed to the desired line.
The code setting the debug location being removed here was accidentally
leaking a location into the call to the non-static data member's ctor
call. Without it the call had no location and could cause assertion
failures if it was inlined. Now that it has a location (and a correct
one at that) this code should hopefully be no longer needed.
It's possible of course that other parts of the debug info are also
relying on the debug locations being set here to leak to where they're
needed - so we might see the same assertions again & will have to
investigate what the dependence was/is. But the chances are good that
any of those are debug info line table quality bugs we've just not found
yet anyway - so it'll be good to flush them out.
David Blaikie [Sun, 18 Jan 2015 00:12:58 +0000 (00:12 +0000)]
DebugInfo: Correct the debug location of non-static data member initializers
This was causing some trouble for otherwise dead code removed in r225085
(reverted in r225361). The location being set for function arguments was
leaking out to the call which wasn't setting its own location (so a
quality bug turned into a crasher with r225085). Fix this so r225085 can
be recommitted.
Chandler Carruth [Sat, 17 Jan 2015 14:20:14 +0000 (14:20 +0000)]
[msan] Fix a uninitialized-use bug in the template argument diffing
logic.
In one place we would try to check for the difference between integers
even if we were missing one of the integers. This would eventually end
up reading uninitialized data out of the APSInt objects. The fix is to
short circuit the sameness test when we don't have integers on both
sides.
This fixes a test failure I was seeing with MSan. Not sure whether other
bots were seeing it or not, but yay MSan. In particular the feature to
very carefully track origins back through stores throughout the program
was invaluable.
Nico Weber [Sat, 17 Jan 2015 02:33:17 +0000 (02:33 +0000)]
If a function decl cannot be merged, mark it as invalid.
Clang currently crashes on
class C {
C() = default;
C() = delete;
};
My cunning plan for fixing this was to change the `if (!FnD)` in
Parser::ParseCXXInlineMethodDef() to `if (!FnD || FnD->isInvalidDecl)` – but
alas, the second constructor decl wasn't marked as invalid. This lets
Sema::MergeFunctionDecl() return true on function redeclarations, which leads
to them being marked invalid.
This also improves error messages when functions are redeclared.