Commit Graph

65267 Commits

Author SHA1 Message Date
Peter Collingbourne f3fe5a7445 Add explicit casts to size_t to try to appease MSVC.
llvm-svn: 280899
2016-09-08 01:45:28 +00:00
Peter Collingbourne e53683f97b CodeGen: Clean up implementation of vtable initializer builder. NFC.
- Simplify signature of CreateVTableInitializer function.
- Move vtable component builder to a separate function.
- Remove unnecessary accessors from VTableLayout class.

This is in preparation for a future change that will alter the type of the
vtable initializer.

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

llvm-svn: 280897
2016-09-08 01:14:39 +00:00
Dean Michael Berris 6f2622e253 [XRay] ARM 32-bit no-Thumb support in Clang
Just a test for now, adapted from x86_64 tests of XRay.
This is one of 3 commits to different repositories of XRay ARM port. The
other 2 are:

1. https://reviews.llvm.org/D23931 (LLVM)
2. https://reviews.llvm.org/D23933 (compiler-rt)

Differential Review: https://reviews.llvm.org/D23932

llvm-svn: 280889
2016-09-08 00:23:28 +00:00
Daniel Jasper 28d8a5ab43 clang-format: [JavaScript] Change default AllowShortFunctionsOnASingleLine
for Google style to "empty".

llvm-svn: 280878
2016-09-07 23:01:13 +00:00
Daniel Jasper 496c199959 clang-format: [JavaScript] Do requoting in a separate pass
The attempt to fix requoting behavior in r280487 after changes to
tooling::Replacements are incomplete. We essentially need to add to
replacements at the same position, one to insert a line break and one to
change the quoting and that's incompatible with the new
tooling::Replacement API, which does not allow for order-dependent
Replacements. To make the order clear, Replacements::merge() has to be
used, but that requires the merged Replacement to actually refer to the
changed text, which is hard to reproduce for the requoting.

This change fixes the behavior by moving the requoting to a completely
separate pass. The added benefit is that no weird ColumnWidth
calculations are necessary anymore and this should just work even if we
implement string literal splitting in the future.

llvm-svn: 280874
2016-09-07 22:48:53 +00:00
Eugene Zelenko e95e7d5d64 Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D24115

llvm-svn: 280870
2016-09-07 21:53:17 +00:00
George Burgess IV 2da19a5a08 Move CHECK right before the function it describes.
llvm-svn: 280852
2016-09-07 20:15:03 +00:00
George Burgess IV fbad5b2f1b [Sema] Compare bad conversions in overload resolution.
r280553 introduced an issue where we'd emit ambiguity errors for code
like:

```
void foo(int *, int);
void foo(unsigned int *, unsigned int);

void callFoo() {
  unsigned int i;
  foo(&i, 0); // ambiguous: int->unsigned int is worse than int->int,
              // but unsigned int*->unsigned int* is better than
              // int*->int*.
}
```

This patch fixes this issue by changing how we handle ill-formed (but
valid) implicit conversions. Candidates with said conversions now always
rank worse than candidates without them, and two candidates are
considered to be equally bad if they both have these conversions for
the same argument.

Additionally, this fixes a case in C++11 where we'd complain about an
ambiguity in a case like:

```
void f(char *, int);
void f(const char *, unsigned);
void g() { f("abc", 0); }
```

...Since conversion to char* from a string literal is considered
ill-formed in C++11 (and deprecated in C++03), but we accept it as an
extension.

llvm-svn: 280847
2016-09-07 20:03:19 +00:00
Nico Weber 82f729bf4e Add a few more test for []-style uuid attributes.
- Should diag on a function (clang-cl warns; it's an error in cl)
- Test the attribute on nested classes (clang-cl is more permissive and more
  self-consistent than cl here)

llvm-svn: 280845
2016-09-07 19:41:35 +00:00
Yaxun Liu 43712e05ea Do not validate pch when -fno-validate-pch is set
There is a bug causing pch to be validated even though -fno-validate-pch is set. This patch fixes it.

ASTReader relies on ASTReaderListener to initialize SuggestedPredefines, which is required for compilations using PCH. Before this change, PCHValidator is the default ASTReaderListener. After this change, when -fno-validate-pch is set, PCHValidator is disabled, but we need a replacement ASTReaderListener to initialize SuggestedPredefines. Class SimpleASTReaderListener is implemented for this purpose.

This change only affects -fno-validate-pch. There is no functional change if -fno-validate-pch is not set.

If -fno-validate-pch is not set, conflicts in predefined macros between pch and current compiler instance causes error.

If -fno-validate-pch is set, predefine macros in current compiler override those in pch so that compilation can continue.

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

llvm-svn: 280842
2016-09-07 18:40:20 +00:00
Ismail Pazarbasi 4a00774e59 Try contextually converting condition of constexpr if to Boolean value
Summary:
C++1z 6.4.1/p2:
 If the if statement is of the form if constexpr, the value of the
 condition shall be a contextually converted constant expression of type
 bool [...]
C++1z 5.20/p4:
 [...] A contextually converted constant expression of type bool is an
 expression, contextually converted to bool (Clause4), where the
 converted expression is a constant expression and the conversion
 sequence contains only the conversions above. [...]

Contextually converting result of an expression `e` to a Boolean value
requires `bool t(e)` to be well-formed.

An explicit conversion function is only considered as a user-defined
conversion for direct-initialization, which is essentially what
//contextually converted to bool// requires.

Also, fixes PR28470.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 280838
2016-09-07 18:24:54 +00:00
Reid Kleckner e5a321b5e8 [MS] Fix prologue this adjustment when 'this' is passed indirectly
Move the logic for doing this from the ABI argument lowering into
EmitParmDecl, which runs for all parameters. Our codegen is slightly
suboptimal in this case, as we may leave behind a dead store after
optimization, but it's 32-bit inalloca, and this fixes the bug in a
robust way.

Fixes PR30293

llvm-svn: 280836
2016-09-07 18:21:30 +00:00
Eugene Zelenko 2fe1cc482b [clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes.
Differential revision: https://reviews.llvm.org/D24165

llvm-svn: 280828
2016-09-07 17:37:28 +00:00
Vassil Vassilev 73e5d89de5 Add missing include. White space.
llvm-svn: 280827
2016-09-07 17:30:50 +00:00
Reid Kleckner 5de2bcdcf6 Add MS __nop intrinsic to intrin.h
Summary: There was no definition for __nop function - added inline
assembly.

Patch by Albert Gutowski!

Reviewers: rnk, thakis

Subscribers: cfe-commits

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

llvm-svn: 280826
2016-09-07 16:55:12 +00:00
Reid Kleckner 3f1ec62a83 Parsing MS pragma intrinsic
Parse pragma intrinsic, display warning if the function isn't a builtin
function in clang and suggest including intrin.h.

Patch by Albert Gutowski!

Reviewers: aaron.ballman, rnk

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 280825
2016-09-07 16:38:32 +00:00
Reid Kleckner 034e727001 [MS] Fix 'this' type when calling virtual methods with inalloca
If the virtual method comes from a secondary vtable, then the type of
the 'this' parameter should be i8*, and not a pointer to the complete
class. In the MS ABI, the 'this' parameter on entry points to the vptr
containing the virtual method that was called, so we use i8* instead of
the normal type. We had a mismatch where the CGFunctionInfo of the call
didn't match the CGFunctionInfo of the declaration, and this resulted in
some assertions, but now both sides agree the type of 'this' is i8*.

Fixes one issue raised in PR30293

llvm-svn: 280815
2016-09-07 15:15:51 +00:00
Sagar Thakur c9113e4863 [EfficiencySanitizer] [MIPS64] Enables esan clang driver options for MIPS64
Reviewed by bruening
Differential: D23800

llvm-svn: 280806
2016-09-07 12:23:15 +00:00
Alexey Bader af17c7959e [OpenCL] Fix pipe built-in functions return type.
By default return type of call expressions calling built-in
functions is set to bool.

Fixes https://llvm.org/bugs/show_bug.cgi?id=30219.

Reviewers: Anastasia

Subscribers: dmitry, cfe-commits, yaxunl

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

llvm-svn: 280800
2016-09-07 10:32:03 +00:00
Matt Arsenault f333de3752 OpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness
OpenCL requires __ENDIAN_LITTLE__ be set for little endian targets.
The default for targets was also apparently big endian, so AMDGPU
was incorrectly reported as big endian. Set this from the triple
so targets don't have another place to set the endianness.

llvm-svn: 280787
2016-09-07 07:08:02 +00:00
Matt Arsenault 8afb5cd894 Fix whitespace issues
^M and extra space

llvm-svn: 280786
2016-09-07 07:07:59 +00:00
Richard Smith 7c2bcc9eb0 Fix clang's handling of the copy performed in the second phase of class
copy-initialization. We previously got this wrong in a couple of ways:
 - we only looked for copy / move constructors and constructor templates for
   this copy, and thus would fail to copy in cases where doing so should use
   some other constructor (but see core issue 670),
 - we mishandled the special case for disabling user-defined conversions that
   blocks infinite recursion through repeated application of a copy constructor
   (applying it in slightly too many cases) -- though as far as I can tell,
   this does not ever actually affect the result of overload resolution, and
 - we misapplied the special-case rules for constructors taking a parameter
   whose type is a (reference to) the same class type by incorrectly assuming
   that only happens for copy/move constructors (it also happens for
   constructors instantiated from templates and those inherited from base
   classes).

These changes should only affect strange corner cases (for instance, where the
copy constructor exists but has a non-const-qualified parameter type), so for
the most part it only causes us to produce more 'candidate' notes, but see the
test changes for other cases whose behavior is affected.

llvm-svn: 280776
2016-09-07 02:14:33 +00:00
Devin Coughlin 80e74cdc68 [scan-build-py] Increase precision of timestamp in report directory name
This commit improves compatibility with the perl version of scan-build.

The perl version of scan-build produces output report directories with
increasing lexicographic ordering. This ordering is relied on by the CmpRuns.py
tool in utils/analyzer when comparing results for build commands with multiple
steps. That tool tries to line up the output directory for each step between
different runs of the analyzer based on the increasing directory name.

The python version of scan-build uses file.mkdtemp() with a time stamp
prefix to create report directories. The timestamp has a 1-second precision.
This means that when analysis of a single build step takes less than a second
the ordering property that CmpRuns.py expects will sometimes not hold,
depending on the timing and the random suffix generated by mkdtemp(). Ultimately
this causes CmpRuns to incorrectly correlate results from build steps and report
spurious differences between runs.

This commit increases the precision of the timestamp used in scan-build-py to
the microsecond level. This approach still has the same underlying issue -- but
in practice analysis of any build step is unlikely to take less than a
millisecond.

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

llvm-svn: 280768
2016-09-06 23:42:51 +00:00
Martin Probst 34ecf42bff clang-format: [JS] whitespace required between ! and as.
Summary:
Before:
    x!as string
After:
    x! as string

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 280731
2016-09-06 18:55:34 +00:00
Martin Probst 56ff7aaacb clang-format: [JS] ignore comments when wrapping returns.
Summary:
When code contains a comment between `return` and the value:

    return /* lengthy comment here */ (
        lengthyValueComesHere);

Do not wrap before the comment, as that'd break the code through JS' automatic
semicolon insertion.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 280730
2016-09-06 18:39:30 +00:00
Manman Ren c748359c14 Modules: Fix an assertion in DeclContext::buildLookup.
When calling getMostRecentDecl, we can pull in more definitions from
a module. We call getPrimaryContext afterwards to make sure that
we buildLookup on a primary context.

rdar://27926200

llvm-svn: 280728
2016-09-06 18:16:54 +00:00
Leny Kholodov df050fd585 Formatting with clang-format patch r280701
llvm-svn: 280718
2016-09-06 17:06:14 +00:00
Pierre Gousseau 209b6e2e78 [clang-cl] Check that we are in clang cl mode before enabling support for the CL environment variable.
Checking for the type of the command line tokenizer should not be the criteria to enable support for the CL environment variable, this change checks that we are in clang-cl mode instead.

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

llvm-svn: 280702
2016-09-06 10:48:27 +00:00
Leny Kholodov 80c047d2c4 DebugInfo: use llvm::DINode::DIFlags type for debug info flags
Use llvm::DINode::DIFlags type (strongly typed enum) for debug flags instead of unsigned int to avoid problems on platforms with sizeof(int) < 4: we already have flags with values > (1 << 16).

Patch by: Victor Leschuk <vleschuk@gmail.com>

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

llvm-svn: 280701
2016-09-06 10:48:04 +00:00
Alexey Bader 3e0b817b91 [OpenCL] Remove access qualifiers on images in arg info metadata.
Summary:
Remove access qualifiers on images in arg info metadata:
 * kernel_arg_type
 * kernel_arg_base_type

Image access qualifiers are inseparable from type in clang implementation,
but OpenCL spec provides a special query to get access qualifier
via clGetKernelArgInfo with CL_KERNEL_ARG_ACCESS_QUALIFIER.

Besides that OpenCL conformance test_api get_kernel_arg_info expects
image types without access qualifier.

Patch by Evgeniy Tyurin.

Reviewers: bader, yaxunl, Anastasia

Subscribers: cfe-commits

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

llvm-svn: 280699
2016-09-06 10:10:28 +00:00
Ed Schouten c6d1a730a6 Add support for targeting armv6-unknown-cloudabi-eabihf.
I'm in the progress of adding ARMv6 support to CloudABI. On the compiler
side, everything seems to work properly with this tiny change applied.

llvm-svn: 280672
2016-09-05 18:38:34 +00:00
NAKAMURA Takumi f852ac88f3 clang/test/Modules/compiler_builtins_x86.c: Fix r280658.
llvm-svn: 280659
2016-09-05 13:14:54 +00:00
James Molloy 3ddbb81ea0 Attempt to fix buildbots not targetting x86
r280613 introduced failures for all builds that don't target x86 by default. Add an explicit target to avoid a missing feature diagnostic.

llvm-svn: 280658
2016-09-05 12:28:49 +00:00
Craig Topper 2dfab63bb3 [AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div builtins and replace with native operations.
We can't do the 512-bit ones because they take a rounding mode argument that we can't represent.

llvm-svn: 280635
2016-09-04 18:30:17 +00:00
Joerg Sonnenberger 9bd9d98929 Test case for r280607 to check presence and sanity of the *_LOCK_FREE
macros.

llvm-svn: 280622
2016-09-04 11:21:27 +00:00
Elad Cohen fb6358d2b5 [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.
This adds support for modules that require (non-)freestanding
environment, such as the compiler builtin mm_malloc submodule.

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

llvm-svn: 280613
2016-09-04 06:00:42 +00:00
Joerg Sonnenberger b50b2fac9f Trailing dot that shouldn't have been committed.
llvm-svn: 280609
2016-09-04 00:51:02 +00:00
Joerg Sonnenberger 82216f0faa PR 27200: Fix names of the atomic lock-free macros.
llvm-svn: 280607
2016-09-04 00:44:10 +00:00
Craig Topper f43e4a1728 [AVX-512] Remove masked integer mullo builtins and replace with native IR.
llvm-svn: 280597
2016-09-03 19:19:49 +00:00
Craig Topper 0e18976b8d [AVX-512] Remove masked integer add/sub builtins and replace with native IR.
llvm-svn: 280596
2016-09-03 18:29:35 +00:00
Aaron Ballman bb18e91cdf Fix the attribute documentation build.
llvm-svn: 280591
2016-09-03 15:36:52 +00:00
Niels Ole Salscheider b28cc458c3 Replace the Radeon GCN GPU family names by more descriptive ones
Differential Revision: https://reviews.llvm.org/D23957

llvm-svn: 280587
2016-09-03 07:13:54 +00:00
Nico Weber 55fbe483d6 Add a test Aaron asked for that I forgot to add before landing r280578.
llvm-svn: 280580
2016-09-03 04:27:14 +00:00
Nico Weber 05e1dadac6 [ms] Add support for parsing uuid as a Microsoft attribute.
Some Windows SDK classes, for example
Windows::Storage::Streams::IBufferByteAccess, use the ATL way of spelling
attributes:

  [uuid("....")] class IBufferByteAccess {};

To be able to use __uuidof() to grab the uuid off these types, clang needs to
support uuid as a Microsoft attribute. There was already code to skip Microsoft
attributes, extend that to look for uuid and parse it.  Use the new "Microsoft"
attribute type added in r280575 (and r280574, r280576) for this.

Final part of https://reviews.llvm.org/D23895

llvm-svn: 280578
2016-09-03 03:25:22 +00:00
Nico Weber 32a0fc7987 Let Microsoft attributes apply to the type, not the variable.
There was already a function that moved attributes off the declspec into
an attribute list for attributes applying to the type, teach that function to
also move Microsoft attributes around and rename it to match its new broader
role.

Nothing uses Microsoft attributes yet, so no behavior change.

Part of https://reviews.llvm.org/D23895

llvm-svn: 280576
2016-09-03 03:01:32 +00:00
Nico Weber 20e08048ec Add plumbing for new attribute type "Microsoft".
This is for attributes in []-delimited lists preceding a class, like e.g.
`[uuid("...")] class Foo {};`  Not used by anything yet, so no behavior change.
Part of https://reviews.llvm.org/D23895

llvm-svn: 280575
2016-09-03 02:55:10 +00:00
Nico Weber 8452327f2d Move calls of MaybeParseMicrosoftAttributes() before ParseExternalDeclaration()
into ParseDeclOrFunctionDefInternal() (which is called by
MaybeParseMicrosoftAttributes()), so that the attributes can be stored in
the DeclSpec.  No behavior change yet, part of https://reviews.llvm.org/D23895

llvm-svn: 280574
2016-09-03 02:48:03 +00:00
Nico Weber cb7f722ffa Remove function name from comment.
The comment starting with "ParseDeclarationOrFunctionDefinition -" is above
a function called ParseDeclOrFunctionDefInternal.  Fix the comment by not
mentioning a function name, like the style guide requests nowadays.  No behavior
change.

llvm-svn: 280572
2016-09-03 02:41:17 +00:00
George Burgess IV 6098fd1989 [Sema] Fix how we set implicit conversion kinds.
We have invariants we like to guarantee for the
`ImplicitConversionKind`s in a `StandardConversionSequence`. These
weren't being upheld in code that r280553 touched, so Richard suggested
that we should fix that. See D24113.

I'm not entirely sure how to go about testing this, so no test case is
included. Suggestions welcome.

llvm-svn: 280562
2016-09-03 00:28:25 +00:00
Yunzhong Gao f4903a3675 (clang part) Implement MASM-flavor intel syntax behavior for inline MS asm block.
Clang tests for verifying the following syntaxes:
1. 0xNN and NNh are accepted as valid hexadecimal numbers, but 0xNNh is not.     
   0xNN and NNh may come with optional U or L suffix.                            
2. NNb is accepted as a valid binary (base-2) number, but 0bNN is not.           
   NNb may come with optional U or L suffix.                                     
                                                                                 
Differential Revision: https://reviews.llvm.org/D22112

llvm-svn: 280556
2016-09-02 23:16:06 +00:00