Commit Graph

58545 Commits

Author SHA1 Message Date
David Majnemer c9741603bc [CodeGen] Update a test-case affected by folding IntToPtr/PtrToInt into Loads
Folding IntToPtr or PtrToInt into Loads, due to r238452,
perturbs the mips-varargs test-case.

Patch by Philip Pfaffe!

Differential Revision: http://reviews.llvm.org/D9153

llvm-svn: 238455
2015-05-28 18:51:36 +00:00
Hans Wennborg bb4f962ad6 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.

llvm-svn: 238443
2015-05-28 17:44:56 +00:00
Ranjeet Singh b90541519e [ARM] Be less specific about the error message expected.
Differential Revision: http://reviews.llvm.org/D10087

llvm-svn: 238436
2015-05-28 15:55:34 +00:00
Renato Golin 33e1f82e5a [ARMTargetParser] FIXME MachO arch names. NFC
llvm-svn: 238435
2015-05-28 15:49:28 +00:00
Renato Golin 3c007259a4 [ARMTargetParser] FIXME on getLLVMArchSuffixForARM. NFC
llvm-svn: 238430
2015-05-28 15:05:53 +00:00
Renato Golin 391544c431 [ARMTargetParser] Removing string parsing from getCPUDefineSuffix. NFC.
Yet another FIXME from ARMTargetParser.

llvm-svn: 238416
2015-05-28 12:11:11 +00:00
Diego Novillo 63b2ad4f71 Fix PPC failure. Adjust CHECK pattern.
llvm-svn: 238413
2015-05-28 11:25:52 +00:00
Daniel Jasper f841d3a6c1 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()
  ];

llvm-svn: 238400
2015-05-28 07:21:50 +00:00
David Majnemer ae1ed0edfe [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.

llvm-svn: 238394
2015-05-28 04:36:18 +00:00
Chandler Carruth 9c6b4f8528 [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.

llvm-svn: 238389
2015-05-28 01:52:38 +00:00
Ekaterina Romanova 2e81434552 Added doxygen comments for the intrinsics.
llvm-svn: 238386
2015-05-28 01:25:25 +00:00
Richard Trieu 95a192a3ab 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.

Differential Revision: http://reviews.llvm.org/D9454

llvm-svn: 238382
2015-05-28 00:14:02 +00:00
Diego Novillo aa8b1cb8a4 Set function entry counts with -fprofile-instr-use.
This generates function entry counts from instrumentation profiles.

llvm-svn: 238360
2015-05-27 21:58:42 +00:00
John Thompson b7892ffc69 It appears these exports are needed, as wmmintrin.h includes them.
llvm-svn: 238345
2015-05-27 18:26:41 +00:00
Renato Golin f05bf0090b ARMTargetParser FIXME getCPUProfile A/R/M
This is the last of the easy ones.

llvm-svn: 238324
2015-05-27 14:15:12 +00:00
Renato Golin f5c4dec750 ARMTargetParser FIXME: ARMv8 detection for hdiv
Avoiding ugly combination of string parsing in the front-end. We still
need to move away from CPU parsing at all, but that's for a different
commit.

llvm-svn: 238318
2015-05-27 13:33:00 +00:00
Daniel Jasper 3e0dcc27d5 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>
  }) {
  }

llvm-svn: 238291
2015-05-27 05:37:40 +00:00
Daniel Jasper 3273930d9a clang-format: Fix false positive in function annotation detection.
llvm-svn: 238285
2015-05-27 04:55:47 +00:00
Hans Wennborg 17f9b4469e 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.

llvm-svn: 238266
2015-05-27 00:06:45 +00:00
David Majnemer 34568bc602 [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.

llvm-svn: 238259
2015-05-26 21:54:24 +00:00
David Majnemer 67fa0b85cd [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.

llvm-svn: 238256
2015-05-26 21:28:50 +00:00
Petar Jovanovic 1a3f965fe3 [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.

llvm-svn: 238253
2015-05-26 21:07:19 +00:00
Akira Hatanaka 08d70edec2 Remove the code in clang that is using TargetOptions::NoFramePointerElim.
This is the clang side change following r238244.

llvm-svn: 238245
2015-05-26 20:18:26 +00:00
Aaron Ballman a235996d4c Fixing an RST issue to silence a sphinx warning.
llvm-svn: 238241
2015-05-26 19:56:13 +00:00
Aaron Ballman 674cf26892 __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.
llvm-svn: 238238
2015-05-26 19:44:52 +00:00
Hans Wennborg 74df0df135 Revert r238200: "[MIPS] fix extension of integer types (function calls)"
mips-unsigned-ext-var.c and mips-unsigned-extend.c fail in some builds.

llvm-svn: 238237
2015-05-26 19:39:54 +00:00
Douglas Katzman 9f5e70e3b7 Change final case of Driver::getToolChain to "if/else/else/else..."
Differential Revision: http://reviews.llvm.org/D9939

llvm-svn: 238225
2015-05-26 18:01:33 +00:00
Ranjeet Singh 5b30b0aaae Test commit.
llvm-svn: 238220
2015-05-26 17:30:35 +00:00
Aaron Ballman d6ea91456a Going out on a limb and guessing that someone viewing the 3.7 release notes may instead want to view 3.6 instead of 3.5.
llvm-svn: 238212
2015-05-26 16:12:07 +00:00
Petar Jovanovic 9aa0f1657f [MIPS] fix extension of integer types (function calls)
On MIPS unsigned int type should not be zero extended but sign-extended.

Patch by Strahinja Petrovic.

Differential Revision: http://reviews.llvm.org/D9198

llvm-svn: 238200
2015-05-26 13:30:54 +00:00
Daniel Jasper 0843434e74 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.

llvm-svn: 238184
2015-05-26 07:26:26 +00:00
Daniel Jasper 0805199185 clang-format: [JS] Support ES6 spread operator.
Specifically, don't add a space before it.

Before:
  someFunction(... a);
  var x = [1, 2, ... a];

After:
  someFunction(...a);
  var x = [1, 2, ...a];

llvm-svn: 238183
2015-05-26 07:18:56 +00:00
Daniel Jasper 1a02822704 clang-format: Fix child-formatting in macros.
This fixes a case where the column limit was incorrectly calculated
leading to a macro like this:

  #define A                                       \
    [] {                                          \
      xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(        \
          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx); \
    }

exceeding the column limit.

llvm-svn: 238182
2015-05-26 07:03:42 +00:00
David Majnemer 7a3ce0c537 [MS ABI] Implement restrict qualified references
MSVC 2015 supports '__restrict' qualified reference types.

llvm-svn: 238166
2015-05-26 01:30:45 +00:00
Kit Barton 5944ee2179 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.



http://reviews.llvm.org/D9903

llvm-svn: 238145
2015-05-25 15:52:45 +00:00
Alexander Musman 6b080fcda5 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.

Patch by Andrey Bokhanko.

Differential Revision: http://reviews.llvm.org/D9856

llvm-svn: 238129
2015-05-25 11:21:20 +00:00
David Majnemer dcecd93196 [Driver] Unbreak hexagon build bots
AddHexagonTargetArgs didn't respect the driver flags by unconditionally
pushing -fno-signed-char.  Instead, add Hexagon handling to
isSignedCharDefault.

llvm-svn: 238106
2015-05-23 19:23:55 +00:00
David Majnemer c3658d2f24 [Driver] Handle -fno-signed-char and -fno-unsigned-char
GCC maps -fno-unsigned-char to -fsigned-char and -fno-signed-char to
-funsigned-char.

llvm-svn: 238105
2015-05-23 18:48:37 +00:00
David Majnemer 7800f1f5aa [Sema] Don't use dyn_cast to detect an AtomicType
An AtomicType might be hidden behind arbitrary levels of typedefs.
getAs<> will reliably walk through the sugar to get the underlying
AtomicType.

This fixes PR23638.

llvm-svn: 238083
2015-05-23 01:32:17 +00:00
Rafael Espindola 992c6fa5db This reverts commit r238064 and r238055.
They depend on a reverted llvm commit.

llvm-svn: 238076
2015-05-23 00:30:33 +00:00
Sanjay Patel 9d084a7ebb add missing include for TargetRecip
llvm-svn: 238064
2015-05-22 22:59:27 +00:00
Justin Bogner cb0829943b CodeGen: Avoid a reserved name and fix the naming style of some arguments. NFC
It's undefined to use reserved names like _Diags. Fix up the other
parameter names to consistently use a modern style while I'm here.

llvm-svn: 238058
2015-05-22 22:16:55 +00:00
Sanjay Patel f5019e60c7 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).

Differential Revision: http://reviews.llvm.org/D8989

llvm-svn: 238055
2015-05-22 21:42:10 +00:00
Rafael Espindola b8a1293e0b Make unique section names the default again.
Using non unique names found a bug in the ICF inplementation in gold:

https://sourceware.org/bugzilla/show_bug.cgi?id=18440

This reverts commit r234143.

llvm-svn: 238048
2015-05-22 20:44:03 +00:00
Renato Golin f6c154d532 Use profile and version parsers from ARMTargetParser
Now that ARMTargetParser can parse profile and version numbers,
use them instead of the local implementation.

llvm-svn: 238037
2015-05-22 18:18:25 +00:00
Diego Novillo e0d289efbd Add clarifying note that sampling-based profiles cannot be used for code coverage.
llvm-svn: 238031
2015-05-22 16:05:07 +00:00
Aaron Ballman 8afcd0a71a Updating the documentation to include an operator! for negative capability support.
llvm-svn: 238020
2015-05-22 13:36:48 +00:00
Szabolcs Sipos b37b0ed239 Adding new AST matcher: isConstexpr
It matches constexpr variable and function declarations.

llvm-svn: 238016
2015-05-22 11:35:50 +00:00
Alexey Bataev 3ae88e2124 [OPENMP] Prepare codegen for privates in tasks for non-capturing of privates in CapturedStmt.
Reworked codegen for privates in tasks:

call @kmpc_omp_task_alloc();
...
call @kmpc_omp_task(task_proxy);

void map_privates(.privates_rec. *privs, type1 ** priv1_ref, ..., typen **privn_ref) {
  *priv1_ref = &privs->private1;
  ...
  *privn_ref = &privs->privaten;
  ret void
}

i32 task_entry(i32 ThreadId, i32 PartId, void* privs, void (void*, ...) map_privates, shareds* captures) {
  type1 **priv1;
  ...
  typen **privn;
  call map_privates(privs, priv1, ..., privn);
  <Task body with priv1, .., privn instead of the captured variables>.
  ret i32
}

i32 task_proxy(i32 ThreadId, kmp_task_t_with_privates *tt) {
  call task_entry(ThreadId, tt->task_data.PartId, &tt->privates, map_privates, tt->task_data.shareds);
}

llvm-svn: 238010
2015-05-22 08:56:35 +00:00
Justin Bogner e8d762e148 Modernize some doc comments. NFC
llvm-svn: 238006
2015-05-22 06:48:13 +00:00
David Majnemer 8d44ac4785 [ItaniumMangle] Fix a typo.
llvm-svn: 238002
2015-05-22 05:54:24 +00:00
David Majnemer ab6607ab09 [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.

This fixes PR23629.

llvm-svn: 237999
2015-05-22 05:49:41 +00:00
Faisal Vali 2933621203 Apply existing checks to C++1Z (has_feature_cxx0x); NFC
This applies the existing checks in has_feature_cxx0x to -std=c++1z.
In addition, references to C++1y are updated to refer to C++14

No functional change. Testing of __has_feature for C++1z features
is not added in this change.

Patch by Hubert Tong! 

llvm-svn: 237992
2015-05-22 02:57:28 +00:00
Ahmed Bougacha b55d416ef1 [OpenMP] Test AVX default SIMD alignment. NFC.
llvm-svn: 237991
2015-05-22 02:51:49 +00:00
Ahmed Bougacha 1fca2edc48 [CodeGen] Use TargetInfo::getABI() throughout X86*TargetCodeGenInfo.
We already have the ABI, we don't need a "HasAVX" flag.
This will also makes it easier to add an AVX512 ABI.

No functional change intended.

llvm-svn: 237989
2015-05-22 02:25:58 +00:00
Richard Smith a7bd4582e7 Fix assertion when assigning to object in OpenCL constant address space.
Patch by John Garvin!

llvm-svn: 237983
2015-05-22 01:14:39 +00:00
Faisal Vali 24d59d14ba "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. 

The patch is tiny and seems quite standard.

Thanks Hubert!

llvm-svn: 237982
2015-05-22 01:11:10 +00:00
Adrian Prantl be81cf570e Debug info: Adapt to new DIBuilder interface.
llvm-svn: 237948
2015-05-21 20:37:26 +00:00
Douglas Gregor 3c523c4a37 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.

llvm-svn: 237929
2015-05-21 18:28:18 +00:00
Manuel Klimek 79e06081a3 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.

Patch by Martin Probst.

llvm-svn: 237895
2015-05-21 12:23:34 +00:00
John Brawn 94fd963315 [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.

Differential Revision: http://reviews.llvm.org/D9879

llvm-svn: 237894
2015-05-21 12:19:49 +00:00
Alexey Bataev 5129d3a4f5 [OPENMP] Fixed codegen for parameters privatization.
For parameters we shall take a derived type of parameters, not the original one.

llvm-svn: 237882
2015-05-21 09:47:46 +00:00
Alexey Bataev 7a228ff439 [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.

llvm-svn: 237879
2015-05-21 07:59:51 +00:00
Richard Smith e520293c8b Avoid using a C++11 library feature not present in libstdc++4.7.
llvm-svn: 237872
2015-05-21 01:26:53 +00:00
Richard Smith 04765ae01e [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.

llvm-svn: 237871
2015-05-21 01:20:10 +00:00
Alexey Samsonov de0aff3e91 [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.

Fixes PR23604.

llvm-svn: 237870
2015-05-21 01:07:52 +00:00
Reid Kleckner 012665e16b 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.

llvm-svn: 237863
2015-05-21 00:13:09 +00:00
Reid Kleckner b4a26ed58e 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.

llvm-svn: 237862
2015-05-21 00:12:53 +00:00
Richard Trieu cbab79a4f8 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.

llvm-svn: 237856
2015-05-20 23:29:18 +00:00
Richard Smith 31d1de2229 [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.

Derived from a patch by Daniel Jasper!

llvm-svn: 237850
2015-05-20 22:48:44 +00:00
Reid Kleckner 892bb0cace Evaluate union cast subexpressions when the cast value is unused
Fixes PR23597.

llvm-svn: 237839
2015-05-20 21:59:25 +00:00
Aaron Ballman 068aa51dae Refactored some common functionality into MaybeParseMicrosoftDeclSpecs; NFC.
llvm-svn: 237835
2015-05-20 20:58:33 +00:00
Ahmed Bougacha 71185aca7e [CodeGen] Check x86_64-arguments.c tests on AVX as well. NFC.
We used to only check the differing tests on AVX, but we might
as well check all of them.

llvm-svn: 237818
2015-05-20 18:39:16 +00:00
Richard Smith fd8b64eea0 [modules] Support merging a parsed default argument with an imported hidden one for non-type and template template parameters too.
llvm-svn: 237815
2015-05-20 18:24:21 +00:00
Richard Smith c7d48d1a16 [modules] Support merging a parsed default function/template argument with an imported but hidden one.
llvm-svn: 237814
2015-05-20 17:50:35 +00:00
Pete Cooper 2f1637ad85 Use Intrinsic::ID instead of unsigned. NFC.
This is after LLVM r237810 which made Function::getIntrinsicID() return an Intrinsic::ID.

llvm-svn: 237811
2015-05-20 17:17:45 +00:00
Justin Bogner 98ceec5725 InstrProf: Change this triple back to %itanium_abi_triple
In my rush to fix the linux bots in r237805, I accidentally committed
a change to the triple. Revert that part.

llvm-svn: 237806
2015-05-20 16:25:35 +00:00
Justin Bogner c49e5aadb9 InstrProf: Remove darwin-specific section names from this test
llvm-svn: 237805
2015-05-20 16:21:26 +00:00
Justin Bogner fb29822bf4 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.

Patch by Betul Buyukkurt. Thanks!

llvm-svn: 237804
2015-05-20 16:16:23 +00:00
Justin Bogner 1cd11f159e CodeGen: Remove some trailing whitespace. NFC
llvm-svn: 237802
2015-05-20 15:53:59 +00:00
Alexey Bataev d7589ffe1d [OPENMP] Fix codegen for ordered loop directives.
loops with ordered clause must be generated the same way as dynamic loops, but with static scheduleing.

llvm-svn: 237788
2015-05-20 13:12:48 +00:00
Alexey Bataev 15413ea02b [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

llvm-svn: 237787
2015-05-20 11:57:02 +00:00
Manuel Klimek 9eff8b1426 Allow skipping imports in the module visitor.
Skip imports when we know that we do not need to visit any imports
because we've already deserialized the redecls from a module.

llvm-svn: 237782
2015-05-20 10:29:23 +00:00
Michael Kuperstein 7619004211 [X86] Add _mm256_set_m128 and its 5 variants.
Differential Revision: http://reviews.llvm.org/D9855

llvm-svn: 237778
2015-05-20 07:46:52 +00:00
Yaron Keren 627ba89bb1 Fix CGRecordLayouts description to say it maps clang types not llvm types
and de-duplicate data fields names from comments according to the coding
standard.

llvm-svn: 237776
2015-05-20 07:15:28 +00:00
David Majnemer e95f3bd0fd [clang-cl] Map /GA to -ftls-model=local-exec
The /GA switch informs the compiler that it may assume that all TLS
access refers to the executable's index: 0.

llvm-svn: 237771
2015-05-20 04:39:56 +00:00
Alexey Bataev db39021cee [OPENMP] -fopenmp enables OpenMP support (fix for http://llvm.org/PR23492)
-fopenmp turns on OpenMP support and links libiomp5 as OpenMP library. Also there is -fopenmp={libiomp5|libgomp} option that allows to override effect of -fopenmp and link libgomp library (if -fopenmp=libgomp is specified).
Differential Revision: http://reviews.llvm.org/D9736

llvm-svn: 237769
2015-05-20 04:24:19 +00:00
Alexey Bataev 16dc7b68c4 Fix for aggregate copying of variable length arrays.
Patch fixes codegen for aggregate copying of VLAs. Currently method CodeGenFunction::EmitAggregateCopy() does not support copying of VLAs. Patch checks if the size of the type is 0, then checks if the type is actually a variable-length array. Then it calculates total length for this array and calculates total size of the array in bytes:

<total number of elements in array> * aligned_sizeof(ElementType) (if copy assignment is requested).
If simple copying is requested, size is calculated like:

<total number of elements in array> * aligned_sizeof(ElementType) - aligned_sizeof(ElementType) + sizeof(ElementType).
memcpy() is used with this calculated size of the VLA.
Differential Revision: http://reviews.llvm.org/D9851

llvm-svn: 237768
2015-05-20 03:46:04 +00:00
David Blaikie bf178d3eb7 [opaque pointer type] Pass the explicit call type when creating calls from LazyRuntimeFunctions
The implicit conversion was causing issues for a helper being added that
would take an llvm::Function rather than an llvm::Value to make the
CallInst. Since we'll eventually need to specify the type of the call
explicitly anyway, fix these up to avoid the future ambiguity.

llvm-svn: 237729
2015-05-19 21:31:34 +00:00
Richard Smith 54ef4c3bb3 Revert r237609 for now.
glibc's headers use __need_* macros to selectively export parts of themselves
to each other. This requires us to enter those files repeatedly when building
a glibc module.

This can be unreverted once we have a better mechanism to deal with that
non-modular aspect of glibc (possibly some way to mark a header as "textual if
this macro is defined").

llvm-svn: 237718
2015-05-19 19:58:11 +00:00
Jonathan Roelofs 99bdd98a2b Fix 'CFG graph' typo. NFC
Patch by Jon Eyolfson!

llvm-svn: 237713
2015-05-19 18:51:56 +00:00
Anders Waldenborg b09075a240 clang-format: Add space in function pointers with SpaceBeforeParens=Always
"void (*my_function)(void)" should become "void (*my_function) (void)" when
SpaceBeforeParens is set to 'Always'

Differential Revision: http://reviews.llvm.org/D9835

llvm-svn: 237704
2015-05-19 16:54:26 +00:00
Michael Kuperstein 877f3cbe84 [X86] Add _mm_broadcastsd_pd intrinsic
_mm_broadcastsd_pd is basically an alias for _mm_movedup_pd, however the alias is only available from AVX2 forward.

llvm-svn: 237698
2015-05-19 14:49:14 +00:00
Michael Kuperstein 6168183e04 [X86] Added _mm256_bslli_epi128 and _mm256_bsrli_epi128.
These two intrinsics are alternative names for _mm256_slli_si256 and _mm256_srli_si256, respectively.

llvm-svn: 237693
2015-05-19 13:05:46 +00:00
Alexey Bataev 1d9c15cf18 [OPENMP] Fixed codegen for copying/initialization of array variables/parameters.
This modification generates proper copyin/initialization sequences for array variables/parameters. Before they were considered as pointers, not arrays.

llvm-svn: 237691
2015-05-19 12:31:28 +00:00
Daniel Jasper 9310166a63 clang-format: Improve *-detection.
Before:
  S << a *(10);

After:
  S << a * (10);

This fixes llvm.org/PR16500.

llvm-svn: 237690
2015-05-19 12:29:27 +00:00
Daniel Jasper d6e09e85f9 clang-format: Improve for-loop formatting.
Before:
  for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator I =
           Container.begin(),
                                                          E = Container.end();
       I != E; ++I)

After:
  for (SmallVectorImpl<TemplateIdAnnotationn *>::iterator
           I = Container.begin(),
           E = Container.end();
       I != E; ++I)

This fixes llvm.org/PR23544.

llvm-svn: 237688
2015-05-19 11:51:39 +00:00
Daniel Jasper fa3f8fbed8 clang-format: Support #include_next
Before:
  #include_next < test.h >

After:
  #include_next <test.h>

This fixes llvm.org/PR23500

llvm-svn: 237686
2015-05-19 11:22:29 +00:00
Daniel Jasper f5e5ee6d69 clang-format: Correctly detect casts to qualified types.
Before:
  ns::E f() { return (ns::E) - 1; }

After:
  ns::E f() { return (ns::E)-1; }

This fixes llvm.org/PR23503.

llvm-svn: 237684
2015-05-19 11:18:39 +00:00
Daniel Jasper ed41f774fc clang-format: Fix regression caused by r237244.
Before:
  [call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.
          aaaaaaaa];

After:
  [call aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa.aaaaaaaa
          .aaaaaaaa];

This merely papers over the fact that we aren't parsing ObjC method calls
correctly. Also, the indentation is weird.

llvm-svn: 237681
2015-05-19 11:06:33 +00:00
Alexey Bataev ccb59ec9b5 [OPENMP] Prohibit VLAs in 'private/firstprivate' clauses of 'task' directive.
Currently runtime does not allow to support variably modified types for 'private' and 'firstprivate' clauses in 'task' directives.

llvm-svn: 237674
2015-05-19 08:44:56 +00:00
Alexey Bataev 7a3e5853df [OPENMP] Prohibit variably modified types in 'copyprivate' clause.
Runtime does not allow to work with VLAs in copyprivate clause.

llvm-svn: 237672
2015-05-19 08:19:24 +00:00
Alexey Bataev f120c0d6f2 [OPENMP] Fixed analysis of function arguments and their data sharing attributes.
Added proper analysis for types of function arguments.

llvm-svn: 237670
2015-05-19 07:46:42 +00:00
NAKAMURA Takumi 4bd67d8f46 SemaExprCXX.cpp: Try to fix \param in r237608. [-Wdocumentation]
llvm-svn: 237668
2015-05-19 06:47:23 +00:00
Richard Smith 86dec39c0a PR20073: promote "dereference of 'void*'" from Extension to ExtWarn.
llvm-svn: 237652
2015-05-19 01:41:12 +00:00
David Majnemer fa7bc78e0a [AST] Put VarDeclBitfields on a diet
VarDeclBitfields contained bits which are never present in parameters.
Split these out so that ParmVarDeclBitfields wouldn't grow past 32-bits
if another field was added.

llvm-svn: 237648
2015-05-19 00:57:16 +00:00
Richard Smith 82e57fb1e8 [modules] Support for merging a parsed definition of a static data member of a class template into an imported but hidden definition.
llvm-svn: 237647
2015-05-19 00:49:29 +00:00
David Blaikie 7d9e79249d Fix indentation
llvm-svn: 237631
2015-05-18 22:51:39 +00:00
Reid Kleckner ac385068f9 Revert changes to DefaultABIInfo accidentally introduced in r208733
Also add trivial handling of transparent unions.

PPC32, MSP430, and XCore apparently all rely on DefaultABIInfo. This
should worry you, because DefaultABIInfo is not implementing the rules
of any particular ABI.

Fixes PR23097, patch by Andy Gibbs.

llvm-svn: 237630
2015-05-18 22:46:30 +00:00
David Blaikie 43f9bb7371 API update for streamlining of IRBuilder::CreateCall to just use ArrayRef/initializer_list+braced init
llvm-svn: 237625
2015-05-18 22:14:03 +00:00
Ismail Pazarbasi 8904d6bb17 Added missing 'override' to `ReadMismatchingDeleteExpressions`
llvm-svn: 237613
2015-05-18 20:46:12 +00:00
Richard Smith c7e6ff02d5 [modules] Support for merging a parsed class template specialization definition into an imported but hidden definition.
llvm-svn: 237612
2015-05-18 20:36:47 +00:00
Richard Trieu db36469554 Create new diagnostic group -Wmove
-Wmove includes the three existing warnings for std::move calls, self move,
reduntant move, and pessimizing move.  -Wmove is included in -Wmost, so that
it can be discoverable to people using that or -Wall.

Differential Revision: http://reviews.llvm.org/D9493 

llvm-svn: 237610
2015-05-18 20:25:44 +00:00
Richard Smith 2d4a11fba6 [modules] When a file is listed as a non-textual header in a module map, don't
enter it more than once, even if it doesn't have #include guards -- we already
know that it is intended to have the same effect every time it's included, and
it's already had that effect. This particularly helps with local submodule
visibility builds, where the include guard macro may not be visible in the
includer, but will become visible the moment we enter the included file.

llvm-svn: 237609
2015-05-18 20:02:41 +00:00
Ismail Pazarbasi e5768d1717 Detect uses of mismatching forms of 'new' and 'delete'
Emit warning when operand to `delete` is allocated with `new[]` or
operand to `delete[]` is allocated with `new`.

rev 2 update:
`getNewExprFromInitListOrExpr` should return `dyn_cast_or_null`
instead of `dyn_cast`, since `E` might be null.

Reviewers: rtrieu, jordan_rose, rsmith

Subscribers: majnemer, cfe-commits

Differential Revision: http://reviews.llvm.org/D4661

llvm-svn: 237608
2015-05-18 19:59:11 +00:00
Richard Trieu 1d4911bc99 Have -Wredundant-move ignore reference types.
Don't give a warning when the type being moved is a reference type.  Also
uncomment two lines in the test case.

llvm-svn: 237607
2015-05-18 19:54:08 +00:00
Daniel Jasper 3c883d1dcc clang-format: Fix another regression caused by r237565.
Before:
  class C : test {
    class D : test{void f(){int i{2};
  }
  }
  ;
  }
  ;

After:
  class C : test {
    class D : test {
      void f() { int i{2}; }
    };
  };

llvm-svn: 237569
2015-05-18 14:49:19 +00:00
Daniel Jasper cec9ffd2a2 clang-format: Fix regression introduced by r237565.
Before:
  class C : public D {
    SomeClass SC { 2 };
  };

After:
  class C : public D {
    SomeClass SC{2};
  };

llvm-svn: 237568
2015-05-18 14:12:24 +00:00
Daniel Jasper 47bbda0939 clang-format: Improve detection of macros annotating functions.
Before:
  ASSERT("aaaaaaaaaaaaaaa")
      << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

After:
  ASSERT("aaaaaaaaaaaaaaa") << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                            << bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

Also cleanup implementation a bit and only mark closing parenthesis of
these annotations.

llvm-svn: 237567
2015-05-18 13:47:23 +00:00
Daniel Jasper adba2aadf2 clang-format: Allow braced initializers in template arguments of class
specializations.

Before:
  template <class T>
      struct S < std::is_arithmetic<T> {
  } > {};

After:
  template <class T> struct S<std::is_arithmetic<T>{}> {};

llvm-svn: 237565
2015-05-18 12:52:00 +00:00
Daniel Jasper f090f031bc clang-format: Support function annotations in macros.
Before:
  DEPRECATED("Use NewClass::NewFunction instead.") string
      OldFunction(const string &parameter) {}

After:
  DEPRECATED("Use NewClass::NewFunction instead.")
  string OldFunction(const string &parameter) {}

llvm-svn: 237562
2015-05-18 09:47:22 +00:00
Alexey Bataev 8fc69dcf42 [OPENMP] Fix for '#pragma omp task' codegen.
Internal task structure must be generated like
typedef struct kmp_task {
  void *              shareds;
  kmp_routine_entry_t routine;
  kmp_int32           part_id;
  kmp_routine_entry_t destructors;
} kmp_task_t;

struct kmp_task_t_with_privates {
  kmp_task_t task_data;
  .kmp_private. privates;
};
to avoid possible additional alignment bytes in first fields (shareds, routine, part_id and destructors). Runtime library is not aware of such kind additional alignment bytes.

llvm-svn: 237561
2015-05-18 07:54:53 +00:00
Richard Smith bca31b731b [modules] Move implicit creation of ImportDecls for #includes transformed into module imports from the frontend into Sema where it belongs.
llvm-svn: 237555
2015-05-18 05:35:52 +00:00
David Majnemer 8db9176d68 [clang-cl] Enable C++14 when targeting 2015 compatibility
llvm-svn: 237553
2015-05-18 04:49:30 +00:00
Richard Smith 63b6fcef96 [modules] Refactor and simplify #include handling.
Fix a tiny bug where we'd try to load a module file for the module we're in
the middle of building.

llvm-svn: 237552
2015-05-18 04:45:41 +00:00
NAKAMURA Takumi 74a0022fde clang/test/CodeGenOpenCL/opencl_types.cl: Tweak expressions according to r237548.
With MS mangler, the signature is:

  x86: define void @"\01?bad1@@$$J0YAXPAPAUocl_image1d@@PAPAUocl_image2d@@1@Z"  (%opencl.image1d_t** %b, %opencl.image2d_t** %c, %opencl.image2d_t** %d) nounwind
  x64: define void @"\01?bad1@@$$J0YAXPEAPAUocl_image1d@@PEAPAUocl_image2d@@1@Z"(%opencl.image1d_t** %b, %opencl.image2d_t** %c, %opencl.image2d_t** %d) nounwind

llvm-svn: 237551
2015-05-18 03:58:27 +00:00
Richard Smith a0aafa3853 [modules] If we see a #include that maps to a module, but use of precompiled modules is disabled, track submodule visibility anyway if -fmodules-local-submodule-visibility is enabled. This, in effect, gives modules semantics but without precompilation.
llvm-svn: 237550
2015-05-18 03:52:30 +00:00
Nico Weber effdb198c2 Wrap to 80 columns. No behavior change.
llvm-svn: 237549
2015-05-18 02:41:17 +00:00
David Majnemer 5a7cfea6b4 [MS ABI] Give __attribute__((overloadable)) functions pretty names
It turns out that there is a mangling for 'extern "C"', it's only used
by MSVC in /clr mode.  Co-opt this mangling so that extern "C" functions
marked overloadable get demangled nicely.

llvm-svn: 237548
2015-05-18 00:05:29 +00:00
David Majnemer ab4b4a1968 [MS ABI] Function encodings are always encoded in template arguments
llvm-svn: 237547
2015-05-18 00:05:25 +00:00
Nico Weber 5fb3a4277a Fix confusing indent. No behavior change.
llvm-svn: 237546
2015-05-18 00:00:29 +00:00
Daniel Jasper 0928553eec clang-format: Properly align ObjC string literals.
Before:
  NSString s = @"a"
               "b"
               "c";
  NSString s = @"a"
               @"b"
                @"c";

After:
  NSString s = @"a"
                "b"
                "c";
  NSString s = @"a"
               @"b"
               @"c";

This fixes llvm.org/PR23536.

llvm-svn: 237538
2015-05-17 08:13:23 +00:00
Daniel Jasper 2fd16632bc clang-format: Improve line wrapping around << operators.
Generally, clang-format tries to keep label-value pairs on a single
line for stream operators. However, we should not do that if there is
just a single such pair, as that doesn't help much.

Before:
  llvm::errs() << "aaaaaaaaaaaa: " << aaaaaaa(aaaaaaaaa,
                                              aaaaaaaaa);

After:
  llvm::errs() << "aaaaaaaaaaaa: "
               << aaaaaaa(aaaaaaaaa, aaaaaaaaa);

Also remove old test case that was testing actual behavior any more.

llvm-svn: 237535
2015-05-17 07:27:09 +00:00
Davide Italiano 24e89664cd [Sema] Improve llvm_unreachable() message.
llvm-svn: 237532
2015-05-17 02:27:10 +00:00
Nico Weber 28e0f243cf Don't leak TemplateIds when a plugin parses late-parsed templates at TU end.
In -fdelayed-template-parsing mode, templates that aren't used are not parsed
at all.  For some diagnostic plugins, this is a problem since they want to
analyse the contents of the template function body.  What has been suggested
on cfe-dev [1] is to explicitly parse interesting templates in
HandleTranslationUnit(); IWYU does this for example [2].

This is workable, but since the delayed parsing doesn't run below a call to
ParseTopLevelDecl(), no DestroyTemplateIdAnnotationsRAIIObj object is on the
stack to clean up TemplateIds that are created during parsing.  To fix this,
let ~Parser() clean them up in delayed template parsing mode instead of
leaking (or asserting in +Assert builds).

(r219810, relanded in r220400, fixed the same problem in incremental processing
mode; the review thread of r219810 has a good discussion of the problem.)

To test this, give the PrintFunctionNames plugin a flag to force parsing
of a template and add a test that uses it in -fdelayed-template-parsing mode.
Without the Parser.cpp change, that test asserts.

1: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-August/038415.html
2: https://code.google.com/p/include-what-you-use/source/detail?r=566 
llvm-svn: 237531
2015-05-17 01:07:16 +00:00
Nico Weber d73258a029 Wrap a few comments to 80 columns.
llvm-svn: 237529
2015-05-16 23:49:53 +00:00
Benjamin Kramer b4569fb51f [Sema] Fold array into for-range loop. No functional change intended.
llvm-svn: 237525
2015-05-16 16:16:31 +00:00
Richard Smith 2b63d15f49 [modules] Retain the name as written for umbrella headers and directories, rather than converting to an absolute path. No observable change expected, but this allows us to correctly compute the module for an umbrella header, which later changes will require.
llvm-svn: 237508
2015-05-16 02:28:53 +00:00
Richard Trieu d3967635bc Fix typo from r237482. "to reference of type" --> "to reference to type"
llvm-svn: 237507
2015-05-16 01:39:39 +00:00
Richard Trieu f956a49e6d When emitting a dropped qualifier error, show which qualifiers are dropped.
llvm-svn: 237505
2015-05-16 01:27:03 +00:00
Bill Schmidt 41e14c4dfa [PPC64] Add vector pack/unpack support from ISA 2.07
This patch adds support for the following new instructions in the
Power ISA 2.07:

  vpksdss
  vpksdus
  vpkudus
  vpkudum
  vupkhsw
  vupklsw

These instructions are available through the vec_packs, vec_packsu,
vec_unpackh, and vec_unpackl built-in interfaces.  These are
lane-sensitive instructions, so the built-ins have different
implementations for big- and little-endian, and the instructions must
be marked as killing the vector swap optimization for now.

The first three instructions perform saturating pack operations.  The
fourth performs a modulo pack operation, which means it can be
represented with a vector shuffle, and conversely the appropriate
vector shuffles may cause this instruction to be generated.  The other
instructions are only generated via built-in support for now.

I noticed during patch preparation that the macro __VSX__ was not
previously predefined when the power8-vector or direct-move features
are requested.  This is an error, and I've corrected that here as
well.

Appropriate tests have been added.

There is a companion patch to llvm for the rest of this support.

llvm-svn: 237500
2015-05-16 01:02:25 +00:00
NAKAMURA Takumi e712f0a183 clang/test/SemaCXX/attr-no-sanitize.cpp: Don't mix stdout and stderr for FileCheck.
MSVCRT's stdio doesn't do line buffering.

llvm-svn: 237492
2015-05-16 00:09:39 +00:00
Richard Trieu 0ff51f39de Reverse the order of types in the reference dropping qualifiers error.
The error has the form ... 'int' ... 'const int' ... dropped qualifiers.  At
first glance, it appears that the const qualifier is added.  Reverse the types
so that the second type is less qualified than the first.

llvm-svn: 237482
2015-05-15 22:07:49 +00:00
Peter Collingbourne 9441094249 Use llvm::StringSwitch<std::string> to take advantage of implicit asserting conversion to std::string.
llvm-svn: 237475
2015-05-15 20:11:18 +00:00
Richard Smith 4241314164 [modules] Add local submodule visibility support for declarations.
With this change, enabling -fmodules-local-submodule-visibility results in name
visibility rules being applied to submodules of the current module in addition
to imported modules (that is, names no longer "leak" between submodules of the
same top-level module). This also makes it much safer to textually include a
non-modular library into a module: each submodule that textually includes that
library will get its own "copy" of that library, and so the library becomes
visible no matter which including submodule you import.

llvm-svn: 237473
2015-05-15 20:05:43 +00:00
Peter Collingbourne 915df9968b Implement no_sanitize attribute.
Differential Revision: http://reviews.llvm.org/D9631

llvm-svn: 237463
2015-05-15 18:33:32 +00:00
NAKAMURA Takumi d16af5dfda CGAtomic.cpp: Fix bogus \brief(s). Did you mean "\param"? [-Wdocumentation]
llvm-svn: 237447
2015-05-15 13:47:52 +00:00
Serge Pavlov e7ad831241 Limit set of types instantiated in FindInstantiatedDecl.
Starting from r236426 FindInstantiatedDecl may instantiate types that
are referenced before definition. This change limit the set of types
that can be instantiated by this function.

llvm-svn: 237434
2015-05-15 10:10:28 +00:00
Daniel Jasper 3ca283ada3 clang-format: Slightly change format decisions around macro annotations.
Before:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      GUARDED_BY(aaaaaaaaaaaa) = aaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(aaaaaaaaaaaa) =
      aaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 237430
2015-05-15 09:58:11 +00:00
Daniel Jasper 731dde91db clang-format: Don't use column layout in lists that have separating
comments. At some point, we might to want to a layout with a different
number of columns instead, but at the moment, this causes more
confusion than it's worth.

llvm-svn: 237427
2015-05-15 09:41:59 +00:00
Daniel Jasper cdb58b2e45 clang-format: Add missing space before ObjC selector.
Before:
  [self aaaaa:(1 + 2)bbbbb:3];

After:
  [self aaaaa:(1 + 2) bbbbb:3];

llvm-svn: 237424
2015-05-15 09:05:31 +00:00
Alexey Bataev f0ab553fea [OPENMP] Fixed bug in atomic update/capture/write constructs.
Fixed a bug with codegen for destination atomic l-value with padding and junk in this padding bytes.

llvm-svn: 237422
2015-05-15 08:36:34 +00:00
NAKAMURA Takumi 1a6756bba0 Revert r237385, "[CodeGen] Reuse stack space from unused function results"
It broke clang stage2, at least tblgen.

llvm-svn: 237418
2015-05-15 03:49:05 +00:00
Richard Smith 4caa449ade Refactor: when exposing a definition in some module, provide listeners with the
module rather than requiring them to work it out themselves.

llvm-svn: 237416
2015-05-15 02:34:32 +00:00
Pirama Arumuga Nainar e9bcddd5cb Add flag to enable native half type
Summary:
r235215 enables support in LLVM for legalizing f16 type in the IR.  AArch64
already had support for this.  r235215 and some backend patches brought support
for ARM, X86, X86-64, Mips and Mips64.

This change exposes the LangOption 'NativeHalfType' in the command line, so the
backend legalization can be used if desired.  NativeHalfType is enabled for
OpenCL (current behavior) or if '-fnative-half-type' is set.

Reviewers: olista01, steven_wu, ab

Subscribers: cfe-commits, srhines, aemerson

Differential Revision: http://reviews.llvm.org/D9781

llvm-svn: 237406
2015-05-14 23:44:18 +00:00
David Blaikie f0f00dc33b Fix Clang -Wsequence-point
llvm-svn: 237401
2015-05-14 22:47:19 +00:00
Justin Bogner 682bfbf35f InstrProf: Only disable coverage in built-in macros, not all system macros
The issue I was trying to solve in r236547 was about built-in macros,
but I disabled coverage in all system macros. This is actually a bit
of overkill, and makes the display of coverage around system macros
degrade unnecessarily. Instead, limit this to builtins specifically.

llvm-svn: 237397
2015-05-14 22:14:10 +00:00
Ted Kremenek c004b4d3a1 Tweak availability checking to look through typedef declarations.
llvm-svn: 237396
2015-05-14 22:07:25 +00:00
Diego Novillo c324b92c35 Revert "Detect uses of mismatching forms of 'new' and 'delete'"
This reverts commit 742dc9b6c9686ab52860b7da39c3a126d8a97fbc.

This is generating multiple segfaults in our internal builds.
Test case coming up shortly.

llvm-svn: 237391
2015-05-14 20:57:48 +00:00
Nemanja Ivanovic e97e111af4 Testing for the fix for bug 23429.
Follow-up to commit for revision 236848.
Just a test case for the macro definition under the right CPU/Arch.
One combination was actually missed in the initial fix:
  - powerpc64-unknown-unknown -mcpu=pwr8 (rather than -mcpu=power8).

llvm-svn: 237386
2015-05-14 20:02:24 +00:00
Sergey Dmitrouk 3e96fc08da [CodeGen] Reuse stack space from unused function results
Summary:
Space on stack allocated for unused structures returned by functions was unused
even when it's lifetime didn't intersect with lifetime of any other objects that
could use the same space.

The test added also checks for named and auto objects.  It seems to make sense
to have this all in one place.

Reviewers: aadg, rsmith, rjmccall, rnk

Reviewed By: rnk

Subscribers: asl, cfe-commits

Differential Revision: http://reviews.llvm.org/D9743

llvm-svn: 237385
2015-05-14 19:58:03 +00:00
Richard Smith a462b4c9ac DR295: cv-qualifiers on function types are ignored in C++.
llvm-svn: 237383
2015-05-14 19:10:42 +00:00
Richard Smith 2d5814c2d4 Update cxx_dr_status to latest issues list.
llvm-svn: 237382
2015-05-14 19:07:47 +00:00
Ikhlas Ajbar 03404c14fe Remove unused function HasPICArg().
llvm-svn: 237374
2015-05-14 17:42:20 +00:00
Vladimir Sukharev 85a19e92d7 [ARM] Fix of architecture naming typo
Inspired by James Greenhalgh's catch

Subscribers: cfe-commits

Relates to: http://reviews.llvm.org/rL237349

llvm-svn: 237370
2015-05-14 16:39:01 +00:00
Ismail Pazarbasi 538ef53c13 Detect uses of mismatching forms of 'new' and 'delete'
Emit warning when operand to `delete` is allocated with `new[]` or
operand to `delete[]` is allocated with `new`.

Reviewers: rtrieu, jordan_rose, rsmith

Subscribers: majnemer, cfe-commits

Differential Revision: http://reviews.llvm.org/D4661

llvm-svn: 237368
2015-05-14 16:14:57 +00:00
Ikhlas Ajbar 522e6196f7 Factor out SmallDataThreshold
This patch factors out SmallDataThreshold code.

llvm-svn: 237364
2015-05-14 13:52:08 +00:00
Vladimir Sukharev c6dab75bd4 [ARM] Add v8.1a architecture
Add support for ARMv8.1a architecture. 

Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development

Reviewers: 	jmolloy, rengolin

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8799

llvm-svn: 237349
2015-05-14 08:25:18 +00:00
Kevin Qin 78b8653a84 [AArch64 ACLE] Allow to define poly64_t as 'unsigned long long' on LLP64 system.
This fixes PR23414 as well.

llvm-svn: 237348
2015-05-14 08:18:05 +00:00
NAKAMURA Takumi 55deb26613 clang/test/Frontend/dependency-gen-escaping.c: Appease win32 hosts. Investigating.
FIXME: Do we really emit single \ or escaped \\ along the context with -fms-compatibility -MG?
llvm-svn: 237347
2015-05-14 07:37:35 +00:00
Yaron Keren 129dfbff4a Revert r237339 as sanitizer-ppc64-linux1 does not like it.
Complains:

/home/buildbots/sanitizerslave1/sanitizer-ppc64-1/build/llvm/tools/clang/tools/c-index-test/c-index-test.c:829:30: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat]
                     I, TAK, clang_Cursor_getTemplateArgumentValue(Cursor, I));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm not sure now how this should be fixed. %lld is non-standard
and not accepted by mingw on Windows while PRId64 is bad for this bot.

Is long long longer than 64 bits here? if not, why is PRId64
incompatible with it? something seems wrong.

Probably all the datatypes should be replaced to unsigned or uint64_t
depending upin requirements instead of the non standard long long.

llvm-svn: 237346
2015-05-14 06:53:31 +00:00
David Majnemer 02ddd7f529 [MS ABI] Add support for /Zc:sizedDealloc
llvm-svn: 237344
2015-05-14 05:55:00 +00:00
Yaron Keren e7aad46665 Replace non-standard %lld printf usage with PRId64.
See also r180024.

llvm-svn: 237339
2015-05-14 05:40:50 +00:00
David Majnemer a84a082384 Fix buildbots
llvm-svn: 237338
2015-05-14 05:24:59 +00:00
David Majnemer 1b5baffd73 [MS ABI] __declspec(thread) behaves like thread_local in MSVC 2015
MSVC 2015 changed __declspec(thread) to make it behave like C++11's
thread_local keyword instead of acting similarly to __thread.

llvm-svn: 237337
2015-05-14 05:19:23 +00:00
David Majnemer dd0bed1b2d [AST] hasAttr followed by getAttr isn't efficient
Just use getAttr because we are interested in the attribute's contents.

llvm-svn: 237336
2015-05-14 05:19:20 +00:00
David Majnemer 87b853c5f0 [clang-cl] Add /Qvec and /Qvec- to control vectorization
llvm-svn: 237335
2015-05-14 05:19:17 +00:00
NAKAMURA Takumi 01477e5d6a clang/test/Frontend/dependency-gen-escaping.c: Tweak r237296, to let '/' and '\\' distinguishd, to unbreak "--host=linux --target=msvc".
llvm-svn: 237333
2015-05-14 04:25:54 +00:00
Richard Smith 31d5184dc5 Generalize future keyword compat diagnostics.
This, in preparation for the introduction of more new keywords in the
implementation of the C++ language, generalizes the support for future keyword
compat diagnostics (e.g., diag::warn_cxx11_keyword) by extending the
applicability of the relevant property in IdentifierTable with appropriate
renaming.

Patch by Hubert Tong!

llvm-svn: 237332
2015-05-14 04:00:59 +00:00
Richard Smith dbbc523639 [modules] Rearrange preprocessor module visibility handling, no observable change intended.
llvm-svn: 237331
2015-05-14 02:25:44 +00:00
Richard Smith 08abfa3aa9 Add missing #include, found by modules build.
llvm-svn: 237326
2015-05-14 01:08:58 +00:00
Richard Smith d0782a69ff [modules] Work around PR23521 to fix -O0 modules bootstrap.
llvm-svn: 237325
2015-05-14 01:08:08 +00:00
Richard Smith 23d8d0338e [modules] Fix a #include cycle when building a module for our builtin headers.
xmmintrin.h includes emmintrin.h and vice versa if SSE2 is enabled. We break
this cycle for a modules build, and instead make the xmmintrin.h module
re-export the immintrin.h module. Also included is a fix for an assert in the
serialization code if a module exports another module that was declared later
in the same module map.

llvm-svn: 237321
2015-05-14 00:45:20 +00:00
Richard Smith a0334a9277 Fix a #include cycle in the libclang headers. "Eventually" is now.
llvm-svn: 237320
2015-05-14 00:22:12 +00:00
Paul Robinson fcdf3e9fe7 Break \# in a depfile the same way as gcc.
Backslash followed by # in a filename should have both characters
escaped, if you do it the way GNU Make wants.  GCC doesn't, so we do
it the way GCC does rather than the way GNU Make wants.

llvm-svn: 237304
2015-05-13 22:33:50 +00:00
Peter Collingbourne 470d94247d Make GNUInline consistent with whether we use traditional GNU inline semantics.
Previously we were setting LangOptions::GNUInline (which controls whether we
use traditional GNU inline semantics) if the language did not have the C99
feature flag set. The trouble with this is that C++ family languages also
do not have that flag set, so we ended up setting this flag in C++ modes
(and working around it in a few places downstream by also checking CPlusPlus).

The fix is to check whether the C89 flag is set for the target language,
rather than whether the C99 flag is cleared. This also lets us remove most
CPlusPlus checks. We continue to test CPlusPlus when deciding whether to
pre-define the __GNUC_GNU_INLINE__ macro for consistency with GCC.

There is a change in semantics in two other places
where we weren't checking both CPlusPlus and GNUInline
(FunctionDecl::doesDeclarationForceExternallyVisibleDefinition and
FunctionDecl::isInlineDefinitionExternallyVisible), but this change seems to
put us back into line with GCC's semantics (test case: test/CodeGen/inline.c).

While at it, forbid -fgnu89-inline in C++ modes, as GCC doesn't support it,
it didn't have any effect before, and supporting it just makes things more
complicated.

Differential Revision: http://reviews.llvm.org/D9333

llvm-svn: 237299
2015-05-13 22:07:22 +00:00
Paul Robinson 64441def58 Fix dependency file escaping.
When writing a dependency (.d) file, if space or # is immediately
preceded by one or more backslashes, escape the backslashes as well as
the space or # character. Otherwise leave backslash alone.
This straddles the fence between BSD Make (which does no escaping at
all, and does not support space or # in filespecs) and GNU Make (which
does support escaping, but will fall back to the filespec as-written
if the escaping doesn't match an existing file).

Differential Revision: http://reviews.llvm.org/D9208

llvm-svn: 237296
2015-05-13 21:18:15 +00:00
Aaron Ballman d43f0c5e82 Made considerable updates to the documentation explaining how to add a new attribute to clang. Cleans up some of the existing wording, as well as adding new information and better explanations.
llvm-svn: 237268
2015-05-13 18:06:48 +00:00
Yaron Keren f428fcfaa0 Silence Visual C++ warning C4189: 'Result' : local variable is initialized but not referenced.
Sadly, LLVM_ATTRIBUTE_UNUSED does nothing with Visual C++ which means
we'll have to workaround such cases again and again.

llvm-svn: 237267
2015-05-13 17:56:46 +00:00
Daniel Jasper c4144ea418 clang-format: Improve nested block / lambda indentation when wrapping
before binary/ternary operators.

Basically, it doesn't seem right to indent a nested block aligned to a
binary or ternary operator.

Before:
  int i = aaaaaa ? 1  //
                 : [] {
                   return 2;  //
                 }();
  llvm::errs() << "number of twos is "
               << std::count_if(v.begin(), v.end(), [](int x) {
                 return x == 2;  // force break
               });

After:
  int i = aaaaaa ? 1  //
                 : [] {
                     return 2;  //
                   }();
  llvm::errs() << "number of twos is "
               << std::count_if(v.begin(), v.end(), [](int x) {
                    return x == 2;  // force break
                  });

llvm-svn: 237263
2015-05-13 16:09:21 +00:00
Daniel Jasper 3a26a8db5d clang-format: Fix incorrect */& classification.
Before:
  void f() { f(new a(), c *d); }

After:
  void f() { f(new a(), c * d); }

llvm-svn: 237249
2015-05-13 12:54:30 +00:00
Daniel Jasper e60cba1337 clang-format: Fix semicolon less macro-detection.
It was fooled by the comment.

Before:
  SOME_UNRELATED_MACRO
      /*static*/ int i;

After:
  SOME_UNRELATED_MACRO
  /*static*/ int i;

llvm-svn: 237246
2015-05-13 11:35:53 +00:00
Daniel Jasper a7b142603d clang-format: [ObjC] Further improve wrapping of methods calls without inputs.
Before:
  [aaaaaaaaaaaaaaaaaaaaaaa
      .aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa] aaaaaaaaaaaaaaaaaaaaaa];

After:
  [aaaaaaaaaaaaaaaaaaaaaaa.aaaaaaaa[aaaaaaaaaaaaaaaaaaaaa]
      aaaaaaaaaaaaaaaaaaaaaa];

llvm-svn: 237244
2015-05-13 10:23:03 +00:00
Alexey Bataev d130fd17f1 [OPENMP] Fixed codegen for firstprivate variables, also marked as lastprivate.
In some rare cases shared copies of lastprivate/firstprivate variables were not updated after the loop directive.

llvm-svn: 237243
2015-05-13 10:23:02 +00:00
Daniel Jasper a2a4d9c049 clang-format: [ObjC] Make IndentWrappedFunctionNames work with ObjC functions
llvm-svn: 237241
2015-05-13 09:38:25 +00:00
Daniel Jasper 0ad2814c89 clang-format: Prefer formatting local lambdas like functions.
Before:
  auto my_lambda =
      [](const string &some_parameter) { return some_parameter.size(); };

After:
  auto my_lambda = [](const string &some_parameter) {
    return some_parameter.size();
  };

llvm-svn: 237235
2015-05-13 08:47:16 +00:00
Daniel Jasper 60c270764e clang-format: Support column layout with comment after {.
Before:
  vector<int> iiiiiiiiiiiiiii = {                      //
      1111111111, 2222222222, 33333333333, 4444444444, //
      111111111, 222222222, 3333333333, 444444444,     //
      11111111, 22222222, 333333333, 44444444};

After:
  vector<int> iiiiiiiiiiiiiii = {                      //
      1111111111, 2222222222, 33333333333, 4444444444, //
      111111111,  222222222,  3333333333,  444444444,  //
      11111111,   22222222,   333333333,   44444444};

llvm-svn: 237233
2015-05-13 08:16:00 +00:00
Eric Fiselier 7aa0d4aac3 Have '__have_extension(cxx_variadic_templates)' return true for any C++ standard.
llvm-svn: 237202
2015-05-12 22:37:23 +00:00
Richard Smith b2974fd3ce Add missing #includes, found by modules build.
llvm-svn: 237194
2015-05-12 21:48:00 +00:00
Richard Trieu 1d3b58e317 Add a new error for unexpected semi-colon before closing delimiter.
Previously, if a semi-colon is unexpectedly added before a closing ')', ']' or
'}', two errors and one note would emitted, and the parsing would get confused
to which scope it was in.  This change consumes the semi-colon, recovers
parsing better, and emits only one error with a fix-it.

llvm-svn: 237192
2015-05-12 21:36:35 +00:00
Justin Bogner 3dda83f03a InstrProf: Update name of compiler-rt routine for setting filename
Patch by Teresa Johnson.

llvm-svn: 237187
2015-05-12 21:23:16 +00:00
Douglas Katzman 78d7c54f7c clang-format AllocateTarget. NFC
llvm-svn: 237183
2015-05-12 21:18:10 +00:00
Richard Smith c62fe69cc8 List Alexey Bataev as code owner for Clang's OpenMP support, as discussed offline.
Thanks for all your hard work getting us OpenMP feature-complete, Alexey!

llvm-svn: 237171
2015-05-12 20:29:41 +00:00
Artem Belevich ed0577cc6d Fixed double-free in case of module loading error.
GetOutputStream() owns the stream it returns pointer to and the
pointer should never be freed by us. When we fail to load and exit
early, unique_ptr still holds the pointer and frees it which leads to
compiler crash when CompilerInstance attempts to free it again.

Added regression test for failed bitcode linking.

Differential Revision: http://reviews.llvm.org/D9625

llvm-svn: 237159
2015-05-12 17:44:15 +00:00
Sunil Srivastava 3acf6275e6 Changed renaming of local symbols by inserting a dot vefore the numeric suffix
details in http://reviews.llvm.org/D9483
goes with llvm checkin r237150

llvm-svn: 237151
2015-05-12 16:48:43 +00:00
Manuel Klimek 328263e4d8 Fix clang-format build from the solution; the underlying path has changed to include the VS directory structure.
llvm-svn: 237136
2015-05-12 14:41:39 +00:00
Yaron Keren eac8a1e328 Remove superfluous SmallString cast.
llvm-svn: 237123
2015-05-12 12:47:05 +00:00
Nikola Smiljanic fb891fcef6 Fix misleading parameter name for PPCallbacks::FileSkipped.
Patch thanks to Vladimir Voskresensky.

llvm-svn: 237115
2015-05-12 11:48:05 +00:00
Daniel Jasper 56807c19ac clang-format: Make member introduced in r237108 const.
llvm-svn: 237114
2015-05-12 11:14:06 +00:00
Renato Golin cb3b0c6eeb Change TargetParser enum names to avoid macro conflicts (clang)
sys/time.h on Solaris (and possibly other systems) defines "SEC" as "1"
using a cpp macro.  The result is that this fails to compile.

Fixes https://llvm.org/PR23482

llvm-svn: 237113
2015-05-12 10:34:10 +00:00
Daniel Jasper 99b5a4648c clang-format: Fix */& detection for lambdas in macros.
Before:
  #define MACRO() [](A * a) { return 1; }

After:
  #define MACRO() [](A *a) { return 1; }

llvm-svn: 237109
2015-05-12 10:20:32 +00:00
Daniel Jasper 5fc133e71e clang-format: Fix hanging nested blocks in macros.
Before:
  #define MACRO()                     \
    Debug(aaa, /* force line break */ \
          {                           \
      int i;                          \
      int j;                          \
          })

After:
  #define MACRO()                     \
    Debug(aaa, /* force line break */ \
          {                           \
            int i;                    \
            int j;                    \
          })

llvm-svn: 237108
2015-05-12 10:16:02 +00:00
Manuel Klimek 3d3ea84a4f Refactor clang-format's formatter.
Summary:
a) Pull out a class LevelIndentTracker whose responsibility is to keep track
   of the indent of levels across multiple annotated lines.
b) Put all responsibility for merging lines into the LineJoiner; make the
   LineJoiner iterate over the lines so we never operate on a line that might
   be merged later; this makes the interface safer to use.
c) Move formatting of the end-of-file whitespace into formatFirstToken.

Fix bugs that became obvious after the refactoring:
1. We would not format lines with offsets correctly inside nested blocks if
   only the outer expression was affected:
   int x = s({ // clang-format only this line
     class X {
       public:
    // ^ this starts at the non-modified indnent level; previously we would
    //   not fix this, now we correctly outdent it.
       void f();
     };
   });
2. We would incorrectly align comments across lines that do not have comments
   for lines with nested blocks:
   int expression; // with comment
   int x = s({
     int y; // comment
     int z; // we would incorrectly align this comment with the comment on
            // 'expression'
   });

llvm-svn: 237104
2015-05-12 09:23:57 +00:00
Alexey Bataev 0c024df9d1 [OPENMP] Allow using of threadprivate variables as loop-control variables in lop based directives.
llvm-svn: 237102
2015-05-12 09:02:07 +00:00
Alexey Bataev 040d540940 [OPENMP] Fixed support for 'schedule' clause with non-constant chunk size.
'schedule' clause for combined directives requires additional processing. Special helper variable is generated, that is captured in the outlined parallel region for 'parallel for' region. This captured variable is used to store chunk expression from the 'schedule' clause in this 'parallel for' region.

llvm-svn: 237100
2015-05-12 08:35:28 +00:00
Justin Bogner 2fd95f6b92 Driver: Fix a -Wshadow issue from r237091
The MachO toolchain has an isTargetIOSBased method, but it isn't
virtual so it isn't very meaningful to call it. After thinking about
this, I guess that putting this logic in the MachO class is a bit of a
layering violation anyway. Do this more like how we handle
AddLinkRuntimeLibArgs instead.

llvm-svn: 237095
2015-05-12 06:30:48 +00:00
Justin Bogner c7701240ed Re-apply "Driver: Make profiling flags work with -nostdlib on Darwin"
This time without a stray "true" in an argument list.

This reverts r237077, restoring r237074.

llvm-svn: 237091
2015-05-12 05:44:36 +00:00
Kostya Serebryany 123e3eb0be revert r237081 -- bad idea (-lcrypt may not be present)
llvm-svn: 237086
2015-05-12 03:10:42 +00:00
Kostya Serebryany 5c79fda912 add -lcrypto to clang and clang-format fuzzers (lib/Fuzzer will soon require it)
llvm-svn: 237081
2015-05-12 01:29:04 +00:00
Eric Christopher 9e172d20f0 Remove the code that pulled soft float attributes out of the feature
strings and remove the setting of TargetOptions::UseSoftFloat to
match the code change in llvm r237079.

llvm-svn: 237080
2015-05-12 01:26:21 +00:00
Justin Bogner 7b6c0e02ac Revert "Driver: Make profiling flags work with -nostdlib on Darwin"
This revert r237074. These tests are failing all over the place.

llvm-svn: 237077
2015-05-12 01:04:33 +00:00
Justin Bogner f44ddae71e Driver: Make profiling flags work with -nostdlib on Darwin
Compiler-rt's Profiling library isn't part of the stdlib, so -nostdlib
shouldn't prevent it from being linked. This makes Darwin behave like
other toolchains, and link in the profile runtime irrespective of
-nostdlib, since the resulting program can't be run unless you link
this.

I've also added a test to show that other toolchains already behave
like this.

llvm-svn: 237074
2015-05-12 00:31:33 +00:00
Steven Wu 18bbe191cd Allow empty assembly string literal with -fno-gnu-inline-asm
Empty assembly string will not introduce assembly code in the output
binary and it is often used as a trick in the header to disable
optimizations. It doesn't conflict with the purpose of the option so it
is allowed with -fno-gnu-inline-asm flag.

llvm-svn: 237073
2015-05-12 00:16:37 +00:00
Eric Christopher 5eaf3815c0 Update initialization of a class variable and comment.
llvm-svn: 237071
2015-05-12 00:04:20 +00:00
James Dennett 570043310e Typo fix: s/initialzier/initializer/ in a doc comment.
No functional change.

llvm-svn: 237068
2015-05-11 23:25:54 +00:00
Richard Smith b0b68010c5 PR20625: Instantiate static constexpr member function of a local struct in a function template earlier.
This is necessary in order to allow the use of a constexpr member function, or
a member function with deduced return type, of a local class within a
surrounding instantiated function template specialization.

Patch by Michael Park!

This re-commits r236063, which was reverted in r236134, along with a fix for a
delayed template parsing bug that was exposed by this change.

llvm-svn: 237064
2015-05-11 23:09:06 +00:00
Peter Collingbourne bf59c34bfd Move sanitizer parser and group expander from Driver to Basic.
No functional change.

Differential Revision: http://reviews.llvm.org/D9621

llvm-svn: 237056
2015-05-11 21:39:20 +00:00
Peter Collingbourne 3eea677f3a Unify sanitizer kind representation between the driver and the rest of the compiler.
No functional change.

Differential Revision: http://reviews.llvm.org/D9618

llvm-svn: 237055
2015-05-11 21:39:14 +00:00
Steven Wu 6b72a6753b Allow AsmLabel with -fno-gnu-inline-asm
Summary:
AsmLabel is heavily used in system level and firmware to redirect
function and access platform specific labels. They are also extensively
used in system headers which makes this option unusable for many
users. Since AsmLabel doesn't introduce any assembly code into the
output binary, it shouldn't be considered as inline-asm.

Reviewers: bob.wilson, rnk

Reviewed By: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D9679

llvm-svn: 237048
2015-05-11 21:14:09 +00:00
Artem Belevich e958275250 [cuda] Fixed test case failure on s390x
llvm-svn: 237007
2015-05-11 18:35:58 +00:00
Richard Barton ad25da87b5 Revert "Allow -target= and --target options"
After mailing list discussion on 11-13 March we would prefer to stick to a
single spelling of the long option.

This reverts commit 30035fe1a7c759c89ee62eb46efce6b3790fcc08.

llvm-svn: 237003
2015-05-11 17:05:05 +00:00
Douglas Katzman f36dddf426 [Sparc] Add support for 'sparcel' to clang.
Differential Revision: http://reviews.llvm.org/D8784

llvm-svn: 237001
2015-05-11 15:21:44 +00:00
Daniel Jasper 015c7a91f1 clang-format: Support aligning ObjC string literals.
Before:
  NSString s = @"aaaa"
      @"bbbb";

After:
  NSString s = @"aaaa"
               @"bbbb";

llvm-svn: 237000
2015-05-11 15:15:48 +00:00
Aaron Ballman 416b127456 Disable __has_cpp_attribute when not compiling in C++ mode. As this feature test macro only supports C++ style attributes, it doesn't apply to code compiled as C code, and can lead to diagnostics when given a scoped attribute.
This addresses PR23435.

llvm-svn: 236996
2015-05-11 14:09:50 +00:00
Daniel Jasper d9ff035de8 clang-format: Appease the buildbots by including climits.
llvm-svn: 236995
2015-05-11 13:52:13 +00:00
Daniel Jasper d57843d4e3 clang-format: Improve column layout.
Specifically, calculate the deviation between the shortest and longest
element (which is used to prevent excessive whitespace) per column, not
overall. This automatically handles the corner cases of a single column
and a single row so that the actualy implementation becomes simpler.

Before:
  vector<int> x = {1,
                   aaaaaaaaaaaaaaaaaaaaaa,
                   2,
                   bbbbbbbbbbbbbbbbbbbbbb,
                   3,
                   cccccccccccccccccccccc};

After:
  vector<int> x = {1, aaaaaaaaaaaaaaaaaaaaaa,
                   2, bbbbbbbbbbbbbbbbbbbbbb,
                   3, cccccccccccccccccccccc};

llvm-svn: 236992
2015-05-11 13:35:40 +00:00
Daniel Jasper 790d4f975e clang-format: Don't merge subsequent lines into _asm blocks.
Before:
  _asm {
  } int i;

After:
  _asm {
  }
  int i;

llvm-svn: 236985
2015-05-11 11:59:46 +00:00
Daniel Jasper ec05fc7b16 clang-format: [JS] Clean up export declaration parsing.
NFC intended.

llvm-svn: 236982
2015-05-11 09:14:50 +00:00
Elena Demikhovsky 23fccde1b1 AVX-512: Changed CC parameter in "cmp" intrinsic
from i8 to i32 according to the Intel Spec

llvm-svn: 236980
2015-05-11 09:03:41 +00:00
Daniel Jasper 668c7bb34f clang-format: [JS] Parse exported functions as free-standing.
Before:
  export function foo() {} export function bar() {}

After:
  export function foo() {
  }
  export function bar() {
  }

llvm-svn: 236978
2015-05-11 09:03:10 +00:00
Daniel Marjamaki ecb0e1bc60 Refactor MacroInfo so range for loops can be used to iterate its tokens.
Differential Revision: http://reviews.llvm.org/D9079

llvm-svn: 236975
2015-05-11 08:25:54 +00:00
Manuel Klimek d3585dbd1a Refactor the formatter of clang-format.
Pull various parts of the UnwrappedLineFormatter into their own
abstractions. NFC.

There are two things left for subsequent changes (to keep this
reasonably small)
- the UnwrappedLineFormatter now has a bad name
- the UnwrappedLineFormatter::format function is still too large

llvm-svn: 236974
2015-05-11 08:21:35 +00:00
David Majnemer b710a938d6 Give isCompatibleWithMSVC a better interface
We now use an enum which maps the marketing name (almost always a year)
to the major version number.

llvm-svn: 236967
2015-05-11 03:57:49 +00:00
David Majnemer 30f058aa9d [MS ABI] Import move assignment operators
MSVC 2015 changed behavior from 2013; it imports move assignment
operators.

llvm-svn: 236966
2015-05-11 03:00:22 +00:00
Jonathan Roelofs 6800293701 Fix indentation problem introduced in r236964. NFC
llvm-svn: 236965
2015-05-11 02:13:24 +00:00
Jonathan Roelofs e868b624da Fix formatting of a few code blocks. NFC
llvm-svn: 236964
2015-05-11 02:05:20 +00:00
David Majnemer e60813f91f [MS ABI] Form member pointers from virtual funcs overriding vbases
We didn't supporting taking the address of virtual member functions
which overrode a method in a virtual base.  We simply need to encode the
virtual base index in the member pointer.

This fixes PR23452.

N.B.  There is no data member pointer side to this change because taking
the address of a virtual bases' data member gives you a member pointer
whose type is derived from the virtual bases' type, not the most derived
type.

llvm-svn: 236962
2015-05-10 21:48:08 +00:00
David Majnemer fb6ffca6f8 [MS ABI] Update EH emission for MSVC 2015 compatibility
MSVC 2015 renamed the symbol found by name lookup for 'std::terminate'
so we cannot rely on using '?terminate@@YAXXZ'.  Furthermore, it seems
that 2015 will be the first release of MSVC which permits inlining a
function which is noexcept into a function which isn't.  This is
implemented by creating a cleanup for the invoker which jumps to
__std_terminate.  Clang's implementation of this aspect of the MSVC
scheme is slightly less efficient in this respect because we use a
catch handler configured as a catch-all handler instead.

llvm-svn: 236961
2015-05-10 21:38:26 +00:00
Daniel Jasper 173504e494 clang-format: Improve wrapping of << operators.
Before:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                      aaaaaaaaaaaaaaaa) << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  llvm::errs() << aaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
                      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                      aaaaaaaaaaaaaaaa)
               << aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;

Also, cleanup and simplify the operator wrapping logic.

llvm-svn: 236960
2015-05-10 21:15:07 +00:00
Craig Topper 382277421d De-virtualize some const versions of getCanonicalDecl by redirecting to the non-const version. Most of the Decl hierarchy already did it this way this just makes the rest consistent.
llvm-svn: 236959
2015-05-10 18:40:12 +00:00