Adrian Prantl [Tue, 30 Jun 2015 17:39:43 +0000 (17:39 +0000)]
Add a function to ExternalASTSource that returns a descriptor that
abstracts the commonalities between modules and PCH files that are
needed to emit debug info for a module or precompiled header.
Reid Kleckner [Tue, 30 Jun 2015 16:32:04 +0000 (16:32 +0000)]
[clang-cl] Use /arch: to set the base target CPU
The main effect of this change is that /arch:IA32 will use i386 as the
CPU, while clang-cl will continue to default to pentium4 (aka SSE2 plus
the usual other features).
/arch:AVX and /arch:AVX2 will also now enable the other features
available in sandybridge and haswell respectively, which is consistent
with MSDN.
Hubert Tong [Tue, 30 Jun 2015 12:14:52 +0000 (12:14 +0000)]
[CONCEPTS] Parsing of concept keyword
Summary: This change adds parsing for the concept keyword in a
declaration and tracks the location. Diagnostic testing added for
invalid use of concept keyword.
David Majnemer [Tue, 30 Jun 2015 04:41:18 +0000 (04:41 +0000)]
[CodeGen] Tweak isTriviallyRecursive further
isTriviallyRecursive is a hack used to bridge a gap between the
expectations that source code assumes and the semantics that LLVM IR can
provide. Specifically, asm labels on functions are treated as an
explicit name for a GlobalObject in Clang but treated like an
output-processing step in GCC. Tweak this hack a little further to emit
calls to library functions instead of emitting an incorrect definition.
The definition in question would have available_externally linkage (this
is OK) but result in a call to itself which will either result in an
infinite loop or stack overflow.
David Majnemer [Tue, 30 Jun 2015 03:30:26 +0000 (03:30 +0000)]
[MS ABI] Workaround corner-case bug in the ABI for operator delete
MSVC only genreates array cookies if the class has a destructor. This
is problematic when having to call T::operator delete[](void *, size_t)
because the second argument's argument is impossible to synthesize
correctly if the class has no destructor (because there will be no array
cookie).
Instead, MSVC passes the size of the class. Do the same, for
compatibility, instead of crashing.
Andrew Wilkins [Tue, 30 Jun 2015 02:52:38 +0000 (02:52 +0000)]
Sphinx-based clang man pages
Summary:
This diff introduces .rst files, Sphinx config, and a CMake target
for building clang man pages. This will deprecate the existing .pod-
based man page, and will integrate nicely with CMake. This diff does
not remove the existing man page; that will be done in a follow-up
once packagers have had a chance to react to the change.
For now, only clang(1) has been done; others can be added over time
by dropping additional files into the docs/CommandGuide directory.
The index page for CommandGuide has been copied from LLVM's
docs/CommandGuide.
The man page itself is mostly the same, with a few minor cosmetic
changes. The only major change is the SYNOPSIS section. I was unable
to get .rst/Sphinx produce the same style as in the existing man page.
Instead, I changed it to match the LLVM tools' relatively simple style.
To build the man pages, use the "docs-clang-man" target if building
with CMake. Otherwise, use "make -f Makefile.sphinx man".
Adrian Prantl [Tue, 30 Jun 2015 02:26:03 +0000 (02:26 +0000)]
Pass HeaderSearchOptions and PreprocessorOptions into CodeGenModule.
In order to produce debug info for clang modules CGDebugInfo it needs
access to macros passed on the command line and the isysroot.
Eric Christopher [Mon, 29 Jun 2015 21:00:05 +0000 (21:00 +0000)]
Add support for the x86 builtin __builtin_cpu_supports.
This matches the implementation of the gcc support for the same
feature, including checking the values set up by libgcc at runtime.
The structure looks like this:
unsigned int __cpu_vendor;
unsigned int __cpu_type;
unsigned int __cpu_subtype;
unsigned int __cpu_features[1];
with a set of enums to match various fields that are field out after
parsing the output of the cpuid instruction.
This also adds a set of errors checking for valid input (and cpu).
compiler-rt support for this and the other builtins in this family
(__builtin_cpu_init and __builtin_cpu_is) are forthcoming.
Serge Pavlov [Mon, 29 Jun 2015 17:50:19 +0000 (17:50 +0000)]
Instantiation of local class members.
If a function containing a local class is instantiated, instantiate
all of local class member, including default arguments and exception
specifications.
This change fixes PR21332 and thus implements DR1484.
David Blaikie [Mon, 29 Jun 2015 17:29:50 +0000 (17:29 +0000)]
Account for calling convention specifiers in function definitions in IR test cases
Several tests wouldn't pass when executed on an armv7a_pc_linux triple
due to the non-default arm_aapcs calling convention produced on the
function definitions in the IR output. Account for this with the
application of a little regex.
Summary: This makes the Mozilla style defaults more compliant with the Mozilla style guide. A few options were removed in order to use the LLVM style defaults.
Javed Absar [Mon, 29 Jun 2015 09:30:19 +0000 (09:30 +0000)]
[ARM]: Extend -mfpu options for half-precision and vfpv3xd
Some of the the permissible ARM -mfpu options, which are supported in GCC,
are currently not present in llvm/clang.This patch adds the options:
'neon-fp16', 'vfpv3-fp16', 'vfpv3-d16-fp16', 'vfpv3xd' and 'vfpv3xd-fp16.
These are related to half-precision floating-point and single precision.
David Majnemer [Mon, 29 Jun 2015 00:06:50 +0000 (00:06 +0000)]
[MS ABI] Unify constant and non-constant member pointer conversion
We had two separate paths for member pointer conversion: one which
takes a constant and another which takes an arbitrary value. In the
latter case, we are permitted to construct arbitrary instructions.
It turns out that the bulk of the member pointer conversion is sharable
if we construct an artificial IRBuilder.
Nemanja Ivanovic [Fri, 26 Jun 2015 19:27:20 +0000 (19:27 +0000)]
Add missing builtins to altivec.h for ABI compliance (vol. 1)
This patch corresponds to review:
http://reviews.llvm.org/D10637
This is the first round of additions of missing builtins listed in the ABI document. More to come (this builds onto what seurer already addes). This patch adds:
vector signed long long vec_abs(vector signed long long)
vector double vec_abs(vector double)
vector signed long long vec_add(vector signed long long, vector signed long long)
vector unsigned long long vec_add(vector unsigned long long, vector unsigned long long)
vector double vec_add(vector double, vector double)
vector double vec_and(vector bool long long, vector double)
vector double vec_and(vector double, vector bool long long)
vector double vec_and(vector double, vector double)
vector signed long long vec_and(vector signed long long, vector signed long long)
vector double vec_andc(vector bool long long, vector double)
vector double vec_andc(vector double, vector bool long long)
vector double vec_andc(vector double, vector double)
vector signed long long vec_andc(vector signed long long, vector signed long long)
vector double vec_ceil(vector double)
vector bool long long vec_cmpeq(vector double, vector double)
vector bool long long vec_cmpge(vector double, vector double)
vector bool long long vec_cmpge(vector signed long long, vector signed long long)
vector bool long long vec_cmpge(vector unsigned long long, vector unsigned long long)
vector bool long long vec_cmpgt(vector double, vector double)
vector bool long long vec_cmple(vector double, vector double)
vector bool long long vec_cmple(vector signed long long, vector signed long long)
vector bool long long vec_cmple(vector unsigned long long, vector unsigned long long)
vector bool long long vec_cmplt(vector double, vector double)
vector bool long long vec_cmplt(vector signed long long, vector signed long long)
vector bool long long vec_cmplt(vector unsigned long long, vector unsigned long long)
Anna Zaks [Fri, 26 Jun 2015 17:42:58 +0000 (17:42 +0000)]
[static analyzer] Analyzer is skipping forward declared C/C++ functions
A patch by Karthik Bhat!
This patch fixes a regression introduced by r224398. Prior to r224398
we were able to analyze the following code in test-include.c and report
a null deref in this case. But post r224398 this analysis is being skipped.
E.g.
// test-include.c
#include "test-include.h"
void test(int * data) {
data = 0;
*data = 1;
}
// test-include.h
void test(int * data);
This patch uses the function body (instead of its declaration) as the location
of the function when deciding if the Decl should be analyzed with path-sensitive
analysis. (Prior to r224398, the call graph was guaranteed to have a definition
when available.)
Manuel Klimek [Fri, 26 Jun 2015 02:15:04 +0000 (02:15 +0000)]
Fix crash-on-invalid bug in template instantiation.
Get rid of code-path that (according to Richard Smith) is not needed but
leads to a crasher bug when assuming a template has been fully
instantiated and thus has a definition.
Davide Italiano [Fri, 26 Jun 2015 00:18:35 +0000 (00:18 +0000)]
[Sema] Commit a better fix for r240242
Skip calls to HasTrivialDestructorBody() in the case where the
destructor is never invoked. Alternatively, Richard proposed to change
Sema to declare a trivial destructor for anonymous union member, which
seems too wasteful.
Nico Weber [Fri, 26 Jun 2015 00:13:18 +0000 (00:13 +0000)]
Add an inttypes.h wrapper that fixes up some macros in Microsoft mode.
Before MSVS2015, MSVS's headers disagree about int32_t and PRIx32 and so on.
Provide a wrapper header to fix this, so that -Wformat can still be used.
Fixes PR23412.
Meador Inge [Fri, 26 Jun 2015 00:09:55 +0000 (00:09 +0000)]
[Sema] Maintain ellipsis location when transforming lambda captures
This patch fixes a crash caused by the following case:
template<typename T>
auto f(T x) {
auto g = [](auto ... args) {
auto h = [args...]() -> int {
return 0;
};
return h;
};
return g;
}
auto x = f(0)();
When the templated function 'f' is instantiated and the inner-most
lambda is transformed the ellipsis location on the captured variable
is lost. Then the lambda returned by 'f' is instantiated and the
tree transformer chokes on the invalid ellipsis location. The
problem is fixed by making a minor change to properly track the
ellipsis location.
Kaelyn Takata [Thu, 25 Jun 2015 23:47:39 +0000 (23:47 +0000)]
Fix a typo correction crash when resolving ambiguous corrections.
In certain cases, the tree transform would introduce new TypoExprs while
trying one of the corrections, invalidating the unique_ptr in the state
reference, and also causing a TypoExpr to exist that will never be
corrected since it doesn't exist in the final corrected expression. The
simple solution to both problems is to temporarily disable typo
correction while handling potentially ambiguous typo corrections.
Anna Zaks [Thu, 25 Jun 2015 23:36:44 +0000 (23:36 +0000)]
[docs] Several updates to the Address Sanitizer webpage.
- Added the description of the interceptor suppression.
- Re-organized a bit: grouped a few things under the Issue Suppression
section, grouped IOC and leaks under a section, placed symbolication
info into Symbolizing the Reports section..
- In supported platforms: "MacOS" -> "OS X"; added "iOS Simulator"
- Added a paragraph to the Usage section describing when DYLD_INSERT_LIBRARIES
might need to be used.
- "attribute((no_sanitize_address))" -> "__attribute__((no_sanitize("address")))"
- Updated Leak Sanitizer page with most up to date info.
....
Sean Silva [Thu, 25 Jun 2015 23:22:11 +0000 (23:22 +0000)]
Remove `requires` for x86 CPU features.
Ever since the target attributes change, we don't need to guard these
headers with `requires`. Actually it's a bit worse, because if we do
then they are included textually under the covers, causing declarations
to appear in submodules they aren't supposed to be in.
Alexey Samsonov [Thu, 25 Jun 2015 23:14:32 +0000 (23:14 +0000)]
[CFI] Diagnose when we CFI in diagnostic mode is unavailable on a toolchain.
Summary:
Namely, we must have proper C++ABI support in UBSan runtime. We don't
have a good way to check for that, so just assume that C++ABI support is
there whenever -fsanitize=vptr is supported (i.e. only on handful of
platforms).
Exact diagnostic is also tricky. It's not "cfi" that is unsupported,
just the diagnostic mode. So, I suggest to report that
"-fno-sanitize-trap=cfi-foobar" is incompatible with a given target
toolchain.
Diego Novillo [Thu, 25 Jun 2015 22:56:00 +0000 (22:56 +0000)]
Display profile file name when emitting a file not found diagnostic.
When a profile file cannot be opened, we used to display just the error
message but not the name of the profile the compiler was trying to open.
This will become useful in the next set of patches that introduce
GCC-compatible flags to specify profiles.
Meador Inge [Thu, 25 Jun 2015 22:06:40 +0000 (22:06 +0000)]
[Parse] Allow 'constexpr' in condition declarations
This patch implements the functionality specified by DR948.
The changes are two fold. First, the parser was modified
to allow 'constexpr's to appear in condition declarations
(which was a hard error before). Second, Sema was modified
to cleanup maybe odr-used declarations by way of a call to
'ActOnFinishFullExpr'. As 'constexpr's were not allowed in
condition declarations before the cleanup wasn't necessary
(such declarations were always odr-used).
Richard Smith [Thu, 25 Jun 2015 20:48:44 +0000 (20:48 +0000)]
[modules] Fix findDirectiveAtLoc to not call a member function on a null pointer.
This is exercised by existing tests, and fixes a failure with -fsanitize=null.
No observable change otherwise; the code happened to do the right thing in
practice under recent versions of Clang and GCC because
MacroDirective::getDefinition happens to check whether this == null.
Chris Bieneman [Thu, 25 Jun 2015 20:25:43 +0000 (20:25 +0000)]
Add -miphonesimulator-version-min as alias to -ios-simulator-version-min.
Summary:
For better or worse the OS X command line tools refer to the iOS simulator as iphonesimucator. We should provide an alias flag -miphonesimulator-version-min that matches a consistent pattern with the other tools.
This is in the interest of making it easier for people to write platform-agnostic darwin build scripts.
Artem Belevich [Thu, 25 Jun 2015 18:29:42 +0000 (18:29 +0000)]
[CUDA] Implemented __nvvm_atom_*_gen_* builtins.
Integer variants are implemented as atomicrmw or cmpxchg instructions.
Atomic add for floating point (__nvvm_atom_add_gen_f()) is implemented
as a call to an overloaded @llvm.nvvm.atomic.load.add.f32.* LVVM
intrinsic.
Aaron Ballman [Thu, 25 Jun 2015 15:37:16 +0000 (15:37 +0000)]
Fix #pragma redefine_extname when there is a local variable of the same name. The local should not be renamed, only the externally-available declaration should be.
Steven Wu [Thu, 25 Jun 2015 01:59:35 +0000 (01:59 +0000)]
Update darwin SDK version parsing to support OSX and simulator
This re-commits r226005 with a tweak. The origin attempt failed because
Darwin bot sets up SDKROOT and clang can deduce SDK version from them
after this patch. That broke many driver tests due to the change of
deployment target version. Now the tests should not complain after
r240574.
Hubert Tong [Thu, 25 Jun 2015 00:25:49 +0000 (00:25 +0000)]
Consolidate and unify initializer list deduction
Summary:
This patch reduces duplication in the template argument deduction code
for handling deduction from initializer lists in a function call. This
extends the fix for PR12119 to also apply to the case where the
corresponding parameter is a trailing parameter pack.
Test Plan:
A test for deduction from nested initializer lists where the
corresponding parameter is a trailing parameter pack is added in
`clang/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp`.
Hubert Tong [Thu, 25 Jun 2015 00:23:39 +0000 (00:23 +0000)]
[Concepts] Parsing of requires-clause in template-declaration
Summary:
This change implements parse-only acceptance of the optional
requires-clause in a template-declaration. Diagnostic testing is added
for cases where the grammar is ambiguous with the expectation that the
longest token sequence which matches the syntax of a
constraint-expression is consumed without backtracking.
Ranjeet Singh [Wed, 24 Jun 2015 23:39:25 +0000 (23:39 +0000)]
[ARM] The bits set in the variable HW_FP could get unset
when iterating through the Features vector if we don't
keep track of what's already been set. This could lead to
the macro __ARM_FP getting the wrong value. This patch
fixes this issue by keeping track of the bits that have
already been set in the loop.
Derek Schuff [Wed, 24 Jun 2015 22:36:36 +0000 (22:36 +0000)]
Relax assertion in x86_64 byval argument handling for 32-bit pointers
Summary:
Byval argument pair formation assumes that if a type is less than 8 bytes
it must be an integer and not a pointer, which is not true for x32 and NaCl.
Relax the assertion and add a test for a codegen case that triggered it.
Steven Wu [Wed, 24 Jun 2015 19:30:36 +0000 (19:30 +0000)]
Remove environment variables from driver tests
Summary:
Remove some of dangerous environmental variables from clang/Driver tests.
Driver tests should not rely on preset value of these variables and may
actually fail because of them.
They cannot be removed in test/lit.cfg because we still need to support
relocatable SDKs and other overwrite for other clang tests.