Justin Lebar [Tue, 26 Jan 2016 17:47:20 +0000 (17:47 +0000)]
[CUDA] Add -fcuda-allow-variadic-functions.
Summary:
Turns out the variadic function checking added in r258643 was too strict
for some existing users; give them an escape valve. When
-fcuda-allow-variadic-functions is passed, the front-end makes no
attempt to disallow C-style variadic functions. Calls to va_arg are
still not allowed.
Chad Rosier [Tue, 26 Jan 2016 15:52:05 +0000 (15:52 +0000)]
[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.
Xiuli Pan [Tue, 26 Jan 2016 04:03:48 +0000 (04:03 +0000)]
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.
Richard Trieu [Tue, 26 Jan 2016 02:51:55 +0000 (02:51 +0000)]
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.
Xiuli Pan [Tue, 26 Jan 2016 02:06:04 +0000 (02:06 +0000)]
[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.
David Majnemer [Tue, 26 Jan 2016 01:37:01 +0000 (01:37 +0000)]
[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.
David Majnemer [Tue, 26 Jan 2016 01:12:17 +0000 (01:12 +0000)]
[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.
Evgeniy Stepanov [Mon, 25 Jan 2016 23:34:52 +0000 (23:34 +0000)]
[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.
Manman Ren [Mon, 25 Jan 2016 21:52:26 +0000 (21:52 +0000)]
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.
Ehsan Akhgari [Mon, 25 Jan 2016 21:14:52 +0000 (21:14 +0000)]
[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.
Benjamin Kramer [Mon, 25 Jan 2016 10:34:06 +0000 (10:34 +0000)]
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.
Alexey Bataev [Mon, 25 Jan 2016 07:06:23 +0000 (07:06 +0000)]
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.
Alexey Bataev [Mon, 25 Jan 2016 05:14:03 +0000 (05:14 +0000)]
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.
Justin Lebar [Sat, 23 Jan 2016 21:28:14 +0000 (21:28 +0000)]
[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.
Evgeniy Stepanov [Sat, 23 Jan 2016 01:20:18 +0000 (01:20 +0000)]
[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.
Devin Coughlin [Sat, 23 Jan 2016 01:09:07 +0000 (01:09 +0000)]
[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.
Aaron Ballman [Fri, 22 Jan 2016 23:15:00 +0000 (23:15 +0000)]
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!
Gabor Horvath [Fri, 22 Jan 2016 22:32:46 +0000 (22:32 +0000)]
[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.
Adrian Prantl [Fri, 22 Jan 2016 21:14:41 +0000 (21:14 +0000)]
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.
Samuel Antao [Fri, 22 Jan 2016 20:21:36 +0000 (20:21 +0000)]
[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.
Ehsan Akhgari [Fri, 22 Jan 2016 19:26:44 +0000 (19:26 +0000)]
[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.
Adrian Prantl [Fri, 22 Jan 2016 17:43:43 +0000 (17:43 +0000)]
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.
David Majnemer [Fri, 22 Jan 2016 16:36:44 +0000 (16:36 +0000)]
[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.
Nico Weber [Fri, 22 Jan 2016 15:11:54 +0000 (15:11 +0000)]
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.
Alexey Bataev [Fri, 22 Jan 2016 08:56:50 +0000 (08:56 +0000)]
[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.
Devin Coughlin [Fri, 22 Jan 2016 01:01:11 +0000 (01:01 +0000)]
[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.
David Majnemer [Thu, 21 Jan 2016 23:01:11 +0000 (23:01 +0000)]
[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].
Devin Coughlin [Thu, 21 Jan 2016 20:09:49 +0000 (20:09 +0000)]
[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.
Vedant Kumar [Thu, 21 Jan 2016 19:25:35 +0000 (19:25 +0000)]
[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.
Aaron Ballman [Thu, 21 Jan 2016 15:18:25 +0000 (15:18 +0000)]
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.
Alexey Bataev [Wed, 20 Jan 2016 12:29:47 +0000 (12:29 +0000)]
[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.
Alexey Bataev [Wed, 20 Jan 2016 09:07:54 +0000 (09:07 +0000)]
[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.
Alexey Bataev [Wed, 20 Jan 2016 05:25:51 +0000 (05:25 +0000)]
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
Adrian Prantl [Wed, 20 Jan 2016 01:29:34 +0000 (01:29 +0000)]
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.
Adrian Prantl [Tue, 19 Jan 2016 23:42:53 +0000 (23:42 +0000)]
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>