Marina Yatsina [Tue, 29 Dec 2015 08:49:34 +0000 (08:49 +0000)]
[ms inline asm] Add support for label names with '$' chars
In MS inline asm syntax a label with '$' char produces an error, while in AT&T it does not.
In AT&T inline asm syntax Clang escapes the '$' char and replaces it with "$$". Adopted same approach for MS syntax.
James Y Knight [Tue, 29 Dec 2015 04:46:43 +0000 (04:46 +0000)]
Revert "[TrailingObjects] Use a different technique to determine if a getDecl"
This reverts commit r256534.
Failed to build on MSVC with error:
clang/ASTMatchers/ASTMatchersInternal.h(572): error C2228: left of '.getDecl' must have class/struct/union
type is 'add_rvalue_reference<_Ty>::type'
Richard Smith [Tue, 29 Dec 2015 01:02:53 +0000 (01:02 +0000)]
Revert r93378, which is incorrect but currently unobservable (because the
underlying declaration of a NamedDecl happens to always have the same name
and identifier namespace as the decl itself today).
Eric Christopher [Mon, 28 Dec 2015 19:58:44 +0000 (19:58 +0000)]
We check for dwarf 5 in the backend, so go ahead and pass it along via
the front end as well.
Note that DWARF5 isn't finalized and any feature support is subject to
change and accepting of the option doesn't mean we're supporting the
full range of the current standard.
Serge Pavlov [Mon, 28 Dec 2015 19:40:14 +0000 (19:40 +0000)]
Do not crash if class is defined in wrong scope.
This patch fixes PR16677. The latter represents the case when due to
misprinted character class definition occurs in the scope of template
arguments. Base class of this class depends on the template parameter in the
same scope and cannot be resolved, it causes crash. Right behavior is to
make semantic processing even if the definition is wrong, as the code
that emits appropriate message is called after the processing.
Serge Pavlov [Mon, 28 Dec 2015 17:19:12 +0000 (17:19 +0000)]
Avoid crash when dumping LocInfoType.
LocInfoType is a helper type used internally inside Sema and Parser, it
does not exist in valid AST. LocInfoType uses code value outside the
range of valid Type codes, as a result, dumping such type causes error.
The fix allows correct dumping LocInfoType.
[X86] Better support for the MCU psABI (clang part)
This adds support for the MCU psABI in a way different from r251223 and r251224,
basically reverting most of these two patches. The problem with the approach
taken in r251223/4 is that it only handled libcalls that originated from the backend.
However, the mid-end also inserts quite a few libcalls and assumes these use the
platform's default calling convention.
The previous patch tried to insert inregs when necessary both in the FE and,
somewhat hackily, in the CG. Instead, we now define a new default calling convention
for the MCU, which doesn't use inreg marking at all, similarly to what x86-64 does.
Alexey Bataev [Mon, 28 Dec 2015 07:25:51 +0000 (07:25 +0000)]
[OPENMP 4.5] Sema/parsing support for extended format of 'schedule' clause.
OpenMP 4.0-3.1 supports the next format of ‘schedule’ clause: schedule(kind[, chunk_size])
Where kind can be one of ‘static’, ‘dynamic’, ‘guided’, ‘auto’ or ‘runtime’.
OpenMP 4.5 defines the format: schedule([modifier [, modifier]:]kind[, chunk_size])
Modifier can be one of ‘monotonic’, ‘nonmonotonic’ or ‘simd’.
Alexey Bataev [Mon, 28 Dec 2015 06:23:08 +0000 (06:23 +0000)]
[OPENMP 4.5] Do not allow 'linear' clause along with 'ordered(expr)' clause.
According to OpenMP 4.5 "A linear clause or an ordered clause with a parameter can be specified on a loop directive but not both.""
Dimitry Andric [Sun, 27 Dec 2015 10:01:44 +0000 (10:01 +0000)]
Fix C++ support on recent DragonFly BSD releases
Summary:
[ Copied from https://llvm.org/bugs/show_bug.cgi?id=25597 ]
Clang support for DragonFly BSD is lagging a bit, resulting in poor
support for c++.
DragonFlyBSD is unique in that it has two base compilers. At the time
of the last Clang update for DragonFly, these compilers were GCC 4.4 and
GCC 4.7 (default).
With DragonFly Release 4.2, GCC 4.4 was replaced with GCC 5.0, partially
because the C++11 support of GCC 4.7 was incomplete. The DragonFly
project will Release version 4.4 soon.
This patch updates the Clang driver to use libstdc++ from GCC 5.2 The
support for falling back to the alternate compiler was removed for two
reasons:
1) The last release to use GCC 4.7 is DF 4.0 which has already reached EOL
2) GCC 4.7 libstdc++ is insufficient for many "ports"
Therefore, I think it is reasonable that the development version of
clang expects GCC 5.2 to be in place and not try to fall back to another
compiler.
The attached patch will do this. The Tools.cpp file was signficantly
modified to fix the linking which had been changed somewhere along the
line. The rest of the changes should be self-explanatory.
Alexey Bataev [Fri, 25 Dec 2015 13:38:08 +0000 (13:38 +0000)]
[OPENMP] Do not allow to use threadprivate or thread local variables as loop iteration variables.
According to OpenMP the loop iteration variable may not appear in a threadprivate directive.
James Y Knight [Thu, 24 Dec 2015 02:59:37 +0000 (02:59 +0000)]
[TrailingObjects] Convert ASTTemplateKWAndArgsInfo and ASTTemplateArgumentListInfo.
Doing so required separating them so that the former doesn't inherit
from the latter anymore. Investigating that, it became clear that the
inheritance wasn't actually providing real value in any case.
So also:
- Remove a bunch of redundant functions (getExplicitTemplateArgs,
getOptionalExplicitTemplateArgs) on various Expr subclasses which
depended on the inheritance relationship.
- Switched external callers to use pre-existing accessors that return the
data they're actually interested in (getTemplateArgs,
getNumTemplateArgs, etc).
- Switched internal callers to use pre-existing getTemplateKWAndArgsInfo.
Alexey Bataev [Wed, 23 Dec 2015 10:27:45 +0000 (10:27 +0000)]
[OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.
OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause.
Nico Weber [Tue, 22 Dec 2015 22:42:56 +0000 (22:42 +0000)]
Disable include sorting by default for Chromium style.
Include sorting generally can break .cc files, especially on Windows. Make
this opt-in for Chromium style to give us some more time to roll this out.
(Given that the Google style guide is used by many companies, some of them
probably writing code on Windows, one could argue this should be opt-in in
general...)
Daniel Jasper [Tue, 22 Dec 2015 15:48:15 +0000 (15:48 +0000)]
clang-format: [JS] Conservatively introduce column layout for JS array
initializers. For now, only use it for 20 items or more. Otherwise,
clang-format formats these one-per-line and thus increases the vertical
code size a lot.
Alexey Bataev [Tue, 22 Dec 2015 12:21:47 +0000 (12:21 +0000)]
[OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.
OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause.
David Majnemer [Mon, 21 Dec 2015 22:09:34 +0000 (22:09 +0000)]
[clang-cl] Add support for /Brepro
The /Brepro flag controls whether or not the compiler should embed
timestamps into the object file. Object files which do not embed
timestamps are not suitable for incremental linking but are suitable for
hermetic build systems and staged self-hosts of clang.
A normal clang spelling of this flag has been added,
-mincremental-linker-compatible.
Vedant Kumar [Mon, 21 Dec 2015 20:21:15 +0000 (20:21 +0000)]
Reapply "[CodeGen] Fix assignments of inline layouts into the byref structure"
When using blocks, a byref structure is created to represent the
closure. The "byref.layout" field of this structure is an i8*. However,
some 'inline' layouts are represented as i64's, not i8*'s.
Prior to r246985 we cast the i64 'inline' layout to an i8* before
assigning it into the byref structure. This patch brings the cast back
and adds a regression test.
The original version of this patch was too invasive. This version only adds the
cast to BuildByrefLayout.
Vedant Kumar [Mon, 21 Dec 2015 19:30:37 +0000 (19:30 +0000)]
[CodeGen] Fix assignments of inline layouts into the byref structure
When using blocks, a byref structure is created to represent the
closure. The "byref.layout" field of this structure is an i8*. However,
some 'inline' layouts are represented as i64's, not i8*'s.
Prior to r246985 we cast the i64 'inline' layout to an i8* before
assigning it into the byref structure. This patch brings the cast back
and adds a regression test.
Daniel Jasper [Mon, 21 Dec 2015 12:14:17 +0000 (12:14 +0000)]
clang-format: Extend detection of the "main" #include to use the filename
Before, the first (non-system) header in a file was considered to be
the main include. This is conservative as it makes clang-format change
the #include order less often. Instead implement some basic usage of
the filename itself. With this patch, clang-format considers every
header to be a main include if the header file's basename is a prefix
to the filename the #include is in.
Paul Robinson [Sat, 19 Dec 2015 19:41:48 +0000 (19:41 +0000)]
Driver part of debugger tuning.
Adds driver options named -glldb and -gsce to mean -g plus tuning for
lldb and SCE debuggers respectively; the existing -ggdb option does
the same for gdb. Existing options -ggdb0, -ggdb1 etc. unpack into
-ggdb -g<N>. (There will not be -glldb<N> or -gsce<N> options.) The
tuning gets a target-specific default in the driver, and is passed
into cc1 with the new -debugger-tuning option.
As fallout, fixes where '-gsplit-dwarf -g0' would ignore the -g0 part
on Linux.
After configuration the following additional targets will be generated:
stage2-instrumented:
Builds a stage1 x86 compiler, runtime, and required tools (llvm-config, llvm-profdata) then uses that compiler to build an instrumented stage2 compiler.
stage2-instrumented-generate-profdata:
Depends on "stage2-instrumented" and will use the instrumented compiler to generate profdata based on the training files in <clang>/utils/perf-training
stage2:
Depends on "stage2-instrumented-generate-profdata" and will use the stage1 compiler with the stage2 profdata to build a PGO-optimized compiler.
stage2-check-llvm:
Depends on stage2 and runs check-llvm using the stage3 compiler.
stage2-check-clang:
Depends on stage2 and runs check-clang using the stage3 compiler.
stage2-check-all:
Depends on stage2 and runs check-all using the stage3 compiler.
stage2-test-suite:
Depends on stage2 and runs the test-suite using the stage3 compiler (requires in-tree test-suite).
Richard Smith [Fri, 18 Dec 2015 22:40:25 +0000 (22:40 +0000)]
Split RequireCompleteType into a function that actually requires that the type
is complete (with an error produced if not) and a function that merely queries
whether the type is complete. Either way we'll trigger instantiation if
necessary, but only the former will diagnose and recover from missing module
imports.
The intent of this change is to prevent a class of bugs where code would call
RequireCompleteType(..., 0) and then ignore the result. With modules, we must
check the return value and use it to determine whether the definition of the
type is visible.
This also fixes a debug info quality issue: calls to isCompleteType do not
trigger the emission of debug information for a type in limited-debug-info
mode. This allows us to avoid emitting debug information for type definitions
in more cases where we believe it is safe to do so.
Richard Smith [Fri, 18 Dec 2015 22:19:11 +0000 (22:19 +0000)]
[modules] Don't try to use the definition of a class if
RequireCompleteType(..., 0) says we're not permitted to do so. The definition
might not be visible, even though we know what it is.