]> granicus.if.org Git - clang/log
clang
7 years agoAdd a mode to clang-tblgen to generate reference documentation for warning and
Richard Smith [Mon, 12 Sep 2016 05:58:29 +0000 (05:58 +0000)]
Add a mode to clang-tblgen to generate reference documentation for warning and
remark flags. For now I'm checking in a copy of the built documentation, but we
can replace this with a placeholder (as we do for the attributes reference
documentation) once we enable building this server-side.

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

7 years ago[MS ABI] Add /include directives for dynamic TLS
David Majnemer [Mon, 12 Sep 2016 02:51:43 +0000 (02:51 +0000)]
[MS ABI] Add /include directives for dynamic TLS

MSVC emits /include directives in the .drective section for the
__dyn_tls_init function (decorated as ___dyn_tls_init@12 for 32-bit).

This fixes PR30347.

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

7 years agoCodeGen: remove unnecessary else case
Saleem Abdulrasool [Sun, 11 Sep 2016 01:25:15 +0000 (01:25 +0000)]
CodeGen: remove unnecessary else case

Refactor the assignment so that its much more clear that the if-clause contains
the lookup, and once cached is directly used.  NFC.

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

7 years agoAdd missing test coverage for an inheritance model attrib merge diag.
Nico Weber [Sat, 10 Sep 2016 13:03:59 +0000 (13:03 +0000)]
Add missing test coverage for an inheritance model attrib merge diag.

Without this, no tests fail if I remove the Diag() in the first if in
Sema::mergeMSInheritanceAttr().

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

7 years ago[tablegen] Check that an optional IdentifierArgument of an attribute is
Akira Hatanaka [Sat, 10 Sep 2016 03:29:43 +0000 (03:29 +0000)]
[tablegen] Check that an optional IdentifierArgument of an attribute is
provided before trying to print it.

This fixes a segfault that occurs when function printPretty generated by
tablegen tries to print an optional argument of attribute
objc_bridge_related.

rdar://problem/28155469

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

7 years agoModules: for ObjectiveC try to keep the definition invariant.
Manman Ren [Fri, 9 Sep 2016 23:48:27 +0000 (23:48 +0000)]
Modules: for ObjectiveC try to keep the definition invariant.

When deserializing ObjCInterfaceDecl with definition data, if we already have
a definition, try to keep the definition invariant; also pull in the
categories even if it is not what getDefinition returns (this effectively
combines categories).

rdar://27926200
rdar://26708823

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

7 years agoDebug info: Bump the default DWARF version on Darwin to 4.
Adrian Prantl [Fri, 9 Sep 2016 21:10:35 +0000 (21:10 +0000)]
Debug info: Bump the default DWARF version on Darwin to 4.

This is a spiritual re-commit of r201375 with only a brief delay
for upgrading the green dragon builders.

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

7 years ago[CUDA] Make __GCC_ATOMIC_XXX_LOCK_FREE macros the same on host/device.
Justin Lebar [Fri, 9 Sep 2016 20:35:43 +0000 (20:35 +0000)]
[CUDA] Make __GCC_ATOMIC_XXX_LOCK_FREE macros the same on host/device.

Summary:
This fixes a bug where we were unable to compile the following CUDA
file with libstdc++ (didn't try libc++):

  #include <future>
  void foo() { std::shared_future<int> x; }

The problem is that <future> only defines std::shared_future if
__GCC_ATOMIC_INT_LOCK_FREE > 1.  When we compiled this file for device,
the macro was set to 1, and then the class didn't exist at all.

Reviewers: tra

Subscribers: cfe-commits, jhen

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

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

7 years agoModules: revert r280728.
Manman Ren [Fri, 9 Sep 2016 19:03:07 +0000 (19:03 +0000)]
Modules: revert r280728.

In post-commit review, Richard suggested a better way to fix this.
rdar://27926200

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

7 years agoMyriad: nominally "support" ASAN.
Douglas Katzman [Fri, 9 Sep 2016 18:20:49 +0000 (18:20 +0000)]
Myriad: nominally "support" ASAN.

Doesn't work, but needs to be enabled in order to get there.

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

7 years agoAlso cleanup comments around redundant colons/commas in format::cleanup.
Eric Liu [Fri, 9 Sep 2016 17:50:49 +0000 (17:50 +0000)]
Also cleanup comments around redundant colons/commas in format::cleanup.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[DebugInfo] Ensure complete type is emitted with -fstandalone-debug
Reid Kleckner [Fri, 9 Sep 2016 17:03:53 +0000 (17:03 +0000)]
[DebugInfo] Ensure complete type is emitted with -fstandalone-debug

The logic for upgrading a class from a forward decl to a complete type
was not checking the debug info emission level before applying the
vtable optimization. This meant we ended up without debug info for a
class which was required to be complete. I noticed it because it
triggered an assertion during CodeView emission, but that's a separate
issue.

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

7 years agoMake -fstandalone-debug and -flimit-debug-info available in clang-cl
Reid Kleckner [Fri, 9 Sep 2016 16:42:50 +0000 (16:42 +0000)]
Make -fstandalone-debug and -flimit-debug-info available in clang-cl

Our limited debug info optimizations are breaking down at DLL
boundaries, so we're going to evaluate the size impact of these
settings, and possibly change the default.

Users should be able to override our settings, though.

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

7 years ago[codeview] Extend the heuristic for detecting classes imported from DLLs
Reid Kleckner [Fri, 9 Sep 2016 16:27:04 +0000 (16:27 +0000)]
[codeview] Extend the heuristic for detecting classes imported from DLLs

If a dynamic class contains a dllimport method, then assume the class
may not be constructed in this DLL, and therefore the vtable will live
in a different PDB.

This heuristic is still incomplete, and will miss things like abstract
base classes that are only constructed on one side of the DLL interface.
That said, this heuristic does detect some cases that are currently
problematic, and may be useful to other projects that don't use many
DLLs.

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

7 years agoUpdate clang for D21514. NFC
Amaury Sechet [Fri, 9 Sep 2016 04:42:49 +0000 (04:42 +0000)]
Update clang for D21514. NFC

Summary: As per title.

Reviewers: ahatanak, bkramer, whitequark, mehdi_amini, void

Subscribers: cfe-commits

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

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

7 years ago[Docs] Fix typos, remove trailing whitespace.
George Burgess IV [Fri, 9 Sep 2016 02:45:48 +0000 (02:45 +0000)]
[Docs] Fix typos, remove trailing whitespace.

Avoided wrapping NullabilityDocs at 80cols, since that would've made
this diff much bigger, and never-ending lines seems to be the style for
many of the null-related docs.

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

7 years agoC++ Modules TS: Add parsing and some semantic analysis support for
Richard Smith [Thu, 8 Sep 2016 23:14:54 +0000 (23:14 +0000)]
C++ Modules TS: Add parsing and some semantic analysis support for
export-declarations. These don't yet have an effect on name visibility;
we still export everything by default.

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

7 years ago[Driver] Report invalid -mtune/-mcpu parameters when -arch=arm64
Vedant Kumar [Thu, 8 Sep 2016 22:53:19 +0000 (22:53 +0000)]
[Driver] Report invalid -mtune/-mcpu parameters when -arch=arm64

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

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

7 years agoImplement MS _rot intrinsics
Albert Gutowski [Thu, 8 Sep 2016 22:32:19 +0000 (22:32 +0000)]
Implement MS _rot intrinsics

Reviewers: thakis, Prazek, compnerd, rnk

Subscribers: majnemer, cfe-commits

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

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

7 years ago[modules] Apply ODR merging for function scoped tags only in C++ mode.
Vassil Vassilev [Thu, 8 Sep 2016 20:34:41 +0000 (20:34 +0000)]
[modules] Apply ODR merging for function scoped tags only in C++ mode.

In C mode, if we have a visible declaration but not a visible definition, a tag
defined in the declaration should be have a visible definition. In C++ we rely
on the ODR merging, whereas in C we cannot because each declaration of a
function gets its own set of declarations in its prototype scope.

Patch developed in collaboration with Richard Smith!

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

7 years agoRevert "[XRay] ARM 32-bit no-Thumb support in Clang"
Renato Golin [Thu, 8 Sep 2016 17:12:32 +0000 (17:12 +0000)]
Revert "[XRay] ARM 32-bit no-Thumb support in Clang"

This reverts commit r280889, as the original LLVM commits broke the thumb
buildbots.

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

7 years agoMoved unreachable to appease msvc, gcc and clang
Simon Pilgrim [Thu, 8 Sep 2016 11:03:41 +0000 (11:03 +0000)]
Moved unreachable to appease msvc, gcc and clang

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

7 years agoFixed a 'not all control paths return a value' warning on MSVC builds
Simon Pilgrim [Thu, 8 Sep 2016 09:59:58 +0000 (09:59 +0000)]
Fixed a 'not all control paths return a value' warning on MSVC builds

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

7 years agoAdd explicit casts to size_t to try to appease MSVC.
Peter Collingbourne [Thu, 8 Sep 2016 01:45:28 +0000 (01:45 +0000)]
Add explicit casts to size_t to try to appease MSVC.

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

7 years agoCodeGen: Clean up implementation of vtable initializer builder. NFC.
Peter Collingbourne [Thu, 8 Sep 2016 01:14:39 +0000 (01:14 +0000)]
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

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

7 years ago[XRay] ARM 32-bit no-Thumb support in Clang
Dean Michael Berris [Thu, 8 Sep 2016 00:23:28 +0000 (00:23 +0000)]
[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

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

7 years agoclang-format: [JavaScript] Change default AllowShortFunctionsOnASingleLine
Daniel Jasper [Wed, 7 Sep 2016 23:01:13 +0000 (23:01 +0000)]
clang-format: [JavaScript] Change default AllowShortFunctionsOnASingleLine
for Google style to "empty".

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

7 years agoclang-format: [JavaScript] Do requoting in a separate pass
Daniel Jasper [Wed, 7 Sep 2016 22:48:53 +0000 (22:48 +0000)]
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.

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

7 years agoFix some Clang-tidy modernize-use-using and Include What You Use warnings; other...
Eugene Zelenko [Wed, 7 Sep 2016 21:53:17 +0000 (21:53 +0000)]
Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes.

Differential revision: https://reviews.llvm.org/D24115

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

7 years agoMove CHECK right before the function it describes.
George Burgess IV [Wed, 7 Sep 2016 20:15:03 +0000 (20:15 +0000)]
Move CHECK right before the function it describes.

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

7 years ago[Sema] Compare bad conversions in overload resolution.
George Burgess IV [Wed, 7 Sep 2016 20:03:19 +0000 (20:03 +0000)]
[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.

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

7 years agoAdd a few more test for []-style uuid attributes.
Nico Weber [Wed, 7 Sep 2016 19:41:35 +0000 (19:41 +0000)]
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)

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

7 years agoDo not validate pch when -fno-validate-pch is set
Yaxun Liu [Wed, 7 Sep 2016 18:40:20 +0000 (18:40 +0000)]
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

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

7 years agoTry contextually converting condition of constexpr if to Boolean value
Ismail Pazarbasi [Wed, 7 Sep 2016 18:24:54 +0000 (18:24 +0000)]
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

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

7 years ago[MS] Fix prologue this adjustment when 'this' is passed indirectly
Reid Kleckner [Wed, 7 Sep 2016 18:21:30 +0000 (18:21 +0000)]
[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

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

7 years ago[clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What...
Eugene Zelenko [Wed, 7 Sep 2016 17:37:28 +0000 (17:37 +0000)]
[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

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

7 years agoAdd missing include. White space.
Vassil Vassilev [Wed, 7 Sep 2016 17:30:50 +0000 (17:30 +0000)]
Add missing  include. White space.

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

7 years agoAdd MS __nop intrinsic to intrin.h
Reid Kleckner [Wed, 7 Sep 2016 16:55:12 +0000 (16:55 +0000)]
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

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

7 years agoParsing MS pragma intrinsic
Reid Kleckner [Wed, 7 Sep 2016 16:38:32 +0000 (16:38 +0000)]
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

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

7 years ago[MS] Fix 'this' type when calling virtual methods with inalloca
Reid Kleckner [Wed, 7 Sep 2016 15:15:51 +0000 (15:15 +0000)]
[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

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

7 years ago[EfficiencySanitizer] [MIPS64] Enables esan clang driver options for MIPS64
Sagar Thakur [Wed, 7 Sep 2016 12:23:15 +0000 (12:23 +0000)]
[EfficiencySanitizer] [MIPS64] Enables esan clang driver options for MIPS64

Reviewed by bruening
Differential: D23800

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

7 years ago[OpenCL] Fix pipe built-in functions return type.
Alexey Bader [Wed, 7 Sep 2016 10:32:03 +0000 (10:32 +0000)]
[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

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

7 years agoOpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness
Matt Arsenault [Wed, 7 Sep 2016 07:08:02 +0000 (07:08 +0000)]
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.

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

7 years agoFix whitespace issues
Matt Arsenault [Wed, 7 Sep 2016 07:07:59 +0000 (07:07 +0000)]
Fix whitespace issues

^M and extra space

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

7 years agoFix clang's handling of the copy performed in the second phase of class
Richard Smith [Wed, 7 Sep 2016 02:14:33 +0000 (02:14 +0000)]
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.

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

7 years ago[scan-build-py] Increase precision of timestamp in report directory name
Devin Coughlin [Tue, 6 Sep 2016 23:42:51 +0000 (23:42 +0000)]
[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

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

7 years agoclang-format: [JS] whitespace required between ! and as.
Martin Probst [Tue, 6 Sep 2016 18:55:34 +0000 (18:55 +0000)]
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

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

7 years agoclang-format: [JS] ignore comments when wrapping returns.
Martin Probst [Tue, 6 Sep 2016 18:39:30 +0000 (18:39 +0000)]
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

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

7 years agoModules: Fix an assertion in DeclContext::buildLookup.
Manman Ren [Tue, 6 Sep 2016 18:16:54 +0000 (18:16 +0000)]
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

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

7 years agoFormatting with clang-format patch r280701
Leny Kholodov [Tue, 6 Sep 2016 17:06:14 +0000 (17:06 +0000)]
Formatting with clang-format patch r280701

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

7 years ago[clang-cl] Check that we are in clang cl mode before enabling support for the CL...
Pierre Gousseau [Tue, 6 Sep 2016 10:48:27 +0000 (10:48 +0000)]
[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

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

7 years agoDebugInfo: use llvm::DINode::DIFlags type for debug info flags
Leny Kholodov [Tue, 6 Sep 2016 10:48:04 +0000 (10:48 +0000)]
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

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

7 years ago[OpenCL] Remove access qualifiers on images in arg info metadata.
Alexey Bader [Tue, 6 Sep 2016 10:10:28 +0000 (10:10 +0000)]
[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

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

7 years agoAdd support for targeting armv6-unknown-cloudabi-eabihf.
Ed Schouten [Mon, 5 Sep 2016 18:38:34 +0000 (18:38 +0000)]
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.

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

7 years agoclang/test/Modules/compiler_builtins_x86.c: Fix r280658.
NAKAMURA Takumi [Mon, 5 Sep 2016 13:14:54 +0000 (13:14 +0000)]
clang/test/Modules/compiler_builtins_x86.c: Fix r280658.

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

7 years agoAttempt to fix buildbots not targetting x86
James Molloy [Mon, 5 Sep 2016 12:28:49 +0000 (12:28 +0000)]
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.

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

7 years ago[AVX-512] Remove 128-bit and 256-bit masked floating point add/sub/mul/div builtins...
Craig Topper [Sun, 4 Sep 2016 18:30:17 +0000 (18:30 +0000)]
[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.

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

8 years agoTest case for r280607 to check presence and sanity of the *_LOCK_FREE
Joerg Sonnenberger [Sun, 4 Sep 2016 11:21:27 +0000 (11:21 +0000)]
Test case for r280607 to check presence and sanity of the *_LOCK_FREE
macros.

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

8 years ago[Modules] Add 'freestanding' to the 'requires-declaration' feature-list.
Elad Cohen [Sun, 4 Sep 2016 06:00:42 +0000 (06:00 +0000)]
[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

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

8 years agoTrailing dot that shouldn't have been committed.
Joerg Sonnenberger [Sun, 4 Sep 2016 00:51:02 +0000 (00:51 +0000)]
Trailing dot that shouldn't have been committed.

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

8 years agoPR 27200: Fix names of the atomic lock-free macros.
Joerg Sonnenberger [Sun, 4 Sep 2016 00:44:10 +0000 (00:44 +0000)]
PR 27200: Fix names of the atomic lock-free macros.

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

8 years ago[AVX-512] Remove masked integer mullo builtins and replace with native IR.
Craig Topper [Sat, 3 Sep 2016 19:19:49 +0000 (19:19 +0000)]
[AVX-512] Remove masked integer mullo builtins and replace with native IR.

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

8 years ago[AVX-512] Remove masked integer add/sub builtins and replace with native IR.
Craig Topper [Sat, 3 Sep 2016 18:29:35 +0000 (18:29 +0000)]
[AVX-512] Remove masked integer add/sub builtins and replace with native IR.

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

8 years agoFix the attribute documentation build.
Aaron Ballman [Sat, 3 Sep 2016 15:36:52 +0000 (15:36 +0000)]
Fix the attribute documentation build.

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

8 years agoReplace the Radeon GCN GPU family names by more descriptive ones
Niels Ole Salscheider [Sat, 3 Sep 2016 07:13:54 +0000 (07:13 +0000)]
Replace the Radeon GCN GPU family names by more descriptive ones

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

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

8 years agoAdd a test Aaron asked for that I forgot to add before landing r280578.
Nico Weber [Sat, 3 Sep 2016 04:27:14 +0000 (04:27 +0000)]
Add a test Aaron asked for that I forgot to add before landing r280578.

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

8 years ago[ms] Add support for parsing uuid as a Microsoft attribute.
Nico Weber [Sat, 3 Sep 2016 03:25:22 +0000 (03:25 +0000)]
[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

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

8 years agoLet Microsoft attributes apply to the type, not the variable.
Nico Weber [Sat, 3 Sep 2016 03:01:32 +0000 (03:01 +0000)]
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

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

8 years agoAdd plumbing for new attribute type "Microsoft".
Nico Weber [Sat, 3 Sep 2016 02:55:10 +0000 (02:55 +0000)]
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

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

8 years agoMove calls of MaybeParseMicrosoftAttributes() before ParseExternalDeclaration()
Nico Weber [Sat, 3 Sep 2016 02:48:03 +0000 (02:48 +0000)]
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

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

8 years agoRemove function name from comment.
Nico Weber [Sat, 3 Sep 2016 02:41:17 +0000 (02:41 +0000)]
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.

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

8 years ago[Sema] Fix how we set implicit conversion kinds.
George Burgess IV [Sat, 3 Sep 2016 00:28:25 +0000 (00:28 +0000)]
[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.

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

8 years ago(clang part) Implement MASM-flavor intel syntax behavior for inline MS asm block.
Yunzhong Gao [Fri, 2 Sep 2016 23:16:06 +0000 (23:16 +0000)]
(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

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

8 years ago[Sema] Relax overloading restrictions in C.
George Burgess IV [Fri, 2 Sep 2016 22:59:57 +0000 (22:59 +0000)]
[Sema] Relax overloading restrictions in C.

This patch allows us to perform incompatible pointer conversions when
resolving overloads in C. So, the following code will no longer fail to
compile (though it will still emit warnings, assuming the user hasn't
opted out of them):

```
void foo(char *) __attribute__((overloadable));
void foo(int) __attribute__((overloadable));

void callFoo() {
  unsigned char bar[128];
  foo(bar); // selects the char* overload.
}
```

These conversions are ranked below all others, so:

  A. Any other viable conversion will win out
  B. If we had another incompatible pointer conversion in the example
     above (e.g. `void foo(int *)`), we would complain about
     an ambiguity.

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

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

8 years agoImplement __attribute__((require_constant_initialization)) for safe static initializa...
Eric Fiselier [Fri, 2 Sep 2016 18:53:31 +0000 (18:53 +0000)]
Implement __attribute__((require_constant_initialization)) for safe static initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

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

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

8 years agoRevert r280516 since it contained accidental changes.
Eric Fiselier [Fri, 2 Sep 2016 18:43:25 +0000 (18:43 +0000)]
Revert r280516 since it contained accidental changes.

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

8 years agoBased on post-commit feedback over IRC with dblaikie, ideally, we should have a Small...
Aaron Ballman [Fri, 2 Sep 2016 18:31:31 +0000 (18:31 +0000)]
Based on post-commit feedback over IRC with dblaikie, ideally, we should have a SmallVector constructor that accepts anything which can supply a range via ADL begin()/end() calls so that we can construct the SmallVector directly from anything range-like.

Since that doesn't exist right now, use a local variable instead of calling getAssocExprs() twice; NFC.

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

8 years agoImplement __attribute__((require_constant_initialization)) for safe static initializa...
Eric Fiselier [Fri, 2 Sep 2016 18:25:29 +0000 (18:25 +0000)]
Implement __attribute__((require_constant_initialization)) for safe static initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

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

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

8 years agoclang-format: [JS] merge requoting replacements.
Martin Probst [Fri, 2 Sep 2016 14:29:48 +0000 (14:29 +0000)]
clang-format: [JS] merge requoting replacements.

Summary:
When formatting source code that needs both requoting and reindentation,
merge the replacements to avoid erroring out for conflicting replacements.

Also removes the misleading Replacements parameter from the
TokenAnalyzer API.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

8 years agoclang-format: [JS] handle default bindings in imports.
Martin Probst [Fri, 2 Sep 2016 14:06:32 +0000 (14:06 +0000)]
clang-format: [JS] handle default bindings in imports.

Summary:
Default imports appear outside of named bindings in curly braces:

  import A from 'a';
  import A, {symbol} from 'a';

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

8 years agoclang-format: [JS] Sort all JavaScript imports if any changed.
Martin Probst [Fri, 2 Sep 2016 14:01:17 +0000 (14:01 +0000)]
clang-format: [JS] Sort all JavaScript imports if any changed.

Summary:
User feedback is that they expect *all* imports to be sorted if any import was
affected by a change, not just imports up to the first non-affected line, as
clang-format currently does.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

8 years agoAllow a C11 generic selection expression to select a function with the overloadable...
Aaron Ballman [Fri, 2 Sep 2016 13:45:40 +0000 (13:45 +0000)]
Allow a C11 generic selection expression to select a function with the overloadable attribute as the result expression without crashing. This fixes PR30201.

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

8 years agoClean up handling of reading module files from stdin. Don't bother trying to
Richard Smith [Fri, 2 Sep 2016 00:18:05 +0000 (00:18 +0000)]
Clean up handling of reading module files from stdin. Don't bother trying to
look for a corresponding file, since we're not going to read it anyway.

No observable behavior change (though we now avoid pointlessly trying to stat
or open a file named "-").

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

8 years agoRefactor to avoid holding a reference to a container element that could go away
Richard Smith [Fri, 2 Sep 2016 00:10:28 +0000 (00:10 +0000)]
Refactor to avoid holding a reference to a container element that could go away
during this function, and to avoid rolling back changes to the module manager's
data structures. Instead, we defer registering the module file until after we
have successfully finished loading it.

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

8 years agoRemove excessive padding from MismatchingNewDeleteDetector
Alexander Shaposhnikov [Thu, 1 Sep 2016 23:18:00 +0000 (23:18 +0000)]
Remove excessive padding from MismatchingNewDeleteDetector

The class MismatchingNewDeleteDetector is in
lib/Sema/SemaExprCXX.cpp inside the anonymous namespace.
This diff reorders the fields and removes the excessive padding.
Test plan: make -j8 check-clang

Differential revision: https://reviews.llvm.org/D23898

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

8 years ago[WebAssembly] Change wasm SizeType to match asmjs
Derek Schuff [Thu, 1 Sep 2016 22:38:37 +0000 (22:38 +0000)]
[WebAssembly] Change wasm SizeType to match asmjs

Summary:
We want wasm and asmjs to have matching ABIs, and right now asmjs uses
unsigned int for its size_t. This causes exported symbols in libcxx to
not match and can cause weird breakage where libcxx doesn't get linked
as a result.  Long-term we probably want wasm32, wasm64, and asmjs to
all use unsigned long, but that would cause unnecessary ABI churn for
asmjs so defer that until we can make all the ABI changes at once.

Patch by Jacob Gravelle

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

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

8 years agoWhen we reach the end of a #include of a header of a local submodule that we
Richard Smith [Thu, 1 Sep 2016 20:15:25 +0000 (20:15 +0000)]
When we reach the end of a #include of a header of a local submodule that we
textually included, create an ImportDecl just as we would if we reached a
#include of any other modular header. This is necessary in order to correctly
determine the set of variables to initialize for an imported module.

This should hopefully make the modules selfhost buildbot green again.

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

8 years ago[CMake] Properly connecting Compiler-RT check and test-depends
Chris Bieneman [Thu, 1 Sep 2016 18:28:49 +0000 (18:28 +0000)]
[CMake] Properly connecting Compiler-RT check and test-depends

This correctly connects compiler-rt-test-depends to test-depends and
check-compiler-rt to check-all.

Based on LLVM r280392, and Compiler-RT r280393.

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

8 years ago[analyzer] ExprEngine: remove second call to PreStmt<CastExpr>
Aleksei Sidorin [Thu, 1 Sep 2016 13:55:38 +0000 (13:55 +0000)]
[analyzer] ExprEngine: remove second call to PreStmt<CastExpr>

This patch also introduces AnalysisOrderChecker which is intended for testing
of callback call correctness.

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

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

8 years ago[analyzer] Add more FileIDs to PlistDiagnostic map to avoid assertion
Aleksei Sidorin [Thu, 1 Sep 2016 12:25:16 +0000 (12:25 +0000)]
[analyzer] Add more FileIDs to PlistDiagnostic map to avoid assertion

Some FileIDs that may be used by PlistDiagnostics were not added while building
a list of pieces. This caused assertion violation in GetFID() function.
This patch adds some missing FileIDs to avoid the assertion. It also contains
small refactoring of PlistDiagnostics::FlushDiagnosticsImpl().

Patch by Aleksei Sidorin, Ilya Palachev.

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

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

8 years ago[Frontend] Fix mcount inlining bug
Honggyu Kim [Thu, 1 Sep 2016 11:29:21 +0000 (11:29 +0000)]
[Frontend] Fix mcount inlining bug

Since some profiling tools, such as gprof, ftrace, and uftrace, use
-pg option to generate a mcount function call at the entry of each
function. Function invocation can be detected by this hook function.

But mcount insertion is done before function inlining phase in clang,
sometime a function that already has a mcount call can be inlined in the
middle of another function.

This patch adds an attribute "counting-function" to each function
rather than emitting the mcount call directly in frontend so that this
attribute can be processed in backend. Then the mcount calls can be
properly inserted in backend after all the other optimizations are
completed.

Link: https://llvm.org/bugs/show_bug.cgi?id=28660
Reviewers: hans, rjmccall, hfinkel, rengolin, compnerd

Subscribers: shenhan, cfe-commits

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

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

8 years ago[analyzer][test commit] ExprEngine.cpp: Remove training whitespace; NFC
Aleksei Sidorin [Thu, 1 Sep 2016 11:11:46 +0000 (11:11 +0000)]
[analyzer][test commit] ExprEngine.cpp: Remove training whitespace; NFC

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

8 years agoRemove whitespace to test commit access
Honggyu Kim [Thu, 1 Sep 2016 06:14:45 +0000 (06:14 +0000)]
Remove whitespace to test commit access

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

8 years agoFix typos in comments.
George Burgess IV [Thu, 1 Sep 2016 01:26:58 +0000 (01:26 +0000)]
Fix typos in comments.

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

8 years ago[Sema] Don't diagnose an array type mismatch when the new or previous
Akira Hatanaka [Thu, 1 Sep 2016 01:03:21 +0000 (01:03 +0000)]
[Sema] Don't diagnose an array type mismatch when the new or previous
declaration has a dependent type.

This fixes a bug where clang errors out on a valid code.

rdar://problem/28051467

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

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

8 years agoFix all tests under test/CXX (and test/Analysis) to pass if clang's default
Richard Smith [Wed, 31 Aug 2016 23:24:08 +0000 (23:24 +0000)]
Fix all tests under test/CXX (and test/Analysis) to pass if clang's default
C++ language standard is not C++98.

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

8 years agoDR259: Demote the pedantic error for an explicit instantiation after an
Richard Smith [Wed, 31 Aug 2016 23:23:25 +0000 (23:23 +0000)]
DR259: Demote the pedantic error for an explicit instantiation after an
explicit specialization to a warning for C++98 mode (this is a defect report
resolution, so per our informal policy it should apply in C++98), and turn
the warning on by default for C++11 and later. In all cases where it fires, the
right thing to do is to remove the pointless explicit instantiation.

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

8 years agoAdd -fprofile-dir= to clang.
Nick Lewycky [Wed, 31 Aug 2016 23:04:32 +0000 (23:04 +0000)]
Add -fprofile-dir= to clang.

-fprofile-dir=path allows the user to specify where .gcda files should be
emitted when the program is run. In particular, this is the first flag that
causes the .gcno and .o files to have different paths, LLVM is extended to
support this. -fprofile-dir= does not change the file name in the .gcno (and
thus where lcov looks for the source) but it does change the name in the .gcda
(and thus where the runtime library writes the .gcda file). It's different from
a GCOV_PREFIX because a user can observe that the GCOV_PREFIX_STRIP will strip
paths off of -fprofile-dir= but not off of a supplied GCOV_PREFIX.

To implement this we split -coverage-file into -coverage-data-file and
-coverage-notes-file to specify the two different names. The !llvm.gcov
metadata node grows from a 2-element form {string coverage-file, node dbg.cu}
to 3-elements, {string coverage-notes-file, string coverage-data-file, node
dbg.cu}. In the 3-element form, the file name is already "mangled" with
.gcno/.gcda suffixes, while the 2-element form left that to the middle end
pass.

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

8 years agoDebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining
David Blaikie [Wed, 31 Aug 2016 20:54:35 +0000 (20:54 +0000)]
DebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining

I tested the cases involving split-dwarf + gmlt +
no-split-dwarf-inlining, but didn't verify the simpler case without
gmlt.

The logic is, admittedly, a little hairy, but seems about as simple as I
could wrangle it.

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

8 years agoDon't diagnoes a mismatch between implicit and explicit exception
Richard Smith [Wed, 31 Aug 2016 20:38:32 +0000 (20:38 +0000)]
Don't diagnoes a mismatch between implicit and explicit exception
specifications under -fno-exceptions, just as we don't diagnose other exception
specification mismatch errors.

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