]> granicus.if.org Git - clang/log
clang
7 years ago[Modules] Implement ODR-like semantics for tag types in C/ObjC
Bruno Cardoso Lopes [Sat, 1 Jul 2017 00:06:47 +0000 (00:06 +0000)]
[Modules] Implement ODR-like semantics for tag types in C/ObjC

Allow ODR for ObjC/C in the sense that we won't keep more that
one definition around (merge them). However, ensure the decl
pass the structural compatibility check in C11 6.2.7/1, for that,
reuse the structural equivalence checks used by the ASTImporter.

Few other considerations:
- Create error diagnostics for tag types mismatches and thread
them into the structural equivalence checks.
- Note that by doing this we only support redefinition between types
that are considered "compatible types" by C.

This is mixed approach of the suggestions discussed in
http://lists.llvm.org/pipermail/cfe-dev/2017-March/053257.html

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

rdar://problem/31909368

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

7 years agoChange enumerator default linkage type for C
Bruno Cardoso Lopes [Sat, 1 Jul 2017 00:06:27 +0000 (00:06 +0000)]
Change enumerator default linkage type for C

Redeclaration lookup should never find hidden enumerators in C, because
they do not have linkage (C11 6.2.2/6)

The linkage of an enumerator should be VisibleNoLinkage, and
isHiddenDeclarationVisible should be checking hasExternalFormalLinkage.

This is was reviewed as part of D31778, but splitted into a different
commit for clarity.

rdar://problem/31909368

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

7 years agoFix PR 33189: Clang assertion on template destructor declaration
Hubert Tong [Fri, 30 Jun 2017 22:43:54 +0000 (22:43 +0000)]
Fix PR 33189: Clang assertion on template destructor declaration

Summary:
This patch aims to fix the bug reported at
https://bugs.llvm.org/show_bug.cgi?id=33189. Clang hits an assertion
when a template destructor declaration is present. This is caused by
later processing that does not expect to encounter a template when
looking at a destructor. The resolution is to treat the destructor as
being not declared when later processing is interested in the properties
of the destructor of a class.

Reviewers: rcraik, hubert.reinterpretcast, aaron.ballman, rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

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

Patch by Kuang He!

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

7 years ago[ODRHash] Support Type TemplateArgument
Richard Trieu [Fri, 30 Jun 2017 22:40:33 +0000 (22:40 +0000)]
[ODRHash] Support Type TemplateArgument

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

7 years agoReinstate "Load lazily the template specialization in multi-module setups."
Vassil Vassilev [Fri, 30 Jun 2017 22:40:17 +0000 (22:40 +0000)]
Reinstate "Load lazily the template specialization in multi-module setups."

It was reverted in r305460 but the issue appears to only break our self-host
libcxx modules bot. Reapplying it will give us a chance to get a reproducer and
fix the issue.

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

7 years ago[Parse] Use normalized attr name for late-parsing checks.
George Burgess IV [Fri, 30 Jun 2017 22:33:24 +0000 (22:33 +0000)]
[Parse] Use normalized attr name for late-parsing checks.

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

7 years ago[Profile] Do not assign counters to functions without bodies
Vedant Kumar [Fri, 30 Jun 2017 21:02:14 +0000 (21:02 +0000)]
[Profile] Do not assign counters to functions without bodies

The root cause of the issues reported in D32406 and D34680 is that clang
instruments functions without bodies. Make it stop doing that, and also
teach it how to use old (incorrectly generated) profiles without
crashing.

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

7 years agoFix a typo. NFC.
Vedant Kumar [Fri, 30 Jun 2017 21:02:14 +0000 (21:02 +0000)]
Fix a typo. NFC.

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

7 years agoFix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
Richard Smith [Fri, 30 Jun 2017 20:57:39 +0000 (20:57 +0000)]
Fix ODR violations due to abuse of LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR

This is a short-term fix for PR33650 aimed to get the modules build bots green again.

Remove all the places where we use the LLVM_YAML_IS_(FLOW_)?SEQUENCE_VECTOR
macros to try to locally specialize a global template for a global type. That's
not how C++ works.

Instead, we now centrally define how to format vectors of fundamental types and
of string (std::string and StringRef). We use flow formatting for the former
cases, since that's the obvious right thing to do; in the latter case, it's
less clear what the right choice is, but flow formatting is really bad for some
cases (due to very long strings), so we pick block formatting. (Many of the
cases that were using flow formatting for strings are improved by this change.)

Other than the flow -> block formatting change for some vectors of strings,
this should result in no functionality change.

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

Corresponding LLVM change is r306878.

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

7 years agoclang-format: add options to merge empty record body
Francois Ferrand [Fri, 30 Jun 2017 20:25:55 +0000 (20:25 +0000)]
clang-format: add options to merge empty record body

Summary:
This patch introduces a few extra BraceWrapping options, similar to
`SplitEmptyFunction`, to allow merging empty 'record' bodies (e.g.
class, struct, union and namespace):
* SplitEmptyClass
* SplitEmptyStruct
* SplitEmptyUnion
* SplitEmptyNamespace

The `SplitEmptyFunction` option name has also been simplified/
shortened (from `SplitEmptyFunctionBody`).

These options are helpful when the correspond AfterXXX option is
enabled, to allow merging the empty record:

  class Foo
  {};

In addition, this fixes an unexpected merging of short records, when
the AfterXXXX options are used, which caused to be formatted like
this:

  class Foo
  { void Foo(); };

This is now properly formatted as:

  class Foo
  {
     void Foo();
  };

Reviewers: djasper, krasimir

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[clang-rename] Just return instead of calling exit(3) from main.
Benjamin Kramer [Fri, 30 Jun 2017 20:24:32 +0000 (20:24 +0000)]
[clang-rename] Just return instead of calling exit(3) from main.

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

7 years agoclang-format: Do not binpack initialization lists
Francois Ferrand [Fri, 30 Jun 2017 20:00:02 +0000 (20:00 +0000)]
clang-format: Do not binpack initialization lists

Summary:
This patch tries to avoid binpacking when initializing lists/arrays, to allow things like:

  static int types[] = {
      registerType1(),
      registerType2(),
      registerType3(),
  };
  std::map<int, std::string> x = {
      { 0, "foo fjakfjaklf kljj" },
      { 1, "bar fjakfjaklf kljj" },
      { 2, "stuff fjakfjaklf kljj" },
  };

This is similar to how dictionnaries are formatted, and actually corresponds to the same conditions: when initializing a container (and not just 'calling' a constructor).

Such formatting involves 2 things:
* Line breaks around the content of the block. This can be forced by adding a comma or comment after the last element
* Elements should not be binpacked

This patch considers the block is an initializer list if it either ends with a comma, or follows an assignment, which seems to provide a sensible approximation.

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: malcolm.parsons, klimek, cfe-commits

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

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

7 years ago[ORE] Use LLVM's "diagnostics hotness" spelling
Brian Gesiak [Fri, 30 Jun 2017 19:37:11 +0000 (19:37 +0000)]
[ORE] Use LLVM's "diagnostics hotness" spelling

Summary:
Depends on https://reviews.llvm.org/D34864.

To unify Clang and LLVM's spelling of "diagnostic[s] hotness", use the
new "diagnostics hotness" spelling in LLVM, which was added in
https://reviews.llvm.org/D34864.

Reviewers: anemet, davidxl

Reviewed By: anemet

Subscribers: cfe-commits

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

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

7 years ago[X86] Add RDRND feature to Goldmont. Add MOVBE to all Atom CPUs.
Craig Topper [Fri, 30 Jun 2017 18:14:04 +0000 (18:14 +0000)]
[X86] Add RDRND feature to Goldmont. Add MOVBE to all Atom CPUs.

Diffential Revision: https://reviews.llvm.org/D34842

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

7 years ago[X86] Add a break to the last case of a few switches to prevent accidents in the...
Craig Topper [Fri, 30 Jun 2017 18:14:02 +0000 (18:14 +0000)]
[X86] Add a break to the last case of a few switches to prevent accidents in the future. NFC

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

7 years ago[X86] Move all atom CPUs to the same section of the switch and use fallthroughs like...
Craig Topper [Fri, 30 Jun 2017 18:14:01 +0000 (18:14 +0000)]
[X86] Move all atom CPUs to the same section of the switch and use fallthroughs like we do for other CPU generations. NFC

This is prep work to add MOVBE to all Atom CPUs. This instruction didn't come in to the Nehalem/Westmere/SandyBridge/etc. line until later so there's no natural place to overlap the Atom CPUs into that part of the switch.

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

7 years agoAttempt to fix the linkage error caused by r306840 on the mingw-RA-on-linux bot
Alex Lorenz [Fri, 30 Jun 2017 17:15:48 +0000 (17:15 +0000)]
Attempt to fix the linkage error caused by r306840 on the mingw-RA-on-linux bot

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

7 years agoMove ClassReplacements.cpp test from clang-rename tests to the
Alex Lorenz [Fri, 30 Jun 2017 16:58:36 +0000 (16:58 +0000)]
Move ClassReplacements.cpp test from clang-rename tests to the
clang-apply-replacements tests

The ClassReplacements.cpp test in the clang-rename tests uses
clang-apply-replacements. I moved it back to the clang-tools-extra repository
for now to ensure that the clang-rename tests can pass when clang is compiled
without clang-tools-extra.

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

7 years agoUse add_clang_unittest in the CMakeLists.txt for the moved unittest
Alex Lorenz [Fri, 30 Jun 2017 16:43:00 +0000 (16:43 +0000)]
Use add_clang_unittest in the CMakeLists.txt for the moved unittest

The unittest was moved in r306840

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

7 years ago[refactor] Move clang-rename into the clang repository
Alex Lorenz [Fri, 30 Jun 2017 16:36:09 +0000 (16:36 +0000)]
[refactor] Move clang-rename into the clang repository

The core engine of clang-rename will be used for local and global renames in the
new refactoring engine, as mentioned in
http://lists.llvm.org/pipermail/cfe-dev/2017-June/054286.html.

The clang-rename tool is still supported but might get deprecated in the future.

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

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

7 years ago[objc] Don't require null-check and don't emit memset when result is ignored for...
Kuba Mracek [Fri, 30 Jun 2017 16:28:15 +0000 (16:28 +0000)]
[objc] Don't require null-check and don't emit memset when result is ignored for struct-returning method calls [clang part]

This fixes an issue with the emission of lifetime markers for struct-returning Obj-C msgSend calls. When the result of a struct-returning call is ignored, the temporary storage is only marked with lifetime markers in one of the two branches of the nil-receiver-check. The check is, however, not required when the result is unused. If we still need to emit the check (due to consumer arguments), let's not emit the memset to zero out the result if it's unused. This fixes a use-after-scope false positive with AddressSanitizer.

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

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

7 years ago[MS] Test that deleting destructor thunks are not exported
Reid Kleckner [Fri, 30 Jun 2017 16:12:14 +0000 (16:12 +0000)]
[MS] Test that deleting destructor thunks are not exported

The MSVC linker emits the LNK4102 warning if they are.

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

7 years agoRevert "[CodeGen] Propagate dllexport to thunks"
Reid Kleckner [Fri, 30 Jun 2017 16:11:49 +0000 (16:11 +0000)]
Revert "[CodeGen] Propagate dllexport to thunks"

This reverts r306770, it causes LNK4102 warnings in MSVC builds.

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

7 years agoDriver: fix option declaration
Saleem Abdulrasool [Fri, 30 Jun 2017 15:15:39 +0000 (15:15 +0000)]
Driver: fix option declaration

The option is a "joined" argument.  Fix silly copy-paste error.  This
allows the parsing to work at runtime.

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

7 years agoDriver: honor -nostdinc and -isystem-after on CrossWindows
Saleem Abdulrasool [Fri, 30 Jun 2017 15:15:38 +0000 (15:15 +0000)]
Driver: honor -nostdinc and -isystem-after on CrossWindows

This changes CrossWindows to look for -nostdinc instead of -nostdlibinc.
In addition, fixes a bug where -isystem-after options would be dropped
when called with -nostdinc.

Patch by Dave Lee!

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

7 years ago[OpenCL] Add function name to extension diagnostic
Joey Gouly [Fri, 30 Jun 2017 14:23:01 +0000 (14:23 +0000)]
[OpenCL] Add function name to extension diagnostic

Slightly improve the diagnostic by including the function name.

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

7 years ago[OPENMP] Initial support for taskloop reductions.
Alexey Bataev [Fri, 30 Jun 2017 13:50:13 +0000 (13:50 +0000)]
[OPENMP] Initial support for taskloop reductions.

Add sema/parsupping ort for taskloop [simd] reductions.

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

7 years ago[Driver] Actually report errors during parsing instead of stopping when there's an...
Benjamin Kramer [Fri, 30 Jun 2017 13:21:27 +0000 (13:21 +0000)]
[Driver] Actually report errors during parsing instead of stopping when there's an error somewhere.

This is a more principled version of r303756. That change was both very
brittle about the state of the Diags object going into the driver and
also broke tooling in funny ways.

In particular it prevented tools from capturing diagnostics properly and
made the compilation database logic fail to provide arguments to the
tool, falling back to scanning directories for JSON files.

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

7 years agoAmbiguity might be also uninitialized. Use llvm::Optional.
Vassil Vassilev [Fri, 30 Jun 2017 09:25:43 +0000 (09:25 +0000)]
Ambiguity might be also uninitialized. Use llvm::Optional.

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

7 years agoARMV8-A archkind and target defines helper functions
Sjoerd Meijer [Fri, 30 Jun 2017 08:07:34 +0000 (08:07 +0000)]
ARMV8-A archkind and target defines helper functions

This introduces helper functions that set target defines for different ARMV8-A
architecture kinds. It fixes an issue that the v8.1 define ARM_FEATURE_QRDMX
was not set for v8.2. These helper functions make things more “scalable” if we
want to add ARMv8.3 at some point, and a cleanup has been done to hold the
architecture kind in one variable (instead of one for each).

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

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

7 years agoFix heap use after free introduced by r306769.
Daniel Jasper [Fri, 30 Jun 2017 08:02:37 +0000 (08:02 +0000)]
Fix heap use after free introduced by r306769.

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

7 years agoFold exception-warnings.cpp into warn-throw-out-noexcept-func.cpp
Stephan Bergmann [Fri, 30 Jun 2017 07:22:02 +0000 (07:22 +0000)]
Fold exception-warnings.cpp into warn-throw-out-noexcept-func.cpp

I had failed to notice the latter existed when I recently introduced the former.

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

7 years agoAdd -no-canonical-prefixes to the test line so that we can handle different build...
Eric Christopher [Fri, 30 Jun 2017 06:03:47 +0000 (06:03 +0000)]
Add -no-canonical-prefixes to the test line so that we can handle different build modes.

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

7 years agofix trivial typos, NFC
Hiroshi Inoue [Fri, 30 Jun 2017 05:40:31 +0000 (05:40 +0000)]
fix trivial typos, NFC

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

7 years agoRemove Clang support for '-fvectorize-slp-aggressive' which used LLVM's
Chandler Carruth [Fri, 30 Jun 2017 05:13:31 +0000 (05:13 +0000)]
Remove Clang support for '-fvectorize-slp-aggressive' which used LLVM's
basic block vectorizer. This vectorizer has had no known users for many,
many years and is completely surpassed by the normal
'-fvectorize-slp'-controlled SLP vectorizer in LLVM.

Hal proposed this back in 2014 to no objections:
http://lists.llvm.org/pipermail/llvm-dev/2014-November/079091.html

While this patch completely removes the flag, Joerg is working on
a patch that will add it back in a way that warns users and ignores the
flag in a clear and well factored way (so that we can keep doing this
going forward).

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

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

7 years agoRemove test commit.
Don Hinton [Fri, 30 Jun 2017 03:03:28 +0000 (03:03 +0000)]
Remove test commit.

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

7 years agoTest Commit
Don Hinton [Fri, 30 Jun 2017 02:57:34 +0000 (02:57 +0000)]
Test Commit

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

7 years ago[WebAssembly] Add throw/rethrow builtins for exception handling
Heejin Ahn [Fri, 30 Jun 2017 00:44:01 +0000 (00:44 +0000)]
[WebAssembly] Add throw/rethrow builtins for exception handling

Summary:
Add new builtins for throw/rethrow instructions. This follows exception handling
handling proposal in
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md

Reviewers: sunfish, dschuff

Reviewed By: dschuff

Subscribers: jfb, dschuff, sbc100, jgravelle-google

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

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

7 years ago[CodeGen] Propagate dllexport to thunks
Shoaib Meenai [Fri, 30 Jun 2017 00:07:54 +0000 (00:07 +0000)]
[CodeGen] Propagate dllexport to thunks

Under Windows Itanium, we need to export virtual and non-virtual thunks
if the functions being thunked are exported. These thunks would
previously inherit their dllexport attribute from the declaration, but
r298330 changed declarations to not have dllexport attributes. We
therefore need to add the dllexport attribute to the definition
ourselves now.

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

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

7 years agoUnified logic for computing target ABI in backend and front end by moving this common...
Eric Christopher [Fri, 30 Jun 2017 00:03:56 +0000 (00:03 +0000)]
Unified logic for computing target ABI in backend and front end by moving this common code to Support/TargetParser.

Modeled Triple::GNU after front end code (aapcs abi) and updated tests that expect apcs abi.

Patch by Ana Pazos!

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

7 years ago[PM] Add support for sample PGO in the new pass manager (clang-side)
Dehao Chen [Thu, 29 Jun 2017 23:33:13 +0000 (23:33 +0000)]
[PM] Add support for sample PGO in the new pass manager (clang-side)

Summary: This implements the clang bits of https://reviews.llvm.org/D34720, and add corresponding test to verify if it worked.

Reviewers: chandlerc, davidxl, davide, tejohnson

Reviewed By: chandlerc, tejohnson

Subscribers: tejohnson, sanjoy, mehdi_amini, eraman, cfe-commits

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

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

7 years agoTeach ASTReader how to read only the Preprocessor state from an AST file, not the...
Richard Smith [Thu, 29 Jun 2017 23:23:46 +0000 (23:23 +0000)]
Teach ASTReader how to read only the Preprocessor state from an AST file, not the ASTContext state.

We use this when running a preprocessor-only action on an AST file in order to
avoid paying the runtime cost of loading the extra information.

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

7 years ago[clang-format] Switch to case-insensitive header matching and use it to
Chandler Carruth [Thu, 29 Jun 2017 23:20:54 +0000 (23:20 +0000)]
[clang-format] Switch to case-insensitive header matching and use it to
improve support for LLVM-style include sorting.

This really is a collection of improvements to the rules for LLVM
include sorting:
- We have gmock headers now, so it adds support for those to one of the
  categories.
- LLVM does use 'FooTest.cpp' files to test 'Foo.h' so it adds that
  suffix for finding a main header.
- At times the test file's case may not match the header file's case, so
  switch to case-insensitive regex matching of header names.

With this set of changes, I can't spot any misbehaviors when re-sorting
all of LLVM's unittest '#include' lines.

Thanks to Eric and Daniel for help testing and refining the patch during
review!

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

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

7 years ago[NewPM] Add Clang cc1 flag -fdebug-pass-manager for printing debug information.
Tim Shen [Thu, 29 Jun 2017 23:10:13 +0000 (23:10 +0000)]
[NewPM] Add Clang cc1 flag -fdebug-pass-manager for printing debug information.

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

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

7 years ago[ThinkLTO] Invoke build(Thin)?LTOPreLinkDefaultPipeline.
Tim Shen [Thu, 29 Jun 2017 23:08:38 +0000 (23:08 +0000)]
[ThinkLTO] Invoke build(Thin)?LTOPreLinkDefaultPipeline.

Previously it doesn't actually invoke the designated new PM builder
functions.

This patch moves NameAnonGlobalPass out from PassBuilder, as Chandler
points out that PassBuilder is used for non-O0 builds, and for
optimizations only.

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

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

7 years ago[ODRHash] Improve typedef handling.
Richard Trieu [Thu, 29 Jun 2017 22:53:04 +0000 (22:53 +0000)]
[ODRHash] Improve typedef handling.

Follow typedef chains to find the root type when processing types, and also
keep track of qualifiers.

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

7 years agoFix openmp-offload.c test on Windows
Reid Kleckner [Thu, 29 Jun 2017 22:31:16 +0000 (22:31 +0000)]
Fix openmp-offload.c test on Windows

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

7 years agoInsert llvm_unreachable at the end of a function to silence gcc's
Akira Hatanaka [Thu, 29 Jun 2017 20:44:20 +0000 (20:44 +0000)]
Insert llvm_unreachable at the end of a function to silence gcc's
-Werror=return-type error.

This is an attempt to fix the following failing bot:

http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror

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

7 years ago[libFuzzer] Add Fuzzer to the list of sanitizers which support coverage.
George Karpenkov [Thu, 29 Jun 2017 19:58:20 +0000 (19:58 +0000)]
[libFuzzer] Add Fuzzer to the list of sanitizers which support coverage.

Without this change, additional coverage flags specified after
-fsanitize=fuzzer would get discarded.

https://reviews.llvm.org/D34794

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

7 years ago[libFuzzer] Do not link in libFuzzer with -fsanitize=fuzzer when producing a shared...
George Karpenkov [Thu, 29 Jun 2017 19:52:33 +0000 (19:52 +0000)]
[libFuzzer] Do not link in libFuzzer with -fsanitize=fuzzer when producing a shared object

https://reviews.llvm.org/D34791

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

7 years ago[ASTReader] Add test for previous change r306583 / 145692e.
Graydon Hoare [Thu, 29 Jun 2017 19:42:35 +0000 (19:42 +0000)]
[ASTReader] Add test for previous change r306583 / 145692e.

Summary:
Add a test for the change to ASTReader that reproduces the
logic for consolidating multiple ObjC interface definitions to the
case of multiple ObjC protocol definitions.

This test is a modified copy of the test that accompanied the original
change to interfaces, in 2ba1979.

Reviewers: bruno

Reviewed By: bruno

Subscribers: cfe-commits

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

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

7 years ago[OpenMP] Fix test for revision D29645. NFC
Gheorghe-Teodor Bercea [Thu, 29 Jun 2017 18:49:16 +0000 (18:49 +0000)]
[OpenMP] Fix test for revision D29645. NFC

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

7 years ago[Sema] Issue diagnostics if a new/delete expression generates a call to
Akira Hatanaka [Thu, 29 Jun 2017 18:48:40 +0000 (18:48 +0000)]
[Sema] Issue diagnostics if a new/delete expression generates a call to
a c++17 aligned allocation/deallocation function that is unavailable in
the standard library on Apple platforms.

The aligned functions are implemented only in the following versions or
later versions of the OSes, so clang issues diagnostics if the deployment
target being targeted is older than these:

macosx: 10.13
ios: 11.0
tvos: 11.0
watchos: 4.0

The diagnostics are issued whenever the aligned functions are selected
except when the selected function has a definition in the same file.
If there is a user-defined function available somewhere else, option
-Wno-aligned-allocation-unavailable can be used to silence the
diagnostics.

rdar://problem/32664169

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

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

7 years agoCodeGen: Fix invalid bitcast for coerced function argument
Yaxun Liu [Thu, 29 Jun 2017 18:47:45 +0000 (18:47 +0000)]
CodeGen: Fix invalid bitcast for coerced function argument

Clang assumes coerced function argument is in address space 0, which is not always true and results in invalid bitcasts.

This patch fixes failure in OpenCL conformance test api/get_kernel_arg_info with amdgcn---amdgizcl triple, where non-zero alloca address space is used.

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

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

7 years agoFixed -Wexceptions derived-to-base false positives
Stephan Bergmann [Thu, 29 Jun 2017 17:58:59 +0000 (17:58 +0000)]
Fixed -Wexceptions derived-to-base false positives

...as introduced with recent <https://reviews.llvm.org/D33333> "Emit warning
when throw exception in destruct or dealloc functions which has a (possible
implicit) noexcept specifier".  (The equivalent of the goodReference case hit
when building LibreOffice.)

(These warnings are apparently only emitted when no errors have yet been
encountered, so it didn't work to add the test code to the end of the existing
clang/test/SemaCXX/exceptions.cpp.)

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

7 years ago[OPENMP][DEBUG] Generate second function with correct arg types.
Alexey Bataev [Thu, 29 Jun 2017 16:43:05 +0000 (16:43 +0000)]
[OPENMP][DEBUG] Generate second function with correct arg types.

Currently, if the some of the parameters are captured by value, this
argument is converted to uintptr_t type and thus we loosing the debug
info about real type of the argument (captured variable):
```
void @.outlined_function.(uintptr %par);

...
%a = alloca i32
%a.casted = alloca uintptr
%cast = bitcast uintptr* %a.casted to i32*
%a.val = load i32, i32 *%a
store i32 %a.val, i32 *%cast
%a.casted.val = load uintptr, uintptr* %a.casted
call void @.outlined_function.(uintptr %a.casted.val)
...
```

To resolve this problem, in debug mode a speciall external wrapper
function is generated, that calls the outlined function with the correct
parameters types:
```
void @.wrapper.(uintptr %par) {
  %a = alloca i32
  %cast = bitcast i32* %a to uintptr*
  store uintptr %par, uintptr *%cast
  %a.val = load i32, i32* %a
  call void @.outlined_function.(i32 %a)
  ret void
}
void @.outlined_function.(i32 %par);

...
%a = alloca i32
%a.casted = alloca uintptr
%cast = bitcast uintptr* %a.casted to i32*
%a.val = load i32, i32 *%a
store i32 %a.val, i32 *%cast
%a.casted.val = load uintptr, uintptr* %a.casted
call void @.wrapper.(uintptr %a.casted.val)
...
```

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

7 years agoInitialize variable and silence potentially uninitialized warning.
Vassil Vassilev [Thu, 29 Jun 2017 16:08:10 +0000 (16:08 +0000)]
Initialize variable and silence potentially uninitialized warning.

Patch by Liza Sakellari!

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

7 years ago[OpenMP] Pass -fopenmp-is-device to preprocessing and machine specific code generatio...
Gheorghe-Teodor Bercea [Thu, 29 Jun 2017 15:59:19 +0000 (15:59 +0000)]
[OpenMP] Pass -fopenmp-is-device to preprocessing and machine specific code generation stages

Summary: The preprocessing and code generation and optimization stages of the compiler are also passed the "-fopenmp-is-device" flag. This is used to trigger machine specific preprocessing and code generation when performing device offloading to an NVIDIA GPU via OpenMP directives.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, Hahnfeld, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: Hahnfeld, rengolin

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

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

7 years ago[OpenMP] Add support for auxiliary triple specification
Gheorghe-Teodor Bercea [Thu, 29 Jun 2017 15:49:03 +0000 (15:49 +0000)]
[OpenMP] Add support for auxiliary triple specification

Summary: Device offloading requires the specification of an additional flag containing the triple of the //other// architecture the code is being compiled on if such an architecture exists. If compiling for the host, the auxiliary triple flag will contain the triple describing the device and vice versa.

Reviewers: arpith-jacob, sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: rengolin, cfe-commits

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

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

7 years agoFix NSAPI constants to reflect the current state of
Alex Lorenz [Thu, 29 Jun 2017 14:18:26 +0000 (14:18 +0000)]
Fix NSAPI constants to reflect the current state of
NSStringMethodKind/NSDictionaryMethodKind enums

Patch by Vladimir Voskresensky!

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

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

7 years ago[Clang][X86][Goldmont]Adding new target-cpu: Goldmont
Michael Zuckerman [Thu, 29 Jun 2017 13:41:04 +0000 (13:41 +0000)]
[Clang][X86][Goldmont]Adding new target-cpu: Goldmont

[Clang-side] Connecting the GoldMont processor to his feature.

Reviewers:
1. igorb
2. delena
3. zvi

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

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

7 years ago[clang-format] Fix parsing of msg{field}-style proto options
Krasimir Georgiev [Thu, 29 Jun 2017 13:30:41 +0000 (13:30 +0000)]
[clang-format] Fix parsing of msg{field}-style proto options

Summary:
This patch makes the `{` in `msg_field{field: OK}` in a proto option scope be
treated as an assignment operator. Previosly the added test case was formatted
as:
```
option (MyProto.options) = {
  field_a: OK
  field_b{field_c: OK} field_d: OKOKOK field_e: OK
}
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoRevert r306653, "[OpenCL] Allow function declaration with empty argument list."
NAKAMURA Takumi [Thu, 29 Jun 2017 10:47:23 +0000 (10:47 +0000)]
Revert r306653, "[OpenCL] Allow function declaration with empty argument list."

It broke bots.

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

7 years ago[Tooling] FixedCompilationDatabase should be able to strip positional
Alex Lorenz [Thu, 29 Jun 2017 10:43:44 +0000 (10:43 +0000)]
[Tooling] FixedCompilationDatabase should be able to strip positional
arguments when `-fsyntax-only` is used

Previously, Clang failed to create a fixed compilation database when the
compilation arguments use -fsyntax-only instead of -c. This commit fixes the
issue by forcing Clang to look at the compilation job when stripping the
positional arguments.

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

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

7 years ago[OpenCL] Allow function declaration with empty argument list.
Alexey Bader [Thu, 29 Jun 2017 08:44:10 +0000 (08:44 +0000)]
[OpenCL] Allow function declaration with empty argument list.

Summary:
does it make sense to enable K&R function declaration style for OpenCL?
clang throws following error message for the declaration w/o arguments:

```
int my_func();
error: function with no prototype cannot use the spir_function calling convention
```

Current way to fix this issue is to specify that parameter list is empty by using 'void':

```
int my_func(void);
```

Let me know what do you think about this patch.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: cfe-commits, echuraev

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

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

7 years agoFactor out a functionality from isBeforeInTranslationUnit
Gabor Horvath [Thu, 29 Jun 2017 06:53:13 +0000 (06:53 +0000)]
Factor out a functionality from isBeforeInTranslationUnit

The first user of this API will be the cross translation unit
functionality of the Static Analyzer which will be committed in a
follow-up patch.

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

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

7 years agoTrack the set of module maps read while building a .pcm file and reload those when...
Richard Smith [Thu, 29 Jun 2017 02:19:42 +0000 (02:19 +0000)]
Track the set of module maps read while building a .pcm file and reload those when preprocessing from that .pcm file.

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

7 years agoCodeGen: handle missed case of COMDAT handling
Saleem Abdulrasool [Thu, 29 Jun 2017 00:54:44 +0000 (00:54 +0000)]
CodeGen: handle missed case of COMDAT handling

When Protocol references are constructed, we need to add the reference
symbol to a COMDAT group on non-MachO object file formats (MachO handles
this by having a coalesced attribute).  This adds the missing case.

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

7 years ago[ASTReader] Treat multiple defns of ObjC protocols the same as interfaces.
Graydon Hoare [Wed, 28 Jun 2017 18:36:27 +0000 (18:36 +0000)]
[ASTReader] Treat multiple defns of ObjC protocols the same as interfaces.

Summary:
In change 2ba19793512, the ASTReader logic for ObjC interfaces was modified to
preserve the first definition-data read, "merging" later definitions into it
rather than overwriting it (though this "merging" is, in practice, a no-op that
discards the later definition-data).

Unfortunately this change was only made to ObjC interfaces, not protocols; this
means that when (for example) loading a protocol that references an interface,
if both the protocol and interface are multiply defined (as can easily happen
if the same header is read from multiple contexts), an _inconsistent_ pair of
definitions is loaded: first-read for the interface and last-read for the
protocol.

This in turn causes very subtle downstream bugs in the Swift ClangImporter,
which filters the results of name lookups based on the owning module of a
definition; inconsistency between a pair of related definitions causes name
lookup failures at various stages of compilation.

To fix these downstream issues, this change replicates the logic applied to
interfaces in change 2ba19793512, but for ObjC protocols.

rdar://30851899

Reviewers: doug.gregor, rsmith

Reviewed By: doug.gregor

Subscribers: jordan_rose, cfe-commits

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

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

7 years ago[Bash-autocompletion] Invoke clang where user called
Yuka Takahashi [Wed, 28 Jun 2017 16:29:26 +0000 (16:29 +0000)]
[Bash-autocompletion] Invoke clang where user called

Summary:
When user build clang and used completion Eg. `build/bin/clang -fno[tab]`, we want to invoke `build/bin/clang --autocomplete=-fno`, rather than `clang --autocomplete=-fno`.

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

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

7 years ago[Bash-autocompletion] Check clang version in Bash
Yuka Takahashi [Wed, 28 Jun 2017 15:59:55 +0000 (15:59 +0000)]
[Bash-autocompletion] Check clang version in Bash

Summary:
Add check if user's clang version supports --autocomplete or not.
If not, we just autocomplete files.

Reviewers: ruiu, v.g.vassilev, teemperor

Subscribers: cfe-commits

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

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

7 years agoUse vfs::FileSystem in ASTUnit when creating CompilerInvocation.
Ilya Biryukov [Wed, 28 Jun 2017 15:06:34 +0000 (15:06 +0000)]
Use vfs::FileSystem in ASTUnit when creating CompilerInvocation.

Summary: It used to always call into the RealFileSystem before.

Reviewers: bkramer, krasimir, klimek, bruno

Reviewed By: klimek

Subscribers: bruno, cfe-commits

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

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

7 years agoFix crash in clang while handling __has_trivial_destructor.
Karthik Bhat [Wed, 28 Jun 2017 08:52:08 +0000 (08:52 +0000)]
Fix crash in clang while handling __has_trivial_destructor.

Fix crash in clang when an array of unknown bounds of an incomplete type is passed to __has_trivial_destructor.

Patch by Puneetha
https://reviews.llvm.org/D34198

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

7 years agoDiagnosticRenderer.h: Prune \param SM, corresponding to rL306384. [-Wdocumentation]
NAKAMURA Takumi [Wed, 28 Jun 2017 06:46:23 +0000 (06:46 +0000)]
DiagnosticRenderer.h: Prune \param SM, corresponding to rL306384. [-Wdocumentation]

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

7 years agoRemove a redundant call to ArgList::hasFlag. NFC.
Vedant Kumar [Wed, 28 Jun 2017 01:56:07 +0000 (01:56 +0000)]
Remove a redundant call to ArgList::hasFlag. NFC.

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

7 years ago[CodeGen] Fix assertion failure in EmitCallArg.
Akira Hatanaka [Wed, 28 Jun 2017 00:42:48 +0000 (00:42 +0000)]
[CodeGen] Fix assertion failure in EmitCallArg.

The assertion was failing when a method of a parameterized class was
called and the types of the argument and parameter didn't match. To fix
the failure, move the assertion in EmitCallArg to its only caller
EmitCallArgs and require the argument and parameter types match only
when the method is not parameterized.

rdar://problem/32874473

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

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

7 years ago[COFF, ARM64] Add support for Windows ARM64 COFF format
Mandeep Singh Grang [Tue, 27 Jun 2017 23:56:34 +0000 (23:56 +0000)]
[COFF, ARM64] Add support for Windows ARM64 COFF format

Summary: This is the clang part of the initial implementation to support Windows ARM64 COFF format.

Reviewers: ruiu, t.p.northover, rnk, compnerd

Reviewed By: ruiu, compnerd

Subscribers: aemerson, kristof.beyls, cfe-commits, llvm-commits

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

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

7 years ago[libclang] Support for querying the exception specification type through libclang
Jonathan Coe [Tue, 27 Jun 2017 22:54:56 +0000 (22:54 +0000)]
[libclang] Support for querying the exception specification type through libclang

Summary: This patch exposes the exception specification type (noexcept,
etc.) of a C++ function through libclang and Python clang.cindex.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: jbcoe, cfe-commits

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

Patch by Andrew Bennieston

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

7 years ago[Sema] Allow unmarked overloadable functions.
George Burgess IV [Tue, 27 Jun 2017 21:31:31 +0000 (21:31 +0000)]
[Sema] Allow unmarked overloadable functions.

This patch extends the `overloadable` attribute to allow for one
function with a given name to not be marked with the `overloadable`
attribute. The overload without the `overloadable` attribute will not
have its name mangled.

So, the following code is now legal:

  void foo(void) __attribute__((overloadable));
  void foo(int);
  void foo(float) __attribute__((overloadable));

In addition, this patch fixes a bug where we'd accept code with
`__attribute__((overloadable))` inconsistently applied. In other words,
we used to accept:

  void foo(void);
  void foo(void) __attribute__((overloadable));

But we will do this no longer, since it defeats the original purpose of
requiring `__attribute__((overloadable))` on all redeclarations of a
function.

This breakage seems to not be an issue in practice, since the only code
I could find that had this pattern often looked like:

  void foo(void);
  void foo(void) __attribute__((overloadable)) __asm__("foo");
  void foo(int) __attribute__((overloadable));

...Which can now be simplified by simply removing the asm label and
overloadable attribute from the redeclaration of `void foo(void);`

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

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

7 years agotest: fix test for release builds
Saleem Abdulrasool [Tue, 27 Jun 2017 18:57:50 +0000 (18:57 +0000)]
test: fix test for release builds

Use a regex capture to avoid hardcoding the name.  This should repair
the failing buildbot.

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

7 years agoCodeGen: load indirect ObjC ARC arguments in prologue
Saleem Abdulrasool [Tue, 27 Jun 2017 18:37:51 +0000 (18:37 +0000)]
CodeGen: load indirect ObjC ARC arguments in prologue

When generating a prologue, add loads for ARC arguments passed
indirectly.

Patch by Dave Lee!

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

7 years agoUpdate the test comment to clarify the intention of the test.
Dehao Chen [Tue, 27 Jun 2017 17:45:40 +0000 (17:45 +0000)]
Update the test comment to clarify the intention of the test.

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

7 years ago[x86] weaken test checks that shouldn't be here in the first place
Sanjay Patel [Tue, 27 Jun 2017 17:39:46 +0000 (17:39 +0000)]
[x86] weaken test checks that shouldn't be here in the first place

This test would fail after the proposed change in:
https://reviews.llvm.org/D34242

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

7 years agoUpdate test for enabling ICP for AutoFDO.
Dehao Chen [Tue, 27 Jun 2017 17:23:42 +0000 (17:23 +0000)]
Update test for enabling ICP for AutoFDO.

Summary: This is the test update patch for https://reviews.llvm.org/D34662

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: cfe-commits, sanjoy, mehdi_amini, eraman, llvm-commits

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

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

7 years ago[OPENMP] Use MapVector instead of DenseMap for stable codegen, NFC.
Alexey Bataev [Tue, 27 Jun 2017 15:46:42 +0000 (15:46 +0000)]
[OPENMP] Use MapVector instead of DenseMap for stable codegen, NFC.

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

7 years ago[clang-format] Fix a clang-tidy warning, NFC
Krasimir Georgiev [Tue, 27 Jun 2017 14:07:45 +0000 (14:07 +0000)]
[clang-format] Fix a clang-tidy warning, NFC

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

7 years ago[clang-format] Fix a buildbot failure after r306406
Krasimir Georgiev [Tue, 27 Jun 2017 13:58:41 +0000 (13:58 +0000)]
[clang-format] Fix a buildbot failure after r306406

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

7 years ago[clang-format] Support <>-style proto message fields
Krasimir Georgiev [Tue, 27 Jun 2017 13:43:07 +0000 (13:43 +0000)]
[clang-format] Support <>-style proto message fields

Summary:
This patch adds support for <>-style proto message fields inside proto options.
Previously these were wrongly treated as binary operators and as such were
working only by chance for a limited number of cases.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[analyzer] Move zero-size allocation checks to optin.portability.
Artem Dergachev [Tue, 27 Jun 2017 11:14:39 +0000 (11:14 +0000)]
[analyzer] Move zero-size allocation checks to optin.portability.

This is a new checker package. It contains checkers that highlight
well-documented implementation-defined behavior. Such checkers are only useful
to developers that intend to write portable code. Code that is only compiled for
a single platform should be allowed to rely on this platform's specific
documented behavior.

rdar://problem/30545046

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

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

7 years agoRecommit r306103: PR26195: Set correct NestedNameSpecifierLoc for the
Alex Lorenz [Tue, 27 Jun 2017 10:35:30 +0000 (10:35 +0000)]
Recommit r306103: PR26195: Set correct NestedNameSpecifierLoc for the
dependent initializer

This commit fixes incorrect source positions of dependent c'tor initializers
like in the following code:

template<typename MyBase>
struct Derived: MyBase::InnerIterator
{

Derived() : MyBase::InnerIterator() {} /// This line is problematic: all positions point to InnerIterator and nothing points to MyBase
};

Patch by Serge Preis!

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

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

7 years ago[clang-format] Add a test for associative map proto buffer fields
Krasimir Georgiev [Tue, 27 Jun 2017 10:06:40 +0000 (10:06 +0000)]
[clang-format] Add a test for associative map proto buffer fields

Summary:
The test suite was missing a test about associative maps:
https://developers.google.com/protocol-buffers/docs/proto3#maps

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoRevert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""
Christof Douma [Tue, 27 Jun 2017 09:50:38 +0000 (09:50 +0000)]
Revert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""

This reverts commit r305688 meaning it reintroduces r305684. To repeat:

[NFC] Refactor DiagnosticRenderer to use FullSourceLoc

Move the DiagnosticRenderer and its dependents to using FullSourceLocs
instead of a SourceLocation and SourceManager pointer. The changeset is
rather large but entirely mechanical.

This is step one to allow DiagnosticRenderer to take either
llvm::SMLocs or clang::SourceLocations.

This breaks clang-tidy and clng-query which will be fixed in a commit
soon after.

Patch by Sanne Wouda

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

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

7 years agoReapply "Frontend support for Nios2 target"
Nikolai Bozhenov [Tue, 27 Jun 2017 09:48:24 +0000 (09:48 +0000)]
Reapply "Frontend support for Nios2 target"

Summary:
- Implements TargetInfo class for Nios2 target.
- Enables handling of -march and -mcpu options for Nios2 target.
- Definition of Nios2 builtin functions.

Reviewed By: craig.topper

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

Author: belickim <mateusz.belicki@intel.com>

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

7 years agoMake CastExpr::getSubExprAsWritten look through implicit temporary under CK_Construct...
Stephan Bergmann [Tue, 27 Jun 2017 08:19:09 +0000 (08:19 +0000)]
Make CastExpr::getSubExprAsWritten look through implicit temporary under CK_ConstructorConversion

With

    struct S1 {};
    struct S2 { operator S1(); };
    S1 f(S2 s) { return static_cast<S1>(s); }

the static_cast expr is

    CXXStaticCastExpr 0x... 'struct S1' static_cast<struct S1> <ConstructorConversion>
    `-CXXConstructExpr 0x... 'struct S1' 'void (struct S1 &&) noexcept' elidable

    `-MaterializeTemporaryExpr 0x... 'struct S1' xvalue
      `-ImplicitCastExpr 0x... 'struct S1' <UserDefinedConversion>
        `-CXXMemberCallExpr 0x... 'struct S1'
          `-MemberExpr 0x... '<bound member function type>' .operator S1 0x...
            `-DeclRefExpr 0x... 'struct S2' lvalue ParmVar 0x... 's' 'struct S2'

getSubExprAsWritten used to return the MaterializeTemporaryExpr (of type S1)
under the CXXConstructExpr, instead of unwinding further to the DeclRefExpr (of
type S2) at the bottom.

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

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

7 years agoMake sure TraverseInitListExpr visits InitListExpr exactly twice
Stephan Bergmann [Tue, 27 Jun 2017 08:04:08 +0000 (08:04 +0000)]
Make sure TraverseInitListExpr visits InitListExpr exactly twice

... once each for the syntactic and semantic form. Without this fix, behavior
of the newly added tests would have been

InitListExprIsPreOrderVisitedTwice:
 syntactic: 1
 semantic: 2

InitListExprIsPostOrderVisitedTwice:
 syntactic: 0
 semantic: 1

InitListExprIsPreOrderNoQueueVisitedTwice:
 syntactic: 1
 semantic: 2

InitListExprIsPostOrderNoQueueVisitedTwice:
 syntactic: 0
 semantic: 2

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

7 years agoSwitch TestVisitor to Lang_C via -x c
Stephan Bergmann [Tue, 27 Jun 2017 07:59:56 +0000 (07:59 +0000)]
Switch TestVisitor to Lang_C via -x c

...instead of -std=c99, as the latter lead to

  error: invalid argument '-std=c99' not allowed with 'C++'

complaints in test logs

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

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

7 years agoclang/test/CodeGenObjC/ivar-type-encoding.m: Tweak to satisfy -m32.
NAKAMURA Takumi [Tue, 27 Jun 2017 07:40:47 +0000 (07:40 +0000)]
clang/test/CodeGenObjC/ivar-type-encoding.m: Tweak to satisfy -m32.

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

7 years ago[CodeGen][ObjC] Fix GNU's encoding of bit-field ivars.
Akira Hatanaka [Tue, 27 Jun 2017 04:34:04 +0000 (04:34 +0000)]
[CodeGen][ObjC] Fix GNU's encoding of bit-field ivars.

According to the documentation, when encoding a bit-field, GNU runtime
needs its starting position in addition to its type and size.

https://gcc.gnu.org/onlinedocs/gcc/Type-encoding.html

Prior to r297702, the starting position information was not being
encoded, which is incorrect, and after r297702, an assertion started to
fail because an ObjCIvarDecl was being passed to a function expecting a
FieldDecl.

This commit moves LookupFieldBitOffset to ASTContext and uses the
function to encode the starting position of bit-fields.

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

7 years agoRemove redundant check.
Richard Smith [Tue, 27 Jun 2017 00:29:32 +0000 (00:29 +0000)]
Remove redundant check.

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

7 years agoFix this test to use a construct that actually forces struct layout to happen when...
Richard Smith [Tue, 27 Jun 2017 00:22:07 +0000 (00:22 +0000)]
Fix this test to use a construct that actually forces struct layout to happen when testing -Wpadded.

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