Richard Smith [Sat, 8 Nov 2014 05:37:34 +0000 (05:37 +0000)]
[c++1z] Implement nested-namespace-definitions.
This allows 'namespace A::B { ... }' as a shorthand for 'namespace A {
namespace B { ... } }'. We already supported this correctly for error recovery;
promote that support to a full implementation.
This is not the right implementation: we do not maintain source fidelity
because we desugar the nested namespace definition in the parser. This is
tricky to avoid, since the definition genuinely does inject one named
entity per level in the namespace name.
Richard Smith [Sat, 8 Nov 2014 05:07:16 +0000 (05:07 +0000)]
[c++1z] N4295: fold-expressions.
This is a new form of expression of the form:
(expr op ... op expr)
where one of the exprs is a parameter pack. It expands into
(expr1 op (expr2onwards op ... op expr))
(and likewise if the pack is on the right). The non-pack operand can be
omitted; in that case, an empty pack gives a fallback value or an error,
depending on the operator.
Ben Langmuir [Sat, 8 Nov 2014 00:34:30 +0000 (00:34 +0000)]
Check module signature when the module has already been loaded
We may need to verify the signature on subsequent imports as well, just
like we verify the size/modtime:
@import A;
@import B; // imports A
@import C; // imports A
[Objective-C Sema]. Issue availability/deprecated warning when
there is a uinque method found when message is sent to receiver
of 'id' type. // rdar://18848183
Tim Northover [Fri, 7 Nov 2014 22:30:50 +0000 (22:30 +0000)]
ARM ABI: simplify decisions on whether args can be expanded.
Homogeneous aggregates on AAPCS_VFP ARM need to be passed *without* being
flattened (e.g. [2 x float] rather than "float, float") for various weird ABI
reasons. However, this isn't the case for anything else; further, we know at
the ABIArgInfo::getDirect callsites whether this flattening is allowed.
So, we can get more unified ARM code, with a simpler Clang, by just using that
knowledge directly.
Alexey Samsonov [Fri, 7 Nov 2014 22:29:38 +0000 (22:29 +0000)]
Introduce a SanitizerKind enum to LangOptions.
Use the bitmask to store the set of enabled sanitizers instead of a
bitfield. On the negative side, it makes syntax for querying the
set of enabled sanitizers a bit more clunky. On the positive side, we
will be able to use SanitizerKind to eventually implement the
new semantics for -fsanitize-recover= flag, that would allow us
to make some sanitizers recoverable, and some non-recoverable.
Samuel Antao [Fri, 7 Nov 2014 17:48:03 +0000 (17:48 +0000)]
Fix clash of gcc toolchains in hexagon driver regression tests.
If clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by -ccc-install-dir. This causes several regression tests to fail as they will be using an unexpected path. Adding the switch --gcc-toolchain="" in each test command is not enough as the hexagon toolchain implementation in the driver is not evaluating this argument. This commit modifies the hexagon toolchain to take the --gcc-toolchain="" argument into account when deciding the toolchain path, similarly to what is already done for other targets toolchains. Additionally, the faulty regression tests are modified in order to --gcc-toolchain="" be passed to the commands.
David Majnemer [Fri, 7 Nov 2014 07:26:38 +0000 (07:26 +0000)]
CodeGen, Itanium: Properly dllimport RTTI data
We would blindly assume that RTTI data should have the same linkage as
the vtable because we didn't think the RTTI data was external. This
oversight stemmed because we didn't take dllimport into account.
[X86] Slightly refactor default features for AMD bdver cpus (NFC). Also add missing checks to test for target features.
This patch simplifies how default target features are set for AMD bdver2
and bdver1. In particular, method 'getDefaultFeatures' now implements a
fallthrough from case 'CK_BDVER2' to case 'CK_BDVER1'.
That is because 'bdver2' has the same features available in bdver1 plus
BMI, FMA, F16C and TBM.
This patch also adds missing checks for predefined macros in test
predefined-arch-macros.c. In the case of BTVER2, the test now also checks
for F16C, BMI and PCLMUL. In the case of BDVER3 and BDVER4, the test now
also checks for the presence of FSGSBASE.
Alexey Bataev [Thu, 6 Nov 2014 10:10:50 +0000 (10:10 +0000)]
Fix for exception specification mismatch in explicit instantiation.
According to C++ standard if an exception-specification is specified in an explicit instantiation directive, it shall be compatible with the exception-specifications of other declarations of that function. This patch adds checks for this.
Differential Revision: http://reviews.llvm.org/D5822
Patch for small addition to availability attribute.
This is to accept "NA" in place of vesion number for availability
attribute. Used on introduced=NA to mean unavailable
and deprecated=NA to mean nothing (not deprecated).
rdar://18804883
Reid Kleckner [Wed, 5 Nov 2014 23:14:59 +0000 (23:14 +0000)]
Make it easier to build against a pre-built Clang package with CMake
Installing <prefix>/share/clang/cmake/ClangConfig.cmake makes CMake's
builtin find_package() utility work with Clang. This also allows
downstream consumers of Clang to statically link against libraries like
clangAST and have that pull in dependencies like clangBasic and
LLVMSupport.
See the CMake docs on packages:
http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html
This patch fixes a crash after rebuilding call AST of
an __unknown_anytype(...). In this case, we rebuild the
vararg function type specially to convert the call expression
to something that IRGen can handle. However, FunctionDecl
as rebuilt in RebuildUnknownAnyExpr::resolveDecl is bogus and
results in crash when accessing its params later on. This
patch fixes the crash by rebuilding the FunctionDecl to match
its new resolved type. rdar://15297105.
John McCall, please review post-commit.
Reid Kleckner [Wed, 5 Nov 2014 20:30:55 +0000 (20:30 +0000)]
cmake: Conditionalize CodeGen's dependency on intrinsics_gen
Custom targets in cmake cannot be exported, and this dependency is only
needed in the combined build to ensure that Intrinsics.gen is created
before compiling CodeGen. In the standalone, all of LLVM is build first.
Frederic Riss [Wed, 5 Nov 2014 19:19:04 +0000 (19:19 +0000)]
[DebugInfo] Do not record artificial global initializer functions in the DeclCache.
When we are generating the global initializer functions, we call
CGDebugInfo::EmitFunctionStart() with a valid decl which is describing
the initialized global variable. Do not update the DeclCache with this
key as it will overwrite the the cached variable DIGlobalVariable with
the newly created artificial DISubprogram.
One could wonder if we should put artificial subprograms in the DIE tree
at all (there are vaild uses for them carrying line information though).
This DefaultIgnore warning under -Wincomplete-module was firing on
any module map files that happened to be parsed (it's only supposed to
fire on headers), and it has been superceded by
-Wnon-modular-include-in-module anyway.
For compatibility, I rewired -Wincomplete-module to imply
-Wnon-modular-include-in-module.
Bob Wilson [Tue, 4 Nov 2014 22:28:48 +0000 (22:28 +0000)]
Use backslashes to escape spaces and other backslashes in -dwarf-debug-flags.
The command line options are specified in a space-separated list that is an
argument to -dwarf-debug-flags, so that breaks if there are spaces in the
options. This feature came from Apple's internal version of GCC, so I went back
to check how llvm-gcc handled this and matched that behavior.
rdar://problem/18775420
Kuba Brecka [Tue, 4 Nov 2014 17:35:17 +0000 (17:35 +0000)]
Use @rpath as LC_ID_DYLIB for ASan dylib on OS X
Change the LC_ID_DYLIB of ASan's dynamic libraries on OS X to be set to "@rpath/libclang_rt.asan_osx_dynamic.dylib" and similarly for iossim. Clang driver then sets the "-rpath" to be the real path to where clang currently has the dylib (because clang uses the relative path to its current executable). This means if you move the compiler or install the binary release, -fsanitize=address will link to the proper library.
[clang-tidy] Move -extra-arg handling to CommonOptionsProvider
Summary:
Handle -extra-arg and -extra-arg-before options in the
CommonOptionsProvider so they can be used in all clang tools. Adjust arguments
in a CompilationDatabase wrapper instead of adding ArgumentsAdjuster to the
tool.
Reid Kleckner [Mon, 3 Nov 2014 23:52:09 +0000 (23:52 +0000)]
Lower __builtin_fabs* to @llvm.fabs.*
mingw64's headers implement fabs by calling __builtin_fabs, so using the
library call results in an infinite loop. If the backend legalizes
@llvm.fabs as a call to fabs later, things should work out, as the crt
provides a definition.
Reid Kleckner [Mon, 3 Nov 2014 21:24:50 +0000 (21:24 +0000)]
Don't diagnose no-prototype callee-cleanup function definitions
We already have a warning on the call sites of code like this:
void f() { }
void g() { f(1, 2, 3); }
t.c:2:21: warning: too many arguments in call to 'f'
We can limit ourselves to diagnosing unprototyped forward declarations
of f to cut down on noise.
This patch reverts r220496 which issues warning on comparing
parameters with nonnull attribute when comparison is always
true/false. Patch causes false positive when parameter is
modified in the function.
Hans Wennborg [Mon, 3 Nov 2014 14:24:45 +0000 (14:24 +0000)]
Don't dllimport inline functions when targeting MinGW (PR21366)
It turns out that MinGW never dllimports of exports inline functions.
This means that code compiled with Clang would fail to link with
MinGW-compiled libraries since we might try to import functions that
are not imported.
To fix this, make Clang never dllimport inline functions when targeting
MinGW.
Craig Topper [Mon, 3 Nov 2014 04:19:58 +0000 (04:19 +0000)]
Remove definitions from Intrin.h that already exist in one of the other x86 intrinsic headers. Add a run line with Broadwell as the cpu type to ms-intrin.cpp test to catch some of these in the future.
clang-format: permit setting the path to clang in vimrc
If g:clang_format_path is set in the vimrc, that path will take precedence over
the hard coded path (which is reliant on the PATH environment variable). This
provides an easy mechanism for switching the selected clang-format binary during
development.
Craig Topper [Sat, 1 Nov 2014 22:50:54 +0000 (22:50 +0000)]
Avoid undefined behavior in the x86 bmi header file by explicitly checking for 0 before calling __builtin_ctz. Without this the optimizers may take advantage of the undefined behavior and produce incorrect results. LLVM itself still needs to be taught to merge the zero check into the llvm.cttz with defined zero behavior.
Craig Topper [Sat, 1 Nov 2014 22:25:23 +0000 (22:25 +0000)]
Avoid undefined behavior in the x86 lzcnt header file by explicitly checking for 0 before calling __builtin_clz. Without this the optimizers may take advantage of the undefined behavior and produce incorrect results. LLVM itself still needs to be taught to merge the zero check into the llvm.ctlz with defined zero behavior.