The __yield intrinsic generates a hint instruction to indicate that the thread
is not performing any useful operations at the moment. This is for
compatibility with MSVC, although, the intrinsic is also part of the ACLE, and
is enabled globally as a result.
Benjamin Kramer [Fri, 25 Apr 2014 20:41:38 +0000 (20:41 +0000)]
Print detailed vector type information on diagnostics.
We never aka vector types because our attributed syntax for it is less
comprehensible than the typedefs. This leaves the user in the dark when
the typedef isn't named that well.
Example:
v2s v; v4f w;
w = v;
The naming in this cases isn't even that bad, but the error we give is
useless without looking up the actual typedefs.
t.c:6:5: error: assigning to 'v4f' from incompatible type 'v2s'
Now:
t.c:6:5: error: assigning to 'v4f' (vector of 4 'float' values) from
incompatible type 'v2s' (vector of 2 'int' values)
We do this for all diagnostics that print a vector type.
David Majnemer [Fri, 25 Apr 2014 17:08:41 +0000 (17:08 +0000)]
CodeGen: Cleanup variable linkage calculation
Almost all linkage calculation for VarDecls occured inside of
GetLLVMLinkageVarDefinition except for static data members. Centralize
the logic so that it can be more readily reused.
David Majnemer [Fri, 25 Apr 2014 17:07:16 +0000 (17:07 +0000)]
CodeGen: Refactor linkage/visibility calculation
It turns out that linkage and visibility have rather similar logic for
both functions and non-variable globals. Split the calculation out so
that both sides may share this code.
CodeGen: Avoid instrumenting implicit Decls more effectively
We don't assign counters for implicit Decls, but we were emitting code
to increment the (non-existent) counters and adding empty counter
lists in the output. This fixes the checks in assignRegionCounters and
emitInstrumentationData to do the right thing, and adds an assert for
the pathological case of emitting zero counters.
Expose the enum CX_CXXAccessSpecifier in the python bindings as a property of
the cursor. If access specifier is not applicable to the node, return the
INVALID specifier rather than raising an exception.
Richard Smith [Thu, 24 Apr 2014 22:45:46 +0000 (22:45 +0000)]
If we see an explicit instantiation declaration or definition of a function
after we've already instantiated a definition for the function, pass it to the
ASTConsumer again so that it knows the specialization kind has changed and can
update the function's linkage.
This only matters if we instantiate the definition of the function before we
reach the end of the TU; this can happen in at least three different ways:
C++11 constexpr functions, C++14 deduced return types, and functions
instantiated within modules.
Daniel Sanders [Thu, 24 Apr 2014 16:05:26 +0000 (16:05 +0000)]
[mips] Support 128-bit int in N32 ABI by overriding TargetInfo::hasInt128Type()
Summary: The condition in the base class is rather strange. It says a target has the 128-bit integer type if the size of a pointer is >= 64-bits. N32 has 32-bit pointers but 64-bit integers. I'm a bit reluctant to change this for all targets so this patch makes the method virtual and overrides it for MIPS64.
Daniel Sanders [Thu, 24 Apr 2014 09:58:52 +0000 (09:58 +0000)]
[mips] Correct size_t and ptrdiff_t for N32.
Summary:
Correct size_t to be unsigned int and ptrdiff_t to be signed long. The types were the correct size before this change but
the exact type matters for name mangling and exception handling in C++.
A CursorPlatformAvailability can have several "unavailable" attributes, don't
leak all but the first. I'm not sure if there can be several "deprecate"ds too,
but add the same logic there to keep the two code paths looking the same.
The result of getBufferForFile() must be freed.
(Should we change functions that expect the caller to assume ownership so
that they return unique_ptrs instead? Then the type system makes sure we get
this right.)
Richard Smith [Thu, 24 Apr 2014 02:25:27 +0000 (02:25 +0000)]
When two templates get merged together, also merge their pattern declarations
together. This is extremely hairy, because in general we need to have loaded
both the template and the pattern before we can determine whether either should
be merged, so we temporarily violate the rule that all merging happens before
reading a decl ends, but *only* in the case where a template's pattern is being
loaded while loading the template itself.
In order to accomodate this for class templates, delay loading the injected
class name type for the pattern of the template until after we've loaded the
template itself, if we happen to load the template first.
LSan folks: LSan pointed to
#0 0x4953e0 in operator new[](unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:64
#1 0x7fb82af5372f in clang::RewriteRope::MakeRopeString(char const*, char const*) llvm/tools/clang/lib/Rewrite/Core/RewriteRope.cpp:796
instead of to the actual leak, which made tracking this down slower than
it could have been.
Ben Langmuir [Wed, 23 Apr 2014 21:10:46 +0000 (21:10 +0000)]
Do not print inferred submodules explicitly in __inferred_module.map
Otherwise including a header in your source file that is not included by
framework's umbrella header will silently add an empty submodule with that
name.
is automatically translated to
@import Foo.NotInModule;
which then would have succeeded because the inferred module map
contained an empty submodule called NotInModule.
Objective-C [IRGen]. Fixes a crash in IRGen involving use of
'typeof' to extract type of an @encode expression used
in an initializer. // rdar://16655340
Diego Novillo [Wed, 23 Apr 2014 15:21:07 +0000 (15:21 +0000)]
Add documentation for sample profiling support.
Summary:
This documents the usage of sample profilers with Clang and the
profile format expected by LLVM's optimizers. It also documents the
profile conversion tool used by Linux Perf.
James Molloy [Wed, 23 Apr 2014 10:26:23 +0000 (10:26 +0000)]
[ARM64] Enable more CodeGen tests for ARM64. The crypto and neon intrinsics tests needed changing slightly due to the naming differences between AArch64 and ARM64.
CodeGen: Unify handling guard variables in the Itanium C++ ABI
We previously treated ARM separately from the generic Itanium ABI for
initializing guard variables. This code duplication led to things like
the ARM path missing the memory barrier for threadsafe handling, and a
highly misleading comment about how we were (mis)using the generic ABI
for ARM64 when really it went through the ARM codepath.
This unifies the two code paths. Functionally, this changes the ARM
and ARM64 codepath to use one byte loads instead of 4 and 8,
respectively, and adds the missing atomic acquire to these loads.
Other architectures are unchanged.
Users are expected to pass system includes through the INCLUDE
environment variable on Windows. There's no reason to change behavior
based on the toolchain used to build Clang.
I didn't change the registry searching code because I'm not sure it
builds with mingw and I'm not set up to test it.
Richard Smith [Tue, 22 Apr 2014 23:50:25 +0000 (23:50 +0000)]
Add some missing checks for C++1y digit separators that don't in fact separate
digits. Turns out we have completely separate lexing codepaths for floating
point numbers depending on whether or not they start with a zero. Who knew...
=)
Objective-C ARC. Under ARC, addition of 'bridge' attribute
on CF type is not sufficient and bridge casting is
still required for proper ownership semantics.
// rdar://16650445
Ben Langmuir [Tue, 22 Apr 2014 17:40:12 +0000 (17:40 +0000)]
Attempt to fix null ASTContext in ASTUnit error path
We don't need the ASTContext for the diagnostics, only the language
options, which we can get from the compiler invocation. It worries me
how many categorically different states the ASTUnit class can be in
depending on how it is being constructed/used.
Try to fix warnings to escape '@' as '\@'. [-Wdocumentation-html]
clang/include/clang/Format/Format.h:185:8: error: HTML tag 'tt' requires an end tag [-Werror,-Wdocumentation-html]
/// <tt>@property (readonly)</tt> instead of <tt>@property(readonly)</tt>.
~^~~