]> granicus.if.org Git - clang/log
clang
9 years agoAdd Hardware Transactional Memory (HTM) Support
Kit Barton [Wed, 25 Mar 2015 19:41:41 +0000 (19:41 +0000)]
Add Hardware Transactional Memory (HTM) Support

This patch adds Hardware Transaction Memory (HTM) support supported by ISA 2.07
(POWER8). The intrinsic support is based on GCC one [1], with both 'PowerPC HTM
Low Level Built-in Functions' and 'PowerPC HTM High Level Inline Functions'
implemented.

Along with builtins a new driver switch is added to enable/disable HTM
instruction support (-mhtm) and a header with common definitions (mostly to
parse the TFHAR register value). The HTM switch also sets a preprocessor builtin
HTM.

The HTM usage requires a recently newer kernel with PPC HTM enabled. Tested on
powerpc64 and powerpc64le.

This is send along a llvm patch to enabled the builtins and option switch.

[1]
https://gcc.gnu.org/onlinedocs/gcc/PowerPC-Hardware-Transactional-Memory-Built-in-Functions.html

Phabricator Review: http://reviews.llvm.org/D8248

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233205 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCreate android x86_32 and x86_64 target info
Tamas Berghammer [Wed, 25 Mar 2015 10:38:50 +0000 (10:38 +0000)]
Create android x86_32 and x86_64 target info

On android x86_32 the long double is only 64 bits (compared to 80 bits
on linux x86_32) and on android x86_64 the long double is IEEEquad
(compared to x87DoubleExtended on linux x86_64). This CL creates new
TargetInfo classes for this targets to represent these differences.

Differential revision: http://reviews.llvm.org/D8357

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233177 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTemporarily disable one more non-determinism flag.
Daniel Jasper [Wed, 25 Mar 2015 06:59:19 +0000 (06:59 +0000)]
Temporarily disable one more non-determinism flag.

This turned the bots to red after r233172 which reverted r233156.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233173 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "[Modules] When writing out the on-disk hash table for the decl context lookup...
Rafael Espindola [Wed, 25 Mar 2015 04:43:15 +0000 (04:43 +0000)]
Revert "[Modules] When writing out the on-disk hash table for the decl context lookup tables, we need to establish a stable ordering for constructing the hash table. This is trickier than it might seem."

This reverts commit r233156. It broke the bots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233172 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInstrProf: Handle whitespace and comments at the ends of macros
Justin Bogner [Wed, 25 Mar 2015 04:13:49 +0000 (04:13 +0000)]
InstrProf: Handle whitespace and comments at the ends of macros

When we try to find the end loc for a token, we have to re-lex the
token. This was running into a problem when we'd store the end loc of
a macro's coverage region, since we wouldn't actually be at the
beginning of a token when we tried to re-lex it, leading us to do
silly things (and eventually assert) when whitespace or comments
followed.

This pushes our use of getPreciseTokenLocEnd earlier, so that we won't
call it when it doesn't make sense to. It also removes an unnecessary
adjustment by 1 that was working around this problem in some cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233169 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Modules] Disable the diff of the merged module, there is still some
Chandler Carruth [Wed, 25 Mar 2015 01:30:02 +0000 (01:30 +0000)]
[Modules] Disable the diff of the merged module, there is still some
non-determinism here, I just got lucky a bunch of times on my system.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233163 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Modules] Make the DeclUpdates map be processed in insertion order.
Chandler Carruth [Wed, 25 Mar 2015 01:02:12 +0000 (01:02 +0000)]
[Modules] Make the DeclUpdates map be processed in insertion order.

This fixes my stress tests non-determinism so far. However, I've not
started playing with templates, friends, or terrible macros. I've found
at least two more seeming instabilities and am just waiting for a test
case to actually trigger them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233162 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDiagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints
Ehsan Akhgari [Wed, 25 Mar 2015 00:53:33 +0000 (00:53 +0000)]
Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints

Summary: Follow-up to the fix of PR22075.

Reviewers: rsmith

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233161 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDiagnose declspecs occuring after virt-specifier-seq and generate fixit hints
Ehsan Akhgari [Wed, 25 Mar 2015 00:53:27 +0000 (00:53 +0000)]
Diagnose declspecs occuring after virt-specifier-seq and generate fixit hints

Summary: This fixes PR22075.

Reviewers: rsmith

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233160 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Modules] When writing out the on-disk hash table for the decl context
Chandler Carruth [Wed, 25 Mar 2015 00:34:51 +0000 (00:34 +0000)]
[Modules] When writing out the on-disk hash table for the decl context
lookup tables, we need to establish a stable ordering for constructing
the hash table. This is trickier than it might seem.

Most of these cases are easily handled by sorting the lookup results
associated with a specific name that has an identifier. However for
constructors and conversion functions, the story is more complicated.
Here we need to merge all of the constructors or conversion functions
together and this merge needs to be stable. We don't have any stable
ordering for either constructors or conversion functions as both would
require a stable ordering across types.

Instead, when we have constructors or conversion functions in the
results, we reconstruct a stable order by walking the decl context in
lexical order and merging them in the order their particular declaration
names are encountered. This doesn't generalize as there might be found
declaration names which don't actually occur within the lexical context,
but for constructors and conversion functions it is safe. It does
require loading the entire decl context if necessary to establish the
ordering but there doesn't seem to be a meaningful way around that.

Many thanks to Richard for talking through all of the design choices
here. While I wrote the code, he guided all the actual decisions about
how to establish the order of things.

No test case yet because the test case I have doesn't pass yet -- there
are still more sources of non-determinism. However, this is complex
enough that I wanted it to go into its own commit in case it causes some
unforseen issue or needs to be reverted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233156 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix obviously broken assertion, NFC
Reid Kleckner [Tue, 24 Mar 2015 23:46:25 +0000 (23:46 +0000)]
Fix obviously broken assertion, NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233138 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CodeGen] Support native half inc/dec amounts.
Ahmed Bougacha [Tue, 24 Mar 2015 23:44:42 +0000 (23:44 +0000)]
[CodeGen] Support native half inc/dec amounts.

We previously defaulted to long double, but it's also possible to have
a half inc/dec amount, when LangOpts NativeHalfType is set.
Currently, that's only true for OpenCL.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233135 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Modules] Stop creating timestamps for the modules cache and trying to
Chandler Carruth [Tue, 24 Mar 2015 21:44:25 +0000 (21:44 +0000)]
[Modules] Stop creating timestamps for the modules cache and trying to
prune it when we have disabled implicit module generation and thus are
not using any cached modules.

Also update a test of explicitly generated modules to pass this CC1 flag
correctly.

This fixes an issue where Clang was dropping files into the source tree
while running its tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233117 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Modules] Start making explicit modules produce deterministic output.
Chandler Carruth [Tue, 24 Mar 2015 21:18:10 +0000 (21:18 +0000)]
[Modules] Start making explicit modules produce deterministic output.

There are two aspects of non-determinism fixed here, which was the
minimum required to cause at least an empty module to be deterministic.

First, the random number signature is only inserted into the module when
we are building modules implicitly. The use case for these random
signatures is to work around the very fact that modules are not
deterministic in their output when working with the implicitly built and
populated module cache. Eventually this should go away entirely when
we're confident that Clang is producing deterministic output.

Second, the on-disk hash table is populated based on the order of
iteration over a DenseMap. Instead, use a MapVector so that we can walk
it in insertion order.

I've added a test that an empty module, when built twice, produces the
same binary PCM file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233115 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdding back a CHECK that works with r233110
Sanjay Patel [Tue, 24 Mar 2015 20:42:20 +0000 (20:42 +0000)]
Adding back a CHECK that works with r233110

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233111 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemoving a CHECK that is about to go wrong.
Sanjay Patel [Tue, 24 Mar 2015 20:35:24 +0000 (20:35 +0000)]
Removing a CHECK that is about to go wrong.

I'm about to commit a patch for:
http://reviews.llvm.org/D8567

That patch will break this one existing test case in Clang.
I'm not sure if this file is intending to create a Clang
dependency on the LLVM IR optimizer, but that's the
consequence of specifying -O3 on this test file.

My hope is to avoid buildbot rage by removing this check,
committing the LLVM patch, and then fixing this check.
I don't know how to make a simultaneous commit to Clang
and LLVM.

I will commit the correct CHECK line fix for this test
shortly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233109 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Objective-C diagnostic PATCH] Accept and ignore -Wreceiver-is-weak
Fariborz Jahanian [Tue, 24 Mar 2015 17:14:20 +0000 (17:14 +0000)]
[Objective-C diagnostic PATCH] Accept and ignore -Wreceiver-is-weak
warning until Xcode removes the warning setting.
rdar://20262140

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233093 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoTrack the source location of the dot or arrow operator in a MemberExpr.
Aaron Ballman [Tue, 24 Mar 2015 15:07:53 +0000 (15:07 +0000)]
Track the source location of the dot or arrow operator in a MemberExpr.

Patch by Joe Ranieri!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233085 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReverting r233023 -- it caused test failures on Windows with MSVC x86.
Aaron Ballman [Tue, 24 Mar 2015 13:51:13 +0000 (13:51 +0000)]
Reverting r233023 -- it caused test failures on Windows with MSVC x86.

http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/572

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233082 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Diagnose declspecs occuring after virt-specifier-seq and generate fixit hints"
Ehsan Akhgari [Tue, 24 Mar 2015 13:25:26 +0000 (13:25 +0000)]
Revert "Diagnose declspecs occuring after virt-specifier-seq and generate fixit hints"

This reverts commit 2131e63e2fdff7c831ab3bfe31facf2e3ebab03d.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233074 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit...
Ehsan Akhgari [Tue, 24 Mar 2015 13:25:23 +0000 (13:25 +0000)]
Revert "Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints"

This reverts commit 49079d45966a3f57cd82edb35bde2e8e88fccf40.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233073 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDiagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints
Ehsan Akhgari [Tue, 24 Mar 2015 13:02:50 +0000 (13:02 +0000)]
Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints

Summary: Follow-up to the fix of PR22075.

Reviewers: rsmith

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233070 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDiagnose declspecs occuring after virt-specifier-seq and generate fixit hints
Ehsan Akhgari [Tue, 24 Mar 2015 13:02:47 +0000 (13:02 +0000)]
Diagnose declspecs occuring after virt-specifier-seq and generate fixit hints

Summary: This fixes PR22075.

Reviewers: rsmith

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233069 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[analyzer] Remove unused function. No functional change intended.
Benjamin Kramer [Tue, 24 Mar 2015 11:11:11 +0000 (11:11 +0000)]
[analyzer] Remove unused function. No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233060 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMake header standalone, it uses memset and memcmp.
Benjamin Kramer [Tue, 24 Mar 2015 11:11:05 +0000 (11:11 +0000)]
Make header standalone, it uses memset and memcmp.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233059 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSilence unused warning in non-assert builds.
Daniel Jasper [Tue, 24 Mar 2015 08:06:38 +0000 (08:06 +0000)]
Silence unused warning in non-assert builds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233053 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] Deserialize CXXCtorInitializer list for a constructor lazily.
Richard Smith [Tue, 24 Mar 2015 06:36:48 +0000 (06:36 +0000)]
[modules] Deserialize CXXCtorInitializer list for a constructor lazily.

Previously we'd deserialize the list of mem-initializers for a constructor when
we deserialized the declaration of the constructor. That could trigger a
significant amount of unnecessary work (pulling in all base classes
recursively, for a start) and was causing problems for the modules buildbot due
to cyclic deserializations. We now deserialize these on demand.

This creates a certain amount of duplication with the handling of
CXXBaseSpecifiers; I'll look into reducing that next.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233052 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoA couple of readASTFileSignature improvements (NFC)
Ben Langmuir [Tue, 24 Mar 2015 04:43:52 +0000 (04:43 +0000)]
A couple of readASTFileSignature improvements (NFC)

* Strength reduce a std::function to a function pointer,
* Factor out checking the AST file magic number,
* Add a brief doc comment to readAStFileSignature

Thanks to Chandler for spotting these oddities.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233050 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] More removal of unnecessary deserialization of lexical decls.
Richard Smith [Tue, 24 Mar 2015 02:49:55 +0000 (02:49 +0000)]
[modules] More removal of unnecessary deserialization of lexical decls.

Even if we have no external visible declarations, we may still have external
lexical decls that lookup() would import to fill its lookup table. It's simpler
and faster to always take the no-deserialization path through noload_lookup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233046 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoWhen looking for lexical decls from an external source, check all contexts
Richard Smith [Tue, 24 Mar 2015 02:44:20 +0000 (02:44 +0000)]
When looking for lexical decls from an external source, check all contexts
rather than just the primary context. This is technically correct but results
in no functionality change (in Clang nor LLDB) because all users of this
functionality only use it on single-context DCs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233045 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCleanup: no need to pass DefinitionKind into ParseCXXInlineMethodDef
Eli Bendersky [Mon, 23 Mar 2015 23:49:41 +0000 (23:49 +0000)]
Cleanup: no need to pass DefinitionKind into ParseCXXInlineMethodDef

All ParseCXXInlineMethodDef does with it is assign it on the ParsingDeclarator.
Since that is passed in as well, the (single) caller may as well set the
DefinitionKind, thus simplifying the code.

No change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233043 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[UBSan] Use shared library for UBSan on OS X (Clang part).
Alexey Samsonov [Mon, 23 Mar 2015 23:14:05 +0000 (23:14 +0000)]
[UBSan] Use shared library for UBSan on OS X (Clang part).

Summary:
UBSan is now used in the same way as ASan, and is supported on
OSX and on iOS simulator. At the moment ASan and UBSan can't be used
together due to PR21112, but I hope to resolve it soon by
embedding UBSan into ASan.

Test Plan: regression test suite.

Reviewers: zaks.anna, kubabrecka

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233035 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRecord correct source range for defaulted/deleted members.
Eli Bendersky [Mon, 23 Mar 2015 21:43:28 +0000 (21:43 +0000)]
Record correct source range for defaulted/deleted members.

Fixes https://llvm.org/bugs/show_bug.cgi?id=20744

struct A {

A() = default;
};

Previously the source range of the declaration of A ended at the ')'. It should
include the '= default' part as well. The same for '= delete'.

Note: this will break one of the clang-tidy fixers, which is going to be
addessed in a follow-up patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233028 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: lambda call operators are instance methods and should use thiscall
Reid Kleckner [Mon, 23 Mar 2015 21:16:49 +0000 (21:16 +0000)]
MS ABI: lambda call operators are instance methods and should use thiscall

Fixes an issue reported by Daniel Berenyi on cfe-dev.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233023 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[SDK modernizer PATCH]. Fixes a bug whereby a call to super
Fariborz Jahanian [Mon, 23 Mar 2015 20:52:26 +0000 (20:52 +0000)]
[SDK modernizer PATCH]. Fixes a bug whereby a call to super
was not converted to property-dot syntax by removing an unused
code. rdar://19140267

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233019 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[cmake] Clang's install should install clang/Config/config.h
Chris Bieneman [Mon, 23 Mar 2015 20:43:21 +0000 (20:43 +0000)]
[cmake] Clang's install should install clang/Config/config.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233016 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdds a warning for unrecognized argument to #pragma comment() on PS4.
Yunzhong Gao [Mon, 23 Mar 2015 20:41:42 +0000 (20:41 +0000)]
Adds a warning for unrecognized argument to #pragma comment() on PS4.

PS4 target recognizes the #pragma comment() syntax as in -fms-extensions, but
only handles the case of #pragma comment(lib). This patch adds a warning if any
other arguments are encountered.

This patch also refactors the code in ParsePragma.cpp a little bit to make it
more obvious that some codes are being shared between -fms-extensions and PS4.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233015 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[UBSan] Introduce "ubsan_standalone" library (Clang part).
Alexey Samsonov [Mon, 23 Mar 2015 20:05:42 +0000 (20:05 +0000)]
[UBSan] Introduce "ubsan_standalone" library (Clang part).

Get rid of "libclang_rt.san" library that used to contain
sanitizer_common pieces required by UBSan if it's used in a standalone
mode. Instead, build two variants of UBSan runtime: "ubsan" and
"ubsan_standalone" (same for "ubsan_cxx" and "ubsan_standalone_cxx").

Later "ubsan" and "ubsan_cxx" libraries will go away, as they will
embedded it into corresponding ASan runtimes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233010 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] Fix an iterator invalidation bug found by the modules selfhost bot.
Richard Smith [Mon, 23 Mar 2015 19:54:56 +0000 (19:54 +0000)]
[modules] Fix an iterator invalidation bug found by the modules selfhost bot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233007 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMake Oveflow tracking more legible (CR feedback from Richard Smith on r232999)
David Blaikie [Mon, 23 Mar 2015 19:54:44 +0000 (19:54 +0000)]
Make Oveflow tracking more legible (CR feedback from Richard Smith on r232999)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233006 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: Simplify boolean expresssions in lib/Lex
David Blaikie [Mon, 23 Mar 2015 19:39:19 +0000 (19:39 +0000)]
Refactor: Simplify boolean expresssions in lib/Lex

Simplify boolean expressions using `true` and `false` with `clang-tidy`

Patch by Richard Thomson.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232999 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix and update comments and a small reformatting.
Eric Christopher [Mon, 23 Mar 2015 19:26:05 +0000 (19:26 +0000)]
Fix and update comments and a small reformatting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232997 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRefactor: Simplify boolean expressions in libclang
Dmitri Gribenko [Mon, 23 Mar 2015 19:23:50 +0000 (19:23 +0000)]
Refactor: Simplify boolean expressions in libclang

Simplify boolean expresions using true and false with clang-tidy.

Patch by Richard.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232996 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoExplicitly include raw_ostream.h instead of relying on transitive inclusion.
Benjamin Kramer [Mon, 23 Mar 2015 18:05:43 +0000 (18:05 +0000)]
Explicitly include raw_ostream.h instead of relying on transitive inclusion.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232975 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CodeGen] Properly support the half FP type with non-native operations.
Ahmed Bougacha [Mon, 23 Mar 2015 17:54:16 +0000 (17:54 +0000)]
[CodeGen] Properly support the half FP type with non-native operations.

On AArch64, the -fallow-half-args-and-returns option is the default.
With it, the half type is considered legal (rather than the i16 used
normally for __fp16), but no operation is, except conversions and
load/stores and such.

The previous behavior was tantamount to saying LangOpts.NativeHalfType
was implied by LangOpts.HalfArgsAndReturns, which isn't true.
Instead, teach the various parts of CodeGen that already know about
half (using the intrinsics or not) about this weird in-between case,
where the "half" type is legal, but operations on it aren't.

This is a smaller intermediate step to the end-goal of removing the
intrinsic, always using "half", and letting the backend legalize.

Builds on r232968.
rdar://20045970, rdar://17468714
Differential Revision: http://reviews.llvm.org/D8367

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232971 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[CodeGen] Convert double -> __fp16 in one step.
Ahmed Bougacha [Mon, 23 Mar 2015 17:48:07 +0000 (17:48 +0000)]
[CodeGen] Convert double -> __fp16 in one step.

Fix the CodeGen so that for types bigger than float, instead of
converting to fp16 via the sequence "InTy -> float -> fp16", we
perform conversions in just one step.  This avoids the double
rounding which potentially changes results from a natural
IEEE-754 operation.

rdar://17594379, rdar://17468714
Differential Revision: http://reviews.llvm.org/D4602
Part of: http://reviews.llvm.org/D8367

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232968 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoOpenMPClause.h: Fix typo in \param. [-Wdocumentation]
NAKAMURA Takumi [Mon, 23 Mar 2015 16:05:50 +0000 (16:05 +0000)]
OpenMPClause.h: Fix typo in \param. [-Wdocumentation]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232956 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[tooling] Move ArgumentsAdjustingCompilations into an anonymous namespace.
Benjamin Kramer [Mon, 23 Mar 2015 12:47:15 +0000 (12:47 +0000)]
[tooling] Move ArgumentsAdjustingCompilations into an anonymous namespace.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232947 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMove private classes into anonymous namespaces
Benjamin Kramer [Mon, 23 Mar 2015 12:31:05 +0000 (12:31 +0000)]
Move private classes into anonymous namespaces

Also merge anonymous namespaces in Targets.cpp a bit. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232945 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agohandle armeb/thumb/thumbeb consistently in gnutools::Assemble::ConstructJob
Scott Douglass [Mon, 23 Mar 2015 10:54:24 +0000 (10:54 +0000)]
handle armeb/thumb/thumbeb consistently in gnutools::Assemble::ConstructJob

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232940 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoConvert cascading if-else-if to switch. NFC
Scott Douglass [Mon, 23 Mar 2015 10:46:28 +0000 (10:46 +0000)]
Convert cascading if-else-if to switch. NFC

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232939 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Fixed test for 'single' directive codegen.
Alexey Bataev [Mon, 23 Mar 2015 06:40:37 +0000 (06:40 +0000)]
[OPENMP] Fixed test for 'single' directive codegen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232933 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] Codegen for 'copyprivate' clause ('single' directive).
Alexey Bataev [Mon, 23 Mar 2015 06:18:07 +0000 (06:18 +0000)]
[OPENMP] Codegen for 'copyprivate' clause ('single' directive).

If there is at least one 'copyprivate' clause is associated with the single directive, the following code is generated:

```
i32 did_it = 0;                                  \\ for 'copyprivate' clause
if(__kmpc_single(ident_t *, gtid)) {
  SingleOpGen();
  __kmpc_end_single(ident_t *, gtid);
  did_it = 1;                                    \\ for 'copyprivate' clause
}
<copyprivate_list>[0] = &var0;
...
<copyprivate_list>[n] = &varn;
call __kmpc_copyprivate(ident_t *, gtid, <copyprivate_list_size>,
                        <copyprivate_list>, <copy_func>, did_it);

...

void<copy_func>(void *LHSArg, void *RHSArg) {
  Dst = (void * [n])(LHSArg);
  Src = (void * [n])(RHSArg);
  Dst[0] = Src[0];
  ... Dst[n] = Src[n];
}
```
All list items from all 'copyprivate' clauses are gathered into single <copyprivate list> (<copyprivate_list_size> is a size in bytes of this list) and <copy_func> is used to propagate values of private or threadprivate variables from the 'single' region to other implicit threads from outer 'parallel' region.
Differential Revision: http://reviews.llvm.org/D8410

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232932 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Add CodeGen support for adding cpu attributes on functions based on"
Daniel Jasper [Mon, 23 Mar 2015 05:52:28 +0000 (05:52 +0000)]
Revert "Add CodeGen support for adding cpu attributes on functions based on"

This breaks CodeGen for an internal target. I'll get repro instructions
to you.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232930 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] Remove redundant import of lexical decls when building a lookup table
Richard Smith [Mon, 23 Mar 2015 03:25:59 +0000 (03:25 +0000)]
[modules] Remove redundant import of lexical decls when building a lookup table
for a DeclContext, and fix propagation of exception specifications along
redeclaration chains.

This reverts r232905, r232907, and r232907, which reverted r232793, r232853,
and r232853.

One additional change is present here to resolve issues with LLDB: distinguish
between whether lexical decls missing from the lookup table are local or are
provided by the external AST source, and still look in the external source if
that's where they came from.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232928 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[ASTMatchers] Factor wrapping matcher classes into a common base class.
Benjamin Kramer [Sun, 22 Mar 2015 21:57:53 +0000 (21:57 +0000)]
[ASTMatchers] Factor wrapping matcher classes into a common base class.

The deduplication here is negligible, but it allows the compiler to
skip emission of many templated base class destructors. Shrinks
clang-query by 53k. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232924 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Analyzer] Don't inherit from FoldingSet.
Benjamin Kramer [Sun, 22 Mar 2015 18:16:22 +0000 (18:16 +0000)]
[Analyzer] Don't inherit from FoldingSet.

That's not really necessary here. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232921 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUpdate unit test for r232916.
Benjamin Kramer [Sun, 22 Mar 2015 16:05:46 +0000 (16:05 +0000)]
Update unit test for r232916.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232918 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[multilib] Turn virtual functor into functin_ref
Benjamin Kramer [Sun, 22 Mar 2015 15:56:12 +0000 (15:56 +0000)]
[multilib] Turn virtual functor into functin_ref

And update code to use lambdas where possible, plus random cleanup. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232916 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd a dump function to Stmt that takes only an output stream. No functionality change.
Faisal Vali [Sun, 22 Mar 2015 13:35:56 +0000 (13:35 +0000)]
Add a dump function to Stmt that takes only an output stream.  No functionality change.

This allows dumping to any given output stream but without requiring a SourceManager, similar to the interface provided by Decl.

It's useful when writing certain generic debug functions, external to the clang code base (for e.g.).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232912 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove empty files left behind by r232907.
Benjamin Kramer [Sun, 22 Mar 2015 10:08:31 +0000 (10:08 +0000)]
Remove empty files left behind by r232907.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232909 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReverting 232853 and 232870 because they depend on 232793,
Vince Harron [Sun, 22 Mar 2015 08:47:07 +0000 (08:47 +0000)]
Reverting 232853 and 232870 because they depend on 232793,
which was reverted because it was causing LLDB test failures

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232907 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Implement driver-level support for thread-safe statics
David Majnemer [Sun, 22 Mar 2015 08:39:22 +0000 (08:39 +0000)]
MS ABI: Implement driver-level support for thread-safe statics

Decide whether or not to use thread-safe statics depending on whether or
not we have an explicit request from the driver.  If we don't have an
explicit request, infer which behavior to use depending on the
compatibility version we are targeting.

N.B. CodeGen support is still ongoing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232906 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoReverting r232793 until some new LLDB failures are discussed
Vince Harron [Sun, 22 Mar 2015 05:59:59 +0000 (05:59 +0000)]
Reverting r232793 until some new LLDB failures are discussed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232905 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago-Wdynamic-class-memaccess: Also warn about array types.
Nico Weber [Sat, 21 Mar 2015 17:56:44 +0000 (17:56 +0000)]
-Wdynamic-class-memaccess: Also warn about array types.

It looks like not warning on this was an oversight in the original
implementation of this warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232900 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDedent code for -Wdynamic-class-memaccess warning. No behavior change.
Nico Weber [Sat, 21 Mar 2015 17:37:46 +0000 (17:37 +0000)]
Dedent code for -Wdynamic-class-memaccess warning. No behavior change.

The diff looks intimidating, but this just moves the -Wdynamic-class-memaccess
code out a scope, protected by a

    if (PointeeTy == QualType())
      continue;

check so that it still only runs when it should.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232899 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoSmall test fix for r232890
Alexander Musman [Sat, 21 Mar 2015 11:49:27 +0000 (11:49 +0000)]
Small test fix for r232890

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232893 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[OPENMP] CodeGen of the 'linear' clause for the 'omp simd' directive.
Alexander Musman [Sat, 21 Mar 2015 10:12:56 +0000 (10:12 +0000)]
[OPENMP] CodeGen of the 'linear' clause for the 'omp simd' directive.
The linear variable is privatized (similar to 'private') and its
value on current iteration is calculated, similar to the loop
counter variables.
Differential revision: http://reviews.llvm.org/D8375

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232890 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd CodeGen support for adding cpu attributes on functions based on
Eric Christopher [Sat, 21 Mar 2015 06:15:15 +0000 (06:15 +0000)]
Add CodeGen support for adding cpu attributes on functions based on
the target-cpu, if different from the triple's cpu, and
target-features as they're written that are passed down from the
driver.

Together with LLVM r232885 this should allow the LTO'ing of binaries
that contain modules compiled with different code generation options
on a subset of architectures with full backend support (x86, powerpc,
aarch64).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232888 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] When either redecl chain merging or an update record causes us to
Richard Smith [Sat, 21 Mar 2015 00:58:54 +0000 (00:58 +0000)]
[modules] When either redecl chain merging or an update record causes us to
give an exception specification to a declaration that didn't have an exception
specification in any of our imported modules, emit an update record ourselves.
Without this, code importing the current module would not see an exception
specification that we could see and might have relied on.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232870 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoOnly add -fno-rtti if KernelOrKext or in C++ mode.
Filipe Cabecinhas [Fri, 20 Mar 2015 23:51:15 +0000 (23:51 +0000)]
Only add -fno-rtti if KernelOrKext or in C++ mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232869 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't claim exception related arguments when looking at RTTIMode
Filipe Cabecinhas [Fri, 20 Mar 2015 23:33:23 +0000 (23:33 +0000)]
Don't claim exception related arguments when looking at RTTIMode

Summary:
We were claiming the -f*exceptions arguments when looking for the
RTTIMode. This makes us not warn about unused arguments if compiling a C
file with -fcxx-exceptions.

This patch fixes it by not claiming the exception-related arguments at
that point.

Reviewers: rsmith, samsonov

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232860 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agofixed vperm2* intrinsics to check for shuffles
Sanjay Patel [Fri, 20 Mar 2015 22:37:20 +0000 (22:37 +0000)]
fixed vperm2* intrinsics to check for shuffles

This corresponds to llvm r232852:
http://reviews.llvm.org/rL232852

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232857 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] Remove temporary IdentifierInfo lookup results when we're done with them.
Richard Smith [Fri, 20 Mar 2015 21:56:50 +0000 (21:56 +0000)]
[modules] Remove temporary IdentifierInfo lookup results when we're done with them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232853 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[analyzer] RetainCountChecker: Don't assume +0 for ivars backing readonly properties.
Jordan Rose [Fri, 20 Mar 2015 21:12:27 +0000 (21:12 +0000)]
[analyzer] RetainCountChecker: Don't assume +0 for ivars backing readonly properties.

Similarly, don't assume +0 if the property's setter is manually implemented.
In both cases, if the property's ownership is explicitly written, then we /do/
assume the ivar has the same ownership.

rdar://problem/20218183

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232849 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoUpdate for llvm api change.
Rafael Espindola [Fri, 20 Mar 2015 20:00:30 +0000 (20:00 +0000)]
Update for llvm api change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232843 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[UBSan] Don't allow to use UBSan with anything except for ASan.
Alexey Samsonov [Fri, 20 Mar 2015 18:45:06 +0000 (18:45 +0000)]
[UBSan] Don't allow to use UBSan with anything except for ASan.

We are not able to make a reliable solution for using UBSan together
with other sanitizers with runtime support (and sanitizer_common).
Instead, we want to follow the path used for LSan: have a "standalone"
UBSan tool, and plug-in UBSan that would be explicitly embedded into
specific sanitizers (in short term, it will be only ASan).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232829 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Accept calls to an unprototyped declaration of _setjmp
David Majnemer [Fri, 20 Mar 2015 17:03:35 +0000 (17:03 +0000)]
MS ABI: Accept calls to an unprototyped declaration of _setjmp

This fixes PR22961.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232824 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[MSVC] Explicit specializations can be declared in any namespace (fix for http:/...
Alexey Bataev [Fri, 20 Mar 2015 07:21:46 +0000 (07:21 +0000)]
[MSVC] Explicit specializations can be declared in any namespace (fix for http://llvm.org/PR13738)

MS compiler emits no errors in case of explicit specializations outside declaration enclosing namespaces, even when language extensions are disabled.
The patch is to suppress errors and emit extension warnings if explicit specializations are not declared in the corresponding namespaces.
This fixes PR13738.

Patch by Alexey Frolov.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232800 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoInstrProf: Make profile variables private to reduce binary size overhead
Justin Bogner [Fri, 20 Mar 2015 06:34:38 +0000 (06:34 +0000)]
InstrProf: Make profile variables private to reduce binary size overhead

When we instrument a program for profiling, we copy the linkage of an
instrumented function so that our datastructures merge in the same way
as the function. This avoids redundant copies for things like
linkonce, but ends up emitting names we never need to reference for
normal and internal symbols. Promoting internal and external linkage
to private for these variables reduces the size overhead of profiling
drastically.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232799 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[modules] Remove some redundant work when building a lookup table for a DeclContext.
Richard Smith [Fri, 20 Mar 2015 02:17:21 +0000 (02:17 +0000)]
[modules] Remove some redundant work when building a lookup table for a DeclContext.

When we need to build the lookup table for a DeclContext, we used to pull in
all lexical declarations for the context; instead, just build a lookup table
for the local lexical declarations. We previously didn't guarantee that the
imported declarations would be in the returned map, but in some cases we'd
happen to put them all in there regardless. Now we're even lazier about this.

This unnecessary work was papering over some other bugs:

 - LookupVisibleDecls would use the DC for name lookups in the TU in C, and
   this was not guaranteed to find all imported names (generally, the DC for
   the TU in C is not a reliable place to perform lookups). We now use an
   identifier-based lookup mechanism for this.

 - We didn't actually load in the list of eagerly-deserialized declarations
   when importing a module (so external definitions in a module wouldn't be
   emitted by users of those modules unless they happened to be deserialized
   by the user of the module).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232793 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDebugInfo: Check for null before using DIType
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 00:53:40 +0000 (00:53 +0000)]
DebugInfo: Check for null before using DIType

A WIP patch to turn on stricter `DIDescriptor` accessor checks fires
here; it's obvious from the code that `T` can be null, so add an
explicit check.  Caught by dozens of current testcases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232791 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoC++14: Disable sized deallocation by default due to ABI breakage
Reid Kleckner [Fri, 20 Mar 2015 00:31:07 +0000 (00:31 +0000)]
C++14: Disable sized deallocation by default due to ABI breakage

There are no widely deployed standard libraries providing sized
deallocation functions, so we have to punt and ask the user if they want
us to use sized deallocation. In the future, when such libraries are
deployed, we can teach the driver to detect them and enable this
feature.

N3536 claimed that a weak thunk from sized to unsized deallocation could
be emitted to avoid breaking backwards compatibility with standard
libraries not providing sized deallocation. However, this approach and
other variations don't work in practice.

With the weak function approach, the thunk has to have default
visibility in order to ensure that it is overridden by other DSOs
providing sized deallocation. Weak, default visibility symbols are
particularly expensive on MachO, so John McCall was considering
disabling this feature by default on Darwin. It also changes behavior
ELF linking behavior, causing certain otherwise unreferenced object
files from an archive to be pulled into the link.

Our second approach was to use an extern_weak function declaration and
do an inline conditional branch at the deletion call site. This doesn't
work because extern_weak only works on MachO if you have some archive
providing the default value of the extern_weak symbol. Arranging to
provide such an archive has the same challenges as providing the symbol
in the standard library. Not to mention that extern_weak doesn't really
work on COFF.

Reviewers: rsmith, rjmccall

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232788 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAllow -fsanitize-coverage with -fsanitize=dataflow
Kostya Serebryany [Fri, 20 Mar 2015 00:06:52 +0000 (00:06 +0000)]
Allow -fsanitize-coverage with -fsanitize=dataflow

Summary: Allow -fsanitize-coverage with -fsanitize=dataflow

Test Plan: check-clang

Reviewers: pcc

Reviewed By: pcc

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232787 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDon't crash-on-valid when an inline function is friend of class template
David Majnemer [Fri, 20 Mar 2015 00:02:27 +0000 (00:02 +0000)]
Don't crash-on-valid when an inline function is friend of class template

We assumed that the most recent declaration of an inline function would
also be inline.  However, a more recent declaration can come from a
friend declaration in a class template that is instantiated at the
definition of the function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232786 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoClang follow-up to LLVM r232772
Duncan P. N. Exon Smith [Thu, 19 Mar 2015 22:43:38 +0000 (22:43 +0000)]
Clang follow-up to LLVM r232772

-verify-di is dead! Long live -verify!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232779 91177308-0d34-0410-b5e6-96231b3b80d8

9 years ago[Modules] Implement __builtin_isinf_sign in Clang.
Chandler Carruth [Thu, 19 Mar 2015 22:39:51 +0000 (22:39 +0000)]
[Modules] Implement __builtin_isinf_sign in Clang.

Somehow, we never managed to implement this fully. We could constant
fold it like crazy, including constant folding complex arguments, etc.
But if you actually needed to generate code for it, error.

I've implemented it using the somewhat obvious lowering. Happy for
suggestions on a more clever way to lower this.

Now, what you might ask does this have to do with modules? Fun story. So
it turns out that libstdc++ actually uses __builtin_isinf_sign to
implement std::isinf when in C++98 mode, but only inside of a template.
So if we're lucky, and we never instantiate that, everything is good.
But once we try to instantiate that template function, we need this
builtin. All of my customers at least are using C++11 and so they never
hit this code path.

But what does that have to do with modules? Fun story. So it turns out
that with modules we actually observe a bunch of bugs in libstdc++ where
their <cmath> header clobbers things exposed by <math.h>. To fix these,
we have to provide global function definitions to replace the macros
that C99 would have used. And it turns out that ::isinf needs to be
implemented using the exact semantics used by the C++98 variant of
std::isinf. And so I started to fix this bug in libstdc++ and ceased to
be able to compile libstdc++ with Clang.

The yaks are legion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232778 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMS ABI: Implement the MSVC 2015 scheme for scope disambiguation
David Majnemer [Thu, 19 Mar 2015 21:54:30 +0000 (21:54 +0000)]
MS ABI: Implement the MSVC 2015 scheme for scope disambiguation

consider C++ that looks like:
  inline int &f(bool b) {
    if (b) {
      static int i;
      return i;
    }
    static int i;
    return i;
  }

Both 'i' variables must have distinct (and stable) names for linkage
purposes.  The MSVC 2013 ABI would number the variables using a count of
the number of scopes that have been created.  However, the final 'i'
returns to a scope that has already been created leading to a mangling
collision.

MSVC 2015 fixes this by giving the second 'i' the name it would have if
it were declared before the 'if'.  However, this results in ABI breakage
because the mangled name, in cases where there was no ambiguity, would
now be different.

We implement the new behavior and only enable it if we are targeting the
MSVC 2015 ABI, otherwise the old behavior will be used.

This fixes PR18131.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232766 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoCorrect typos in C11 generic-selection expressions.
Kaelyn Takata [Thu, 19 Mar 2015 20:56:07 +0000 (20:56 +0000)]
Correct typos in C11 generic-selection expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232760 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove unused diagnostic.
Benjamin Kramer [Thu, 19 Mar 2015 19:44:37 +0000 (19:44 +0000)]
Remove unused diagnostic.

Unused since r231851.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232751 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd -Wpartial-availability.
Nico Weber [Thu, 19 Mar 2015 19:18:22 +0000 (19:18 +0000)]
Add -Wpartial-availability.

This warns when using decls that are not available on all deployment targets.
For example, a call to

  - (void)ppartialMethod __attribute__((availability(macosx,introduced=10.8)));

will warn if -mmacosx-version-min is set to less than 10.8.

To silence the warning, one has to explicitly redeclare the method like so:

  @interface Whatever(MountainLionAPI)
  - (void)ppartialMethod;
  @end

This way, one cannot accidentally call a function that isn't available
everywhere.  Having to add the redeclaration will hopefully remind the user
to add an explicit respondsToSelector: call as well.

Some projects build against old SDKs to get this effect, but building against
old SDKs suppresses some bug fixes -- see http://crbug.com/463171 for examples.
The hope is that SDK headers are annotated well enough with availability
attributes that new SDK + this warning offers the same amount of protection
as using an old SDK.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232750 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRemove .CUDAIsDevice flags from CodeGenOpts as it's already
Artem Belevich [Thu, 19 Mar 2015 18:58:18 +0000 (18:58 +0000)]
Remove .CUDAIsDevice flags from CodeGenOpts as it's already
available in LangOpts.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232749 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix -ast-dump of dependent new and delete exprs
Reid Kleckner [Thu, 19 Mar 2015 18:47:47 +0000 (18:47 +0000)]
Fix -ast-dump of dependent new and delete exprs

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232748 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoIgnore device-side asm constraint errors while compiling CUDA code for host and vice...
Artem Belevich [Thu, 19 Mar 2015 18:40:25 +0000 (18:40 +0000)]
Ignore device-side asm constraint errors while compiling CUDA code for host and vice versa.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232747 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoAdd -ast-dump support for new and delete expressions to help figure out which operato...
Reid Kleckner [Thu, 19 Mar 2015 18:09:25 +0000 (18:09 +0000)]
Add -ast-dump support for new and delete expressions to help figure out which operator got selected

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232740 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoFix incremental linking with ninja and CMake 3.2+, see LLVM r232662 for details
Reid Kleckner [Thu, 19 Mar 2015 17:45:12 +0000 (17:45 +0000)]
Fix incremental linking with ninja and CMake 3.2+, see LLVM r232662 for details

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232739 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoEnsure that we still parse preprocessed CUDA files as CUDA when we use
Artem Belevich [Thu, 19 Mar 2015 17:32:06 +0000 (17:32 +0000)]
Ensure that we still parse preprocessed CUDA files as CUDA when we use
-save-temps option.

Summary: Fixes PR22926.

Review: http://reviews.llvm.org/D8383

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232737 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoRevert "Improvement on sized deallocation from r230160"
Reid Kleckner [Thu, 19 Mar 2015 17:03:58 +0000 (17:03 +0000)]
Revert "Improvement on sized deallocation from r230160"

This reverts commit r230580.

extern_weak functions don't appear to work on Darwin (PR22951), so we'll
need to come up with a new approach.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232731 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoDevirtualize Attr and all subclasses.
Benjamin Kramer [Thu, 19 Mar 2015 16:06:49 +0000 (16:06 +0000)]
Devirtualize Attr and all subclasses.

We know all subclasses in tblgen so just generate a giant switch for
the few virtual methods or turn them into a member variable using spare
bits. The giant jump tables aren't pretty but still much smaller than
a vtable for every attribute, shrinking Release+Asserts clang by ~400k.

Also halves the size of the Attr base class. No functional change
intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232726 91177308-0d34-0410-b5e6-96231b3b80d8

9 years agoMove ThreadSafetyReporter into an anonymous namespace. NFC.
Benjamin Kramer [Thu, 19 Mar 2015 14:23:45 +0000 (14:23 +0000)]
Move ThreadSafetyReporter into an anonymous namespace. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232723 91177308-0d34-0410-b5e6-96231b3b80d8