Richard Trieu [Fri, 10 Jun 2016 04:52:09 +0000 (04:52 +0000)]
Check for null pointers before calling the Stmt Profiler
Some calls from OMPClauseProfiler were calling the Stmt Profiler with null
pointers, but the profiler can only handle non-null pointers. Add an assert
to the VisitStmt for valid pointers, and check all calls from OMPClauseProfiler
to be non-null pointers.
Serge Pavlov [Fri, 10 Jun 2016 04:39:07 +0000 (04:39 +0000)]
Fix recognition of shadowed template parameter
Crash reported in PR28023 is caused by the fact that non-type template
parameters are found by tag name lookup. In the code provided in that PR:
template<int V> struct A {
struct B {
template <int> friend struct V;
};
};
the template parameter V is found when lookup for redeclarations of 'struct V'
is made. Latter on the error about shadowing of 'V' is emitted but the semantic
context of 'struct V' is already determined wrong: 'struct A' instead of
translation unit.
The fix moves the check for shadowing toward the beginning of the method and
thus prevents from wrong context calculations.
Summary:
Add RenderScript language type and associate it with ".rs" extensions.
Test that the driver passes "-x renderscript" to the frontend for ".rs"
files.
(Also add '.rs' to the list of suffixes tested by lit).
Tim Shen [Thu, 9 Jun 2016 19:54:46 +0000 (19:54 +0000)]
[Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr.
These ExprWithCleanups are added for holding a RunCleanupsScope not
for destructor calls; rather, they are for lifetime marks. This requires
ExprWithCleanups to keep a bit to indicate whether it have cleanups with
side effects (e.g. dtor calls).
Chris Bieneman [Thu, 9 Jun 2016 17:24:16 +0000 (17:24 +0000)]
Revert "[CMake] Fix an issue building out-of-tree introduced in r272200"
This reverts r272275. This actually wasn't the right way to fix the problem. The correct solution is in r272279.
Applying the fix to LLVM as done in r272279, means this fix will get picked up by all projects building out of tree using LLVM's CMake modules. As opposed to the fix I had in r272275, which would require each project to change.
David Majnemer [Thu, 9 Jun 2016 05:26:56 +0000 (05:26 +0000)]
[Sema] Don't crash when a field w/ a mem-initializer clashes with a record name
It is possible for a field and a class to have the same name. In such
cases, performing lookup for the field might return a result set with
more than one entry. An overzealous assertion fired, causing us to
crash instead of using the non-class lookup result.
Craig Topper [Thu, 9 Jun 2016 05:15:12 +0000 (05:15 +0000)]
[X86] Handle AVX2 pslldqi and psrldqi intrinsics shufflevector creation directly in the header file instead of in CGBuiltin.cpp. Simplify the sse2 equivalents as well.
Yaxun Liu [Wed, 8 Jun 2016 15:11:21 +0000 (15:11 +0000)]
[OpenCL] Fix __builtin_astype for vec3 types.
__builtin_astype does not generate correct LLVM IR for vec3 types. This patch inserts bitcasts to/from vec4 when necessary in addition to generating vector shuffle. Sema and codegen tests are added.
Martin Probst [Wed, 8 Jun 2016 14:04:04 +0000 (14:04 +0000)]
clang-format: [JS] fix an assertion failure caused by shrinking sources.
Summary:
The JavaScript import sorter has a corner condition that can cause the overall
source text length to shrink. This change circumvents the issue by appending
trailing space in the line after the import blocks to match at least the
previous source code length.
This needs a better long term fix, but this fixes the immediate issue.
Add doxygen comments to xmmintrin.h's intrinsics.
Only half of the intrinsics in this file is documented here. The patch for the o
ther half will be sent out later.
The doxygen comments are automatically generated based on Sony's intrinsics docu
ment.
I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.
We'll currently happily (and correctly) resolve `foo` to the `foo`
overload without `enable_if` when assigning to `P`. However, we'll
complain about an ambiguous overload on the `P == foo` line, because
`Sema::CheckPlaceholderExpr` doesn't recognize that there's only one
`foo` that could possibly work here.
This patch teaches `Sema::CheckPlaceholderExpr` how to properly deal
with such cases.
Grepping for other callers of things like
`Sema::ResolveAndFixSingleFunctionTemplateSpecialization`, it *looks*
like this is the last place that needed to be fixed up. If I'm wrong,
I'll see if there's something we can do that beats what amounts to
whack-a-mole with bugs.
We attempted to use the UnaryTransformType's UnderlyingType instead of
it's BaseType. This is not correct for dependent UnaryTransformType
because the have no underlying type.
Igor Kudrin [Tue, 7 Jun 2016 10:07:51 +0000 (10:07 +0000)]
Reapply [Coverage] Fix an assertion failure if the definition of an unused function spans multiple files.
We have an assertion failure if, for example, the definition of an unused
inline function starts in one macro and ends in another. This patch fixes
the issue by finding the common ancestor of the start and end locations
of that function's body and changing the locations accordingly.
Thanks to NAKAMURA Takumi for helping with fixing the test failure on Windows.
Xiuli Pan [Tue, 7 Jun 2016 04:34:00 +0000 (04:34 +0000)]
[OPENCL] Fix wrongly vla error for OpenCL array.
Summary:
OpenCL should support array with const value size length, those const
varibale in global and constant address space and variable in constant
address space.
Xiuli Pan [Tue, 7 Jun 2016 03:13:39 +0000 (03:13 +0000)]
[OPENCL] Fix wrongly vla error for OpenCL array.
Summary:
OpenCL should support array with const value size length, those const varibale in global and constant address space and variable in constant address space.
Igor Kudrin [Tue, 7 Jun 2016 02:17:03 +0000 (02:17 +0000)]
[Coverage] Fix an assertion failure if the definition of an unused function spans multiple files.
We have an assertion failure if, for example, the definition of an unused
inline function starts in one macro and ends in another. This patch fixes
the issue by finding the common ancestor of the start and end locations
of that function's body and changing the locations accordingly.
Mike Spertus [Mon, 6 Jun 2016 21:41:20 +0000 (21:41 +0000)]
Improved Visual Studio visualizations for template argument lists
Improved the visualizer for TemplateArgumentList to show type arguments in the DisplayString.
E.g., <double, long>. Added a visualizer for MultiLevelTemplateArgumentList.
I decided to display them by how they would appear in a template with the
(non-existent) template-id's omitted, so the DisplayString naturally presents
as something like <double, long>::<char *>.
Aaron Ballman [Mon, 6 Jun 2016 18:52:17 +0000 (18:52 +0000)]
Adding an AST matcher to ignore parenthesis in *types* (rather than expressions). This is required for traversing certain types (like function pointer types).
Devin Coughlin [Mon, 6 Jun 2016 16:47:16 +0000 (16:47 +0000)]
[analyzer] Add checker for correct usage of MPI API in C and C++.
This commit adds a static analysis checker to check for the correct usage of the
MPI API in C and C++.
3 path-sensitive checks are included:
- Double nonblocking: Double request usage by nonblocking calls
without intermediate wait.
- Missing wait: Nonblocking call without matching wait.
- Unmatched wait: Waiting for a request that was never used by a
nonblocking call.
Examples of how to use the checker can be found
at https://github.com/0ax1/MPI-Checker
Give FileCheck a hint on which ld to match. Under Windows, the preferred
match was the ld.elf_so that should be matched in a second step. Add one
of the ever-present-but-irrelevant-for-this-test arguments to the
pattern to force matching the right argument.
Daniel Sanders [Mon, 6 Jun 2016 12:02:21 +0000 (12:02 +0000)]
[mips] The default ABI depends on the CPU not the Arch on MTI and IMG vendor triples.
Summary:
32-bit CPU's default to O32. 64-bit CPU's default to N64. The default CPU
(mips32r2/mips64r2) still depends on the arch so there's no functional
change when the CPU isn't specified but commands like:
clang -target mips-mti-linux-gnu -mips64r2
will now default to a 64-bit ABI like our gcc toolchains do* instead of
asserting in the backend**.
Other vendors (including Triple::UnknownVendor) still derive the default
ABI from the arch.
* Although not the same one as our gcc toolchains, clang has historically
defaulted to N64 where gcc defaults to N32.
** Mixing O32 and a 64-bit CPU causing assertions is a long-standing bug.
Mike Spertus [Mon, 6 Jun 2016 03:37:18 +0000 (03:37 +0000)]
Slightly improve Visual Studio visualization of clang::Expr
Now it gives the StmtClass of the Expr as well as the type. It's still
a long way from full visualization of expressions, but I have found
that having the class really helps when debugging, so definitely
worth submitting.
Craig Topper [Sat, 4 Jun 2016 05:43:41 +0000 (05:43 +0000)]
[X86] Use unsigned types for vector arithmetic in intrinsics to avoid undefined behavior for signed integer overflow.
This is really only needed for addition, subtraction, and multiplication, but I did the bitwise ops too for overall consistency. Clang currently doesn't set NSW for signed vector operations so the undefined behavior shouldn't happen today.
We would attempt to evaluate the sizeof a dependent type to check for an
integral overflow. However, because the dependent type is not yet resolved, we
cannot determine if the expression would overflow. Report a failure to perform
a symbolic evaluation of a constant involving the dependent type.
The assertion added earlier was overly strict. We need to strip the pointer
casts (as when constructing the GV). Correct the types (Function or Variable).