John Brawn [Fri, 29 May 2015 13:10:44 +0000 (13:10 +0000)]
[ARM] Adjust -march checking
getCanonicalArchName can return an empty string for an architecture
that is well-formed but meaningless. Use parseArch to determine if
it's actually valid or not.
Alexander Musman [Fri, 29 May 2015 11:24:32 +0000 (11:24 +0000)]
Fix assertion on C++ attributes in fillAttributedTypeLoc
this fixes http://llvm.org/PR17424
fillAttributedTypeLoc() function is only called with AttributeLists of either
DeclarationChunk (which is used for each type in a declarator being parsed) or
DeclSpec (which captures information about declaration specifiers).
As C++11 attributes actually appertain to declarators, they are moved straight
to the declarator’s attr list in distributeFunctionTypeAttrFromDeclSpec()
function.
'Put them wherever you like' semantics is not supported for C++11 attributes
(but is allowed for GNU attributes, for example). So when we meet an attribute
while parsing the declaration, we cannot be sure if it appertains to either
DeclarationChunk or DeclSpec.
This investigation correlates with the history of changes of SemaType.cpp:
• Asserts in fillAttributedTypeLoc() were added on 3 Mar 2011 in r126986
(http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon- 20110228/039638.html);
• Distributing C++11 attrs to the declarator was added on 14 Jan 2013
in r172504 (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon- 20130114/071830.html).
Considering all written above I changed asserts in fillAttributedTypeLoc()
to nullptr checks.
This fixes PR17424 and related assertion on
[[gnu::fastcall]] void __stdcall foo();
Diego Novillo [Thu, 28 May 2015 21:30:04 +0000 (21:30 +0000)]
Improve user documentation on profiling.
This clarifies the relationship between instrumentation and sampling based PGO,
code coverage analysis and the different formats supported by sample
profiling.
Chandler Carruth [Thu, 28 May 2015 21:20:14 +0000 (21:20 +0000)]
[omp] Loosen the driver test enough so that overriding the defaults
works well for folks.
This isn't terribly clean (sadly) but after chatting with both Eric and
Richard, nothing cleaner really emerged. The clean way of doing this is
a *lot* of work for extremely little benefit here.
Hans Wennborg [Thu, 28 May 2015 17:44:56 +0000 (17:44 +0000)]
Get the dll storage class right for structors of classes exported/imported via explicit instantiation (PR23667)
This is a follow-up to r238266. It turned out structors are codegened through a different path,
and didn't get the storage class set in EmitGlobalFunctionDefinition.
Daniel Jasper [Thu, 28 May 2015 07:21:50 +0000 (07:21 +0000)]
clang-format: Lower binding strengths created by the [] created by ObjC
method expressions and array literals. They should not bind stronger
than regular parentheses or the braces of braced lists.
Specific test case in JavaScript:
Before:
var aaaaa: List<
SomeThing> = [new SomeThingAAAAAAAAAAAA(), new SomeThingBBBBBBBBB()];
After:
var aaaaa: List<SomeThing> = [
new SomeThingAAAAAAAAAAAA(),
new SomeThingBBBBBBBBB()
];
David Majnemer [Thu, 28 May 2015 04:36:18 +0000 (04:36 +0000)]
[Basic] Define __declspec for cygwin
Cygwin (and MinGW) targets define __declspec to __attribute__ unless
-fms-extensions is specified. It turns out that cygwin headers rely on
the existence of this macro.
Chandler Carruth [Thu, 28 May 2015 01:52:38 +0000 (01:52 +0000)]
[omp] Re-work Clang's handling of -fopenmp and undo r237769.
This isn't an actual revert of r237769, it just restores the behavior of
the Clang driver prior to it while completely re-implementing how that
behavior works.
This also re-does the work of making the default OpenMP runtime
selectable at CMake (or configure) time to work in the way all of our
other such hooks do (config.h, configure and cmake hooks, etc.).
I've re-implemented how we manage the '-fopenmp' flagset in an important
way. Now, the "default" hook just makes '-fopenmp' equivalent to
'-fopenmp=<default>' rather than a separate special beast. Also, there
is an '-fno-openmp' flag which does the obvious thing. Also, the code is
shared between all the places to select a known OpenMP runtime and act
on it.
Finally, and most significantly, I've taught the driver to inspect the
selected runtime when choosing whether to propagate the '-fopenmp' flag
to the frontend in the CC1 commandline. Without this, it isn't possible
to use Clang with libgomp, even if you were happy with the serial,
boring way in which it worked previously (ignoring all #pragmas but
linking in the library to satisfy direct calls into the runtime).
While I'm here, I've gone ahead and sketched out a path for the future
name of LLVM's OpenMP runtime (libomp) and the legacy support for its
current name (libiomp5) in what seems a more reasonable way.
To re-enable LLVM's OpenMP runtime (which I think should wait until the
normal getting started instructions are a reasonable way for falks to
check out, build, and install Clang with the runtime) all that needs to
change is the default string in the CMakeLists.txt and configure.ac
file. No code changes necessary.
I also added a test for the driver's behavior around OpenMP since it was
*completely missing* previously. Makes it unsurprising that we got it
wrong.
Richard Trieu [Thu, 28 May 2015 00:14:02 +0000 (00:14 +0000)]
Update -Winvalid-noreturn to handle destructors better.
When checking if a function is noreturn, consider a codepath to be noreturn if
the path destroys a class and the class destructor, base class destructors, or
member field destructors are marked noreturn.
Daniel Jasper [Wed, 27 May 2015 05:37:40 +0000 (05:37 +0000)]
clang-format: [JS] Fix incorrect detection of ternary expressions.
A definintion like this could not be formatted at all:
constructor({aa}: {
aa?: string, aaaaaaaa?: string, aaaaaaaaaaaaaaa?: boolean,
aaaaaa?: List<string>
}) {
}
Hans Wennborg [Wed, 27 May 2015 00:06:45 +0000 (00:06 +0000)]
clang-cl: Handle dll attributes in explicit class template specialization definitions (PR23667)
Previously, we wouldn't call checkDLLAttribute() after the class template
specialization definition if the class template was already instantiated
by an explicit class template specialization declaration.
David Majnemer [Tue, 26 May 2015 21:54:24 +0000 (21:54 +0000)]
[MS ABI, DebugInfo] Omit the size for model-less pointers-to-members
The representation of a pointer-to-member in the MS ABI is governed by
the layout of the relevant class or if a model has been explicitly
specified. If no model is specified, then an appropriate
"worst-case-scenario" model is implicitly chosen if, and only, if the
pointer-to-member type's representation was needed.
Debug info cannot force a pointer-to-member type to have a
representation so do not try to query the size of such a type unless we
know it is safe to do so.
David Majnemer [Tue, 26 May 2015 21:28:50 +0000 (21:28 +0000)]
[CodeGen] Handle flexible array members containing pointers to members
Types can be classified as being zero-initializable or
non-zero-initializable. We used to classify array types by giving them
the classification of their base element type. However, incomplete
array types are never initialized directly and thus are always
zero-initializable.
Petar Jovanovic [Tue, 26 May 2015 21:07:19 +0000 (21:07 +0000)]
[MIPS] Re-land the change r238200 to fix extension of integer types
Re-land the change r238200, but with modifications in the tests that should
prevent new failures in some environments as reported with the original
change on the mailing list.
Aaron Ballman [Tue, 26 May 2015 19:44:52 +0000 (19:44 +0000)]
__declspec is not a core Clang language extension. Instead, require -fms-extensions or -fborland to enable the language extension.
Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets.
Daniel Jasper [Tue, 26 May 2015 07:26:26 +0000 (07:26 +0000)]
clang-format: Guard the bin-packing in braced lists on BinPackArguments
instead of BinPackParameters. Braced lists are used as constructor
calls in many places and so the bin-packing should follow what is done
for other calls and not what is done for function declarations.
Kit Barton [Mon, 25 May 2015 15:52:45 +0000 (15:52 +0000)]
This patch adds support for the vector quadword add/sub instructions introduced
in POWER8.
These are the Clang-related changes for http://reviews.llvm.org/D9081
vadduqm
vaddeuqm
vaddcuq
vaddecuq
vsubuqm
vsubeuqm
vsubcuq
vsubecuq
All builtins are added in altivec.h, and guarded with the POWER8_VECTOR and
powerpc64 macros.
Alexander Musman [Mon, 25 May 2015 11:21:20 +0000 (11:21 +0000)]
Bug fix for PR23577 (https://llvm.org/bugs/show_bug.cgi?id=23577#c0).
"1-4" specifiers are returned as numeric constants, not identifiers,
and should be treated as such. Currently pragma handler incorrectly
assumes that they are returned as identifiers.
Sanjay Patel [Fri, 22 May 2015 21:42:10 +0000 (21:42 +0000)]
add the -mrecip driver flag and process its options
This is the front-end counterpart to D8982 (LLVM r238051).
The -mrecip option interface is based on maintaining compatibility with gcc:
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627
https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289
...while adding more functionality (allowing users to specify the number of refinement steps for each
estimate type).
David Majnemer [Fri, 22 May 2015 05:49:41 +0000 (05:49 +0000)]
[Sema] Don't crash on out-of-line virtual constexpr functions
The method wasn't an overrider but didn't have 'virtual' textually
written because our CXXMethodDecl was an out-of-line definition. Make
sure we use the canonical decl instead.
Faisal Vali [Fri, 22 May 2015 01:11:10 +0000 (01:11 +0000)]
"This adds -fconcepts-ts as a cc1 option for enabling the
in-progress implementation of the Concepts TS. The recommended feature
test macro __cpp_experimental_concepts is set to 1 (as opposed to
201501) to indicate that the feature is enabled, but the
implementation is incomplete.
The link to the Concepts TS in cxx_status is updated to refer to the
PDTS (N4377). Additional changes related to __has_feature and
__has_extension are to follow in a later change.
Relevant tests include:
test/Lexer/cxx-features.cpp
The test file is updated with testing of the C++14 + Concepts TS mode.
The expected behaviour is the same as that of the C++14 modes except
for the case of __cpp_experimental_concepts."
- Hubert Tong.
Being committed for Hubert (as per his understanding with Richard Smith) as we start work on the concepts-ts following our preliminary strategy session earlier today.
Douglas Gregor [Thu, 21 May 2015 18:28:18 +0000 (18:28 +0000)]
Itanium mangler: don't trip an assertion when unresolved members have implicit bases.
When we find a member of the current instantation, the base of the
unresolved member expression is implicit; use nullptr for such
bases. This is not a change in behavior: the AST already contains null
in such cases, so non-asserts builds do the right thing already. Fixes
rdar://problem/21020559.
Manuel Klimek [Thu, 21 May 2015 12:23:34 +0000 (12:23 +0000)]
clang-format: [JS] Better support for fat arrows.
Assigns a token type (TT_JsFatArrow) to => tokens, and uses that to
more easily recognize and format fat arrow functions.
Improves function parsing to better recognize formal parameter
lists and return type declarations.
Recognizes arrow functions and parse function bodies as child blocks.
John Brawn [Thu, 21 May 2015 12:19:49 +0000 (12:19 +0000)]
[ARM] Restructure cpu handling in the driver to mostly use the triple
Using the target cpu to determine some behaviour is sprinkled in
several places in the driver, but in almost all the information that
is needed can be found in the triple. Restructure things so that the
triple is used, and the cpu is only used if the exact cpu name is
needed.
Also add a check that the -mcpu argument is valid, and correct the
-march argument checking so that it handles -march=native correctly. I
would have liked to move these checks into the computation of the
triple, but the triple is calculated several times in several places
and that would lead to multiple error messages for the same thing.
Alexey Bataev [Thu, 21 May 2015 07:59:51 +0000 (07:59 +0000)]
[OPENMP] Fixed codegen for lastprivate LCV in worksharing constructs.
If loop control variable in a worksharing construct is marked as lastprivate, we should copy last calculated value of private counter back to original variable.
Richard Smith [Thu, 21 May 2015 01:20:10 +0000 (01:20 +0000)]
[modules] If we re-enter a submodule from within itself (when submodule
visibility is enabled) or leave and re-enter it, restore the macro and module
visibility state from last time we were in that submodule.
This allows mutually-#including header files to stand a chance at being
modularized with local visibility enabled.
Alexey Samsonov [Thu, 21 May 2015 01:07:52 +0000 (01:07 +0000)]
[Driver] Improve unused-argument diagnostic for extra sanitizer features.
Don't print unused-argument warning for sanitizer-specific feature flag
if this sanitizer was eanbled, and later disabled in the command line.
For example, now:
clang -fsanitize=address -fsanitize-coverage=bb -fno-sanitize=address a.cc
doesn't print warning, but
clang -fsanitize-coverage=bb
does. Same holds for -fsanitize-address-field-padding= and
-fsanitize-memory-track-origins= flags.
Reid Kleckner [Thu, 21 May 2015 00:13:09 +0000 (00:13 +0000)]
Rename a helper template function to 'bytes' to avoid a C++17 STL conflict
MSVC 2015 includes the std::data() template function added to C++17. ADL
causes both cl.exe and clang-cl to prefer std::data over our static
helper here, and we get errors about converting int64_t* to StringRef.
Renaming it to bytes avoids the ambiguity.
Reid Kleckner [Thu, 21 May 2015 00:12:53 +0000 (00:12 +0000)]
Work around overloading bug in MSVC 2015
MSVC 2015 appears to be unable to find the correct operator== here. I
haven't yet filed a bug with Microsoft as I've been unable to create a
reduced test case.
Richard Trieu [Wed, 20 May 2015 23:29:18 +0000 (23:29 +0000)]
Check for bool-like conversion in conditional expressions.
Add a check for bool-like conversions for the condition expression of
conditional operators. This is similiar to the checking of condition
expressions of if statements, for-loops, while-loops, and do-while loops.
Specificially, this is to fix the problem of assert("message") not triggering
-Wstring-conversion when the assert macro uses a conditional operator.
Richard Smith [Wed, 20 May 2015 22:48:44 +0000 (22:48 +0000)]
[OpenMP] Make default OpenMP library (the one selected with just -fopenmp)
configurable in the CMake build. There shouldn't be any change in default
behavior.
Justin Bogner [Wed, 20 May 2015 16:16:23 +0000 (16:16 +0000)]
InstrProf: Increment the profile counter for all types of destructor
-fprofile-instr-generate does not emit counter increment intrinsics
for Dtor_Deleting and Dtor_Complete destructors with assigned
counters. This causes unnecessary [-Wprofile-instr-out-of-date]
warnings during profile-use runs even if the source has never been
modified since profile collection.
Alexey Bataev [Wed, 20 May 2015 11:57:02 +0000 (11:57 +0000)]
[MSVC] Handle out-of-line definition of static data member correctly (fix for http://llvm.org/PR21164), by Alexey Frolov
There are 3 cases of defining static const member:
initialized inside the class, not defined outside the class.
initialized inside the class, defined outside the class.
not initialized inside the class, defined outside the class.
Revision r213304 was supposed to fix the linkage problem of case (1), but mistakenly it made case (2) behave the same.
As a result, out-of-line definition of static data member is not handled correctly.
Proposed patch distinguishes between cases (1) and (2) and allows to properly emit static const members under –fms-compatibility option.
This fixes http://llvm.org/PR21164.
Differential Revision: http://reviews.llvm.org/D9850