]> granicus.if.org Git - clang/log
clang
7 years agoTouch up [[clang::require_constant_initialization]] docs
Eric Fiselier [Fri, 16 Sep 2016 10:04:38 +0000 (10:04 +0000)]
Touch up [[clang::require_constant_initialization]] docs

* Fix an egregious comma usage.
* Remove the `static` keyword in the example since the variables should have
  external linkage.
* Use C++11 attributes in the example.

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

7 years agoTesting commit rights. Removing trailing white space from test file.
Neil Hickey [Fri, 16 Sep 2016 09:38:11 +0000 (09:38 +0000)]
Testing commit rights. Removing trailing white space from test file.

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

7 years agoFix unused result from sign extending an Offset.
Stephen Hines [Fri, 16 Sep 2016 07:21:24 +0000 (07:21 +0000)]
Fix unused result from sign extending an Offset.

Summary:
Offset was doubled in size, but the assignment was missing. We just need
to reassign to the original variable in this case to fix it.

Reviewers: cfe-commits, echristo

Subscribers: meikeb

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

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

7 years agoAlter the iOS/tvOS ARM64 C++ ABI to ignore the upper half of the
John McCall [Fri, 16 Sep 2016 02:40:45 +0000 (02:40 +0000)]
Alter the iOS/tvOS ARM64 C++ ABI to ignore the upper half of the
virtual table offset in a member function pointer.

We are reserving this space for future ABI use relating to alternative
v-table configurations.  In the meantime, continue to zero-initialize
this space when actually emitting a member pointer literal.

This will successfully interoperate with existing compilers.
Future versions of the compiler may place additional data in
this location, and at that point, code emitted by compilers
prior to this patch will fail if exposed to such a member pointer.
This is therefore a somewhat hard ABI break.  However, because
it is limited to an uncommon case of an uncommon language feature,
and especially because interoperation with the standard library
does not depend on member pointers, we believe that with a
sufficiently advance compiler change the impact of this break
will be minimal in practice.

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

7 years agoDo not warn about format strings that are indexed string literals.
Stephen Hines [Fri, 16 Sep 2016 01:07:04 +0000 (01:07 +0000)]
Do not warn about format strings that are indexed string literals.

Summary:
The warning for a format string not being a string literal and therefore
being potentially insecure is overly strict for indices into string
literals. This fix checks if the index into the string literal is
precomputable. If that's the case it will check if the suffix of that
string literal is a valid format string string literal. It will still
issue the aforementioned warning for out of range indices into the
string literal.

Patch by Meike Baumgärtner (meikeb)

Reviewers: rsmith

Subscribers: srhines, cfe-commits

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

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

7 years ago[CodeGen][ObjC] Block captures should inherit the type of the captured
Akira Hatanaka [Fri, 16 Sep 2016 00:02:06 +0000 (00:02 +0000)]
[CodeGen][ObjC] Block captures should inherit the type of the captured
field in the enclosing lambda or block.

This patch fixes a bug in code-gen where it uses the type of the
declared variable rather than the type of the capture of the enclosing
lambda or block for the block capture. For example, in the following
function, code-gen currently uses i32* for the block capture "a" because
"a" is passed to foo1 as a reference, but it should use i32 since the
enclosing lambda captures "a" by value.

void foo1(int &a) {
  auto lambda = [a]{
    auto block1 = ^{
      i = a;
    };
    block1();
  };
  lambda();
}

rdar://problem/18586386

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

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

7 years ago[CUDA] Don't try to run sanitizers on NVPTX.
Justin Lebar [Thu, 15 Sep 2016 23:44:13 +0000 (23:44 +0000)]
[CUDA] Don't try to run sanitizers on NVPTX.

Summary:
Sanitizers aren't supported on NVPTX -- don't try to run them.

This lets you e.g. pass -fsanitize=address and get asan on your host
code.

Reviewers: kcc

Subscribers: cfe-commits, tra, jhen

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

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

7 years ago[Sema] Allow shifting a scalar operand by a vector operand.
Akira Hatanaka [Thu, 15 Sep 2016 22:19:25 +0000 (22:19 +0000)]
[Sema] Allow shifting a scalar operand by a vector operand.

r278501 inadvertently introduced a bug in which it disallowed shifting
scalar operands by vector operands when not compiling for OpenCL. This
commit fixes it.

Patch by Vladimir Yakovlev.

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

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

7 years agoSimplify Clang's version number configuration in CMake.
David L. Jones [Thu, 15 Sep 2016 22:12:26 +0000 (22:12 +0000)]
Simplify Clang's version number configuration in CMake.

Currently, the Clang version is computed as follows:

 1. LLVM defines major, minor, and patch versions, all statically set. Today,
    these are 4, 0, and 0, respectively.
 2. The static version numbers are combined into PACKAGE_VERSION along with a
    suffix, so the result today looks like "4.0.0svn".
 3. Clang extracts CLANG_VERSION from PACKAGE_VERSION using a regexp. The regexp
    allows the patch level to omitted, and drops any non-digit trailing values.
    Today, this result looks like "4.0.0".
 4. CLANG_VERSION is then split further into CLANG_VERSION_MAJOR and
    CLANG_VERSION_MINOR. Today, these resolve to 4 and 0, respectively.
 5. If CLANG_VERSION matches a regexp with three version components, then
    CLANG_VERSION_PATCHLEVEL is extracted and the CLANG_HAS_VERSION_PATCHLEVEL
    variable is set to 1. Today, these values are 0 and 1, respectively.
 6. The CLANG_VERSION_* variables (and CLANG_HAS_VERSION_PATCHLEVEL) are
    configured into [llvm/tools/clang/]include/clang/Basic/Version.inc
    verbatim by CMake.
 7. In [llvm/tools/clang/]include/clang/Basic/Version.h, macros are defined
    conditionally, based on CLANG_HAS_VERSION_PATCHLEVEL, to compute
    CLANG_VERSION_STRING as either a two- or three-level version number. Today,
    this value is "4.0.0", because despite the patchlevel being 0, it was
    matched by regexp and is thus "HAS"ed by the preprocessor. This string is
    then used wherever Clang's "version" is needed [*].

[*] Including, notably, by compiler-rt, for computing its installation path.

This change collapses steps 2-5 by defaulting Clang to use LLVM's (non-string)
version components for the Clang version (see [*] for why not PACKAGE_VERSION),
and collapses steps 6 and 7 by simply writing CLANG_VERSION_STRING into
Version.inc. The Clang version today always uses the patchlevel form, so the
collapsed Version.inc does not have logic for a version without a patch level.

Historically speaking, this technique began with the VER file in r82085 (which
survives in the form of the regexp in #3). The major, minor, and patchlevel
versions were introduced by r106863 (which remains in #4-6). The VER file itself
was deleted in favor of the LLVM version number in r106914. On the LLVM side,
the individual LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, and PACKAGE_VERSION
weren't introduced for nearly two more years, until r150405.

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

7 years ago[sanitizer-coverage] make trace-pc-guard and indirect-call work together
Kostya Serebryany [Thu, 15 Sep 2016 22:11:08 +0000 (22:11 +0000)]
[sanitizer-coverage] make trace-pc-guard and indirect-call work together

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

7 years agoclang-format VS plugin: upgrade the project files to VS2015
Hans Wennborg [Thu, 15 Sep 2016 19:44:49 +0000 (19:44 +0000)]
clang-format VS plugin: upgrade the project files to VS2015

The plugin itself runs on previous VS versions, but this enables
it to be built with VS2015.

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

7 years agoReapply: Silence false positive diagnostics regarding passing an object of enumeratio...
Aaron Ballman [Thu, 15 Sep 2016 18:07:51 +0000 (18:07 +0000)]
Reapply: Silence false positive diagnostics regarding passing an object of enumeration type to va_start().

The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former.

This patch addresses PR29140.

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

7 years ago[analyzer] Fix HTMLRewriter style sheets to support non-webkit browsers.
Artem Dergachev [Thu, 15 Sep 2016 16:25:42 +0000 (16:25 +0000)]
[analyzer] Fix HTMLRewriter style sheets to support non-webkit browsers.

This fixes rounded corners and shadows of analyzer diagnostic pieces
in browsers such as Firefox.

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

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

7 years agoReverting r281609; it caused some build bots to break.
Aaron Ballman [Thu, 15 Sep 2016 14:12:33 +0000 (14:12 +0000)]
Reverting r281609; it caused some build bots to break.

http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/20061/steps/test/logs/stdio

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

7 years ago[mips][ias] Enable IAS by default for N64 on Debian mips64el.
Simon Dardis [Thu, 15 Sep 2016 14:01:55 +0000 (14:01 +0000)]
[mips][ias] Enable IAS by default for N64 on Debian mips64el.

Unfortunately we can't enable it for all N64 because it is not yet possible to
distinguish N32 from N64 from the triple on other environments.

N64 has been confirmed to produce identical (within reason) objects to GAS
during stage 2 of compiler recursion on N64-abi Fedora. Unfortunately,
Fedora's triples do not distinguish N32 from N64 so I can't enable it by
default there. I'm currently repeating this testing for Debian mips64el but
it's very unlikely to produce a different result.

Patch by: Daniel Sanders

Reviewers: sdardis

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

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

7 years agoSilence false positive diagnostics regarding passing an object of enumeration type...
Aaron Ballman [Thu, 15 Sep 2016 14:01:10 +0000 (14:01 +0000)]
Silence false positive diagnostics regarding passing an object of enumeration type to va_start(). The underlying type for an enumeration in C is either char, signed int, or unsigned int. In the case the underlying type is chosen to be char (such as when passing -fshort-enums or using __attribute__((packed)) on the enum declaration), the enumeration can result in undefined behavior. However, when the underlying type is signed int or unsigned int (or long long as an extension), there is no undefined behavior because the types are compatible. This patch silences diagnostics for the latter while retaining the diagnostics for the former.

This patch addresses PR29140.

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

7 years ago[ARM] ARM-specific attributes should be accepted for big-endian
Oliver Stannard [Thu, 15 Sep 2016 08:55:41 +0000 (08:55 +0000)]
[ARM] ARM-specific attributes should be accepted for big-endian

The ARM-specific C attributes (currently just interrupt) need to check
for both the big- and little-endian versions of the triples, so that
they are accepted for both big and little endian targets.

TargetWindows and TargetMicrosoftCXXABI also only use the little-endian
triples, but this is correct as windows is not supported on big-endian
ARM targets (and this is asserted in lib/Basic/Targets.cpp).

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

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

7 years agoUpdate clang unittests for rL281586.
Wei Mi [Thu, 15 Sep 2016 06:31:30 +0000 (06:31 +0000)]
Update clang unittests for rL281586.

The change in rL281586 is in llvm component and tests updated here are
in clang component, so I have to commit them consecutively.

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

7 years agoBuiltins.def: Explicitly undef finitef, to appease mingw. It defines finitef as alias...
NAKAMURA Takumi [Thu, 15 Sep 2016 05:11:43 +0000 (05:11 +0000)]
Builtins.def: Explicitly undef finitef, to appease mingw. It defines finitef as alias of _finitef.

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

7 years agoRevert r281457 "Supports adding insertion around non-insertion replacements."
Artem Belevich [Wed, 14 Sep 2016 23:03:06 +0000 (23:03 +0000)]
Revert r281457 "Supports adding insertion around non-insertion replacements."

Commit was breaking our internal tests.

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

7 years ago[clang-cl] Accept the joined equals version of -resource-dir=
Reid Kleckner [Wed, 14 Sep 2016 22:31:24 +0000 (22:31 +0000)]
[clang-cl] Accept the joined equals version of -resource-dir=

lib/Tooling injects this argument without regard for what driver syntax
is in use.

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

7 years ago[CUDA] Make __clang_cuda_cmath.h compatible with libc++.
Justin Lebar [Wed, 14 Sep 2016 21:50:14 +0000 (21:50 +0000)]
[CUDA] Make __clang_cuda_cmath.h compatible with libc++.

Summary:
We need to add a bunch more "using"s, which weren't necessary with
libstdc++.

Once this is in I can check in a test to the test-suite.

Reviewers: tra

Subscribers: cfe-commits

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

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

7 years ago[CUDA] Add test checking our ability to take a function pointer to a __global__ funct...
Justin Lebar [Wed, 14 Sep 2016 21:50:11 +0000 (21:50 +0000)]
[CUDA] Add test checking our ability to take a function pointer to a __global__ function on the host side.

Summary: This functionality is used by Thrust.

Reviewers: tra

Subscribers: cfe-commits

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

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

7 years agoAdd some MS aliases for existing intrinsics
Albert Gutowski [Wed, 14 Sep 2016 21:19:43 +0000 (21:19 +0000)]
Add some MS aliases for existing intrinsics

Reviewers: thakis, compnerd, majnemer, rsmith, rnk

Subscribers: alexshap, cfe-commits

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

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

7 years agoRevert "Do not warn about format strings that are indexed string literals."
Stephen Hines [Wed, 14 Sep 2016 20:20:14 +0000 (20:20 +0000)]
Revert "Do not warn about format strings that are indexed string literals."

Summary: This reverts r281527 because I messed up the attribution.

Reviewers: srhines

Subscribers: cfe-commits

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

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

7 years agoDo not warn about format strings that are indexed string literals.
Stephen Hines [Wed, 14 Sep 2016 20:05:20 +0000 (20:05 +0000)]
Do not warn about format strings that are indexed string literals.

Summary:
The warning for a format string not being a sting literal and therefore
being potentially insecure is overly strict for indecies into sting
literals. This fix checks if the index into the string literal is
precomputable. If thats the case it will check if the suffix of that
sting literal is a valid format string string literal. It will still
issue the aforementioned warning for out of range indecies into the
string literal.

Reviewers: rsmith

Subscribers: srhines, cfe-commits

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

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

7 years agoCorrect assert text in DeclGroup::getSingleDecl()
Kirill Bobyrev [Wed, 14 Sep 2016 19:59:26 +0000 (19:59 +0000)]
Correct assert text in DeclGroup::getSingleDecl()

Assert text for getSingleDecl() is inaccurate. Appears to have been copy pasted
from getDeclGroup().

Patch by Ben Taylor!

Reviewers: alexfh

Subscribers: cfe-commits

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

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

7 years ago[analyzer] scan-build-py: Remove relative path hack for SATestsBuild.py
Devin Coughlin [Wed, 14 Sep 2016 18:14:11 +0000 (18:14 +0000)]
[analyzer] scan-build-py: Remove relative path hack for SATestsBuild.py

Remove the relative path hack in scan-build-py that converts a fully qualified
directory name and a fully qualified file path to a relative path before running
the analyzer on a file.

This hack is not needed: the bad interaction with SATestsBuild.py it was
intended to address is actually the same underlying problem that r280768 fixed.
Further, because the hack would always relativize paths, it caused
SATestBuild.py to be unable to properly line up issues when the build system
changed directory and then built a source file in a child directory but used a
fully-qualified path for the source file.

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

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

7 years agoConvert finite to builtin
Dehao Chen [Wed, 14 Sep 2016 17:34:14 +0000 (17:34 +0000)]
Convert finite to builtin

Summary: This patch converts finite/__finite to builtin functions so that it will be inlined by compiler.

Reviewers: hfinkel, davidxl, efriedma

Subscribers: efriedma, llvm-commits

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

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

7 years agoCodeGen: simplify the logic a slight bit
Saleem Abdulrasool [Wed, 14 Sep 2016 15:17:46 +0000 (15:17 +0000)]
CodeGen: simplify the logic a slight bit

Move the definition of `getTriple()` into the header.  It would just call
`getTarget().getTriple()`.  Inline the definition to allow the compiler to see
the same amount of the layout as previously.  Remove the more verbose
`getTarget().getTriple()` in favour of `getTriple()`.

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

7 years agoFix documentation of MemberExpr::getMemberDecl
Stephan Bergmann [Wed, 14 Sep 2016 14:03:50 +0000 (14:03 +0000)]
Fix documentation of MemberExpr::getMemberDecl

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

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

7 years agoSupports adding insertion around non-insertion replacements.
Eric Liu [Wed, 14 Sep 2016 13:04:51 +0000 (13:04 +0000)]
Supports adding insertion around non-insertion replacements.

Summary:
Extend `tooling::Replacements::add()` to support adding order-independent replacements.

Two replacements are considered order-independent if one of the following conditions is true:
  - They do not overlap. (This is already supported.)
  - One replacement is insertion, and the other is a replacement with
    length > 0, and the insertion is adjecent to but not contained in the
    other replacement. In this case, the replacement should always change
    the original code instead of the inserted text.

Reviewers: klimek, djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoRevert "[modules] When merging one definition into another, propagate the list of...
Eric Liu [Wed, 14 Sep 2016 10:05:10 +0000 (10:05 +0000)]
Revert "[modules] When merging one definition into another, propagate the list of re-exporting modules from the discarded definition to the retained definition."

This reverts commit r281429.

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

7 years agoDocument option '-rtlib' in clang's man page and help info
Jonas Hahnfeld [Wed, 14 Sep 2016 05:52:21 +0000 (05:52 +0000)]
Document option '-rtlib' in clang's man page and help info

This patch adds an entry for "-rtlib" in the output of `man clang` and `clang -help`.

Patch by Lei Zhang!

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

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

7 years ago[docs] Fix formatting of   characters so that tables line up properly. Add
Richard Smith [Wed, 14 Sep 2016 02:24:50 +0000 (02:24 +0000)]
[docs] Fix formatting of   characters so that tables line up properly. Add
padding around table cells so the borders of adjacent tables don't run into
each other (now that they're perfectly aligned).

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

7 years ago[docs] Order diagnostic cross-references alphabetically rather than based on
Richard Smith [Wed, 14 Sep 2016 01:55:42 +0000 (01:55 +0000)]
[docs] Order diagnostic cross-references alphabetically rather than based on
order in the .td file.

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

7 years agoUpdate DiagnosticsReference and fix emitter to emit -Wpedantic diagnostics and groups...
Richard Smith [Wed, 14 Sep 2016 01:51:10 +0000 (01:51 +0000)]
Update DiagnosticsReference and fix emitter to emit -Wpedantic diagnostics and groups in a deterministic order.

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

7 years ago[sanitizer-coverage] add yet another flavour of coverage instrumentation: trace-pc...
Kostya Serebryany [Wed, 14 Sep 2016 01:39:49 +0000 (01:39 +0000)]
[sanitizer-coverage] add yet another flavour of coverage instrumentation: trace-pc-guard. The intent is to eventually replace all of {bool coverage, 8bit-counters, trace-pc} with just this one. Clang part

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

7 years agoFollow-up to r281367: Compare uuids case-insensitively.
Nico Weber [Wed, 14 Sep 2016 01:16:54 +0000 (01:16 +0000)]
Follow-up to r281367: Compare uuids case-insensitively.

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

7 years ago[modules] When merging one definition into another, propagate the list of
Richard Smith [Wed, 14 Sep 2016 01:05:35 +0000 (01:05 +0000)]
[modules] When merging one definition into another, propagate the list of
re-exporting modules from the discarded definition to the retained definition.

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

7 years agoColor warnings purple rather than orange, to match actual Clang output.
Richard Smith [Wed, 14 Sep 2016 00:35:56 +0000 (00:35 +0000)]
Color warnings purple rather than orange, to match actual Clang output.

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

7 years agoMissed update from r281412.
Richard Smith [Tue, 13 Sep 2016 23:03:41 +0000 (23:03 +0000)]
Missed update from r281412.

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

7 years agoAlso don't inline dllimport functions referring to non-dllimport constructors.
Hans Wennborg [Tue, 13 Sep 2016 22:51:42 +0000 (22:51 +0000)]
Also don't inline dllimport functions referring to non-dllimport constructors.

The AST walker wasn't visiting CXXConstructExprs before.

This is a follow-up to r281395.

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

7 years agoWarning flag updates:
Richard Smith [Tue, 13 Sep 2016 22:51:09 +0000 (22:51 +0000)]
Warning flag updates:
-Wdiv-by-zero may as well be an alias for -Wdivision-by-zero rather than a GCC-compatibility no-op.
-Wno-shadow should disable -Wshadow-ivar.
-Weffc++ may as well enable -Wnon-virtual-dtor like it does in GCC.

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

7 years agoFix a FIXME about MSVC 2013 in the diagnostic doc generation code
Reid Kleckner [Tue, 13 Sep 2016 22:22:56 +0000 (22:22 +0000)]
Fix a FIXME about MSVC 2013 in the diagnostic doc generation code

Ultimately it boiled down to adding a move constructor.

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

7 years ago[CUDA] Do not merge CUDA target attributes.
Artem Belevich [Tue, 13 Sep 2016 22:16:30 +0000 (22:16 +0000)]
[CUDA] Do not merge CUDA target attributes.

CUDA target attributes are used for function overloading and must not be merged.

This fixes a bug where attributes were inherited during function template
specialization in CUDA and made it impossible for specialized function
to provide its own target attributes.

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

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

7 years ago[CodeGen] Fix an assert in EmitNullConstant.
Akira Hatanaka [Tue, 13 Sep 2016 22:13:02 +0000 (22:13 +0000)]
[CodeGen] Fix an assert in EmitNullConstant.

r235815 changed CGRecordLowering::accumulateBases to ignore non-virtual
bases of size 0, which prevented adding those non-virtual bases to
CGRecordLayout's NonVirtualBases. This caused clang to assert when
CGRecordLayout::getNonVirtualBaseLLVMFieldNo was called in
EmitNullConstant. This commit fixes the bug by ignoring zero-sized
non-virtual bases in EmitNullConstant.

rdar://problem/28100139

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

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

7 years agoObjectiveC Generics: follow-up commit to r281355.
Manman Ren [Tue, 13 Sep 2016 21:57:28 +0000 (21:57 +0000)]
ObjectiveC Generics: follow-up commit to r281355.

Correct getExtraLocalDataSize for ObjCTypeParamTypeLoc.

rdar://24619481
rdar://25060179

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

7 years agoTemporary fix for MS _Interlocked intrinsics
Albert Gutowski [Tue, 13 Sep 2016 21:51:37 +0000 (21:51 +0000)]
Temporary fix for MS _Interlocked intrinsics

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

7 years agoReverse commit 281375 (breaks building Chromium)
Albert Gutowski [Tue, 13 Sep 2016 21:24:51 +0000 (21:24 +0000)]
Reverse commit 281375 (breaks building Chromium)

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

7 years agoTry harder to not inline dllimport functions referencing non-dllimport functions
Hans Wennborg [Tue, 13 Sep 2016 21:08:20 +0000 (21:08 +0000)]
Try harder to not inline dllimport functions referencing non-dllimport functions

In r246338, code was added to check for this, but it failed to take into
account implicit destructor invocations because those are not reflected
in the AST. This adds a separate check for them.

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

7 years agoRemove excessive padding from PTHWriter
Alexander Shaposhnikov [Tue, 13 Sep 2016 20:17:57 +0000 (20:17 +0000)]
Remove excessive padding from PTHWriter

The class PTHWriter is in lib/Frontend/CacheTokens.cpp
inside the anonymous namespace.
This diff changes the order of fields an removes excessive padding.
Test plan: make -j8 check-clang

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

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

7 years ago[SemaObjC] Be more strict while parsing type arguments and protocols
Bruno Cardoso Lopes [Tue, 13 Sep 2016 20:04:35 +0000 (20:04 +0000)]
[SemaObjC] Be more strict while parsing type arguments and protocols

Fix a crash-on-invalid.

When parsing type arguments and protocols,
parseObjCTypeArgsOrProtocolQualifiers() calls ParseTypeName(), which tries to
find matching tokens for '[', '(', etc whenever they appear among potential
type names. If unmatched, ParseTypeName() yields a tok::eof token stream. This
leads to crashes since the parsing at this point is not expected to go beyond
the param list closing '>'.

Fix that by properly handling tok::eof in
parseObjCTypeArgsOrProtocolQualifiers() callers.

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

rdar://problem/25063557

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

7 years agoWork around MSVC 2013's inability to default move special members.
Richard Smith [Tue, 13 Sep 2016 20:00:02 +0000 (20:00 +0000)]
Work around MSVC 2013's inability to default move special members.

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

7 years agoAdd bunch of _Interlocked builtins
Albert Gutowski [Tue, 13 Sep 2016 19:43:33 +0000 (19:43 +0000)]
Add bunch of _Interlocked builtins

Reviewers: compnerd, thakis, Prazek, majnemer, rnk

Subscribers: cfe-commits

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

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

7 years agoAdd some MS aliases for existing intrinsics
Albert Gutowski [Tue, 13 Sep 2016 19:26:42 +0000 (19:26 +0000)]
Add some MS aliases for existing intrinsics

Reviewers: thakis, compnerd, majnemer, rsmith, rnk

Subscribers: cfe-commits

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

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

7 years ago[analyzer] Fix ExprEngine::VisitMemberExpr
Alexander Shaposhnikov [Tue, 13 Sep 2016 19:17:20 +0000 (19:17 +0000)]
[analyzer] Fix ExprEngine::VisitMemberExpr

AST may contain intermediate ParenExpr nodes
between MemberExpr and ArrayToPointerDecay.
This diff adjusts the check in ExprEngine::VisitMemberExpr accordingly.
Test plan: make -j8 check-clang-analysis

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

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

7 years ago[clang-cl] Diagnose duplicate uuids.
Nico Weber [Tue, 13 Sep 2016 18:55:26 +0000 (18:55 +0000)]
[clang-cl] Diagnose duplicate uuids.

This mostly behaves cl.exe's behavior, even though clang-cl is stricter in some
corner cases and more lenient in others (see the included test).

To make the uuid declared previously here diagnostic work correctly, tweak
stripTypeAttributesOffDeclSpec() to keep attributes in the right order.

https://reviews.llvm.org/D24469

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

7 years agoWork around a GCC 4.7-specific issue: due to implementing older rules for
Richard Smith [Tue, 13 Sep 2016 18:35:34 +0000 (18:35 +0000)]
Work around a GCC 4.7-specific issue: due to implementing older rules for
implicit declarations of move operations, GCC 4.7 would find that SelectPiece
has neither a move constructor nor a copy constructor. The copy constructor was
(correctly) deleted because the class has a member of move-only type, and the
move constructor was (incorrectly, per current C++ rules) not provided because
the class has a copy-only base class (in turn because it explicitly declares a
destructor).

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

7 years agoObjectiveC Generics: Start using ObjCTypeParamType.
Manman Ren [Tue, 13 Sep 2016 17:41:05 +0000 (17:41 +0000)]
ObjectiveC Generics: Start using ObjCTypeParamType.

For ObjC type parameter, we used to have TypedefType that is canonicalized to
id or the bound type. We can't represent "T <protocol>" and thus will lose
the type information in the following example:
@interface MyMutableDictionary<KeyType, ObjectType> : NSObject
- (void)setObject:(ObjectType)obj forKeyedSubscript:(KeyType <NSCopying>)key;
@end
MyMutableDictionary<NSString *, NSString *> *stringsByString;
NSNumber *n1, *n2;
stringsByString[n1] = n2;
--> no warning on type mismatch of the key.

To fix the problem, we introduce a new type ObjCTypeParamType that supports
a list of protocol qualifiers.

We create ObjCTypeParamType for ObjCTypeParamDecl when we create
ObjCTypeParamDecl. We also substitute ObjCTypeParamType instead of TypedefType
on an ObjCTypeParamDecl.

rdar://24619481
rdar://25060179

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

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

7 years agoAMDGPU: Fix target options fp32/64-denormals
Yaxun Liu [Tue, 13 Sep 2016 17:37:09 +0000 (17:37 +0000)]
AMDGPU: Fix target options fp32/64-denormals

Fix target options for fp32/64-denormals so that

+fp64-denormals is set if fp64 is supported
-fp32-denormals if fp32 denormals is not supported, or -cl-denorms-are-zero is set
+fp32-denormals if fp32 denormals is supported and -cl-denorms-are-zero is not set

If target feature fp32/64-denormals is explicitly set, they will override default options and options deduced from -cl-denorms-are-zero.

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

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

7 years agoObjectiveC generics: Add ObjCTypeParamType in the type system.
Manman Ren [Tue, 13 Sep 2016 17:25:08 +0000 (17:25 +0000)]
ObjectiveC generics: Add ObjCTypeParamType in the type system.

We also need to add ObjCTypeParamTypeLoc. ObjCTypeParamType supports the
representation of "T <protocol>" where T is a type parameter. Before this,
we use TypedefType to represent the type parameter for ObjC.

ObjCTypeParamType has "ObjCTypeParamDecl *OTPDecl" and it extends from
ObjCProtocolQualifiers. It is a non-canonical type and is canonicalized
to the underlying type with the protocol qualifiers.

rdar://24619481
rdar://25060179

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

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

7 years agoObjectiveC: Refactor applyObjCProtocolQualifiers.
Manman Ren [Tue, 13 Sep 2016 17:03:12 +0000 (17:03 +0000)]
ObjectiveC: Refactor applyObjCProtocolQualifiers.

To construct the canonical type of ObjCTypeParamType, we need to apply
qualifiers on ObjCObjectPointerType. The updated applyObjCProtocolQualifiers
handles this case by merging the protocol lists, constructing a new
ObjCObjectType, then a new ObjCObjectPointerType.

rdar://24619481
rdar://25060179

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

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

7 years agoAdd a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.
Manman Ren [Tue, 13 Sep 2016 16:45:29 +0000 (16:45 +0000)]
Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.

Now ObjCObjectType extends from ObjCProtocolQualifiers. We save number of
protocols in ObjCProtocolQualifiers.

This is in preparation of adding a new type class ObjCTypeParamType that
can take protocol qualifiers.

rdar://24619481
rdar://25060179

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

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

7 years agoTraversing template paramter lists of DeclaratorDecls and/or TagDecls.
Nico Weber [Tue, 13 Sep 2016 15:05:04 +0000 (15:05 +0000)]
Traversing template paramter lists of DeclaratorDecls and/or TagDecls.

The unit tests in this patch demonstrate the need to traverse template
parameter lists of DeclaratorDecls (e.g. VarDecls, CXXMethodDecls) and
TagDecls (e.g. EnumDecls, RecordDecls).

Fixes PR29042.
https://reviews.llvm.org/D24268

Patch from Lukasz
Łukasz Anforowicz <lukasza@chromium.org>!

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

7 years agoRemove redundant comma around parenthesis in parameter list.
Eric Liu [Tue, 13 Sep 2016 15:02:43 +0000 (15:02 +0000)]
Remove redundant comma around parenthesis in parameter list.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoRevert accidentally checked in change in r281315.
Vassil Vassilev [Tue, 13 Sep 2016 10:38:26 +0000 (10:38 +0000)]
Revert accidentally checked in change in r281315.

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

7 years agoSimplify. NFC.
Vassil Vassilev [Tue, 13 Sep 2016 10:36:12 +0000 (10:36 +0000)]
Simplify. NFC.

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

7 years agoAllow register variables in naked functions.
Nikola Smiljanic [Tue, 13 Sep 2016 07:02:02 +0000 (07:02 +0000)]
Allow register variables in naked functions.

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

7 years agoclang-format: Add Java detection to git-clang-format.
Stephen Hines [Tue, 13 Sep 2016 05:00:20 +0000 (05:00 +0000)]
clang-format: Add Java detection to git-clang-format.

Summary: This change adds "java" to the list of known extensions that clang-format supports.

Patch by Luis Hector Chavez

Reviewers: djasper

Subscribers: srhines, cfe-commits

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

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

7 years agoReapply r281276 with passing -emit-llvm in one of the tests
Adam Nemet [Tue, 13 Sep 2016 04:32:40 +0000 (04:32 +0000)]
Reapply r281276 with passing -emit-llvm in one of the tests

Original commit message:

Add -fdiagnostics-show-hotness

Summary:
I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

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

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

7 years agoHandle empty message in static_asserts.
Richard Trieu [Tue, 13 Sep 2016 01:37:01 +0000 (01:37 +0000)]
Handle empty message in static_asserts.

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

7 years agoFix interaction between serialization and c++1z feature.
Richard Trieu [Tue, 13 Sep 2016 01:20:40 +0000 (01:20 +0000)]
Fix interaction between serialization and c++1z feature.

In c++1z, static_assert is not required to have a StringLiteral message, where
previously it was required.  Update the AST Reader to be able to handle a
null StringLiteral.

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

7 years agoUpdate Clang for D20147 ("DebugInfo: New metadata representation for global variables.")
Peter Collingbourne [Tue, 13 Sep 2016 01:13:19 +0000 (01:13 +0000)]
Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")

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

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

7 years agoRevert "Add -fdiagnostics-show-hotness"
Adam Nemet [Tue, 13 Sep 2016 00:16:49 +0000 (00:16 +0000)]
Revert "Add -fdiagnostics-show-hotness"

This reverts commit r281276.

Many bots are failing.

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

7 years ago[DebugInfo] Deduplicate debug info limiting logic
Reid Kleckner [Tue, 13 Sep 2016 00:01:23 +0000 (00:01 +0000)]
[DebugInfo] Deduplicate debug info limiting logic

We should be doing the same checks when a type is completed as we do
when a complete type is used during emission. Previously, we duplicated
the logic, and it got out of sync. This could be observed with
dllimported classes.

Also reduce a test case for this slightly.

Implementing review feedback from David Blaikie on r281057.

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

7 years ago[Sema] Fix PR30346: relax __builtin_object_size checks.
George Burgess IV [Mon, 12 Sep 2016 23:50:35 +0000 (23:50 +0000)]
[Sema] Fix PR30346: relax __builtin_object_size checks.

This patch makes us act more conservatively when trying to determine
the objectsize for an array at the end of an object. This is in
response to code like the following:

```
struct sockaddr {
  /* snip */
  char sa_data[14];
};

void foo(const char *s) {
  size_t slen = strlen(s) + 1;
  size_t added_len = slen <= 14 ? 0 : slen - 14;
  struct sockaddr *sa = malloc(sizeof(struct sockaddr) + added_len);
  strcpy(sa->sa_data, s);
  // ...
}
```

`__builtin_object_size(sa->sa_data, 1)` would return 14, when there
could be more than 14 bytes at `sa->sa_data`.

Code like this is apparently not uncommon. FreeBSD's manual even
explicitly mentions this pattern:
https://www.freebsd.org/doc/en/books/developers-handbook/sockets-essential-functions.html
(section 7.5.1.1.2).

In light of this, we now just give up on any array at the end of an
object if we can't find the object's initial allocation.

I lack numbers for how much more conservative we actually become as a
result of this change, so I chose the fix that would make us as
compatible with GCC as possible. If we want to be more aggressive, I'm
happy to consider some kind of whitelist or something instead.

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

7 years agoAdd -fdiagnostics-show-hotness
Adam Nemet [Mon, 12 Sep 2016 23:48:16 +0000 (23:48 +0000)]
Add -fdiagnostics-show-hotness

Summary:
I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

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

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

7 years agoFix a long comment line
Adam Nemet [Mon, 12 Sep 2016 23:48:11 +0000 (23:48 +0000)]
Fix a long comment line

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

7 years agoCodeGen: use some range-based for loops
Saleem Abdulrasool [Mon, 12 Sep 2016 21:15:23 +0000 (21:15 +0000)]
CodeGen: use some range-based for loops

Use range-based for loops to simplify the logic.  Add an explicit check for
MachO as the inline asm uses MachO specific directives.

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

7 years agoAdd a couple of test files missed in r281258.
Richard Smith [Mon, 12 Sep 2016 21:07:09 +0000 (21:07 +0000)]
Add a couple of test files missed in r281258.

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

7 years ago[modules] When we merge two definitions of a function, mark the retained
Richard Smith [Mon, 12 Sep 2016 21:06:40 +0000 (21:06 +0000)]
[modules] When we merge two definitions of a function, mark the retained
definition as visible in the discarded definition's module, as we do for
other kinds of definition.

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

7 years agoDiagnostics reference: "error:" should be red, not orange.
Richard Smith [Mon, 12 Sep 2016 17:55:49 +0000 (17:55 +0000)]
Diagnostics reference: "error:" should be red, not orange.

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

7 years agoTrivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable
Jonathan Roelofs [Mon, 12 Sep 2016 16:14:52 +0000 (16:14 +0000)]
Trivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable

Fixed incorrect docs that referred to:
  objc_arc_weak_unavailable
when it should be:
  objc_arc_weak_reference_unavailable

Patch by: Sean McBride!

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

7 years agoclang-format: Make emacs integration work with narrowed buffers.
Daniel Jasper [Mon, 12 Sep 2016 10:02:46 +0000 (10:02 +0000)]
clang-format: Make emacs integration work with narrowed buffers.

Use (call-process region nil ...) instead of (point-min) so that the
call works in narrowed buffers.

Patch by Philipp Stephani, thank you!

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

7 years ago[CFG] Add iterator_ranges to CFG and CFGBlock.
Martin Bohme [Mon, 12 Sep 2016 08:28:21 +0000 (08:28 +0000)]
[CFG] Add iterator_ranges to CFG and CFGBlock.

Summary: (Needed for D23353.)

Reviewers: alexfh

Subscribers: cfe-commits

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

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

7 years agoAdd virtual destructor (necessary due to the switch to shared_ptr).
Richard Smith [Mon, 12 Sep 2016 06:51:11 +0000 (06:51 +0000)]
Add virtual destructor (necessary due to the switch to shared_ptr).

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

7 years agoAttempt #3 to placate MSVC.
Richard Smith [Mon, 12 Sep 2016 06:38:31 +0000 (06:38 +0000)]
Attempt #3 to placate MSVC.

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

7 years agoAttempt #2 to placate MSVC
Richard Smith [Mon, 12 Sep 2016 06:23:26 +0000 (06:23 +0000)]
Attempt #2 to placate MSVC

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

7 years agoAttempt to placate MSVC.
Richard Smith [Mon, 12 Sep 2016 06:13:44 +0000 (06:13 +0000)]
Attempt to placate MSVC.

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

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