Commit Graph

62108 Commits

Author SHA1 Message Date
Chad Rosier 17d2e8789c [Driver] Make sure -fno-math-builtin option is being passed by the driver.
Support for the -fno-math-builtin option was added in r186899.  The codegen side
is being tested in test/CodeGen/nomathbuiltin.c.  The missing part was just
passing the option through the driver.

PR26317

llvm-svn: 258814
2016-01-26 15:52:05 +00:00
Chad Rosier 38fd54edc5 [Driver] Update FIXME comment now that PR4941 has been addressed.
The actual fix should be addressed by someone who can test on Darwin.

llvm-svn: 258813
2016-01-26 15:46:29 +00:00
Alexey Bataev 1189bd0205 [OPENMP 4.5] Allow arrays in 'reduction' clause.
OpenMP 4.5, alogn with array sections, allows to use variables of array type in reductions.

llvm-svn: 258804
2016-01-26 12:20:39 +00:00
Matt Arsenault cf70cb9d00 AMDGPU: Add amdgcn cube builtins
llvm-svn: 258794
2016-01-26 06:37:54 +00:00
Xiuli Pan bb4d8d30b1 Recommit: R258773 [OpenCL] Pipe builtin functions
Fix arc patch fuzz error.
Summary:
Support for the pipe built-in functions for OpenCL 2.0.
The pipe builtin functions may have infinite kinds of element types, one approach
would be to just generate calls that would always use generic types such as void*.
This patch is based on bader's opencl support patch on SPIR-V branch.

Reviewers: Anastasia, pekka.jaaskelainen

Subscribers: keryell, bader, cfe-commits

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

llvm-svn: 258782
2016-01-26 04:03:48 +00:00
Richard Trieu 3a5c958182 Fix -Wnull-conversion for long macros.
Move the function to get a macro name from DiagnosticRenderer.cpp to Lexer.cpp
so that other files can use it.  Lexer now has two functions to get the
immediate macro name, the newly added one is better for diagnostic purposes.
Make -Wnull-conversion use this function for better NULL macro detection.

llvm-svn: 258778
2016-01-26 02:51:55 +00:00
Ehsan Akhgari fefe300a62 Recommit the test for r258720 using -###
llvm-svn: 258776
2016-01-26 02:23:05 +00:00
David Majnemer 747f168e8d Revert "[OpenCL] Pipe builtin functions"
This reverts commit r258773, it broke the build bots:
http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/43853

llvm-svn: 258775
2016-01-26 02:22:31 +00:00
Xiuli Pan 3a9952c9e7 [OpenCL] Pipe builtin functions
Summary:
Support for the pipe built-in functions for OpenCL 2.0.
The pipe builtin functions may have infinite kinds of element types, one approach
would be to just generate calls that would always use generic types such as void*.
This patch is based on bader's opencl support patch on SPIR-V branch.

Reviewers: Anastasia, pekka.jaaskelainen

Subscribers: keryell, bader, cfe-commits

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

llvm-svn: 258773
2016-01-26 02:06:04 +00:00
Ehsan Akhgari 09a8a8a59d Revert the test for r258720 temporarily
This test is failing on a bot for reasons that are unclear to me.
Reverting for now...

llvm-svn: 258772
2016-01-26 01:51:47 +00:00
David Majnemer fedb8d4bab [Sema] Remove stray semicolons.
No functional change is intended.

llvm-svn: 258769
2016-01-26 01:39:17 +00:00
David Majnemer d3d91bd17f [Sema] Incomplete types are OK for covariant returns
Per C++14 [class.virtual]p8, it is OK for the return type's class type
to be incomplete so long as the return type is the same between the base
and complete classes.

This fixes PR26297.

llvm-svn: 258768
2016-01-26 01:37:01 +00:00
David Majnemer 145abde152 [MS Compat] Don't crash if __GetExceptionInfo is in global scope
__GetExceptionInfo triggered Sema::LazilyCreateBuiltin which tries to
create a non-templated function decl.  This is unnecessary and
ill-advised, there is no need for us to create a declaration for such a
builtin.

This fixes PR26298.

llvm-svn: 258762
2016-01-26 01:12:17 +00:00
Evgeniy Stepanov 4d3b087c93 Fix use of constexpr std::pair that's not in C++11.
llvm-svn: 258749
2016-01-25 23:45:37 +00:00
Evgeniy Stepanov 3fd61df186 [cfi] Cross-DSO CFI diagnostic mode (clang part)
* Runtime diagnostic data for cfi-icall changed to match the rest of
  cfi checks
* Layout of all CFI diagnostic data changed to put Kind at the
  beginning. There is no ABI stability promise yet.
* Call cfi_slowpath_diag instead of cfi_slowpath when needed.
* Emit __cfi_check_fail function, which dispatches a CFI check
  faliure according to trap/recover settings of the current module.
* A tiny driver change to match the way the new handlers are done in
  compiler-rt.

llvm-svn: 258745
2016-01-25 23:34:52 +00:00
Justin Lebar bbdf697a51 [CUDA] Add -target to cuda-constructor-alias.cu test so it doesn't fail on Mac.
The test was checking that we passed -mconstructor-alias to host
compilation, but that explicitly shouldn't happen on Mac.

llvm-svn: 258737
2016-01-25 22:52:31 +00:00
Manman Ren b373677c61 Update comments to match the implementation.
llvm-svn: 258735
2016-01-25 22:37:47 +00:00
Justin Lebar cd2f6bbd5c [CUDA] Don't generate aliases for static extern "C" functions.
Summary:
These aliases are done to support inline asm, but there's nothing we can
do: NVPTX doesn't support aliases.

Reviewers: tra

Subscribers: cfe-commits, jhen, echristo

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

llvm-svn: 258734
2016-01-25 22:36:37 +00:00
Justin Lebar 710a35f1c7 [CUDA] Disable ctor/dtor aliases in device code.
Summary: NVPTX doesn't support aliases, so don't generate them.

Reviewers: tra

Subscribers: cfe-commits, jhen, echristo

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

llvm-svn: 258733
2016-01-25 22:36:35 +00:00
Manman Ren 392443879d Move ObjCPropertyDecl to before ObjCContainerDecl.
After we add ObjCPropertyDecl::isClassProperty, we can use it in
ObjCContainerDecl to define filter to iterate over instance properties
and class properties.

This is the first patch in a series of patches to support class properties
in addition to instance properties in objective-c.

rdar://23891898

llvm-svn: 258727
2016-01-25 21:52:26 +00:00
Ehsan Akhgari d851833c9a [MSVC Compat] Only warn for unknown clang-cl arguments
Summary:
MSVC's driver accepts all unknown arguments but warns about them.  clang
by default rejects all unknown arguments.  This causes issues
specifically with build systems such as autoconf which liberally pass
things such as $LDFLAGS to the compiler and expect everything to work.
This patch teaches clang-cl to ignore unknown driver arguments.

Reviewers: rnk

Subscribers: cfe-commits

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

llvm-svn: 258720
2016-01-25 21:14:52 +00:00
Paul Robinson 4391d09d60 LTO via the gold plugin needs to be told about debugger tuning.
Differential Revision: http://reviews.llvm.org/D16094

llvm-svn: 258712
2016-01-25 19:46:40 +00:00
Rafael Espindola b17bc536d3 Pass --wrap=pthread_create to linker for -fsplit-stack.
From

https://gcc.gnu.org/ml/gcc-patches/2010-09/msg01807.html

-fsplit-stack should pass --wrap=pthread_create to linker for -fsplit-stack
It is needed to initialize the stack guard.  This fixes PR 20148.

Patch by H.J Lu!

llvm-svn: 258698
2016-01-25 18:29:16 +00:00
Benjamin Kramer 54f81ed325 Fix printing of types in initializers with suppressed tags.
Tag and specifier printing can be suppressed in Decl::printGroup, but these suppressions leak into the initializers. Thus
    int *x = ((void *)0), *y = ((void *)0);
gets printed as
    int *x = ((void *)0), *y = ((*)0);
And
    struct { struct Z z; } z = {(struct Z){}};
gets printed as
    struct { struct Z z; } z = {(){}};
The stops the suppressions from leaking into the initializers.

Patch by Nick Sumner!

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

llvm-svn: 258679
2016-01-25 10:34:06 +00:00
Daniel Marjamaki d3e1dede4a [Sema] Improve constness
llvm-svn: 258673
2016-01-25 09:29:38 +00:00
Alexey Bataev 41ed6b7aba Allow capture typedefs/type aliases for VLAs in lambdas/captured statements chain.
Previous it was allowed to capture VLAs/types with arrays of runtime bounds only inside the first lambda/capture statement in stack. Patch allows to capture these typedefs implicitly in chains of lambdas/captured statements.

llvm-svn: 258669
2016-01-25 07:06:23 +00:00
Alexey Bataev 86a489e4f3 Fixed processing of GNU extensions to C99 designated initializers
Clang did not handles correctly inner parts of arrays/structures initializers in GNU extensions to C99 designated initializers. 

llvm-svn: 258668
2016-01-25 05:14:03 +00:00
Betul Buyukkurt 7e15272bbe [PGO] Windows buildbot failure fix. [NFC]
llvm-svn: 258652
2016-01-24 00:56:19 +00:00
Betul Buyukkurt 518276a5fe Clang changes for value profiling
Differential Revision: http://reviews.llvm.org/D8940

llvm-svn: 258650
2016-01-23 22:50:44 +00:00
Justin Lebar e48cd6c530 [CUDA] Disallow variadic functions other than printf in device code.
Reviewers: tra

Subscribers: cfe-commits, echristo, jhen

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

llvm-svn: 258643
2016-01-23 21:28:17 +00:00
Justin Lebar 3039a593db [CUDA] Make printf work.
Summary:
The code in CGCUDACall is largely based on a patch written by Eli
Bendersky:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20140324/210218.html

That patch implemented an LLVM pass lowering printf to vprintf; this
one does something similar, but in Clang codegen.

Reviewers: echristo

Subscribers: cfe-commits, jhen, tra, majnemer

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

llvm-svn: 258642
2016-01-23 21:28:14 +00:00
Justin Lebar a8f0254bc1 [CUDA] Reject the alias attribute in CUDA device code.
Summary: CUDA (well, strictly speaking, NVPTX) doesn't support aliases.

Reviewers: echristo

Subscribers: cfe-commits, jhen, tra

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

llvm-svn: 258641
2016-01-23 21:28:10 +00:00
Justin Lebar b2db45065c [CUDA] Use Triple::isNVPTX() instead of enumerating nvptx && nvptx64.
Summary: No functional changes.

Subscribers: tra, echristo, jhen, cfe-commits

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

llvm-svn: 258640
2016-01-23 21:28:08 +00:00
Aaron Ballman a681151ebd Improving documentation for the isMoveAssignmentOperator AST matcher.
Patch by Jonathan Coe.

llvm-svn: 258628
2016-01-23 17:49:18 +00:00
NAKAMURA Takumi 6dcb8149a5 SemaOpenMP.cpp: Fix a warning in r258543. [-Wunused-variable]
llvm-svn: 258598
2016-01-23 01:38:20 +00:00
Evgeniy Stepanov 93987df0fd [cfi] Do not emit bit set entry for available_externally vtables.
In the Itanium ABI, vtable may be emitted speculatively as an
available_externally global. Such vtable may not be present at the
link time and should not have a corresponding CFI bit set entry.

llvm-svn: 258596
2016-01-23 01:20:18 +00:00
Devin Coughlin 9ea8033d1b [analyzer] SATestBuild.py: Remove html and log when producing reference results.
The html reports are huge -- every issue in a given file results in a separate
copy of the source code, in HTML form, for the file. This gets very large
quickly and it doesn't make sense to check this into a reference repository.
Also remove the log when generating reference results because it can leak
absolute path names. We still keep both the html and the log around when
producing non-reference results.

llvm-svn: 258594
2016-01-23 01:09:07 +00:00
Anna Zaks e2fcffb0f9 [analyzer] Fixup r258572 Utility to match function calls.
Initialize the IdentifierInfo pointer. Hope this fixes the buildbot breakage.

llvm-svn: 258591
2016-01-23 00:45:37 +00:00
Adrian Prantl 3a2d4947a6 Module Debugging: Canonicalize the file names used as PCH module names
by stripping the path. Follow-up to r258555.

This is safe because only one PCH per CU is currently supported for
module debugging.

rdar://problem/24301262

llvm-svn: 258582
2016-01-22 23:30:56 +00:00
Aaron Ballman 672dde2b3e Properly encode the < entity; it was missing the semicolon. Regenerating the AST matcher reference after fixing the issue. Thanks to Richard for noticing the issue and bringing it to my attention!
llvm-svn: 258579
2016-01-22 23:15:00 +00:00
Aaron Ballman 31bde8762e Add am AST matcher for isMoveAssignmentOperator.
Patch by Jonathan Coe.

llvm-svn: 258573
2016-01-22 22:37:09 +00:00
Gabor Horvath 343730c58f [analyzer] Utility to match function calls.
This patch adds a small utility to match function calls. This utility abstracts away the mutable keywords and the lazy initialization and caching logic of identifiers from the checkers. The SimpleStreamChecker is ported over this utility within this patch to show the reduction of code and to test this change.

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

llvm-svn: 258572
2016-01-22 22:32:46 +00:00
Matt Arsenault 721d21b821 AMDGPU: Add barrier builtin
llvm-svn: 258564
2016-01-22 21:56:30 +00:00
Matt Arsenault 8a4078c741 AMDGPU: Rename builtins to use amdgcn prefix
Keep the ones still used by libclc around for now.

Emit the new amdgcn intrinsic name if not targeting r600,
in which case the old AMDGPU name is still used.

llvm-svn: 258560
2016-01-22 21:30:53 +00:00
Adrian Prantl aa5d08d04b Module debugging: Create a parent DIModule with the PCH name for types
emitted into a precompiled header to mirror the debug info emitted for
object files importing the PCH.

rdar://problem/24290667

llvm-svn: 258555
2016-01-22 21:14:41 +00:00
Samuel Antao 7b384e7fef [OpenMP] Remove '#if 1' hanging in target_map_messages.cpp.
llvm-svn: 258550
2016-01-22 20:52:54 +00:00
Samuel Antao 5de996e3bd [OpenMP] Update map clause SEMA to support OpenMP 4.5 possible list items.
Summary:
Extend support in the map clause SEMA for the expressions supported in the OpenMP 4.5 specification, namely member expressions.  

Fix some bugs in the previous implementation of SEMA related with expressions that do not consist of single variable references.

Fix bug in parsing when the expression in the map clause do not start with an identifier: accept any expression in the map clause and check for validity in SEMA instead of just ignoring it.

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

Subscribers: cfe-commits, fraggamuffin, caomhin

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

llvm-svn: 258543
2016-01-22 20:21:36 +00:00
Adrian Prantl 98bfc82c39 Fix the build by using the correct suffix for 64 bit literals
llvm-svn: 258531
2016-01-22 19:29:41 +00:00
Ehsan Akhgari 34461a626e [MSVC Compat] Accept elided commas in macro function arguments
Summary:
This fixes PR25875.  When the trailing comma in a macro argument list is
elided, we need to treat it similarly to the case where a variadic macro
misses one actual argument.

Reviewers: rnk, rsmith

Subscribers: cfe-commits

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

llvm-svn: 258530
2016-01-22 19:26:44 +00:00
Adrian Prantl d4e73e7412 Rephrase this test to help debug a buildbot issue
llvm-svn: 258526
2016-01-22 19:14:24 +00:00
Yaron Keren e94da64e65 Merge templated static member variables, fixes http://llvm.org/pr26179.
Patch by Vassil Vassilev!
Reviewed by Richard Smith.

llvm-svn: 258524
2016-01-22 19:03:27 +00:00
Adrian Prantl ae108c4704 Fix a typo in r258507 and change the PCH dwoid constant to ~1UL.
rdar://problem/24290667

llvm-svn: 258519
2016-01-22 18:46:45 +00:00
Adrian Prantl e1c2ad8aa7 Fix 80-column violations.
llvm-svn: 258518
2016-01-22 18:46:40 +00:00
Devin Coughlin 86f61a9a62 [analyzer] SATestBuild.py: Handle spaces in path passed to --use-analyzer.
I missed this one in r258493.

llvm-svn: 258517
2016-01-22 18:45:22 +00:00
Adrian Prantl c96da8faa6 Module Debugging: Use a nonzero DWO id for precompiled headers.
PCH files don't have a module signature and LLVM uses a nonzero DWO id as
an indicator for skeleton / module CUs. This change pins the DWO id for PCH
files to a known constant value.
The correct long-term solution here is to implement a module signature
that is an actual dterministic hash (at the moment module signatures are
just random nonzero numbers) and then enable this for PCH files as well.

<rdar://problem/24290667>

llvm-svn: 258507
2016-01-22 17:43:43 +00:00
David Majnemer fc80b6e5d8 [MSVC Compat] Don't provide /volatile:ms semantics to types > pointer
Volatile loads of type wider than a pointer get split by MSVC because
the base x86 ISA doesn't provide loads which are wider than pointer
width.  LLVM assumes that it can emit an cmpxchg8b but this is
problematic if the memory is in a CONST memory segment.

Instead, provide behavior compatible with MSVC: split loads wider than a
pointer.

llvm-svn: 258506
2016-01-22 16:36:44 +00:00
Nico Weber f7ed399881 Try to pacify MSVC.
I'm not sure why it needs these braces, but they help locally.

llvm-svn: 258505
2016-01-22 15:49:53 +00:00
Andrey Bokhanko 6e4463fecc Change of UserLabelPrefix default value from "_" to ""
Differential Revision: http://reviews.llvm.org/D16295

llvm-svn: 258504
2016-01-22 15:24:34 +00:00
Nico Weber c4acee3380 Let RecursiveASTVisitor visit array index VarDecls
An implicit copy ctor creates loop VarDecls that hang off CXXCtorInitializer.
RecursiveASTVisitor used to not visit them, so that they didn't show up in the
parent map used by ASTMatchers, causing asserts() when the implicit
DeclRefExpr() in a CXXCtorInitializer referred to one of these VarDecls.

Fixes PR26227.
http://reviews.llvm.org/D16413

llvm-svn: 258503
2016-01-22 15:11:54 +00:00
Arpith Chacko Jacob 0ff939f251 [OpenMP] Sema for depend clause on target exit data directive.
Summary:
Accept depend clause on target exit data directive in sema and add test cases.

Reviewers: ABataev

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

llvm-svn: 258502
2016-01-22 14:58:21 +00:00
Nico Weber 5fe4122348 Replace some tabs with spaces.
llvm-svn: 258500
2016-01-22 14:12:44 +00:00
Alexey Bataev 3015bcc62a [OPENMP] Generalize codegen for 'sections'-based directive.
If 'sections' directive has only one sub-section, the code for 'single'-based directive was emitted. Removed this codegen, because it causes crashes in different cases.

llvm-svn: 258495
2016-01-22 08:56:50 +00:00
Devin Coughlin ab95cd2794 [analyzer] Update SATestBuild.py to handle spaces in paths.
The Jenkins workspace on the new Green Dragon builder for the static analyzer has spaces
in its path.

llvm-svn: 258493
2016-01-22 07:08:06 +00:00
Ekaterina Romanova 08d1f2431d 2 missing intrinsics _cvtss_sh and _mm_cvtps_ph were added to the intrinsics header f16intrin.h
Differential Revision: http://reviews.llvm.org/D16177

llvm-svn: 258492
2016-01-22 06:50:50 +00:00
Alexey Samsonov 710d9f8385 [Docs] Slightly update LSan documentation.
llvm-svn: 258476
2016-01-22 01:35:45 +00:00
Arpith Chacko Jacob 4f4815789d [OpenMP] Sema for depend clause on target enter data directive.
Summary:
Accept depend clause on target enter data directive in sema and add test cases.

Reviewers: ABataev

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

llvm-svn: 258466
2016-01-22 01:09:37 +00:00
Devin Coughlin 4a330201ff [analyzer] Suppress nullability warning for defensive super initializer idiom.
A common idiom in Objective-C initializers is for a defensive nil-check on the
result of a call to a super initializer:
  if (self = [super init]) {
     ...
  }
  return self;

To avoid warning on this idiom, the nullability checker now suppress diagnostics
for returns of nil on syntactic 'return self' even in initializers with non-null
return types.

llvm-svn: 258461
2016-01-22 01:01:11 +00:00
Arpith Chacko Jacob cef5c9551b [OpenMP] Sema for depend clause on target directive.
Summary:
Accept depend clause on target directive in sema and add test cases.

Reviewers: ABataev

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

llvm-svn: 258460
2016-01-22 00:49:21 +00:00
Arpith Chacko Jacob 1784e954b3 [OpenMP] Parsing + Sema for nowait clause on target exit data directive.
Summary:
Accept nowait clause on target exit data directive in sema and add test cases.

Reviewers: ABataev

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

llvm-svn: 258459
2016-01-22 00:22:05 +00:00
Arpith Chacko Jacob 68b6d5ac42 [OpenMP] Parsing + Sema for nowait clause on target enter data directive.
Summary:
Accept nowait clause on target enter data directive in sema and add test cases.

Reviewers: ABataev

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

llvm-svn: 258457
2016-01-22 00:03:50 +00:00
David Majnemer 259d71a464 [MSVC Compat] Don't omit frame pointers if /Oy- is specified before /O2
Microsoft's documentation states that specifying
/Oy- after the /O[12x] options disables frame-pointer omission.
What it does *not* state is that it also disables frame-pointer omission
if /Oy- is specified before /O[12x].

llvm-svn: 258447
2016-01-21 23:01:11 +00:00
Arpith Chacko Jacob bfc33d0f3a [OpenMP] Parsing + Sema for nowait clause on target directive
Summary:
Allow nowait clause on target directive in sema and add test cases.

Reviewers: ABataev

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

llvm-svn: 258441
2016-01-21 22:18:28 +00:00
Devin Coughlin 65c7708b01 [driver] Enable some static analyzer "unix" checkers on Windows.
Many of the "unix" checkers are not actually unix-specific and would be valuable
to run on Windows. This commit explicitly enables those checkers on
Windows.

A patch by Alexander Riccio!

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

llvm-svn: 258426
2016-01-21 20:09:49 +00:00
Arpith Chacko Jacob 46a04bb5a8 [OpenMP] Check for at least one map clause on target data directive.
Summary:
Adds the following restriction in the OpenMP specifications.

OpenMP [2.10.1, Restrictions, p. 97]
At least one map clause must appear on the directive.

Reviewers: ABataev

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

llvm-svn: 258425
2016-01-21 19:57:55 +00:00
Vedant Kumar ca3326c0d4 [Coverage] Reduce complexity of adding function mapping records
Replace a string append operation in addFunctionMappingRecord with a
vector append. The existing behavior is quadratic in the worst case:
this patch makes it linear.

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

llvm-svn: 258424
2016-01-21 19:25:35 +00:00
Nico Weber a415a1d0d7 Add an isVirtualAsWritten AST matcher.
http://reviews.llvm.org/D16394

llvm-svn: 258415
2016-01-21 17:56:24 +00:00
Aaron Ballman c35724cc72 When dumping documentation for AST matchers, do something more useful with \see doxygen commands. Ideally this would link to the target of \see, but for now it translates \see into "See also: "
Regenerate the AST documentation for this new functionality.

llvm-svn: 258401
2016-01-21 15:18:25 +00:00
Alexey Bataev 93a546a326 Fix crash for typedefs for arrays of runtime bounds in Lambdas/Captured Statements, used in sizeof() expression only.
llvm-svn: 258396
2016-01-21 12:54:48 +00:00
Alexey Bataev 8524d15954 [OPENMP] Fix crash on reduction for complex variables.
reworked codegen for reduction operation for complex types to avoid crash

llvm-svn: 258394
2016-01-21 12:35:58 +00:00
Aaron Ballman 433485f003 Register the isCopyAssignmentOperator AST matcher so that it can be used dynamically.
Path by Jonathan Coe.

llvm-svn: 258341
2016-01-20 20:47:58 +00:00
Daniel Jasper 18b1de3ec6 clang-format-diff: Replace hard-code default for clang-format binary with flag.
Patch by Kwasi Mensah, thank you.

llvm-svn: 258328
2016-01-20 18:55:57 +00:00
Aaron Ballman 2b6963fce9 Add AST matcher support for FunctionDecls with the hasBody matcher.
Patch by Aleksei Sidorin.

llvm-svn: 258322
2016-01-20 16:26:48 +00:00
Aaron Ballman e8295d7980 Add AST matcher for paren expressions.
Patch by Adrian Zgorzałek.

llvm-svn: 258321
2016-01-20 16:17:39 +00:00
Aaron Ballman 01dc157ce8 Silencing several -Wcast-qual warnings; NFC.
llvm-svn: 258317
2016-01-20 15:25:30 +00:00
Alexey Bataev 9619f04c0e [OPENMP 4.0] Fix for codegen of 'cancel' directive within 'sections' directive.
Allow to emit code for 'cancel' directive within 'sections' directive with single sub-section.

llvm-svn: 258307
2016-01-20 12:29:47 +00:00
Alexey Bataev 48c0bfb99f [OPENMP 4.5] Allow to use non-static data members in non-static member functions in 'private' clause.
OpenMP 4.5 allows to use non-static members of current class in non-static member functions in 'private' clause. Patch adds initial support for privatizing data members.

llvm-svn: 258299
2016-01-20 09:07:54 +00:00
Alexey Bataev 79de17d3af Fix infinite loop when ::new or ::delete are found in member initializer list, by Denis Zobnin
Fix for an infinite loop on parsing ::new or ::delete in member initializer list, found by fuzzing PR23057, comment #33. Skip the rest of the member initializers if the previous initializer was invalid.
Differential Revision: http://reviews.llvm.org/D16216

llvm-svn: 258290
2016-01-20 05:25:51 +00:00
Adrian Prantl 8f55b66a53 Module Debugging: Fine-tune the condition that determines whether a type
can be found in a module.

There are externally visible anonymous types that can be found:
  typedef struct { } s; // I can be found via the typedef.
There are anonymous internal types that can be found:
  namespace { struct s {}; } // I can be found by name.

rdar://problem/24199640

llvm-svn: 258272
2016-01-20 01:29:34 +00:00
Justin Lebar 6644e366b0 [CUDA] Bail, rather than crash, on va_arg in device code.
Reviewers: tra

Subscribers: echristo, jhen, cfe-commits

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

llvm-svn: 258264
2016-01-20 00:27:00 +00:00
Justin Lebar c66a10652a [CUDA] Only allow __global__ on free functions and static member functions.
Summary:
Warn for NVCC compatibility if you declare a static member function or
inline function as __global__.

Reviewers: tra

Subscribers: jhen, echristo, cfe-commits

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

llvm-svn: 258263
2016-01-20 00:26:57 +00:00
Xinliang David Li 7077f0af26 Reference the updated function name /NFC
llvm-svn: 258261
2016-01-20 00:24:52 +00:00
Adrian Prantl 8c0e50519b Module Debugging: Add Objective-C testcases for anonymous tag decls. (NFC)
rdar://problem/24199640

llvm-svn: 258252
2016-01-19 23:42:56 +00:00
Adrian Prantl 43e0081740 Module Debugging: Don't emit external type references to anonymous types.
Even if they exist in the module, they can't be matched with the forward
declaration in the object file.
<rdar://problem/24199640>

llvm-svn: 258251
2016-01-19 23:42:53 +00:00
Adrian Prantl cd975018fe Module Debugging: Make sure that anonymous tag decls that define global
variables are visited.

This shouldn't encourage anyone to put global variables into clang modules.
rdar://problem/24199640

llvm-svn: 258250
2016-01-19 23:42:44 +00:00
NAKAMURA Takumi 1b335e9feb StmtOpenMP.h: Fix a warning in r258177. [-Wdocumentation]
llvm-svn: 258220
2016-01-19 23:21:18 +00:00
NAKAMURA Takumi 468f3ed5bc StmtOpenMP.h: Fix a warning in r258165. [-Wdocumentation]
llvm-svn: 258219
2016-01-19 23:21:13 +00:00
Chris Bieneman fe4a7b3ccd [CMake] Don't apply Export set to clang tools
I can't apply export to tools without getting some strange CMake spew. The behavior here is a bit unexpected. CMake is complaining about static link dependencies not being in the same export set, which shouldn't matter.

In the short term it is easier to just remove the export set (which was just added in r258209) while I sort this out.

llvm-svn: 258214
2016-01-19 23:01:38 +00:00
Aaron Ballman 6c8848abe6 Allow __attribute__((mode)) to appertain to field declarations again. Corrects compile issues with LibreOffice.
Patch by Stephan Bergmann

llvm-svn: 258213
2016-01-19 22:54:26 +00:00
Chris Bieneman b6a296ca62 [CMake] Creating add_clang_tool macro to wrap add_clang_executable and generate install actions and targets.
This change brings forward the LLVM convention that "executables" are just runnable binaries, and "tools" are executables that are part of the project's install.

Having this abstraction will allow us to simplify some of the tool CMakeLists files, and it will standardize some of the install behaviors.

llvm-svn: 258209
2016-01-19 22:41:51 +00:00
Samuel Antao 23abd726e6 [OpenMP] Detect implicit map type to report unspecified map type for target enter/exit data directives.
Support for the following OpenMP 4.5 restriction on 'target enter data' and 'target exit data':

  - A map-type must be specified in all map clauses.

I have to save 'IsMapTypeImplicit' when parsing a map clause to support this constraint and for more informative error messages. This helps me support the following case:

  #pragma omp target enter data map(r) // expected-error {{map type must be specified for '#pragma omp target enter data'}}

and distinguish it from:

  #pragma omp target enter data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target enter data'}}

Patch by Arpith Jacob. Thanks!

llvm-svn: 258179
2016-01-19 20:40:49 +00:00
Samuel Antao 7259076032 [OpenMP] Parsing + sema for "target exit data" directive.
Patch by Arpith Jacob. Thanks!

llvm-svn: 258177
2016-01-19 20:04:50 +00:00
Justin Lebar 2836dcdb75 [CUDA] Handle -O options (more) correctly.
Summary:
Previously we'd crash the driver if you passed -O0.  Now we try to
handle all of clang's various optimization flags in a sane way.

Reviewers: tra

Subscribers: cfe-commits, echristo, jhen

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

llvm-svn: 258174
2016-01-19 19:52:21 +00:00
Samuel Antao df67fc468e [OpenMP] Parsing + sema for "target enter data" directive.
Patch by Arpith Jacob. Thanks!

llvm-svn: 258165
2016-01-19 19:15:56 +00:00
Adrian Prantl e5238d2a82 Module Debugging: Defer the emission of anonymous tag decls
until we are visiting their declcontext.

This fixes a regression introduced in r256962:
When building debug info for a typdef'd anonymous tag type, we would be
visiting the inner anonymous type first thus creating a "typedef changes
linkage of anonymous type, but linkage was already computed" error.

rdar://problem/24199640

llvm-svn: 258152
2016-01-19 18:02:47 +00:00
Chris Bieneman fac5905e55 [CMake] Properly respect the CLANG_APPEND_VC_REV option
Only set -DSVN_REVISION if CLANG_APPEND_VC_REV=On

llvm-svn: 258143
2016-01-19 17:06:12 +00:00
Carlo Bertolli 9e8c6c1731 Activate OpenMP private clause for target construct and a regression test.
llvm-svn: 258140
2016-01-19 16:53:55 +00:00
Nico Weber b5d539380a Rename -Wexpansion-to-undefined to -Wexpansion-to-defined.
llvm-svn: 258131
2016-01-19 15:32:55 +00:00
Nico Weber b2348f4ced Add -Wexpansion-to-undefined: warn when using `defined` in a macro definition.
[cpp.cond]p4:
  Prior to evaluation, macro invocations in the list of preprocessing
  tokens that will become the controlling constant expression are replaced
  (except for those macro names modified by the 'defined' unary operator),
  just as in normal text. If the token 'defined' is generated as a result
  of this replacement process or use of the 'defined' unary operator does
  not match one of the two specified forms prior to macro replacement, the
  behavior is undefined.

This isn't an idle threat, consider this program:
  #define FOO
  #define BAR defined(FOO)
  #if BAR
  ...
  #else
  ...
  #endif
clang and gcc will pick the #if branch while Visual Studio will take the
#else branch.  Emit a warning about this undefined behavior.

One problem is that this also applies to function-like macros. While the
example above can be written like

    #if defined(FOO) && defined(BAR)
    #defined HAVE_FOO 1
    #else
    #define HAVE_FOO 0
    #endif

there is no easy way to rewrite a function-like macro like `#define FOO(x)
(defined __foo_##x && __foo_##x)`.  Function-like macros like this are used in
practice, and compilers seem to not have differing behavior in that case. So
this a default-on warning only for object-like macros. For function-like
macros, it is an extension warning that only shows up with `-pedantic`.
(But it's undefined behavior in both cases.)

llvm-svn: 258128
2016-01-19 15:15:31 +00:00
Manuel Klimek 27f278186d Fix formatting of fully qualified names in array subscripts.
Before:
  a[ :🅱️:c];

After:
  a[:🅱️:c];

llvm-svn: 258123
2016-01-19 14:05:32 +00:00
Faisal Vali cc496a9977 Fix PR26134: When substituting into default template arguments, keep CurContext unchanged.
Or, do not set Sema's CurContext to the template declaration's when substituting into default template arguments of said template declaration.   
If we do push the template declaration context on to Sema, and the template declaration is at namespace scope, Sema can get confused and try and do odr analysis when substituting into default template arguments, even though the substitution could be occurring within a dependent context.
I'm not sure why this was being done, perhaps there was concern that if a default template argument referred to a previous template parameter, it might not be found during substitution - but all regression tests pass, and I can't craft a test that would cause it to fails (if some one does, please inform me, and i'll craft a different fix for the PR).


This patch removes a single line of code, but unfortunately adds more than it removes, because of the tests.  Some day I still hope to commit a patch that removes far more lines than it adds, while leaving clang better for it ;)

Sorry that r253590 ("Change the expression evaluation context from Unevaluated to ConstantEvaluated while substituting into non-type template argument defaults") caused the PR!

llvm-svn: 258110
2016-01-19 03:58:55 +00:00
Adam Nemet e708747129 [AVX512] Fix typo in r226298
Hal noticed that the double/float got mixed up on the parameters for
these.

llvm-svn: 258108
2016-01-19 02:02:25 +00:00
Xinliang David Li 848da13718 Fix local variable name /NFC
llvm-svn: 258106
2016-01-19 00:49:06 +00:00
Sanjay Patel 846b63b436 fix formatting; NFC
llvm-svn: 258097
2016-01-18 22:15:33 +00:00
Aaron Ballman 9e373df2f7 The destructor name should be matched to ~Foo instead of Foo.
llvm-svn: 258077
2016-01-18 20:47:02 +00:00
Aaron Ballman eb85b04c7e Add an AST matcher for checking whether a function is defaulted.
Patch by Jonathan Coe.

llvm-svn: 258072
2016-01-18 20:37:44 +00:00
Aaron Ballman d7b18b9f2f Augments r258042; changes the AST matcher tests to use matchesNot and EXPECT_TRUE instead of EXPECT_FALSE. Adds a matcher test to ensure that static member functions are properly handled. Generates the documentation from the matcher.
llvm-svn: 258070
2016-01-18 20:28:57 +00:00
Craig Topper 2576124eb5 [TableGen] Merge the SuperClass Record and SMRange vector a single vector. This removes the state needed to manage the extract vector. NFC
llvm-svn: 258066
2016-01-18 19:52:54 +00:00
Devin Coughlin 5a3843e506 [analyzer] Nullability: Look through implicit casts when suppressing warnings on return.
In r256567 I changed the nullability checker to suppress warnings about returning a null
value from a function/method with a non-null return type when the type of the returned
expression is itself nonnull. This enables the programmer to silence nullability warnings
by casting to _Nonnull:

  return (SomeObject * _Nonnull)nil;

Unfortunately, under ObjC automated reference counting, Sema adds implicit casts to
_Nonnull to return expressions of nullable or unspecified types in functions with
non-null function/method return types. With r256567, these casts cause all nullability
warnings for returns of reference-counted types to be suppressed under ARC, leading to
false negatives.

This commit updates the nullability checker to look through implicit casts before
determining the type of the returned expression. It also updates the tests to turn on
ARC for the nullability_nullonly.mm testfile and adds a new testfile to test when ARC
is turned off.

rdar://problem/24200117

llvm-svn: 258061
2016-01-18 18:53:33 +00:00
Manuel Klimek ce28f9ebd3 Add forEachArgumentWithParam AST matcher.
The new matcher allows users to provide a matcher for both the argument
of a CallExpr/CxxConstructExpr a well as the ParmVarDecl of the
argument.

Patch by Felix Berger.

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

llvm-svn: 258042
2016-01-18 11:20:09 +00:00
Artem Dergachev 91c45e8f46 [analyzer] Fix an off-by-one in evalIntegralCast()
Make sure that we do not add SymbolCast at the very boundary of
the range in which the cast would not certainly happen.

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

llvm-svn: 258039
2016-01-18 10:17:16 +00:00
David Majnemer 413111952a [MS ABI] Don't crash while mangling recursive lambdas
We might get into bad situations where we try to embed the signature of
an inner lambda into an outer lambda which cannot work: the inner lambda
wants to embed the name of the outer lambda!

Instead, omit the return type for lambdas.

This fixes PR26105.

N.B.  While we are here, make lambdas nested within functions use an
artificial scope so that they can get demangled.

llvm-svn: 258003
2016-01-17 07:09:24 +00:00
NAKAMURA Takumi 1dd0d5599d clang/test/Driver/darwin-multiarch-arm.c: Appease the case that "ld.exe" exists on %PATH% on win32.
llvm-svn: 257989
2016-01-16 08:35:53 +00:00
Justin Lebar 954c95c08b Fix buildbot bustage in Driver/darwin-multiarch-arm.c caused by r257983.
The test was too loose; "ld" was matching directories named "build" in
the path.

llvm-svn: 257986
2016-01-16 04:50:13 +00:00
NAKAMURA Takumi 33ff1dda6a [Cygwin] Use -femulated-tls by default since r257718 introduced the new pass.
FIXME: Add more targets to use emutls into clang/test/Driver/emulated-tls.cpp.
FIXME: Add cygwin tests into llvm/test/CodeGen/X86. Working in progress.
llvm-svn: 257984
2016-01-16 03:44:52 +00:00
Justin Lebar 55c83325ae Respect bound archs, even when they don't alter the toolchain.
Summary:
It's possible to BindArch without changing the toolchain at all.  For
example, armv7 and armv7s have exactly the same toolchain triple.

Therefore the code in the Driver that checks that we're not creating a
job for the same Action twice needs to consider (Action, Toolchain,
BoundArch) tuples.

Reviewers: tra

Subscribers: aemerson, echristo, beanz, cfe-commits

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

llvm-svn: 257983
2016-01-16 03:30:08 +00:00
Argyrios Kyrtzidis a851d7e9ad [libclang] Add missing CINDEX_LINKAGE from some new APIs in Index.h.
llvm-svn: 257982
2016-01-16 03:01:20 +00:00
Peter Collingbourne dc13453128 Introduce -fsanitize-stats flag.
This is part of a new statistics gathering feature for the sanitizers.
See clang/docs/SanitizerStats.rst for further info and docs.

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

llvm-svn: 257971
2016-01-16 00:31:22 +00:00
Argyrios Kyrtzidis 785705b399 [libclang] Introduce APIs for evaluating a cursor and checking if a macro is builtin/function.
rdar://24091595

llvm-svn: 257968
2016-01-16 00:20:02 +00:00
David Blaikie efdccaa94f OpaquePtr: Use nullptr construction for ParsedType OpaquePtr typedef
llvm-svn: 257958
2016-01-15 23:43:34 +00:00
David Blaikie e20506d1e4 OpaquePtr: Use nullptr construction for TemplateTy OpaquePtr typedef
llvm-svn: 257957
2016-01-15 23:43:28 +00:00
David Blaikie 0403cb11a1 OpaquePtr: Use nullptr construction for DeclGroupPtrTy OpaquePtr typedef
llvm-svn: 257956
2016-01-15 23:43:25 +00:00
David Blaikie 62d4a253f7 OpaquePtr: Provide conversion-from-nullptr_t to make default construction simpler to read/write
llvm-svn: 257955
2016-01-15 23:43:21 +00:00
Chris Bieneman 3f746e67df [CMake] Fix bots broken by including order file generation in check-all
llvm-svn: 257948
2016-01-15 22:44:18 +00:00
Joerg Sonnenberger 9db01aaf78 Avoid self-assignment of SmallString, trigger UB behavior down the road.
llvm-svn: 257947
2016-01-15 22:29:34 +00:00
Nico Weber 5a9259caa9 Make -Wdelete-non-virtual-dtor warn on explicit `a->~A()` dtor calls too.
-Wdelete-non-virtual-dtor warns if A is a type with virtual functions but
without virtual dtor has its constructor called via `delete a`. This makes the
warning also fire if the dtor is called via `a->~A()`. This would've found a
security bug in Chromium at compile time. Fixes PR26137.

To fix the warning, add a virtual destructor, make the class final, or remove
its other virtual methods.  If you want to silence the warning, there's also
a fixit that shows how:

test.cc:12:3: warning: destructor called on 'B' ... [-Wdelete-non-virtual-dtor]
  b->~B();
  ^
test.cc:12:6: note: qualify call to silence this warning
  b->~B();
     ^
     B::

http://reviews.llvm.org/D16206

llvm-svn: 257939
2016-01-15 21:45:31 +00:00
Devin Coughlin 851da71c8f [analyzer] Check for return of nil in ObjC methods with nonnull return type.
Update NullabilityChecker so that it checks return statements in ObjC methods.
Previously it was returning early because methods do not have a function type.

Also update detection of violated parameter _Nonnull preconditions to handle
ObjC methods.

rdar://problem/24200560

llvm-svn: 257938
2016-01-15 21:35:40 +00:00
Chris Bieneman 6c33fc1ee0 [CMake] [Order-files] Use print_function as an attempt at being forward compatible.
Based on feedback from bogner.

llvm-svn: 257936
2016-01-15 21:30:06 +00:00
Chris Bieneman d8b5bde5d6 [CMake] Support generation of linker order files using dtrace
Summary:
This patch extends the lit-based perf-training tooling supplied for PGO data generation to also generate linker order files using dtrace.

This patch should work on any system that has dtrace. If CMake can find the dtrace tool it will generate a target 'generate-order-file' which will run the per-training tests wrapped by dtrace to capture function entries. There are several algorithms implemented for sorting the order files which can be experimented with for best performance. The dtrace wrapper also supports bot oneshot and pid probes.

The perf-helper.py changes to support order file construction are ported from internal changes by ddunbar; he gets all the credit for the hard work here, I just copy and pasted.

Note: I've tested these patches on FreeBSD and OS X 10.10.

Reviewers: ddunbar, bogner, silvas

Subscribers: llvm-commits, emaste

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

llvm-svn: 257934
2016-01-15 21:21:12 +00:00
Carlo Bertolli b4adf55e0f Add OpenMP dist_schedule clause to distribute directive and related regression tests.
llvm-svn: 257917
2016-01-15 18:50:31 +00:00
Artem Dergachev 895242f9fb [analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion, v2.
Provide separate visitor templates for the three hierarchies, and also
the `FullSValVisitor' class, which is a union of all three visitors.

Additionally, add a particular example visitor, `SValExplainer', in order to
test the visitor templates. This visitor is capable of explaining the SVal,
SymExpr, or MemRegion in a natural language.

Compared to the reverted r257605, this fixes the test that used to fail
on some triples, and fixes build failure under -fmodules.

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

llvm-svn: 257893
2016-01-15 15:22:05 +00:00
James Y Knight 925d60ee1e Fix a -Wparentheses warning in ASTDiagnostic.cpp.
llvm-svn: 257871
2016-01-15 05:57:41 +00:00
Richard Trieu 2331c8bdd3 Fixing more issues with template type diffing
1) Print qualifiers for templates with zero arguments
2) Add a few more tests for the template type diffing refactoring.
Specifically, PR24587 has been fixed and has a test case from
http://reviews.llvm.org/D15384
3) Adds asserts to check the DiffTree is in correct state when moving nodes
4) Rename the field FromType and ToType since it is heavily used within
member functions.

llvm-svn: 257870
2016-01-15 05:48:38 +00:00
Richard Trieu 9213ce559a Add new diff modes to template type diffing.
Remove an old assertion that does not hold.  It is possible for a template
argument to be a declaration in one instantiation and an integer in another.
Create two new diff kinds for these (decl vs int and int vs decl).

llvm-svn: 257869
2016-01-15 05:01:53 +00:00
Alexey Bataev 2c485a7003 PR26111: segmentation fault with __attribute__((mode(QI))) on function declaration, by Denis Zobnin
Allow "mode" attribute to be applied to VarDecl, not ValueDecl (which includes FunctionDecl and EnumConstantDecl), emit an error if this attribute is used with function declarations and enum constants.
Differential Revision: http://reviews.llvm.org/D16112

llvm-svn: 257868
2016-01-15 04:36:32 +00:00
Alexey Bataev d51e9933b6 [X86] Support 'interrupt' attribute for x86
This attribute may be attached to a function definition and instructs the backend to generate appropriate function entry/exit code so that
it can be used directly as an interrupt handler.
The IRET instruction, instead of the RET instruction, is used to return from interrupt or exception handlers. All registers, except for the EFLAGS register which is restored by the IRET instruction, are preserved by the compiler.
Any interruptible-without-stack-switch code must be compiled with -mno-red-zone since interrupt handlers can and will, because of the hardware design, touch
the red zone.

interrupt handler must be declared with a mandatory pointer argument:
struct interrupt_frame;

__attribute__ ((interrupt))
void f (struct interrupt_frame *frame) {
    ...
}
and user must properly define the structure the pointer pointing to.

exception handler: 

The exception handler is very similar to the interrupt handler with a different mandatory function signature:
#ifdef __x86_64__
typedef unsigned long long int uword_t;
#else
typedef unsigned int uword_t;
#endif

struct interrupt_frame;

__attribute__ ((interrupt))
void f (struct interrupt_frame *frame, uword_t error_code) {
    ...
}
and compiler pops the error code off stack before the IRET instruction.

The exception handler should only be used for exceptions which push an error code and all other exceptions must use the interrupt handler.
The system will crash if the wrong handler is used.
Differential Revision: http://reviews.llvm.org/D15709

llvm-svn: 257867
2016-01-15 04:06:31 +00:00
Akira Hatanaka 26907f9236 [CodeGen] Attach attributes to thread local wrapper function.
This commit is a follow-up to r251734, r251476, and r249735, which fixes
a bug where function attributes were not attached to thread local
wrapper functions.

rdar://problem/20828324

llvm-svn: 257865
2016-01-15 03:34:06 +00:00
Richard Smith 4b83886ff1 When copying whitespace flags from the token naming a macro argument onto the
first token of the expansion, don't forget to copy the "is at the start of a
line" token (which is always false, as newlines cannot appear within a macro
body); otherwise, stringizing the result can insert spurious whitespace.

llvm-svn: 257863
2016-01-15 03:24:18 +00:00
Richard Trieu d5c7378b9e Save the integer type for integral template arguments.
Save the integer type when diffing integers in template type diffing.  When
integers are different sizes, print out the type along with the integer value.
Also with the type information, print true and false instead of 1 and 0 for
boolean values.

llvm-svn: 257861
2016-01-15 02:55:17 +00:00
Richard Trieu 2c22a86f94 Make template type diffing use the new desguared iterator.
If available, use the canonical template argument to fill in information for
template type diffing instead of attempting to special case and evaluate Expr's
for the value.  Since those are the values used in template instantiation,
we don't have to worry about difference between our evaluator and theirs.  Also
move the nullptr template arguments from DiffKind::Expression to
DiffKind::Declaration and allow DiffKind::Declaration to set an Expr.  The only
effect that should result is that a named nullptr will show up as
'ptr aka nullptr' in diagnostics.

llvm-svn: 257853
2016-01-15 01:08:56 +00:00
Justin Lebar f8bdacbadc [CUDA] Warn undeclared identifiers in CUDA kernel calls
Value, type, and instantiation dependence were not being handled
correctly for CUDAKernelCallExpr AST nodes. As a result, if an
undeclared identifier was used in the triple-angle-bracket kernel call
configuration, there would be no error during parsing, and there would
be a crash during code gen. This patch makes sure that an error will be
issued during parsing in this case, just as there would be for any other
use of an undeclared identifier in C++.

Patch by Jason Henline.

Reviewers: jlebar, rsmith

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

llvm-svn: 257839
2016-01-14 23:31:30 +00:00
Richard Trieu ac1e2f8f03 Change the TSTiterator in Template Type Diffing.
Modify the TSTiterator to have two internal iterators, which will walk
the provided sugared type and the desugared type.  This will provide better
access to the template argument information.  No functional changes.

llvm-svn: 257838
2016-01-14 23:30:12 +00:00
Richard Trieu 14714c4181 Refactor template type diffing
1) Instead of using pairs of From/To* fields, combine fields into a struct
TemplateArgInfo and have two in each DiffNode.
2) Use default initialization in DiffNode so that the constructor shows the
only field that is initialized differently on construction.
3) Use Set and Get functions per each DiffKind to make sure all fields for the
diff is set.  In one case, the Expr fields were not set.
4) Don't print boolean literals for boolean template arguments.  This prevents
printing 'false aka 0'

Only #3 has a functional change, which is reflected in the test change.

llvm-svn: 257831
2016-01-14 22:56:39 +00:00
Chris Bieneman 9c92d67b78 [CMake] Move the install logic for libclang's headers into the libclang CMakelists
This makes it so if you disable building libclang you won't install the headers as part of the 'install' target.

llvm-svn: 257828
2016-01-14 22:48:45 +00:00
Chris Bieneman 61266fc955 [CMake] Set SVN_REVISION if CLANG_APPEND_VC_REV=On
This matches autoconf's ability to put clang revisions in the clang --version spew.

llvm-svn: 257827
2016-01-14 22:45:12 +00:00
Justin Lebar e8c3609d3a [CUDA] Add test for compiling CUDA code with -S.
Reviewers: tra

Subscribers: cfe-commits, jhen

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

llvm-svn: 257810
2016-01-14 21:41:31 +00:00
Justin Lebar 21e5d4fcfa [CUDA] Invoke ptxas and fatbinary during compilation.
Summary:
Previously we compiled CUDA device code to PTX assembly and embedded
that asm as text in our host binary.  Now we compile to PTX assembly and
then invoke ptxas to assemble the PTX into a cubin file.  We gather the
ptx and cubin files for each of our --cuda-gpu-archs and combine them
using fatbinary, and then embed that into the host binary.

Adds two new command-line flags, -Xcuda_ptxas and -Xcuda_fatbinary,
which pass args down to the external tools.

Reviewers: tra, echristo

Subscribers: cfe-commits, jhen

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

llvm-svn: 257809
2016-01-14 21:41:27 +00:00
Justin Lebar b44f6fed4d Don't build jobs for the same Action + ToolChain twice.
Summary:
Right now if the Action graph is a DAG and we encounter an action twice,
we will run it twice.

This patch is difficult to test as-is, but I have testcases for this as
used within CUDA compilation.

Reviewers:

Subscribers:

llvm-svn: 257808
2016-01-14 21:41:21 +00:00
Justin Lebar 2b187c3977 [CUDA] Add tests for compiling CUDA files with -E.
Reviewers: tra

Subscribers: cfe-commits, jhen

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

llvm-svn: 257807
2016-01-14 21:41:18 +00:00
Rui Ueyama 83aa97941f Update for LLVM function name change.
llvm-svn: 257802
2016-01-14 21:00:27 +00:00
Dan Gohman 6ad8f61297 [WebAssembly] Configure some simple include paths and runtime library settings.
llvm-svn: 257774
2016-01-14 16:00:13 +00:00
Krzysztof Parzyszek 428d9dbaf9 [Hexagon] Change all builtins returning "bool" to return "int" instead
llvm-svn: 257765
2016-01-14 14:26:36 +00:00
Daniel Jasper a3cd216483 clang-format: Fix incorrectly enforced linebreak with ColumnLimit 0.
Before:
  aaaa[bbbb]
      .cccc();

After:
  aaaa[bbbb].cccc();

llvm-svn: 257763
2016-01-14 13:36:46 +00:00
Scott Egerton b67d4690a8 [mips] Added support for -Wa,-mips32 and similar.
Reviewers: vkalintiris, dsanders

Subscribers: cfe-commits

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

llvm-svn: 257762
2016-01-14 13:01:48 +00:00
Andrey Bokhanko 834ea6826e Fix for armv7-a15 and thumbv7-a15 buildbot fails.
llvm-svn: 257757
2016-01-14 11:53:50 +00:00
Andrey Bokhanko 4f8867fc63 Correct setting of UserLabelPrefix for MCU target.
Differential Revision: http://reviews.llvm.org/D16138

llvm-svn: 257756
2016-01-14 10:59:36 +00:00
Andrey Bokhanko 7aa88ce70c PR25910: clang allows two var definitions with the same mangled name
Proper diagnostic and resolution of mangled names' conflicts in variables.
When there is a declaration and a definition using the same name but different
types, we emit what is in the definition. When there are two conflicting
definitions, we issue an error.

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

llvm-svn: 257754
2016-01-14 10:41:16 +00:00
Daniel Jasper 11a876533e clang-format: [JS] Fix incorrect line break leading to semicolon insertion.
clang-format only works for JavaScript code, if all the semicolons are
present anyway, so this linebreak can never be desired.

Before (with appropriate statement lengths or column limit):
  return
      [ aaa ];

After:
  return [
    aaaa
  ];

llvm-svn: 257741
2016-01-14 05:37:52 +00:00
Peter Collingbourne f7e62096ff Driver: Remove SanitizerArgs::clear() function and SanitizerSet ctor,
replace with in-class initializers.

llvm-svn: 257739
2016-01-14 02:49:51 +00:00
Peter Collingbourne 574975efa9 CodeGen: Only emit CFI unrelated cast checks for bit casts.
We were previously emitting them for no-op casts (e.g. implicit casts
to const).

llvm-svn: 257738
2016-01-14 02:49:48 +00:00
George Burgess IV 60bc972575 [Sema] Suppress diags in overload resolution.
We were emitting diagnostics from our shiny new C-only overload
resolution mode. This patch attempts to silence all such diagnostics.

This fixes PR26085.
Differential Revision: http://reviews.llvm.org/D16159

llvm-svn: 257710
2016-01-13 23:36:34 +00:00
Richard Smith 2761508fcd Update cxx_dr_status for latest issues list.
llvm-svn: 257698
2016-01-13 22:58:22 +00:00
Richard Smith ba651344a8 Update make_cxx_dr_status after the 3.8 branch.
llvm-svn: 257695
2016-01-13 22:51:59 +00:00
Hans Wennborg e3391d7ef9 Update cxx_dr_status.html after the 3.8 branch
llvm-svn: 257652
2016-01-13 19:14:03 +00:00
Hans Wennborg ac3ddfffd7 Update version to 3.9
llvm-svn: 257628
2016-01-13 17:32:59 +00:00
Daniel Jasper 50780ce110 clang-format: [ObjC+JS] Allow bin-packing of array literals.
After reading the style guides again, they don't actually say how to
pack or not pack array literals. Based on some user reports, array
initializers can unnecessarily get quite long if they contain many
small elements. Array literals with trailing commas are still formatted
one per line so that users have a way to opt out of the packing.

Before:
  var array = [
    aaaaaa,
    aaaaaa,
    aaaaaa,
    aaaaaa,
    aaaaaa,
    aaaaaa,
    aaaaaa,
    aaaaaa,
    aaaaaa,
    aaaaaa
  ];

After:
  var array = [
    aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa, aaaaaa,
    aaaaaa, aaaaaa
  ];

llvm-svn: 257615
2016-01-13 16:41:34 +00:00
Scott Egerton 2df06baf02 Revert r257602 because it breaks integrated-as.s on mips hosts.
llvm-svn: 257610
2016-01-13 16:19:33 +00:00
Artem Dergachev 26ec8acc84 Revert "[analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion."
This reverts commit r257605.

The test fails on architectures that use unsigned int as size_t.
SymbolManager.h fails with compile errors on some platforms.

llvm-svn: 257608
2016-01-13 15:52:25 +00:00
Artem Dergachev beb02b5b8f [analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion.
Provide separate visitor templates for the three hierarchies, and also
the `FullSValVisitor' class, which is a union of all three visitors.

Additionally, add a particular example visitor, `SValExplainer', in order to
test the visitor templates. This visitor is capable of explaining the SVal,
SymExpr, or MemRegion in a natural language.

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

llvm-svn: 257605
2016-01-13 15:13:48 +00:00
Scott Egerton f60087a22b [mips] Added support for -Wa,-mips32 and similar.
Reviewers: vkalintiris, dsanders

Subscribers: cfe-commits

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

llvm-svn: 257602
2016-01-13 14:27:59 +00:00
Artem Dergachev 73f018e381 [analyzer] Fix SVal/SymExpr/MemRegion class and enum names for consistency.
The purpose of these changes is to simplify introduction of definition files
for the three hierarchies.

1. For every sub-class C of these classes, its kind in the relevant enumeration
is changed to "CKind" (or C##Kind in preprocessor-ish terms), eg:

  MemRegionKind   -> MemRegionValKind
  RegionValueKind -> SymbolRegionValueKind
  CastSymbolKind  -> SymbolCastKind
  SymIntKind      -> SymIntExprKind

2. MemSpaceRegion used to be inconsistently used as both an abstract base and
a particular region. This region class is now an abstract base and no longer
occupies GenericMemSpaceRegionKind. Instead, a new class, CodeSpaceRegion,
is introduced for handling the unique use case for MemSpaceRegion as
"the generic memory space" (when it represents a memory space that holds all
executable code).

3. BEG_ prefixes in memory region kind ranges are renamed to BEGIN_ for
consisitency with symbol kind ranges.

4. FunctionTextRegion and BlockTextRegion are renamed to FunctionCodeRegion and
BlockCodeRegion, respectively. The term 'code' is less jargony than 'text' and
we already refer to BlockTextRegion as a 'code region' in BlockDataRegion.

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

llvm-svn: 257598
2016-01-13 13:49:29 +00:00
Alexey Bataev c4fad65bfc [OPENMP] Fix for declarative/standalone directives use.
Fixes processing of declarative directives and standalone executable directives. Declarative directives should not be allowed as an immediate statements and standalone executable directives are allowed to be used in case-stmt constructs.

llvm-svn: 257586
2016-01-13 11:18:54 +00:00
Eugene Zelenko a78996e2e6 Install scan-build and scan-view only if Static Analyzer was enabled.
llvm-svn: 257562
2016-01-13 02:03:50 +00:00
George Burgess IV df1ed0099b [Bugfix] Fix ICE on constexpr vector splat.
In {CG,}ExprConstant.cpp, we weren't treating vector splats properly.
This patch makes us treat splats more properly.

Additionally, this patch adds a new cast kind which allows a bool->int
cast to result in -1 or 0, instead of 1 or 0 (for true and false,
respectively), so we can sanely model OpenCL bool->int casts in the AST.

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

llvm-svn: 257559
2016-01-13 01:52:39 +00:00
Justin Lebar 388579fab7 [CUDA] Rename check-prefixes in cuda-options.cu and cuda-unused-arg-warning.cu.
Summary:
Rename the args to be more human-readable.  Among other things, this
lets us get rid of a bunch of comments (e.g. "ensure we don't run the
linker"), greatly shortening these tests.

Also apply consistent formatting and fix some English nits while we're
at it.

Reviewers: tra

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

llvm-svn: 257557
2016-01-13 01:24:35 +00:00
Bob Wilson 0a15e6cc36 Generalize r256026 to apply to all MachO targets, not just Darwin targets.
The PIC default is set for the MachO toolchain, not just the Darwin toolchain,
so this treats those the same. The behavior with -static should be the same
for all MachO targets. rdar://24152327

llvm-svn: 257556
2016-01-13 01:19:02 +00:00
Justin Lebar 3eaaf86397 [CUDA] Report an error if code tries to mix incompatible CUDA attributes.
Summary: Thanks to jhen for helping me figure this out.

Reviewers: tra, echristo

Subscribers: jhen

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

llvm-svn: 257554
2016-01-13 01:07:35 +00:00
Frederic Riss 3ad83bd384 [Darwin] Fix deployment target detection
There was a thinko in the deployment target detection code that
made the -isysroot parsing have precedence over the environment
variable for tvOS. This patch makes this logic symetric for all
platforms (the env variable must have precedence).

llvm-svn: 257543
2016-01-12 23:47:59 +00:00
Hans Wennborg 94d6a71363 Follow-up to r257537: add test that majnemer asked about
llvm-svn: 257541
2016-01-12 23:31:58 +00:00
Hans Wennborg 21d73d2e0a clang-cl: Support /Dfoo#bar (PR25984)
Such flags will now be translated to -Dfoo=bar.

llvm-svn: 257537
2016-01-12 23:17:03 +00:00
Laszlo Nagy bc68758dd5 D9600: Add scan-build python implementation
llvm-svn: 257533
2016-01-12 22:38:41 +00:00
Justin Lebar 29bfa893cc [CUDA] Add explicit mapping from sm_XX to compute_YY.
Summary: This is used by D16082 when it invokes fatbinary.

Reviewers: tra

Subscribers: cfe-commits, jhen, echristo

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

llvm-svn: 257530
2016-01-12 22:23:04 +00:00
Richard Smith ba3a4f917f Improve AST dumping:
1) When dumping a declaration that declares a name for a type, also dump the named type.
 2) Add a #pragma clang __debug dump X, that dumps the lookup results for X in
    the current context.

llvm-svn: 257529
2016-01-12 21:59:26 +00:00
Aaron Ballman 580ccaf827 Properly track the end location of an exception specification.
Patch by Adrian Zgorzałek

llvm-svn: 257521
2016-01-12 21:04:22 +00:00
Adrian Prantl 793038d31b Module debugging: Make the module format part of the module hash instead
of the file name. This is consistent with how other HeaderSearchOptions
are handled.

Due to the other inputs of the module hash (revision number) this is not
really testable in a meaningful way.

llvm-svn: 257520
2016-01-12 21:01:56 +00:00
Hans Wennborg 45c7439d11 Don't store CGOpenMPRegionInfo::CodeGen as a reference (PR26078)
The referenced llvm::function_ref<void(CodeGenFunction &)> object can go
away before CodeGen is used, resulting in a crash.

llvm-svn: 257516
2016-01-12 20:54:36 +00:00
Richard Smith 2de44e658d [modules] Don't diagnose a conflict between two using-declarations that name equivalent internal linkage entities.
llvm-svn: 257512
2016-01-12 20:34:32 +00:00
Dimitry Andric e18d46205c Add a clang test for r257376 (Ensure -mcpu=xscale works for arm targets).
llvm-svn: 257509
2016-01-12 19:40:55 +00:00
Sanjay Patel d61f3c71c3 function names start with a lower case letter ; NFC
llvm-svn: 257497
2016-01-12 18:03:41 +00:00
Ismail Donmez 5797c55f07 Revert r253898 and r253899, this breaks mingw compilation on openSUSE.
Will re-apply after llvm 3.8 is branched. 

Original commit message:

Driver: fallback to the location of clang if no sysroot,

hard coding /usr makes little sense for mingw-w64.
If we have portable toolchains having /usr breaks that.
If the clang we use is in /usr/bin or /usr/sbin etc this will
still detect as though it was hard coded to /usr

This makes the most sense going forward for mingw-w64 toolchains
on both linux and mac

llvm-svn: 257468
2016-01-12 10:41:20 +00:00
Pierre Gousseau bdd9da14d6 [analyzer] Fix RangeConstraintManager's pinning of single value ranges.
This fix a bug in RangeSet::pin causing single value ranges to be considered non conventionally ordered.

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

llvm-svn: 257467
2016-01-12 10:40:45 +00:00