]> granicus.if.org Git - clang/log
clang
7 years agoBring back note about not supporting global register variables.
Michael Kuperstein [Mon, 12 Dec 2016 19:11:39 +0000 (19:11 +0000)]
Bring back note about not supporting global register variables.

This was accidentally removed in r260506, even though we only support
non-allocatable global register variables. The general (allocatable) case
is explicitly not supported.

Differential Revision: https://reviews.llvm.org/D27473

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

7 years agoAvoid use of std::to_string. NFC.
Vedant Kumar [Mon, 12 Dec 2016 18:47:33 +0000 (18:47 +0000)]
Avoid use of std::to_string. NFC.

Apparently this routine isn't available on some Android platforms. See
the mailing list thread re: D21695.

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

7 years agoFix format and a few typos in comments.
Samuel Antao [Mon, 12 Dec 2016 18:00:20 +0000 (18:00 +0000)]
Fix format and a few typos in comments.

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

7 years ago[Fix] Add missing include from r289444.
Filipe Cabecinhas [Mon, 12 Dec 2016 16:43:40 +0000 (16:43 +0000)]
[Fix] Add missing include from r289444.

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

7 years ago[clang] Version support for UBSan handlers
Filipe Cabecinhas [Mon, 12 Dec 2016 16:18:40 +0000 (16:18 +0000)]
[clang] Version support for UBSan handlers

This adds a way for us to version any UBSan handler by itself.
The patch overrides D21289 for a better implementation (we're able to
rev up a single handler).

After this, then we can land a slight modification of D19667+D19668.

We probably don't want to keep all the versions in compiler-rt (maybe we
want to deprecate on one release and remove the old handler on the next
one?), but with this patch we will loudly fail to compile when mixing
incompatible handler calls, instead of silently compiling and then
providing bad error messages.

Reviewers: kcc, samsonov, rsmith, vsk

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D21695

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

7 years ago[Driver] Attempt to fix new linux-ld tests on Windows
Michal Gorny [Mon, 12 Dec 2016 16:04:37 +0000 (16:04 +0000)]
[Driver] Attempt to fix new linux-ld tests on Windows

(broken by r289436)

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

7 years ago[Driver] Fix finding multilib gcc install on Gentoo (with gcc-config)
Michal Gorny [Mon, 12 Dec 2016 15:07:43 +0000 (15:07 +0000)]
[Driver] Fix finding multilib gcc install on Gentoo (with gcc-config)

Fix the gcc-config code to support multilib gcc installs properly. This
solves two problems: -mx32 using the 64-bit gcc directory (due to matching
installation triple), and -m32 not respecting gcc-config at all (due to
mismatched installation triple).

In order to fix the former issue, split the multilib scan out of
Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple() (the code
is otherwise unchanged), and call it for each installation found via
gcc-config.

In order to fix the latter issue, split the gcc-config processing out of
Generic_GCC::GCCInstallationDetector::init() and repeat it for all
triples, including extra and biarch triples. The only change
in the gcc-config code itself is adding the call to multilib scan.

Convert the gentoo_linux_gcc_multi_version_tree test input to multilib
x86_64+32+x32 install, and add appropriate tests to linux-header-search
and linux-ld.

Differential Revision: https://reviews.llvm.org/D26887

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

7 years agoUse function_ref to avoid allocation in std::function. NFC.
Benjamin Kramer [Mon, 12 Dec 2016 14:41:19 +0000 (14:41 +0000)]
Use function_ref to avoid allocation in std::function. NFC.

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

7 years ago[StaticAnalysis] Remove unnecessary parameter in CallGraphNode::addCallee.
Haojian Wu [Mon, 12 Dec 2016 14:12:10 +0000 (14:12 +0000)]
[StaticAnalysis] Remove unnecessary parameter in CallGraphNode::addCallee.

Summary:
Remove the CallGraph in addCallee as it is not used in addCallee.
It decouples addCallee from CallGraph, so that we can use CallGraphNode
within our customized CallGraph.

Reviewers: bkramer

Subscribers: cfe-commits, ioeric

Differential Revision: https://reviews.llvm.org/D27674

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

7 years agoclang-format: Separate out a language kind for ObjC.
Daniel Jasper [Mon, 12 Dec 2016 12:42:29 +0000 (12:42 +0000)]
clang-format: Separate out a language kind for ObjC.

While C(++) and ObjC are generally formatted the same way and can be
mixed, people might want to choose different styles based on the
language. This patch recognizes .m and .mm files as ObjC and also
implements a very crude detection of whether or not a .h file contains
ObjC code. This can be improved over time.

Also move most of the ObjC tests into their own test file to keep file
size maintainable.

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

7 years ago[Driver] Simplify ToolChain::GetCXXStdlibType (NFC)
Jonas Hahnfeld [Mon, 12 Dec 2016 07:53:47 +0000 (07:53 +0000)]
[Driver] Simplify ToolChain::GetCXXStdlibType (NFC)

I made the wrong assumption that execution would continue after an error Diag
which led to unneeded complex code.
This patch aligns with the better implementation of ToolChain::GetRuntimeLibType.

Differential Revision: https://reviews.llvm.org/D25669

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

7 years agoAdd two new AST nodes to represent initialization of an array in terms of
Richard Smith [Mon, 12 Dec 2016 02:53:20 +0000 (02:53 +0000)]
Add two new AST nodes to represent initialization of an array in terms of
initialization of each array element:

 * ArrayInitLoopExpr is a prvalue of array type with two subexpressions:
   a common expression (an OpaqueValueExpr) that represents the up-front
   computation of the source of the initialization, and a subexpression
   representing a per-element initializer
 * ArrayInitIndexExpr is a prvalue of type size_t representing the current
   position in the loop

This will be used to replace the creation of explicit index variables in lambda
capture of arrays and copy/move construction of classes with array elements,
and also C++17 structured bindings of arrays by value (which inexplicably allow
copying an array by value, unlike all of C++'s other array declarations).

No uses of these nodes are introduced by this change, however.

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

7 years ago[CrashReproducer] Setup a module collector callback for HeaderInclude
Bruno Cardoso Lopes [Sun, 11 Dec 2016 04:27:31 +0000 (04:27 +0000)]
[CrashReproducer] Setup a module collector callback for HeaderInclude

Collect missing include that cannot be fetched otherwise (e.g. when
using headermaps).

rdar://problem/27913709

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

7 years ago[CrashReproducer] Collect headermap files
Bruno Cardoso Lopes [Sun, 11 Dec 2016 04:27:28 +0000 (04:27 +0000)]
[CrashReproducer] Collect headermap files

Include headermaps (.hmap files) in the .cache directory and
add VFS entries. All headermaps are known after HeaderSearch
setup, collect them right after.

rdar://problem/27913709

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

7 years ago[AVX-512] Remove masking from 512-bit vpermil builtins. The backend now has versions...
Craig Topper [Sun, 11 Dec 2016 01:26:52 +0000 (01:26 +0000)]
[AVX-512] Remove masking from 512-bit vpermil builtins. The backend now has versions without masking so wrap it with select.

This will allow the backend to constant fold these to generic shuffle vectors like 128-bit and 256-bit without having to working about handling masking.

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

7 years ago[AVX-512] Remove masking from 512-bit pshufb builtin. The backend now has a version...
Craig Topper [Sat, 10 Dec 2016 23:09:52 +0000 (23:09 +0000)]
[AVX-512] Remove masking from 512-bit pshufb builtin. The backend now has a version without masking so wrap it with select.

This will allow the backend to constant fold these to generic shuffle vectors like 128-bit and 256-bit without having to working about handling masking.

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

7 years ago[AVX-512] Remove 128/256-bit masked vpermilvar builtins and replace with select and...
Craig Topper [Sat, 10 Dec 2016 20:27:39 +0000 (20:27 +0000)]
[AVX-512] Remove 128/256-bit masked vpermilvar builtins and replace with select and the avx unmasked builtins.

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

7 years agoSimplify parseShowColorsArgs logic, NFC.
Yaron Keren [Sat, 10 Dec 2016 14:55:14 +0000 (14:55 +0000)]
Simplify parseShowColorsArgs logic, NFC.

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

7 years ago[analyzer] Improve VirtualCallChecker diagnostics and move into optin package.
Devin Coughlin [Sat, 10 Dec 2016 01:16:09 +0000 (01:16 +0000)]
[analyzer] Improve VirtualCallChecker diagnostics and move into optin package.

The VirtualCallChecker is in alpha because its interprocedural diagnostics
represent the call path textually in the diagnostic message rather than with a
path sensitive diagnostic.

This patch turns off the AST-based interprocedural analysis in the checker so
that no call path is needed and improves with diagnostic text. With these
changes, the checker is ready to be moved into the optin package.

Ultimately the right fix is to rewrite this checker to be path sensitive -- but
there is still value in enabling the checker for intraprocedural analysis only
The interprocedural mode can be re-enabled with an -analyzer-config flag.

Differential Revision: https://reviews.llvm.org/D26768

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

7 years ago[clang-format] Another attempt at python 3 compatibility
Vedant Kumar [Sat, 10 Dec 2016 00:54:13 +0000 (00:54 +0000)]
[clang-format] Another attempt at python 3 compatibility

The entries in vim.current.buffer appear to be decoded strings, which
means that python3 won't allow invoking 'decode' on them. Keep the old
behavior when running under python2, but skip the error-inducing decode
step with python3..

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

7 years ago[ubsan] Treat ObjC's BOOL as if its range is always {0, 1}
Vedant Kumar [Fri, 9 Dec 2016 23:48:18 +0000 (23:48 +0000)]
[ubsan] Treat ObjC's BOOL as if its range is always {0, 1}

On some Apple platforms, the ObjC BOOL type is defined as a signed char.
When performing instrumentation for -fsanitize=bool, we'd like to treat
the range of BOOL like it's always {0, 1}. While we can't change clang's
IRGen for char-backed BOOL's due to ABI compatibility concerns, we can
teach ubsan to catch potential abuses of this type.

rdar://problem/29502773

Differential Revision: https://reviews.llvm.org/D27607

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

7 years ago[CUDA,Driver] Added --no-cuda-gpu-arch= option.
Artem Belevich [Fri, 9 Dec 2016 22:59:17 +0000 (22:59 +0000)]
[CUDA,Driver] Added --no-cuda-gpu-arch= option.

This allows us to negate preceding --cuda-gpu-arch=X.
This comes handy when user needs to override default
flags set for them by the build system.

Differential Revision: https://reviews.llvm.org/D27631

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

7 years ago[c++17] P0490R0, NB comment FI 20: allow direct-initialization of decomposition decla...
Richard Smith [Fri, 9 Dec 2016 22:56:20 +0000 (22:56 +0000)]
[c++17] P0490R0, NB comment FI 20: allow direct-initialization of decomposition declarations.

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

7 years agoFix unused variable warnings. NFCI.
Simon Pilgrim [Fri, 9 Dec 2016 22:45:21 +0000 (22:45 +0000)]
Fix unused variable warnings. NFCI.

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

7 years ago[modules] Add optional out-param to ASTReader::ReadAST for imported submodules.
Graydon Hoare [Fri, 9 Dec 2016 21:45:49 +0000 (21:45 +0000)]
[modules] Add optional out-param to ASTReader::ReadAST for imported submodules.

Summary:
The Swift frontend is acquiring the ability to load non-module PCH files containing
bridging definitions from C/ObjC. As part of this work, it needs to know which submodules
were imported by a PCH in order to wrap them in local Swift modules. This information
is collected by ASTReader::ReadAST in a local vector, but is currently kept private.

The change here is just to make the type of the vector elements public, and provide
an optional out-parameter to the ReadAST method to provide the vector's contents to
a caller after a successful read.

Reviewers: manmanren, rsmith, doug.gregor

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D27580

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

7 years agoRemove special error recovery for ::(id)
Reid Kleckner [Fri, 9 Dec 2016 21:10:43 +0000 (21:10 +0000)]
Remove special error recovery for ::(id)

The code pattern used to implement the token rewriting hack doesn't
interact well with token caching in the pre-processor. As a result,
clang would crash on 'int f(::(id));' while doing a tenative parse of
the contents of the outer parentheses. The original code from PR11852
still doesn't crash the compiler.

This error recovery also often does the wrong thing with member function
pointers. The test case from the original PR doesn't recover the right
way either:
  void S::(*pf)() = S::f; // should be 'void (S::*pf)()'

Instead we were recovering as 'void S::*pf()', which is still wrong.

If we still think that users mistakenly parenthesize identifiers in
nested name specifiers, we should change clang to intentionally parse
that form with an error, rather than doing a token rewrite.

Fixes PR26623, but I think there will be many more bugs like this around
token rewriting in the parser.

Reviewers: rsmith, rtrieu

Differential Revision: https://reviews.llvm.org/D25882

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

7 years agoImprove error message when referencing a non-tag type with a tag
Reid Kleckner [Fri, 9 Dec 2016 19:47:58 +0000 (19:47 +0000)]
Improve error message when referencing a non-tag type with a tag

Other compilers accept invalid code here that we reject, and we need a
better error message to try to convince users that the code is really
incorrect. Consider:
  class Foo {
    typedef MyIterHelper<Foo> iterator;
    friend class iterator;
  };

Previously our wording was "elaborated type refers to a typedef".
"elaborated type" isn't widely known terminology, so the new diagnostic
says "typedef 'iterator' cannot be referenced with class specifier".

Reviewers: rsmith

Differential Revision: https://reviews.llvm.org/D25216

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

7 years agoAdd tests for a couple more DRs.
Richard Smith [Fri, 9 Dec 2016 19:35:45 +0000 (19:35 +0000)]
Add tests for a couple more DRs.

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

7 years agocxx_dr_status: update to latest issue list and add a couple more tests.
Richard Smith [Fri, 9 Dec 2016 19:11:50 +0000 (19:11 +0000)]
cxx_dr_status: update to latest issue list and add a couple more tests.

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

7 years agoAdd support for non-zero null pointer for C and OpenCL
Yaxun Liu [Fri, 9 Dec 2016 19:01:11 +0000 (19:01 +0000)]
Add support for non-zero null pointer for C and OpenCL

In amdgcn target, null pointers in global, constant, and generic address space take value 0 but null pointers in private and local address space take value -1. Currently LLVM assumes all null pointers take value 0, which results in incorrectly translated IR. To workaround this issue, instead of emit null pointers in local and private address space, a null pointer in generic address space is emitted and casted to local and private address space.

Tentative definition of global variables with non-zero initializer will have weak linkage instead of common linkage since common linkage requires zero initializer and does not have explicit section to hold the non-zero value.

Virtual member functions getNullPointer and performAddrSpaceCast are added to TargetCodeGenInfo which by default returns ConstantPointerNull and emitting addrspacecast instruction. A virtual member function getNullPointerValue is added to TargetInfo which by default returns 0. Each target can override these virtual functions to get target specific null pointer and the null pointer value for specific address space, and perform specific translations for addrspacecast.

Wrapper functions getNullPointer is added to CodegenModule and getTargetNullPointerValue is added to ASTContext to facilitate getting the target specific null pointers and their values.

This change has no effect on other targets except amdgcn target. Other targets can provide support of non-zero null pointer in a similar way.

This change only provides support for non-zero null pointer for C and OpenCL. Supporting for other languages will be added later incrementally.

Differential Revision: https://reviews.llvm.org/D26196

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

7 years agoDR1295 and cleanup for P0135R1: Make our initialization code more directly
Richard Smith [Fri, 9 Dec 2016 18:49:13 +0000 (18:49 +0000)]
DR1295 and cleanup for P0135R1: Make our initialization code more directly
mirror the description in the standard. Per DR1295, this means that binding a
const / rvalue reference to a bit-field no longer "binds directly", and per
P0135R1, this means that we materialize a temporary in reference binding
after adjusting cv-qualifiers and before performing a derived-to-base cast.

In C++11 onwards, this should have fixed the last case where we would
materialize a temporary of the wrong type (with a subobject adjustment inside
the MaterializeTemporaryExpr instead of outside), but we still have to deal
with that possibility in C++98, unless we want to start using xvalues to
represent materialized temporaries there too.

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

7 years ago[DOXYGEN] Improved doxygen comments for x86 intrinsics headers.
Ekaterina Romanova [Fri, 9 Dec 2016 18:35:50 +0000 (18:35 +0000)]
[DOXYGEN] Improved doxygen comments for x86 intrinsics headers.

Tagged instruction names with <c> INSTR_NAME </c> to display them in typewriter font.

In the past, \c command was used, unfortunately it applied to only one word.
<c> .. </c> has the same meaning, but applies to all words in between the tags.

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

7 years agoRelax IRgen check in decl-in-prototype.c to match signext on PPC64
Reid Kleckner [Fri, 9 Dec 2016 17:56:04 +0000 (17:56 +0000)]
Relax IRgen check in decl-in-prototype.c to match signext on PPC64

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

7 years agoDon't assert when redefining a built-in macro in a PCH, PR29119
Nico Weber [Fri, 9 Dec 2016 17:32:52 +0000 (17:32 +0000)]
Don't assert when redefining a built-in macro in a PCH, PR29119

PCH files store the macro history for a given macro, and the whole history list
for one identifier is given to the Preprocessor at once via
Preprocessor::setLoadedMacroDirective(). This contained an assert that no macro
history exists yet for that identifier. That's usually true, but it's not true
for builtin macros, which are created in Preprocessor() before flags and pchs
are processed. Luckily, ASTWriter stops writing macro history lists at builtins
(see shouldIgnoreMacro() in ASTWriter.cpp), so the head of the history list was
missing for builtin macros. So make the assert weaker, and splice the history
list to the existing single define for builtins.

https://reviews.llvm.org/D27545

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

7 years agoStore decls in prototypes on the declarator instead of in the AST
Reid Kleckner [Fri, 9 Dec 2016 17:14:05 +0000 (17:14 +0000)]
Store decls in prototypes on the declarator instead of in the AST

This saves two pointers from FunctionDecl that were being used for some
rare and questionable C-only functionality.  The DeclsInPrototypeScope
ArrayRef was added in r151712 in order to parse this kind of C code:

    enum e {x, y};
    int f(enum {y, x} n) {
     return x; // should return 1, not 0
    }

The challenge is that we parse 'int f(enum {y, x} n)' it its own
function prototype scope that gets popped before we build the
FunctionDecl for 'f'. The original change was doing two questionable
things:

1. Saving all tag decls introduced in prototype scope on a TU-global
Sema variable. This is problematic when you have cases like this, where
'x' and 'y' shouldn't be visible in 'f':
    void f(void (*fp)(enum { x, y } e)) { /* no x */ }
This patch fixes that, so now 'f' can't see 'x', which is consistent
with GCC.

2. Storing the decls in FunctionDecl in ActOnFunctionDeclarator so that
they could be used in ActOnStartOfFunctionDef. This is just an
inefficient way to move information around. The AST lives forever, but
the list of non-parameter decls in prototype scope is short lived.

Moving these things to the Declarator solves both of these issues.

Reviewers: rsmith

Subscribers: jmolloy, cfe-commits

Differential Revision: https://reviews.llvm.org/D27279

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

7 years agoDocument and publish the useful module-file-info flag.
Vassil Vassilev [Fri, 9 Dec 2016 14:20:32 +0000 (14:20 +0000)]
Document and publish the useful module-file-info flag.

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

7 years ago[clang-format] calculate MaxInsertOffset in the original code correctly.
Eric Liu [Fri, 9 Dec 2016 11:45:50 +0000 (11:45 +0000)]
[clang-format] calculate MaxInsertOffset in the original code correctly.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D27615

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

7 years ago[Headers] Add #include_next for tgmath.h on Darwin
Bruno Cardoso Lopes [Fri, 9 Dec 2016 03:30:46 +0000 (03:30 +0000)]
[Headers] Add #include_next for tgmath.h on Darwin

Allow darwin to provide additional definitions and implementation
specifc values for tgmath.h on Apple platforms.

rdar://problem/19019845

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

7 years ago[OpenMP] Sema and parsing for 'teams distribute parallel for' pragma
Kelvin Li [Fri, 9 Dec 2016 03:24:30 +0000 (03:24 +0000)]
[OpenMP] Sema and parsing for 'teams distribute parallel for' pragma

This patch is to implement sema and parsing for 'teams distribute parallel for' pragma.

Differential Revision: https://reviews.llvm.org/D27345

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

7 years ago[CrashReproducer] Provide a clean dir path for -fmodules-cache-path
Bruno Cardoso Lopes [Fri, 9 Dec 2016 03:11:48 +0000 (03:11 +0000)]
[CrashReproducer] Provide a clean dir path for -fmodules-cache-path

The most common workflow with module reproducers involves deleting the
module cache before running the script. This happens because leftovers
from the crash are present in the cache and could trigger unrelated and
confusing errors, misleading from the initial reproduction intent.
Change this to point to a clean path but leave the leftovers untouched.

rdar://problem/28655070

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

7 years ago[CrashReproducer] Rewrite relative include paths
Bruno Cardoso Lopes [Fri, 9 Dec 2016 02:22:47 +0000 (02:22 +0000)]
[CrashReproducer] Rewrite relative include paths

When -fmodules is on, the reproducer invocation currently leave paths
for include-like flags as is. If the path is relative, the reproducer
doesn't know how to access that file during reproduction time because
the VFS cannot reason about relative paths.

Expand relative paths to absolute ones when creating the reproducer
command line. This allows, for example, the reproducer to work for
crashes while building clang with modules; this wasn't possible before
because building clang requires using relative inc dir from within the
build directory.

rdar://problem/28655070

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

7 years agoSpecify -std=gnu++98 on some Rewriter tests. NFC.
Paul Robinson [Fri, 9 Dec 2016 01:20:40 +0000 (01:20 +0000)]
Specify -std=gnu++98 on some Rewriter tests. NFC.

Rewriter tests rewrite Objective-C++ to C++, and then compile the
result.  The rewritten result sometimes doesn't work with C++11.  As
we want to allow Clang's default dialect to become C++11, we need to
make sure the tests will still pass.

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

7 years ago[AST, ASTMatchers, Basic] Fix some Clang-tidy modernize and Include What You Use...
Eugene Zelenko [Fri, 9 Dec 2016 00:11:53 +0000 (00:11 +0000)]
[AST, ASTMatchers, Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

7 years ago[DOXYGEN] Improved doxygen comments for xmmintrin.h intrinsics.
Ekaterina Romanova [Thu, 8 Dec 2016 23:58:39 +0000 (23:58 +0000)]
[DOXYGEN] Improved doxygen comments for xmmintrin.h intrinsics.

Tagged parameter names with \a doxygen command to display parameters in italics.
Formatted comments to fit into 80 chars.

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

7 years ago[DOXYGEN] Improved doxygen comments.
Ekaterina Romanova [Thu, 8 Dec 2016 23:32:07 +0000 (23:32 +0000)]
[DOXYGEN] Improved doxygen comments.

Improved doxygen comments for fxsrintrin.h and mmintrin.h intrinsics by taagging parameter names with \a doxygen command to display parameters in italics.

Formatted comments to fit into 80 chars.

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

7 years ago[sanitizers] lsan+sancov doesn't need ubsanrt (multi def error)
Mike Aizatsky [Thu, 8 Dec 2016 22:25:01 +0000 (22:25 +0000)]
[sanitizers] lsan+sancov doesn't need ubsanrt (multi def error)

Reviewers: eugenis

Differential Revision: https://reviews.llvm.org/D27594

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

7 years ago[DOXYGEN] Improved doxygen comments for emmintrin.h intrinsics.
Ekaterina Romanova [Thu, 8 Dec 2016 22:10:51 +0000 (22:10 +0000)]
[DOXYGEN] Improved doxygen comments for emmintrin.h intrinsics.

Tagged parameter names with \a doxygen command to display parameters in italics.
Formatted comments to fit into 80 chars.

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

7 years ago[DebugInfo] Relax test case for long double constants.
David Gross [Thu, 8 Dec 2016 21:15:17 +0000 (21:15 +0000)]
[DebugInfo] Relax test case for long double constants.

Summary:
D27549 (partial fix for PR26619) emits a constant value in the debug
metadata for a floating-point static const that does not exceed 64
bits in size.  The regression test accompanying that fix assumes that
a long double exceeds 64 bits in size and hence does not get a
constant value in the debug metadata.  However, for some targets --
such as "--target=hexagon-unknown-elf" -- a long double does not
exceed 64 bits in size, and hence the test fails.

As a temporary fix, modify the regression test to no longer inspect
the debug metadata for a long double.

Reviewers: cfe-commits, probinson

Differential Revision: https://reviews.llvm.org/D27589

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

7 years ago[DebugInfo] Add support for __fp16, float, and double constants.
David Gross [Thu, 8 Dec 2016 20:02:46 +0000 (20:02 +0000)]
[DebugInfo] Add support for __fp16, float, and double constants.

Summary:
Partial fix for PR26619.

Prior to this change, a DIGlobalVariable corresponding to a static
const was marked with an expression corresponding to its constant
value only if it is of integral type.  With this change, we now do the
same if it is of __fp16, float, or double type (that is,
floating-point types that do not exceed 64 bits in size, and hence are
supported easily by the existing LLVM machinery for creating constant
expressions in debug info).

Reviewers: llvm-commits

Differential Revision: https://reviews.llvm.org/D27549

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

7 years ago[CUDA] Ignore implicit target attributes during function template instantiation.
Artem Belevich [Thu, 8 Dec 2016 19:38:13 +0000 (19:38 +0000)]
[CUDA] Ignore implicit target attributes during function template instantiation.

Some functions and templates are treated as __host__ __device__ even
when they don't have explicitly specified target attributes.
What's worse, this treatment may change depending on command line
options (-fno-cuda-host-device-constexpr) or
#pragma clang force_cuda_host_device.

Combined with strict checking for matching function target that comes
with D25809(r288962), it makes it hard to write code which would
explicitly instantiate or specialize some functions regardless of
pragmas or command line options in effect.

This patch changes the way we match target attributes of base template
vs attributes used in explicit instantiation or specialization so that
only explicitly specified attributes are considered. This makes base
template selection behave consistently regardless of pragma of command
line options that may affect CUDA target.

Differential Revision: https://reviews.llvm.org/D25845

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

7 years ago[DOXYGEN] Improved doxygen comments.
Ekaterina Romanova [Thu, 8 Dec 2016 17:57:23 +0000 (17:57 +0000)]
[DOXYGEN] Improved doxygen comments.

Improved doxygen comments for __wmmintrin_pclmul.h and ammintrin.h intrinsics by taagging parameter names with \a doxygen command to display parameters in italics.

Formatted comments to fit into 80 chars.

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

7 years agoFixing test to work when the compiler defaults to a different C++ standard version.
Douglas Yung [Thu, 8 Dec 2016 17:27:20 +0000 (17:27 +0000)]
Fixing test to work when the compiler defaults to a different C++ standard version.

Differential Revision: https://reviews.llvm.org/D27488

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

7 years ago[CodeCompletion][ObjC] Use a parameterized NSSet return type for
Alex Lorenz [Thu, 8 Dec 2016 16:49:05 +0000 (16:49 +0000)]
[CodeCompletion][ObjC] Use a parameterized NSSet return type for
keyPathsForValuesAffecting* KVO completion results

rdar://23791701

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

7 years ago[CodeCompletion] Provide Objective-C class property completion results
Alex Lorenz [Thu, 8 Dec 2016 15:09:40 +0000 (15:09 +0000)]
[CodeCompletion] Provide Objective-C class property completion results

This commit provides class property code completion results. It supports
explicit and implicit class properties, but the special block completion is done
only for explicit properties right now.

rdar://25636195

Differential Revision: https://reviews.llvm.org/D27053

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

7 years ago[Sema] Avoid "case value not in enumerated type" warning for C++11 opaque enums
Alex Lorenz [Thu, 8 Dec 2016 14:46:05 +0000 (14:46 +0000)]
[Sema] Avoid "case value not in enumerated type" warning for C++11 opaque enums

This commit ensures that the switch warning "case value not in enumerated type"
isn't shown for opaque enums. We don't know the actual list of values in opaque
enums, so that warning is incorrect.

rdar://29230764

Differential Revision: https://reviews.llvm.org/D27299

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

7 years ago[analyzer] Add dispatch_data_create as a special case in RetainCountChecker.
Artem Dergachev [Thu, 8 Dec 2016 14:05:48 +0000 (14:05 +0000)]
[analyzer] Add dispatch_data_create as a special case in RetainCountChecker.

This function receives a callback block. The analyzer suspects that this block
may be used to take care of releasing the libdispatch object returned from
the function. In fact, it doesn't - it only releases the raw data buffer.
Inform the analyzer about that. Fixes the resulting false negatives.

rdar://problem/22280098

Differential Revision: https://reviews.llvm.org/D27409

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

7 years ago[ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmType
Malcolm Parsons [Thu, 8 Dec 2016 11:46:22 +0000 (11:46 +0000)]
[ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmType

Summary: Needed for https://reviews.llvm.org/D27166

Reviewers: sbenza, bkramer, klimek

Subscribers: aemerson, cfe-commits

Differential Revision: https://reviews.llvm.org/D27447

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

7 years ago[DOXYGEN] Improved doxygen comments for avxintrin.h intrinsics.
Ekaterina Romanova [Thu, 8 Dec 2016 04:09:17 +0000 (04:09 +0000)]
[DOXYGEN] Improved doxygen comments for avxintrin.h intrinsics.

Tagged parameter names with \a doxygen command to display them in italics.
Formatted comments to fit into 80 chars.

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

7 years ago[c++1z] P0490R0, NB comment GB 20: if std::tuple_size<T> is complete, use the
Richard Smith [Thu, 8 Dec 2016 03:24:55 +0000 (03:24 +0000)]
[c++1z] P0490R0, NB comment GB 20: if std::tuple_size<T> is complete, use the
tuple-like interpretation of decomposition declaration even if there is no
::value member. We already did this, anticipating this resolution, just update
comments and tweak a testcase.

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

7 years ago[c++1z] P0003R5: Removing dynamic exception specifications.
Richard Smith [Thu, 8 Dec 2016 02:49:07 +0000 (02:49 +0000)]
[c++1z] P0003R5: Removing dynamic exception specifications.

We continue to support dynamic exception specifications in C++1z as an
extension, but produce an error-by-default warning when we encounter one. This
allows users to opt back into the feature with a warning flag, and implicitly
opts system headers back into the feature should they happen to use it.

There is one semantic change implied by P0003R5 but not implemented here:
violating a throw() exception specification should now call std::terminate
directly instead of calling std::unexpected(), but since P0003R5 also removes
std::unexpected() and std::set_unexpected, and the default unexpected handler
calls std::terminate(), a conforming C++1z program cannot tell that we are
still calling it. The upside of this strategy is perfect backwards
compatibility; the downside is that we don't get the more efficient 'noexcept'
codegen for 'throw()'.

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

7 years ago[Headers] Enable #include_next<float.h> on Darwin
Bruno Cardoso Lopes [Thu, 8 Dec 2016 02:13:56 +0000 (02:13 +0000)]
[Headers] Enable #include_next<float.h> on Darwin

Allows darwin targets to provide additional definitions and
implementation specifc values for float.h

rdar://problem/21961491

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

7 years agoLoosen checks for _MSC_FULL_VER under -fms-extensions.
David L. Jones [Thu, 8 Dec 2016 01:11:41 +0000 (01:11 +0000)]
Loosen checks for _MSC_FULL_VER under -fms-extensions.

Summary:
On actual Windows hosts :-) , this could report something other than the
fallback, with a non-zero minor/build number.

Reviewers: rnk, llvm-commits

Differential Revision: https://reviews.llvm.org/D27554

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

7 years ago[Driver][Darwin] Disable default stack protector levels in freestanding mode.
Bruno Cardoso Lopes [Thu, 8 Dec 2016 00:22:06 +0000 (00:22 +0000)]
[Driver][Darwin] Disable default stack protector levels in freestanding mode.

Currently -fstack-protector is on by default when using -ffreestanding.
Change the default behavior to have it off when using -ffreestanding.

rdar://problem/14089363

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

7 years agoRefactor how the MSVC toolchain searches for a compatibility version.
David L. Jones [Wed, 7 Dec 2016 23:41:58 +0000 (23:41 +0000)]
Refactor how the MSVC toolchain searches for a compatibility version.

Summary:
The MSVC toolchain and Clang driver combination currently uses a fairly complex
sequence of steps to determine the MS compatibility version to pass to cc1.
There is some oddness in this sequence currently, with some code which inspects
flags in the toolchain, and some code which inspects the triple and local
environment in the driver code.

This change is an attempt to consolidate most of this logic so that
Win32-specific code lives in MSVCToolChain.cpp. I'm not 100% happy with the
split, so any suggestions are welcome.

There are a few things you might want to watch for for specifically:

 - On all platforms, if MSVC compatibility flags are provided (and valid), use
   those.
 - The fallback sequence should be the same as before, but is now consolidated
   into MSVCToolChain::getMSVCVersion:
   - Otherwise, try to use the Triple.
   - Otherwise, on Windows, check the executable.
   - Otherwise, on Windows or with --fms-extensions, default to 18.
   - Otherwise, we can't determine the version.
 - MSVCToolChain::ComputeEffectiveTriple no longer calls the base
   ToolChain::ComputeEffectiveClangTriple. The only thing it would change for
   Windows the architecture, which we don't care about for the compatibility
   version.
    - I'm not sure whether this is philosophically correct (but it should
      be easy to add back to MSVCToolChain::getMSVCVersionFromTriple if not).
    - Previously, Tools.cpp just called getTriple() anyhow, so it doesn't look
      like the effective triple was always being used previously anyhow.

Reviewers: hans, compnerd, llvm-commits, rnk

Subscribers: amccarth

Differential Revision: https://reviews.llvm.org/D27477

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

7 years agoAdd more tests for MSVC version handling.
David L. Jones [Wed, 7 Dec 2016 23:39:44 +0000 (23:39 +0000)]
Add more tests for MSVC version handling.

Summary:
This change adds more test cases for the default MSVC compatibility version:
 1. When -fms-extensions is supplied, but -fmsc-version and
    -fms-compatibility-version are not.
 2. With the target triple specifies an MSVC environment, but no other
    -fms* flags.

Reviewers: rnk, llvm-commits

Subscribers: hans, compnerd, amccarth

Differential Revision: https://reviews.llvm.org/D27498

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

7 years ago[Driver] Add tests for default stack protector values on Darwin
Bruno Cardoso Lopes [Wed, 7 Dec 2016 23:20:30 +0000 (23:20 +0000)]
[Driver] Add tests for default stack protector values on Darwin

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

7 years ago[RecursiveASTVisitor] Improve post-order traversal unit test
Malcolm Parsons [Wed, 7 Dec 2016 20:38:20 +0000 (20:38 +0000)]
[RecursiveASTVisitor] Improve post-order traversal unit test

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

7 years ago[CUDA] Improve target attribute checking for function templates.
Artem Belevich [Wed, 7 Dec 2016 19:27:16 +0000 (19:27 +0000)]
[CUDA] Improve target attribute checking for function templates.

* __host__ __device__ functions are no longer considered to be
  redeclarations of __host__ or __device__ functions. This prevents
  unintentional merging of target attributes across them.
* Function target attributes are not considered (and must match) during
  explicit instantiation and specialization of function templates.

Differential Revision: https://reviews.llvm.org/D25809

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

7 years ago[RecursiveASTVisitor] Fix post-order traversal of UnaryOperator
Malcolm Parsons [Wed, 7 Dec 2016 17:39:04 +0000 (17:39 +0000)]
[RecursiveASTVisitor] Fix post-order traversal of UnaryOperator

Reviewers: aaron.ballman, klimek, doug.gregor, teemperor, rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D26742

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

7 years ago[analyzer] Fix typo in nullability checker diagnostic
Devin Coughlin [Wed, 7 Dec 2016 17:36:27 +0000 (17:36 +0000)]
[analyzer] Fix typo in nullability checker diagnostic

'infered' --> 'inferred'

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

7 years ago[analyzer] Remove an unused enum value in RetainCountChecker.
Artem Dergachev [Wed, 7 Dec 2016 16:51:54 +0000 (16:51 +0000)]
[analyzer] Remove an unused enum value in RetainCountChecker.

No functional change intended.

Differential Revision: https://reviews.llvm.org/D27408

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

7 years ago[analyzer] pr31226: Disable CastSizeChecker in C++ because it's not quite ready.
Artem Dergachev [Wed, 7 Dec 2016 16:12:26 +0000 (16:12 +0000)]
[analyzer] pr31226: Disable CastSizeChecker in C++ because it's not quite ready.

Avoids a crash and a related false positive.

Investigation by Daniel Krupp!

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

7 years agoImplement the -Wstrict-prototypes warning
Alex Lorenz [Wed, 7 Dec 2016 10:52:18 +0000 (10:52 +0000)]
Implement the -Wstrict-prototypes warning

This commit fixes PR20796. It implements the C only -Wstrict-prototypes warning.
Clang now emits a warning for function declarations which have no parameters
specified and for K&R function definitions with more than 0 parameters that are
not preceded by a previous prototype declaration.

The patch was originally submitted by Paul Titei!

rdar://15060615

Differential Revision: https://reviews.llvm.org/D16533

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

7 years ago[ObjC++] Don't enter a C++ declarator scope when the current context is
Alex Lorenz [Wed, 7 Dec 2016 10:24:44 +0000 (10:24 +0000)]
[ObjC++] Don't enter a C++ declarator scope when the current context is
an Objective-C declaration

This commit ensures that Sema won't enter a C++ declarator scope when the
current context is an Objective-C declaration. This prevents an assertion
failure in EnterDeclaratorContext that's used to ensure that current context
will be restored correctly after exiting the declarator context.

rdar://20560175

Differential Revision: https://reviews.llvm.org/D26922

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

7 years agoCompilation database test: don't try to output to CWD
Sam McCall [Wed, 7 Dec 2016 09:19:07 +0000 (09:19 +0000)]
Compilation database test: don't try to output to CWD

Summary:
Write output from compilation database test to %T rather than the working dir.
Sometimes CWD isn't writable!
Also specify no-canonical-prefixes so that clang has 'clang' in the name.

Reviewers: bkramer

Subscribers: joerg, cfe-commits

Differential Revision: https://reviews.llvm.org/D27504

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

7 years ago[OpenCL] Added a LIT test for ensuring address space mangling is done the same both...
Alexey Bader [Wed, 7 Dec 2016 08:43:49 +0000 (08:43 +0000)]
[OpenCL] Added a LIT test for ensuring address space mangling is done the same both in OpenCL1.2 and OpenCL2.0.

Patch by Egor Churaev (echuraev).

Reviewers: Anastasia

Subscribers: yaxunl, cfe-commits, bader

Differential Revision: https://reviews.llvm.org/D27403

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

7 years ago[OpenCL] Fix SPIR version generation.
Alexey Bader [Wed, 7 Dec 2016 08:38:24 +0000 (08:38 +0000)]
[OpenCL] Fix SPIR version generation.

Patch by Egor Churaev (echuraev).

Reviewers: Anastasia

Subscribers: bader, yaxunl, cfe-commits

Differential Revision: https://reviews.llvm.org/D27300

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

7 years agoDriver: Remove support for -fobjc-gc*
Duncan P. N. Exon Smith [Wed, 7 Dec 2016 00:31:10 +0000 (00:31 +0000)]
Driver: Remove support for -fobjc-gc*

As a first step toward removing Objective-C garbage collection from
Clang, remove support from the driver.  I'm hoping this will flush out
any expected bots/configurations/whatever that might rely on it.

I've left the options behind temporarily in -cc1 to keep tests passing.
I'll kill them off entirely in a follow up when I've had a chance to
update/delete the rest of Clang.

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

7 years agoFix test.
Richard Smith [Wed, 7 Dec 2016 00:24:40 +0000 (00:24 +0000)]
Fix test.

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

7 years ago[MS-ABI]V-base dtor called more than needed when throw happens in v-base ctor in...
Erich Keane [Wed, 7 Dec 2016 00:21:45 +0000 (00:21 +0000)]
[MS-ABI]V-base dtor called more than needed when throw happens in v-base ctor in window. Need add "complete object flag" check in eh cleanup code.

The problem only happen on window ( A MS-ABI issuer )

The nature of the problem is virtual base dtor called more than it is needed after exception throw in inheriting base class(with virtual bases) ctor.

The root problem is when throw happen, not all virtual base classes have been contructed, so not all virtual base dtors are need to call for ehcleanup.

clang has code to handle vbase initialization: basically add check for "complete object flag" before call to v-base ctor.
But that part is missing for cleanup code.

To fix this add similar code as v-base init to cleanup code, same algorithm.

1> Add new routine:
EmitDtorCompleteObjectHandler

With corresponding to EmitCtorCompleteObjectHandler

2> In the EmitDestructorCal
Call EmitDtorCompleteObjectHandler when generate ehcleanup inside ctor.

Just add check for "complete object flag" before call to v-base dtor.

Without my change:
ehcleanup: ; preds = %ctor.skip_vbases

%13 = cleanuppad within none [], !dbg !66
%14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66
%15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66
%16 = bitcast i8* %15 to %struct.class_2*, !dbg !66
call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token

%13) ], !dbg !66

cleanupret from %13 unwind to caller, !dbg !66

with my change:
ehcleanup: ; preds = %ctor.skip_vbases

%13 = cleanuppad within none [], !dbg !66
%14 = bitcast %struct.class_0* %this1 to i8*, !dbg !66
%15 = getelementptr inbounds i8, i8* %14, i64 8, !dbg !66
%16 = bitcast i8* %15 to %struct.class_2*, !dbg !66
%is_complete_object4 = icmp ne i32 %is_most_derived2, 0, !dbg !66
br i1 %is_complete_object4, label %Dtor.dtor_vbase, label %Dtor.skip_vbase, !d

bg !66

Dtor.dtor_vbase: ; preds = %ehcleanup

call void @"\01??1class_2@@UEAA@XZ"(%struct.class_2* %16) #6 [ "funclet"(token

%13) ], !dbg !66

br label %Dtor.skip_vbase, !dbg !66

Dtor.skip_vbase: ; preds = %Dtor.dtor_vbase, %ehcleanup

cleanupret from %13 unwind to caller, !dbg !66

Please let me know you need more info.

Patch by Jennifer Yu.

Differential Revision: https://reviews.llvm.org/D27358

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

7 years agoAddress review feedback by adding comments about ${:uid}
Reid Kleckner [Wed, 7 Dec 2016 00:17:18 +0000 (00:17 +0000)]
Address review feedback by adding comments about ${:uid}

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

7 years ago[c++17] P0135R1: Guaranteed copy elision.
Richard Smith [Tue, 6 Dec 2016 23:52:28 +0000 (23:52 +0000)]
[c++17] P0135R1: Guaranteed copy elision.

When an object of class type is initialized from a prvalue of the same type
(ignoring cv qualifications), use the prvalue to initialize the object directly
instead of inserting a redundant elidable call to a copy constructor.

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

7 years ago[OpenMP] Fix typo in the run command in the test case. NFC.
Kelvin Li [Tue, 6 Dec 2016 23:18:06 +0000 (23:18 +0000)]
[OpenMP] Fix typo in the run command in the test case. NFC.

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

7 years agoDisable -Wweak-vtables when there are no key functions
Reid Kleckner [Tue, 6 Dec 2016 21:44:41 +0000 (21:44 +0000)]
Disable -Wweak-vtables when there are no key functions

Our -Wweak-vtables diagnostic is powered by our key function
calculation, which checks if key functions are enabled. We won't find
any key functions in C++ ABIs that lack key functions, so -Wweak-vtables
was warning on every dynamic class before this change. So, turn off this
warning in ABIs without key functions.

Addresses PR31220

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

7 years ago[OpenMP] Fix typo in the test case. NFC.
Kelvin Li [Tue, 6 Dec 2016 18:50:20 +0000 (18:50 +0000)]
[OpenMP] Fix typo in the test case. NFC.

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

7 years agoFix FileCheck pattern.
Joerg Sonnenberger [Tue, 6 Dec 2016 17:06:33 +0000 (17:06 +0000)]
Fix FileCheck pattern.

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

7 years agoAllow additional output since e.g. OSX appends flags like
Joerg Sonnenberger [Tue, 6 Dec 2016 17:02:41 +0000 (17:02 +0000)]
Allow additional output since e.g. OSX appends flags like
"-mlinker-version=264.3.102" automatically. Wiring down a target on the
other hand is problematic as this actually needs to run codegen and
doesn't work with -###.

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

7 years ago[MS ABI] Implement more of the Itanium mangling rules
David Majnemer [Tue, 6 Dec 2016 17:01:02 +0000 (17:01 +0000)]
[MS ABI] Implement more of the Itanium mangling rules

We didn't implement handle corner cases like:
 - lambdas used to initialize a field
 - lambdas in default argument initializers

This fixes PR31197.

Differential Revision: https://reviews.llvm.org/D27226

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

7 years agoMake test case slightly more robust by explicitly passing --sysroot.
Joerg Sonnenberger [Tue, 6 Dec 2016 16:47:00 +0000 (16:47 +0000)]
Make test case slightly more robust by explicitly passing --sysroot.
Otherwise it would change when DEFAULT_SYSROOT is provided.

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

7 years agoIf clang was configured for a DEFAULT_SYSROOT and no --sysroot argument
Joerg Sonnenberger [Tue, 6 Dec 2016 16:40:57 +0000 (16:40 +0000)]
If clang was configured for a DEFAULT_SYSROOT and no --sysroot argument
is seen, record one with the implicit default.

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

7 years agoAllow clang to write compilation database records.
Joerg Sonnenberger [Tue, 6 Dec 2016 16:33:22 +0000 (16:33 +0000)]
Allow clang to write compilation database records.

When integrating compilation database output into existing build
systems, two approaches dominate so far. Ad-hoc implementation of the
JSON output rules or using compiler wrappers. This patch adds a new
option "-MJ foo.json" which gives a slightly cleaned up compilation
record. The output is a fragment, i.e. you still need to add the array
markers, but it allows multiple files to be easy merged.

This way the only change in a build system is adding the option with
potentially a per-target output file and merging the files with
something like
  (echo '['; cat *.o.json; echo ']' > compilation_database.json
or some additional filtering to remove the trailing comma for strict
JSON compliance.

Differential Revision: https://reviews.llvm.org/D27140

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

7 years agoFix doc string typo: s/@__yes/@__objc_yes/
Jonathan Roelofs [Tue, 6 Dec 2016 15:45:41 +0000 (15:45 +0000)]
Fix doc string typo: s/@__yes/@__objc_yes/

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

7 years agoFix two clang-tidy misc-move-forwarding-reference warnings
Malcolm Parsons [Tue, 6 Dec 2016 14:49:18 +0000 (14:49 +0000)]
Fix two clang-tidy misc-move-forwarding-reference warnings

Patch by Michael Sharpe.

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

7 years agoAlso recognize -std=iso9899:201x
Benjamin Kramer [Tue, 6 Dec 2016 10:23:07 +0000 (10:23 +0000)]
Also recognize -std=iso9899:201x

It should already be handled but a typo in the LANGSTANDARD() definition
was introduced in r147220.

Patch by Alexander Richardson, test case by me.

Differential Revision:https://reviews.llvm.org/D27427

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

7 years ago[clang] Fix D26214: Move error handling out of MC and to the callers.
Mandeep Singh Grang [Tue, 6 Dec 2016 02:49:16 +0000 (02:49 +0000)]
[clang] Fix D26214: Move error handling out of MC and to the callers.

Summary: Related llvm patch: https://reviews.llvm.org/D27359

Reviewers: echristo, t.p.northover, rengolin, grosbach, compnerd

Subscribers: mehdi_amini, cfe-commits, llvm-commits

Tags: #clang-c

Differential Revision: https://reviews.llvm.org/D27360

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

7 years agoClean up some Sema checking code. NFC
Richard Trieu [Tue, 6 Dec 2016 01:42:28 +0000 (01:42 +0000)]
Clean up some Sema checking code.  NFC

- Rename CheckMinZero to CheckMaxUnsignedZero to reflect its actual purpose.
- Remove unused parameters from CheckAbsoluteValueFunction and
  CheckMaxUnsignedZero functions.
- Refactor the function name check so both functions can use the same one.

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

7 years agoRevert r288626, which reverts r288449. Original commit message:
Richard Smith [Tue, 6 Dec 2016 00:40:17 +0000 (00:40 +0000)]
Revert r288626, which reverts r288449. Original commit message:

Recover better from an incompatible .pcm file being provided by -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually.

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

7 years agoAdd test for r288732, warn on unsigned zero in std::max
Richard Trieu [Tue, 6 Dec 2016 00:27:21 +0000 (00:27 +0000)]
Add test for r288732, warn on unsigned zero in std::max

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

7 years agoAdditional test file missed from r288737.
Richard Smith [Tue, 6 Dec 2016 00:14:22 +0000 (00:14 +0000)]
Additional test file missed from r288737.

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

7 years ago[modules] Use the "redundant #include" diagnostic rather than the "module
Richard Smith [Tue, 6 Dec 2016 00:12:39 +0000 (00:12 +0000)]
[modules] Use the "redundant #include" diagnostic rather than the "module
import can't appear here" diagnostic if an already-visible module is textually
entered (because we have the module map but not the AST file) within a
function/namespace scope.

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