]> granicus.if.org Git - clang/log
clang
8 years ago[analyzer] Improve modeling of ObjC synthesized property setters.
Devin Coughlin [Thu, 18 Feb 2016 19:13:30 +0000 (19:13 +0000)]
[analyzer] Improve modeling of ObjC synthesized property setters.

When modeling a call to a setter for a property that is synthesized to be
backed by an instance variable, don't invalidate the entire instance
but rather only the storage for the updated instance variable itself.

This still doesn't model the effect of the setter completely. It doesn't
bind the set value to the ivar storage location because doing so would cause
the set value to escape, removing valuable diagnostics about potential
leaks of the value from the retain count checker.

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

8 years agoFile missed from r261222
Serge Pavlov [Thu, 18 Feb 2016 16:43:24 +0000 (16:43 +0000)]
File missed from r261222

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

8 years agoAvoid double deletion in Clang driver.
Serge Pavlov [Thu, 18 Feb 2016 16:42:09 +0000 (16:42 +0000)]
Avoid double deletion in Clang driver.

Llvm module object is shared between CodeGenerator and BackendConsumer,
in both classes it is stored as std::unique_ptr, which is not a good
design solution and can cause double deletion error. Usually it does
not occur because in BackendConsumer::HandleTranslationUnit the
ownership of CodeGenerator over the module is taken away. If however
this method is not called, the module is deleted twice and compiler crashes.

As the module owned by BackendConsumer is always the same as CodeGenerator
has, pointer to llvm module can be removed from BackendGenerator.

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

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

8 years agoAdd an AST matcher for real floating-point types. e.g., float, double, long double...
Aaron Ballman [Thu, 18 Feb 2016 16:36:01 +0000 (16:36 +0000)]
Add an AST matcher for real floating-point types. e.g., float, double, long double, but not complex.

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

8 years ago[analyzer] dump_ast_matchers.py: fix replacement regexps
Yury Gribov [Thu, 18 Feb 2016 15:43:56 +0000 (15:43 +0000)]
[analyzer] dump_ast_matchers.py: fix replacement regexps

Patch by Alex Sidorin!

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

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

8 years ago[Parse] Code complete expressions in bracket declarators.
Benjamin Kramer [Thu, 18 Feb 2016 15:30:24 +0000 (15:30 +0000)]
[Parse] Code complete expressions in bracket declarators.

Currently we return no results when completing inside of the brackets in
a 'char foo[]' declaration. Let the generic expression completion code
handle it instead. We could get fancier here (e.g. filter non-constant
expressions in contexts where VLAs are not allowed), but it's a strict
improvement over the existing version.

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

8 years ago[OPENMP] Fix codegen for lastprivate loop counters.
Alexey Bataev [Thu, 18 Feb 2016 13:48:15 +0000 (13:48 +0000)]
[OPENMP] Fix codegen for lastprivate loop counters.

Patch fixes bug with codegen for lastprivate loop counters. Also it may
improve performance for lastprivates calculations in some cases.

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

8 years ago[analyzer] Add --force-analyze-debug-code option to scan-build
Yury Gribov [Thu, 18 Feb 2016 11:08:46 +0000 (11:08 +0000)]
[analyzer] Add --force-analyze-debug-code option to scan-build
to force debug build and hopefully enable more precise warnings.

Static Analyzer is much more efficient when built in debug mode
(-UNDEBUG) so we advice users to enable it manually. This may be
inconvenient in case of large complex projects (think about Linux
distros e.g. Android or Tizen). This patch adds a flag to scan-build
which inserts -UNDEBUG automatically.

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

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

8 years ago[CLANG] [AVX512] [BUILTIN] Adding pmovsx{b|d|w}{w|d|q}{128|256|512} builtin to clang
Michael Zuckerman [Thu, 18 Feb 2016 09:09:34 +0000 (09:09 +0000)]
[CLANG] [AVX512] [BUILTIN] Adding pmovsx{b|d|w}{w|d|q}{128|256|512} builtin to clang

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

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

8 years ago[MSVC] Turn C++ EH on my default
David Majnemer [Thu, 18 Feb 2016 08:15:05 +0000 (08:15 +0000)]
[MSVC] Turn C++ EH on my default

Our support for C++ EH is sufficiently good that it makes sense to
enable support for it out of the box.

While we are here, update the MSVCCompatibility doc.

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

8 years agoSema: provide an extension warning for enable_if
Saleem Abdulrasool [Thu, 18 Feb 2016 06:49:31 +0000 (06:49 +0000)]
Sema: provide an extension warning for enable_if

Clang implements an enable_if attribute as an extension.  Hook up `-Wpedantic`
to issue an extension usage warning when __enable_if__ is used.

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

8 years ago[Parse] Make sure we don't forget to diagnose typos in exprs
David Majnemer [Thu, 18 Feb 2016 06:37:44 +0000 (06:37 +0000)]
[Parse] Make sure we don't forget to diagnose typos in exprs

If ActOn*Op fails, we will forget to diagnose typos in the LHS of
expressions.

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

8 years ago[sanitizer-coverage] allow -fsanitize-coverage=trace-pc w/o any other sanitizer and...
Kostya Serebryany [Thu, 18 Feb 2016 00:49:23 +0000 (00:49 +0000)]
[sanitizer-coverage] allow -fsanitize-coverage=trace-pc w/o any other sanitizer and w/o ...=[func,bb,edge]. This makes this syntax a superset of the GCC's syntax

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

8 years ago[sanitizer-coverage] add a deprecation warning for -fsanitize-coverage=[1234]
Kostya Serebryany [Wed, 17 Feb 2016 23:57:17 +0000 (23:57 +0000)]
[sanitizer-coverage] add a deprecation warning for -fsanitize-coverage=[1234]

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

8 years agoDon't crash w/ a diagnostic range containing a null byte
David Majnemer [Wed, 17 Feb 2016 22:37:45 +0000 (22:37 +0000)]
Don't crash w/ a diagnostic range containing a null byte

We prematurely ended the line at the null byte which caused us to crash
down stream because we tried to reason about columns beyond the end of
the line.

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

8 years agoAdd 'nopartial' qualifier for availability attributes.
Manman Ren [Wed, 17 Feb 2016 22:05:48 +0000 (22:05 +0000)]
Add 'nopartial' qualifier for availability attributes.

An optional nopartial can be placed after the platform name.
int bar() __attribute__((availability(macosx,nopartial,introduced=10.12))

When deploying back to a platform version prior to when the declaration was
introduced, with 'nopartial', Clang emits an error specifying that the function
is not introduced yet; without 'nopartial', the behavior stays the same: the
declaration is `weakly linked`.

A member is added to the end of AttributeList to save the location of the
'nopartial' keyword. A bool member is added to AvailabilityAttr.

The diagnostics for 'nopartial' not-yet-introduced is handled in the same way as
we handle unavailable cases.

Reviewed by Doug Gregor and Jordan Rose.

rdar://23791325

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

8 years ago[modules] Cache 'acceptable decl' lookups for namespaces. In projects with
Richard Smith [Wed, 17 Feb 2016 21:52:44 +0000 (21:52 +0000)]
[modules] Cache 'acceptable decl' lookups for namespaces. In projects with
thousands of modules, each of which declares the same namespace, linearly
scanning the redecl chain looking for a visible declaration (once for each leaf
module, for each use) performs very poorly. Namespace visibility can only
decrease when we leave a module during a module build step, and we never care
*which* visible declaration of a namespace we find, so we can cache this very
effectively.

This results in a 35x speedup on one of our internal build steps (2m -> 3.5s),
but is hard to unit test because it requires a very large number of modules.
Ideas for a test appreciated! No functionality change intended other than the
speedup.

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

8 years ago[sanitizer-coverage] implement -fsanitize-coverage=trace-pc. This is similar to trace...
Kostya Serebryany [Wed, 17 Feb 2016 21:34:43 +0000 (21:34 +0000)]
[sanitizer-coverage] implement -fsanitize-coverage=trace-pc. This is similar to trace-bb, but has a different API. We already use the equivalent flag in GCC for Linux kernel fuzzing. We may be able to use this flag with AFL too

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

8 years ago[CodeGen] Fix an assert in CodeGenFunction::EmitFunctionEpilog
Akira Hatanaka [Wed, 17 Feb 2016 21:09:50 +0000 (21:09 +0000)]
[CodeGen] Fix an assert in CodeGenFunction::EmitFunctionEpilog

The assert is triggered because isObjCRetainableType() is called on the
canonicalized return type that has been stripped of the typedefs and
attributes attached to it. To fix this assert, this commit gets the
original return type from CurCodeDecl or BlockInfo and uses it instead
of the canoicalized type.

rdar://problem/24470031

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

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

8 years agoEnable SafeStack for CloudABI.
Ed Schouten [Wed, 17 Feb 2016 18:56:20 +0000 (18:56 +0000)]
Enable SafeStack for CloudABI.

Summary:
I've got a patchset in my home directory to integrate support for
SafeStack into CloudABI's C library. All of the CloudABI unit tests
still seem to pass. Pretty sweet!

This change adds the necessary changes to Clang to make
-fsanitize=safe-stack work on CloudABI. Without it, passing this command
line flag throws an error.

Reviewers: eugenis, samsonov

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

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

8 years agoCorrect more typos in conditional expressions
David Majnemer [Wed, 17 Feb 2016 17:19:00 +0000 (17:19 +0000)]
Correct more typos in conditional expressions

We didn't correctly handle some edge cases, causing us to bail out
before correcting all the typos.

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

8 years ago[OPENMP] Fix tests incompatibility with ARM buildbots.
Alexey Bataev [Wed, 17 Feb 2016 15:36:39 +0000 (15:36 +0000)]
[OPENMP] Fix tests incompatibility with ARM buildbots.

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

8 years ago[OPENMP 4.5] Codegen support for data members in 'firstprivate' clause.
Alexey Bataev [Wed, 17 Feb 2016 13:19:37 +0000 (13:19 +0000)]
[OPENMP 4.5] Codegen support for data members in 'firstprivate' clause.

Added codegen for captured data members in non-static member functions.

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

8 years ago[OpenCL] Added half type literal with suffix h.
Anastasia Stulova [Wed, 17 Feb 2016 11:34:37 +0000 (11:34 +0000)]
[OpenCL] Added half type literal with suffix h.

OpenCL Extension v1.2 s9.5 allows half precision floating point
type literals with suffices h or H when cl_khr_fp16 is enabled.

Example:  half x = 1.0h;

Patch by Liu Yaxun (Sam)!

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

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

8 years ago[OPENMP] Fix handling loop-based directives with arrays.
Alexey Bataev [Wed, 17 Feb 2016 10:29:05 +0000 (10:29 +0000)]
[OPENMP] Fix handling loop-based directives with arrays.
Patch fixes possible problems with correct handling arrays as
expressions in initialization, conditions etc in loop-based constructs.

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

8 years ago[cmake] Revert r260742 (and r260744) to improve order file support.
Chandler Carruth [Wed, 17 Feb 2016 02:13:35 +0000 (02:13 +0000)]
[cmake] Revert r260742 (and r260744) to improve order file support.

This appears to be passing '-Wl,-order_file' to Linux link commands,
which then causes the linker to silently, behind the scenes, write the
output to 'rder_file' instead of somewhere else. Will work with Chris to
figure out the proper support for this, but so far there are numerous
people who can't get Clang to update when they build because of this.

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

8 years ago[AttrDocs.td] Fix up some reST syntax.
Sean Silva [Wed, 17 Feb 2016 02:08:19 +0000 (02:08 +0000)]
[AttrDocs.td] Fix up some reST syntax.

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

8 years agoTest simplification
Xinliang David Li [Wed, 17 Feb 2016 00:59:01 +0000 (00:59 +0000)]
Test simplification

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

8 years agoRestrengthen tests relaxed in r259955
Xinliang David Li [Wed, 17 Feb 2016 00:58:13 +0000 (00:58 +0000)]
Restrengthen tests relaxed in r259955

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

8 years agoTeach clang to use the ThinLTO pipeline
Mehdi Amini [Wed, 17 Feb 2016 00:42:20 +0000 (00:42 +0000)]
Teach clang to use the ThinLTO pipeline

Summary: Use the new pipeline implemented in D17115

Reviewers: tejohnson

Subscribers: joker.eph, cfe-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>

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

8 years agoImprove diagnostics for ill-formed literal operator declarations.
Richard Smith [Wed, 17 Feb 2016 00:04:04 +0000 (00:04 +0000)]
Improve diagnostics for ill-formed literal operator declarations.

Patch by Erik Pilkington!

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

8 years ago[CUDA] pass debug options to ptxas.
Artem Belevich [Tue, 16 Feb 2016 22:03:20 +0000 (22:03 +0000)]
[CUDA] pass debug options to ptxas.

ptxas optimizations are disabled if we need to generate debug info
as ptxas does not accept '-g' otherwise.

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

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

8 years agoMissing semicolons are kind of important. Who knew?
Aaron Ballman [Tue, 16 Feb 2016 21:06:10 +0000 (21:06 +0000)]
Missing semicolons are kind of important. Who knew?

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

8 years agoAdd a nullPointerConstant() AST matcher to handle variations of null pointer constant...
Aaron Ballman [Tue, 16 Feb 2016 21:02:23 +0000 (21:02 +0000)]
Add a nullPointerConstant() AST matcher to handle variations of null pointer constants in one matcher.

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

8 years agoStop using "template" when printing qualtype names
Reid Kleckner [Tue, 16 Feb 2016 20:34:27 +0000 (20:34 +0000)]
Stop using "template" when printing qualtype names

Summary:
The keyword "template" isn't necessary when
printing a fully-qualified qualtype name, and, in fact,
results in a syntax error if one tries to use it. So stop
printing it.

Reviewers: rsmith, rnk

Subscribers: rnk, klimek, cfe-commits

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

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

8 years agoExclude PCH/missing-file.cpp on Windows, it does not pass reliably
Reid Kleckner [Tue, 16 Feb 2016 19:16:28 +0000 (19:16 +0000)]
Exclude PCH/missing-file.cpp on Windows, it does not pass reliably

Tag the test with "REQUIRES: can-remove-opened-file", which is what we
use for the similar test Modules/explicit-build-missing-file.cpp.

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

8 years ago[typo-correction] Apply name specifier corrections when forming a NNS
Reid Kleckner [Tue, 16 Feb 2016 19:16:20 +0000 (19:16 +0000)]
[typo-correction] Apply name specifier corrections when forming a NNS

Previously we would leave behind the old name specifier prefix, which
creates an invalid AST.  Other callers of CorrectTypo update their
CXXScopeSpec objects with the correction specifier if one is present.

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

8 years agoclang-cl: Expose -isystem.
Nico Weber [Tue, 16 Feb 2016 19:05:50 +0000 (19:05 +0000)]
clang-cl: Expose -isystem.

Like cl.exe, clang-cl allows adding system include directories via the
INCLUDE env var.  Having a driver flag for this functionality is useful,
so add this too.

(In the future, we probably also want to have a flag alternative to
VCINSTALLDIR as used in MSVCToolChain::getVisualStudioBinaries(), and
a way to override the registry accesses in MSVCToolChain::getWindowsSDKDir()
-- maybe -ivcroot= and -iwinsdkroot=?).

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

8 years ago[OPENMP] Allow to use compound assignment operators.
Alexey Bataev [Tue, 16 Feb 2016 12:13:49 +0000 (12:13 +0000)]
[OPENMP] Allow to use compound assignment operators.
Loop-based directives allow to use iterators as loop counters. Iterators are allowed to define their own operators. This patch allows to use compound assignment operators for iterators.

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

8 years ago[OPENMP] Improved handling of pseudo-captured expressions in OpenMP.
Alexey Bataev [Tue, 16 Feb 2016 11:18:12 +0000 (11:18 +0000)]
[OPENMP] Improved handling of pseudo-captured expressions in OpenMP.
Expressions inside 'schedule'|'dist_schedule' clause must be captured in
combined directives to avoid possible crash during codegen. Patch
improves handling of such constructs

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

8 years ago[Frontend] Make sure WrapperFrontendAction updates CurrentInput after calling BeginSo...
Argyrios Kyrtzidis [Tue, 16 Feb 2016 05:39:33 +0000 (05:39 +0000)]
[Frontend] Make sure WrapperFrontendAction updates CurrentInput after calling BeginSourceFileAction.

I don't have a test case to add unfortunately.

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

8 years agoclang/test/Driver/ps4-linker-win.c: Tweak substitutions if %PATH% ends with '\\'...
NAKAMURA Takumi [Tue, 16 Feb 2016 03:17:13 +0000 (03:17 +0000)]
clang/test/Driver/ps4-linker-win.c: Tweak substitutions if %PATH% ends with '\\', or lit complains with "parser error".

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

8 years agoSimplify users of StringRef::{l,r}trim (clang) (NFC)
Vedant Kumar [Tue, 16 Feb 2016 02:14:44 +0000 (02:14 +0000)]
Simplify users of StringRef::{l,r}trim (clang) (NFC)

r260925 introduced a version of the *trim methods which is preferable
when trimming a single kind of character. Update all users in clang.

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

8 years agoRemove unnecessary regex in the test cases I fixed in r260496.
Akira Hatanaka [Tue, 16 Feb 2016 00:46:03 +0000 (00:46 +0000)]
Remove unnecessary regex in the test cases I fixed in r260496.

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

8 years agoDarwin: fix stdlib handling when CLANG_DEFAULT_STDLIB is set
Tim Northover [Mon, 15 Feb 2016 16:38:10 +0000 (16:38 +0000)]
Darwin: fix stdlib handling when CLANG_DEFAULT_STDLIB is set

I'd accidentally skipped the CMake check in a premature optimisation. I'd also
put the original test in completely the wrong place.

Thanks Jonas Hahnfeld!

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

8 years agoPR26449: Tests for builtin_classify_type fix
Andrey Bokhanko [Mon, 15 Feb 2016 10:44:27 +0000 (10:44 +0000)]
PR26449: Tests for builtin_classify_type fix

In my previous commit (rL260881) I forget to svn add tests. This commit adds
them.

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

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

8 years agoPR26449: Fixes for bugs in __builtin_classify_type implementation
Andrey Bokhanko [Mon, 15 Feb 2016 10:39:04 +0000 (10:39 +0000)]
PR26449: Fixes for bugs in __builtin_classify_type implementation

This patch fixes the following bugs in __builtin_classify_type implementation:
1) Support for member functions and fields
2) Same behavior as GCC in C mode (specifically, return integer_type_class for
   enums and pointer_type_class for function pointers and arrays). Behavior in
   C++ mode didn't changed.

Also, it refactors the whole implementation, by replacing a sequence of
if-else-if with a couple of switches.

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

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

8 years ago[OPENMP] Remove extra sync barriers for 'firstprivate' clause.
Alexey Bataev [Mon, 15 Feb 2016 08:07:17 +0000 (08:07 +0000)]
[OPENMP] Remove extra sync barriers for 'firstprivate' clause.
Sync barrier will be emitted after generation of firstprivate variables
only if one of the firstprivate vars is used in lastprivate clause.

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

8 years agoclangIndex requires LLVMIR as Core, since r260858 uses llvm/IR.
NAKAMURA Takumi [Mon, 15 Feb 2016 04:29:36 +0000 (04:29 +0000)]
clangIndex requires LLVMIR as Core, since r260858 uses llvm/IR.

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

8 years agoAdd isAnyPointer() matchers. Register missing matchers.
Felix Berger [Mon, 15 Feb 2016 04:00:39 +0000 (04:00 +0000)]
Add isAnyPointer() matchers. Register missing matchers.

Summary:
The isAnyPointer() matcher is useful for http://reviews.llvm.org/D15623.

Reviewers: alexfh, klimek

Subscribers: cfe-commits

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

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

8 years agoSema: prevent assertion on stack return checking
Saleem Abdulrasool [Mon, 15 Feb 2016 01:51:24 +0000 (01:51 +0000)]
Sema: prevent assertion on stack return checking

In the case that the array indexing itself is within a type dependent context,
bail out of the evaluation.  We would previously try to symbolically evaluate
the expression which would then try to evaluate a non-address expression as an
address, triggering an assertion in Asserts builds.

We only need to consider the array subscript expression itself as in the case
that the base itself being type dependent is handled appropriately in EvalAddr.

Resolves PR26599.

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

8 years ago[AST/index] Introduce an option 'SuppressTemplateArgsInCXXConstructors' in printing...
Argyrios Kyrtzidis [Mon, 15 Feb 2016 01:32:36 +0000 (01:32 +0000)]
[AST/index] Introduce an option 'SuppressTemplateArgsInCXXConstructors' in printing policy.

Enable it for USRs and names when indexing.
Forward references can have different template argument names; including them
makes USRs and names unstable, since the name depends on whether we saw a forward reference or not.

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

8 years agosilence -Wreturn-type warnings
Saleem Abdulrasool [Mon, 15 Feb 2016 00:36:52 +0000 (00:36 +0000)]
silence -Wreturn-type warnings

These codepaths would generate warnings with GCC on linux even though the switch
was covered.  Add llvm_unreachable markers to indicate that the switch should be
covered.  NFC.

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

8 years agoSema: constify EvalAddr, EvalVal
Saleem Abdulrasool [Mon, 15 Feb 2016 00:36:49 +0000 (00:36 +0000)]
Sema: constify EvalAddr, EvalVal

Propagate const throughout these methods as they are non-mutating analyzers of
state.  NFC.

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

8 years ago[test/Index] Set a specific target for the test.
Argyrios Kyrtzidis [Sun, 14 Feb 2016 22:38:38 +0000 (22:38 +0000)]
[test/Index] Set a specific target for the test.

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

8 years ago[index] Factor libclang's functionality to determing the mangled name of symbols...
Argyrios Kyrtzidis [Sun, 14 Feb 2016 22:30:14 +0000 (22:30 +0000)]
[index] Factor libclang's functionality to determing the mangled name of symbols into the clangIndex library.

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

8 years agoFix some typos in the clang doc
Sylvestre Ledru [Sun, 14 Feb 2016 20:20:58 +0000 (20:20 +0000)]
Fix some typos in the clang doc

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

8 years agoAs reported in https://llvm.org/bugs/show_bug.cgi?id=25496, on FreeBSD,
Dimitry Andric [Sun, 14 Feb 2016 16:08:20 +0000 (16:08 +0000)]
As reported in https://llvm.org/bugs/show_bug.cgi?id=25496, on FreeBSD,
C++ programs compiled for profiling (using `-pg`) should be linked with
`-lc++_p` (or `-lstdc++_p`, depending on the `-stdlib=` setting), not
with the regular C++ libraries.

Add a `FreeBSD::AddCXXStdlibLibArgs()` override to handle this, and add
a test case for it.  While here, extend the test case for the proper
passing of -lm and -lm_p.

Reviewers: compnerd, davide, dws, emaste
Reviewed By: compnerd
Differential Revision: http://reviews.llvm.org/D16264

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

8 years agoDon't leak the ASTUnit when done with testing.
Benjamin Kramer [Sun, 14 Feb 2016 13:18:06 +0000 (13:18 +0000)]
Don't leak the ASTUnit when done with testing.

Found by lsan.

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

8 years agoc-index-test: Fix libdeps corresponding to r260841.
NAKAMURA Takumi [Sun, 14 Feb 2016 09:19:04 +0000 (09:19 +0000)]
c-index-test: Fix libdeps corresponding to r260841.

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

8 years ago[c-index-test] Fix a gcc build error.
Argyrios Kyrtzidis [Sun, 14 Feb 2016 07:08:31 +0000 (07:08 +0000)]
[c-index-test] Fix a gcc build error.

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

8 years ago[index] Fix gcc builds.
Argyrios Kyrtzidis [Sun, 14 Feb 2016 06:53:20 +0000 (06:53 +0000)]
[index] Fix gcc builds.

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

8 years ago[index] Enhance c-index-test tool and have it link and test the clangIndex library...
Argyrios Kyrtzidis [Sun, 14 Feb 2016 06:39:11 +0000 (06:39 +0000)]
[index] Enhance c-index-test tool and have it link and test the clangIndex library directly.

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

8 years ago[index] Allow calling createIndexingAction() without passing another action to wrap...
Argyrios Kyrtzidis [Sun, 14 Feb 2016 06:39:03 +0000 (06:39 +0000)]
[index] Allow calling createIndexingAction() without passing another action to wrap over.

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

8 years ago[OpenMP] Rename the offload entry points.
Samuel Antao [Sat, 13 Feb 2016 23:35:10 +0000 (23:35 +0000)]
[OpenMP] Rename the offload entry points.

Summary:
Unlike other outlined regions in OpenMP, offloading entry points have to have be visible (external linkage) for the device side. Using dots in the names of the entries can be therefore problematic for some toolchains, e.g. NVPTX.

Also the patch drops the column information in the unique name of the entry points. The parsing of directives ignore unknown tokens, preventing several target  regions to be implemented in the same line. Therefore, the line information is sufficient for the name to be unique. Also, the preprocessor printer does not preserve the column information, causing offloading-entry detection issues if the host uses an integrated preprocessor and the target doesn't (or vice versa).

Reviewers: hfinkel, arpith-jacob, carlo.bertolli, kkwli0, ABataev

Subscribers: cfe-commits, fraggamuffin, caomhin

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

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

8 years ago[AST] Add a print() method in DeclarationName that accepts a PrintingPolicy.
Argyrios Kyrtzidis [Sat, 13 Feb 2016 21:46:50 +0000 (21:46 +0000)]
[AST] Add a print() method in DeclarationName that accepts a PrintingPolicy.

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

8 years agoFix a leak in the generated code for attributes with strings.
Benjamin Kramer [Sat, 13 Feb 2016 18:11:49 +0000 (18:11 +0000)]
Fix a leak in the generated code for attributes with strings.

Storing std::strings in attributes simply doesn't work, we never call
the destructor. Use an array of StringRefs instead of std::strings and
copy the data into memory taken from the ASTContext.

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

8 years agoRValue refs do not work that way.
Benjamin Kramer [Sat, 13 Feb 2016 16:00:13 +0000 (16:00 +0000)]
RValue refs do not work that way.

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

8 years agoDon't copy a DenseMap just to do lookup in it.
Benjamin Kramer [Sat, 13 Feb 2016 15:49:17 +0000 (15:49 +0000)]
Don't copy a DenseMap just to do lookup in it.

Also remove the now unused isPodLike specialization. DenseMap only uses
it for copies.

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

8 years agoReduce the number of implicit StringRef->std::string conversions by threading StringR...
Benjamin Kramer [Sat, 13 Feb 2016 13:42:54 +0000 (13:42 +0000)]
Reduce the number of implicit StringRef->std::string conversions by threading StringRef through more APIs.

No functionality change intended.

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

8 years agoFix use after free.
Benjamin Kramer [Sat, 13 Feb 2016 13:42:41 +0000 (13:42 +0000)]
Fix use after free.

Found by asan.

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

8 years ago[OPENMP] NFC rewrite ParseOpenMPDirectiveKind
Dmitry Polukhin [Sat, 13 Feb 2016 06:53:38 +0000 (06:53 +0000)]
[OPENMP] NFC rewrite ParseOpenMPDirectiveKind

New implementation is easier to read and extend.

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

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

8 years ago[index] Change some default parameters to fix an MSVC ICE.
Argyrios Kyrtzidis [Sat, 13 Feb 2016 05:17:15 +0000 (05:17 +0000)]
[index] Change some default parameters to fix an MSVC ICE.

Many thanks to Yunzhong Gao for tracking this down!

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

8 years agolibclang/CMakeLists.txt: Prune IndexingContext.h out of ADDITIONAL_HEADERS. VS IDE...
NAKAMURA Takumi [Sat, 13 Feb 2016 04:01:49 +0000 (04:01 +0000)]
libclang/CMakeLists.txt: Prune IndexingContext.h out of ADDITIONAL_HEADERS. VS IDE uses it.

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

8 years agoFix the ASTPrinter output for ascii char literals >127.
Steven Watanabe [Sat, 13 Feb 2016 02:31:28 +0000 (02:31 +0000)]
Fix the ASTPrinter output for ascii char literals >127.

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

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

8 years agoAccept "-Weverything" in clang diagnistic pragmas
Sunil Srivastava [Sat, 13 Feb 2016 01:44:05 +0000 (01:44 +0000)]
Accept "-Weverything" in clang diagnistic pragmas

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

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

8 years ago[Sema] More changes to fix Objective-C fallout from r249995.
Bob Wilson [Sat, 13 Feb 2016 01:41:41 +0000 (01:41 +0000)]
[Sema] More changes to fix Objective-C fallout from r249995.

This is a follow-up to PR26085. That was fixed in r257710 but the testcase
there was incomplete. There is a related issue where the overload resolution
for Objective-C incorrectly picks a method that is not valid without a
bridge cast. The call to Sema::CheckSingleAssignmentConstraints that was
added to SemaOverload.cpp's IsStandardConversion() function does not catch
that case and reports that the method is Compatible even when it is not.

The root cause here is that various Objective-C-related functions in Sema
do not consistently return a value to indicate whether there was an error.
This was fine in the past because they would report diagnostics when needed,
but r257710 changed them to suppress reporting diagnostics when checking
during overload resolution.

This patch adds a new ACR_error result to the ARCConversionResult enum and
updates Sema::CheckObjCARCConversion to return that value when there is an
error. Most of the calls to that function do not check the return value,
so adding this new result does not affect them. The one exception is in
SemaCast.cpp where it specifically checks for ACR_unbridged, so that is
also OK. The call in Sema::CheckSingleAssignmentConstraints can then check
for an ACR_okay result and identify assignments as Incompatible. To
preserve the existing behavior, it only changes the return value to
Incompatible when the new Diagnose argument (from r257710) is false.

Similarly, the CheckObjCBridgeRelatedConversions and
ConversionToObjCStringLiteralCheck need to identify when an assignment is
Incompatible. Those functions already return appropriate values but they
need some fixes related to the new Diagnose argument.

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

8 years ago[RecursiveASTVisitor] Introduce dataTraverseStmtPre()/dataTraverseStmtPost() to allow...
Argyrios Kyrtzidis [Sat, 13 Feb 2016 01:24:19 +0000 (01:24 +0000)]
[RecursiveASTVisitor] Introduce dataTraverseStmtPre()/dataTraverseStmtPost() to allow clients to do before/after actions during data recursive visitation.

This should fix the asan bot that hits stack overflow in a couple of test/Index tests.

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

8 years agoAMDGPU: Add sin/cos builtins
Matt Arsenault [Sat, 13 Feb 2016 01:21:09 +0000 (01:21 +0000)]
AMDGPU: Add sin/cos builtins

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

8 years agoAMDGPU: Update builtin for intrinsic change
Matt Arsenault [Sat, 13 Feb 2016 01:03:09 +0000 (01:03 +0000)]
AMDGPU: Update builtin for intrinsic change

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

8 years agoDisable two tests that use a lot of stack under ASan.
Alexey Samsonov [Sat, 13 Feb 2016 01:02:59 +0000 (01:02 +0000)]
Disable two tests that use a lot of stack under ASan.

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

8 years agoMake -Wnull-conversion more useful.
Richard Trieu [Sat, 13 Feb 2016 00:58:53 +0000 (00:58 +0000)]
Make -Wnull-conversion more useful.

When a null constant is used in a macro, walk through the macro stack to
determine where the null constant is written and where the context is located.
Only warn if both locations are within the same macro expansion.  This helps
function-like macros which involve pointers be treated as if they were
functions.

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

8 years ago[index] Add llvm/Support/DataTypes.h header to fix build failures in the bots.
Argyrios Kyrtzidis [Fri, 12 Feb 2016 23:30:07 +0000 (23:30 +0000)]
[index] Add llvm/Support/DataTypes.h header to fix build failures in the bots.

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

8 years ago[libclang] Separate the underlying indexing functionality of libclang and introduce...
Argyrios Kyrtzidis [Fri, 12 Feb 2016 23:10:59 +0000 (23:10 +0000)]
[libclang] Separate the underlying indexing functionality of libclang and introduce it into the clangIndex library.

It is a general goodness for libclang itself to mostly be a wrapper of functionality provided by the libraries.

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

8 years agoFix remaining Clang-tidy readability-redundant-control-flow warnings; other minor...
Eugene Zelenko [Fri, 12 Feb 2016 22:53:10 +0000 (22:53 +0000)]
Fix remaining Clang-tidy readability-redundant-control-flow warnings; other minor fixes.

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

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

8 years agoDarwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++
Tim Northover [Fri, 12 Feb 2016 22:30:42 +0000 (22:30 +0000)]
Darwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++

Recent refactoring meant it only got passed down when explicitly specified,
which breaks header search on Darwin.

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

8 years ago[CMake] Fixing bots I broke.
Chris Bieneman [Fri, 12 Feb 2016 21:46:25 +0000 (21:46 +0000)]
[CMake] Fixing bots I broke.

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

8 years ago[CMake] Improve the clang order-file generation workflow
Chris Bieneman [Fri, 12 Feb 2016 21:36:55 +0000 (21:36 +0000)]
[CMake] Improve the clang order-file generation workflow

Summary:
This commit re-lands r259862. The underlying cause of the build breakage was an incorrectly written capabilities test. In tools/Driver/CMakeLists.txt I was attempting to check if a linker flag worked, the test was passing it to the compiler, not the linker. CMake doesn't have a linker test, so we have a hand-rolled one.

Original Patch Review: http://reviews.llvm.org/D16896

Original Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

Reviewers: bogner

Subscribers: cfe-commits

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

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

8 years agoAdded missing '__'.
Artem Belevich [Fri, 12 Feb 2016 20:26:43 +0000 (20:26 +0000)]
Added missing '__'.

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

8 years agotest/Headers/float.c: fix theoretical edge values
Hubert Tong [Fri, 12 Feb 2016 19:24:36 +0000 (19:24 +0000)]
test/Headers/float.c: fix theoretical edge values

For *_MANT_DIG, *_MAX_EXP and *_MIN_EXP, the C Standard does not list
the least requirements directly. This patch adjusts the test values with
refined ones.

Patch by Jorge Teixeira!

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

8 years ago[AST] Fix typos in RecordLayoutBuilder
David Majnemer [Fri, 12 Feb 2016 19:21:02 +0000 (19:21 +0000)]
[AST] Fix typos in RecordLayoutBuilder

No functional change is intended.

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

8 years ago[CMake] Pass stage1 tools through to stage2 when building with LTO
Chris Bieneman [Fri, 12 Feb 2016 19:06:12 +0000 (19:06 +0000)]
[CMake] Pass stage1 tools through to stage2 when building with LTO

This was originally a hacky if(APPLE) block. Now that we have an option for enabling LTO, it is better to properly gate this.

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

8 years ago[CUDA] Tweak attribute-based overload resolution to match nvcc behavior.
Artem Belevich [Fri, 12 Feb 2016 18:29:18 +0000 (18:29 +0000)]
[CUDA] Tweak attribute-based overload resolution to match nvcc behavior.

This is an artefact of split-mode CUDA compilation that we need to
mimic. HD functions are sometimes allowed to call H or D functions. Due
to split compilation mode device-side compilation will not see host-only
function and thus they will not be considered at all. For clang both H
and D variants will become function overloads visible to
compiler. Normally target attribute is considered only if C++ rules can
not determine which function is better. However in this case we need to
ignore functions that would not be present during current compilation
phase before we apply normal overload resolution rules.

Changes:
* introduced another level of call preference to better describe
  possible call combinations.
* removed WrongSide functions from consideration if the set contains
  SameSide function.
* disabled H->D, D->H and G->H calls. These combinations are
  not allowed by CUDA and we were reluctantly allowing them to work
  around device-side calls to math functions in std namespace.
  We no longer need it after r258880.

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

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

8 years ago[Hexagon] Specify vector alignment in DataLayout string
Krzysztof Parzyszek [Fri, 12 Feb 2016 14:48:34 +0000 (14:48 +0000)]
[Hexagon] Specify vector alignment in DataLayout string

The DataLayout can calculate alignment of vectors based on the alignment
of the element type and the number of elements. In fact, it is the product
of these two values. The problem is that for vectors of N x i1, this will
return the alignment of N bytes, since the alignment of i1 is 8 bits. The
vector types of vNi1 should be aligned to N bits instead. Provide explicit
alignment for HVX vectors to avoid such complications.

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

8 years agoFix ICE with constexpr and friend functions
Olivier Goffart [Fri, 12 Feb 2016 12:34:44 +0000 (12:34 +0000)]
Fix ICE with constexpr and friend functions

Fix a crash while parsing this code:

  struct X  {
    friend constexpr int foo(X*) { return 12; }
    static constexpr int j = foo(static_cast<X*>(nullptr));
  };

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

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

8 years ago[OpenCL] Disable C99 standard lib functions
Anastasia Stulova [Fri, 12 Feb 2016 12:07:04 +0000 (12:07 +0000)]
[OpenCL] Disable C99 standard lib functions

The library functions defined in the C99 standard headers
are not available (OpenCL v1.2 s6.9.f).

This change stops treating OpenCL builtin functions as standard C lib
functions to eliminate warning messages about printf format string.

Patch by Liu Yaxun (Sam)!

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

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

8 years ago[CMake] Add option to switch default C++ stdlib
Jonas Hahnfeld [Fri, 12 Feb 2016 07:48:37 +0000 (07:48 +0000)]
[CMake] Add option to switch default C++ stdlib

With this option one can optionally override the architecture dependent
default library to use if no -stdlib= is provided on compiler invocation.

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

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

8 years agotests: Add explicit -stdlib=libstdc++ to tests that require it
Jonas Hahnfeld [Fri, 12 Feb 2016 07:48:28 +0000 (07:48 +0000)]
tests: Add explicit -stdlib=libstdc++ to tests that require it

This will be needed for the next commit that allows to switch the default
C++ library which would otherwise make these tests fail.

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

8 years agoUpdate functions in clang supplied headers to use the compiler reserved
Eric Christopher [Fri, 12 Feb 2016 02:22:53 +0000 (02:22 +0000)]
Update functions in clang supplied headers to use the compiler reserved
namespace for arguments.

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

8 years ago<float.h>: do not define DECIMAL_DIG in -std=c89 mode; this macro was added in C99.
Richard Smith [Fri, 12 Feb 2016 01:15:33 +0000 (01:15 +0000)]
<float.h>: do not define DECIMAL_DIG in -std=c89 mode; this macro was added in C99.

Patch by Jorge Teixeira!

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