Now that Sparc/Sparc64 backend is mostly usable, provide the same
linking defaults as other NetBSD targets, i.e. compiler_rt-in-libc and
libc++ as STL.
Devin Coughlin [Thu, 11 Feb 2016 22:13:20 +0000 (22:13 +0000)]
[analyzer] Improve pattern matching in ObjCDealloc checker.
Look through PseudoObjectExpr and OpaqueValueExprs when scanning for
release-like operations. This commit also adds additional tests in anticipation
of re-writing this as a path-sensitive checker.
Tim Northover [Thu, 11 Feb 2016 21:31:51 +0000 (21:31 +0000)]
Relax recently added clang version checks.
You can override the value of these during CMake, and we often use sentinels
with more than one digit (not to mention our actual Clang being 700.whatever).
Manman Ren [Thu, 11 Feb 2016 19:19:18 +0000 (19:19 +0000)]
[PR26550] Use a different TBAA root for C++ vs C.
This commit changes the root from "Simple C/C++ TBAA" to "Simple C++ TBAA" for
C++.
The problem is that the type name in the TBAA nodes is generated differently
for C vs C++. If we link an IR file for C with an IR file for C++, since they
have the same root and the type names are different, accesses to the two type
nodes will be considered no-alias, even though the two type nodes are from
the same type in a header file.
The fix is to use different roots for C and C++. Types from C will be treated
conservatively in respect to types from C++.
Follow-up commits will change the C root to "Simple C TBAA" plus some mangling
change for C types to make it a little more aggresive.
Ben Langmuir [Thu, 11 Feb 2016 18:54:02 +0000 (18:54 +0000)]
[Modules] Early-exit if ReadOptionsBlock fails to avoid crashing
If we didn't tell ReadOptionsBlock to allow failures then we can't
assume that the stream is not in the middle of a block if it returns
out-of-date. This was causing a crash when we tried to continue reading.
Also, it's just generally a good idea to early-exit if we're doing
implicit module builds, since we will want to immediately rebuild this
module anyway and there's no reason to waste time continuing after
failure.
David Majnemer [Thu, 11 Feb 2016 17:49:28 +0000 (17:49 +0000)]
Revert "Revert r260388 "[MS ABI] Never reference dllimport'd vtables""
This reverts commit r260449.
We would supress our emission of vftable definitions if we thought
another translation unit would provide the definition because we saw an
explicit instantiation declaration. This is not the case with
dllimport, we want to synthesize a definition of the vftable regardless.
Ben Langmuir [Thu, 11 Feb 2016 17:04:42 +0000 (17:04 +0000)]
[Modules] Don't infinite recurse on implicit import of circular modules in preamble
Update the Preprocessor's VisibleModuleSet when typo-correction creates
an implicit module import so that we won't accidentally write an invalid
SourceLocation into the preamble AST. This would later lead to infinite
recursion when loading the preamble AST because we use the value in
ImportLocs to prevent visiting a module twice.
James Y Knight [Thu, 11 Feb 2016 16:51:29 +0000 (16:51 +0000)]
Use new --match-full-lines FileCheck feature for Preprocessor/init.c.
This required fixing a few check lines which had omitted trailing
characters, and were passing incorrectly (e.g., asserting that
__UINT64_C_SUFFIX__ is "UL" instead of the "ULL" that it actually is set
to). All were obviously broken tests, not broken code.
Oliver Stannard [Thu, 11 Feb 2016 16:05:52 +0000 (16:05 +0000)]
[ARM] Add command-line options for ARMv8.2-A
This allows ARMv8.2-A to be targeted either by using "armv8.2a" in the
triple, or by using -march=armv8.2-a (or the alias -march=armv8.2a).
The FP16 extension can be enabled with the "+fp16" suffix to the -march
or -mcpu option. This is consistent with the AArch64 option, rather than
the usual ARM option of -mfpu. We have agreed with the team which will
be upstreaming this to GCC that we want to use this new option format
for new architecture extensions for both ARM and AArch64.
Most of the work for this was done by the TargetParser patch in llvm.
Andrey Bokhanko [Thu, 11 Feb 2016 13:27:02 +0000 (13:27 +0000)]
Partial revert of rL260506.
After some experiments I discovered that clang doesn't support static
initialization of flexible array members in full, so restored this paragraph in
"GCC extensions not implemented yet" list.
Andrey Bokhanko [Thu, 11 Feb 2016 10:36:06 +0000 (10:36 +0000)]
Update of "GCC extensions not implemented yet" in Clang User's Manual
#pragma weak, global register variables and static initialization of flexible
array members are supported now, so they are removed from "GCC extensions not
implemented yet" list.
Akira Hatanaka [Thu, 11 Feb 2016 06:36:35 +0000 (06:36 +0000)]
[Objective-c] Stop attaching section "datacoal_nt" to global variables.
The current macho linker just copies symbols in section datacoal_nt to
section data, so it doesn't really matter whether or not section
"datacoal_nt" is attached to the global variable.
This is a follow-up to r250370, which made changes in llvm to stop
putting functions and data in the *coal* sections.
Alexey Bataev [Thu, 11 Feb 2016 05:35:55 +0000 (05:35 +0000)]
[OPENMP] Rename OMPCapturedFieldDecl to OMPCapturedExprDecl, NFC.
OMPCapturedExprDecl allows caopturing not only of fielddecls, but also
other expressions. It also allows to simplify codegen for several
clauses.
Justin Lebar [Wed, 10 Feb 2016 22:17:00 +0000 (22:17 +0000)]
Bail on compilation as soon as a job fails.
Previously we attempted to be smart; if one job failed, we'd run all
jobs that didn't depend on the failing job.
Problem is, this doesn't work well for e.g. CUDA compilation without
-save-temps. In this case, the device-side and host-side Assemble
actions (which actually are responsible for preprocess, compile,
backend, and assemble, since we're not saving temps) are necessarily
distinct. So our clever heuristic doesn't help us, and we repeat every
error message once for host and once for each device arch.
The main effect of this change, other than fixing CUDA, is that if you
pass multiple cc files to one instance of clang and you get a compile
error, we'll stop when the first cc1 job fails.
Reid Kleckner [Wed, 10 Feb 2016 21:28:38 +0000 (21:28 +0000)]
[clang-cl] /Z7 now generates normal debug info, not just line info
Previously LLVM could not process any debug info we produced, so it
didn't make sense to spend time generating it. Now that it has primitive
support for local variable info, it does make sense to generate normal
debug info.
David Majnemer [Wed, 10 Feb 2016 17:40:47 +0000 (17:40 +0000)]
[MS ABI] Never reference dllimport'd vtables
Referencing a dllimported vtable is impossible in a constexpr
constructor. It would be friendlier to C++ programmers if we
synthesized a copy of the vftable which referenced imported virtual
functions. This would let us initialize the object in a way which
preserves both the intent to import functionality from another DLL while
also making constexpr work.
Daniel Jasper [Wed, 10 Feb 2016 12:42:58 +0000 (12:42 +0000)]
clang-format sort include use the source file name to determine the
"main include" that will be the 1st include (category 0).
Because the clang-format visual studio extension does not pass the file
name and use the standard input, sort include cannot find a "main
include":
Testing fix on llvm\tools\clang\lib\Format\Format.cpp:
Original file:
#include "clang/Format/Format.h"
...
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
Without fix, selecting the includes and running visual studio
clang-format:
...
#include "clang/Basic/SourceManager.h"
#include "clang/Format/Format.h"
#include "clang/Lex/Lexer.h"
With fix, selecting the includes and running visual studio clang-format:
#include "clang/Format/Format.h"
...
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
Test 2 with main header not at the start:
Original file:
...
#include "clang/Format/Format.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
Without fix, selecting the includes and running visual studio
clang-format:
...
#include "clang/Basic/SourceManager.h"
#include "clang/Format/Format.h"
#include "clang/Lex/Lexer.h"
With fix, selecting the includes and running visual studio clang-format:
#include "clang/Format/Format.h"
...
#include "clang/Basic/SourceManager.h"
#include "clang/Lex/Lexer.h"
Patch by Jean-Philippe Dufraigne, thank you.
Review: http://reviews.llvm.org/D16524
Alexey Bataev [Wed, 10 Feb 2016 11:29:16 +0000 (11:29 +0000)]
[OPENMP 4.5] Initial support for data members in 'firstprivate' clause.
OpenMP 4.5 allows privatization of non-static data members of current
class in non-static member functions.
Akira Hatanaka [Wed, 10 Feb 2016 06:06:06 +0000 (06:06 +0000)]
[Sema] Issue a warning for integer overflow in nested struct initializer
r257357 fixed clang to warn on integer overflow in struct initializers.
However, it didn't warn when a struct had a nested initializer. This
commit makes changes in Sema::CheckForIntOverflow to handle nested
initializers.
For example:
struct s {
struct t {
unsigned x;
} t;
} s = {
{
.x = 4 * 1024 * 1024 * 1024
}
};
Chris Bieneman [Wed, 10 Feb 2016 01:09:59 +0000 (01:09 +0000)]
[CMake] Pass LLVM_EXTERNAL_*_SOURCE_DIR variables to subsequent stages
For multi-stage builds we need to pass any overridden source directory variables. Without passing these the subsequent stages won't find the project sources.
Chris Bieneman [Wed, 10 Feb 2016 01:09:56 +0000 (01:09 +0000)]
[CMake] Fixing the 3-stage cmake cache.
I had hoped this would work from a single cache file, but turns out there is a bug I can't quite figure out relating to passing list arguments to recursive CMake invocations.
This patch adds doxygen comments for all the intrinsincs in the header file f16cintrin.h. The doxygen comments are automatically generated based on Sony's intrinsics document.
Richard Smith [Tue, 9 Feb 2016 22:48:14 +0000 (22:48 +0000)]
Update documentation to reflect that libc++abi provides __cxa_thread_atexit (and has for quite a while). Also document that we have not yet implemented the new inheriting constructor rules.
Reid Kleckner [Tue, 9 Feb 2016 19:53:30 +0000 (19:53 +0000)]
Pass /bigobj when building lib/ASTMatchers/Dynamic/Registry.cpp
This is the third time it has crossed the 2^16 section limit. We've
already spent time optimizing this file to reduce template
instantiations, and it's not clear that there is anymore low hanging
fruit.
Ehsan Akhgari [Tue, 9 Feb 2016 19:43:11 +0000 (19:43 +0000)]
clang-cl: Support loading plugins on Windows
This builds on the support being added to LLVM to import and export
registries from DLLs. This will allow us to pick up the registry
entries added in the DLL's copy of FrontendPluginRegistry.
This will allow us to use plugins on Windows using:
$ clang-cl -Xclang -load -Xclang plugin.dll \
-Xclang -add-plugin -Xclang foo
David Blaikie [Tue, 9 Feb 2016 18:52:09 +0000 (18:52 +0000)]
Simplify EnterTokenStream API to make it more robust for memory management
While this won't help fix things like the bug that r260219 addressed, it
seems like good tidy up to have anyway.
(it might be nice if "makeArrayRef" always produced a MutableArrayRef &
let it decay to an ArrayRef when needed - then I'd use that for the
MutableArrayRefs in this patch)
If we had std::dynarray I'd use that instead of unique_ptr+size_t,
ideally (but then it'd have to be threaded down through the Preprocessor
all the way - no idea how painful that would be)
Alexey Bataev [Tue, 9 Feb 2016 08:51:26 +0000 (08:51 +0000)]
Fixed preprocessed output of the first token for pragmas.
Clang did not expanded macros in the very first token of the pragmas
during preprocessed output
Richard Smith [Tue, 9 Feb 2016 01:05:04 +0000 (01:05 +0000)]
Fix undefined behavior when compiling in C++14 due to sized operator delete
being called with the wrong size: convert CGFunctionInfo to use TrailingObjects
and ask TrailingObjects to provide a working 'operator delete' for us.
This patch adds doxygen comments for all the intrinsincs in the header file pmmintrin.h. The doxygen comments are automatically generated based on Sony's intrinsics document.
Nico Weber [Mon, 8 Feb 2016 22:23:09 +0000 (22:23 +0000)]
Make ParentMap work with explicit specializations of function templates.
For an explicit specialization, we first build a FunctionDecl, and then
we call SubstDecl() on it to build a second FunctionDecl, which has the
first FunctionDecl as canonical decl.
The address of an explicit specialization of function template used to be the
canonical decl of the FunctionDecl. This is different from all the other
DeduceTemplateArguments() calls in SemaOverload, and since the canonical decl
isn't visited by ParentMap while the redecl is, it also made ParentMap assert
when computing the parent of a address-of-explicit-specialization-fun-template.
To fix, remove the getCanonicalDecl() call. No behavior difference for clang,
but it fixes an assert in ParentMap (which is e.g. used by libTooling).
Vedant Kumar [Mon, 8 Feb 2016 19:25:45 +0000 (19:25 +0000)]
[Coverage] Fix crash when handling certain macro expansions
When handling 'if' statements, we crash if the condition and the consequent
branch are spanned by a single macro expansion.
The crash occurs because of a sanity 'reset' in popRegions(): if an expansion
exactly spans an entire region, we set MostRecentLocation to the start of the
expansion (its 'include location'). This ensures we don't handleFileExit()
ourselves out of the expansion before we're done processing all of the regions
within it. This is tested in test/CoverageMapping/macro-expressions.c.
This causes a problem when an expansion spans both the condition and the
consequent branch of an 'if' statement. MostRecentLocation is updated to the
start of the 'if' statement in popRegions(), so the file for the expansion
isn't exited by the time we're done handling the statement. We then crash with
'fatal: File exit not handled before popRegions'.
The fix for this is to detect these kinds of expansions, and conservatively
update MostRecentLocation to the end of expansion region containing the
conditional. I've added tests to make sure we don't have the same problem with
other kinds of statements.