]> granicus.if.org Git - clang/log
clang
7 years agoRevert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"
Christof Douma [Mon, 19 Jun 2017 12:41:22 +0000 (12:41 +0000)]
Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"

This reverts commit 305684.
This patch breaks extra/tools/clang-tidy

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

7 years agoMove the test from r305678 to a separte file with 'REQUIRES: system-darwin'
Alex Lorenz [Mon, 19 Jun 2017 12:13:59 +0000 (12:13 +0000)]
Move the test from r305678 to a separte file with 'REQUIRES: system-darwin'

Otherwise it will fail on non-macOS systems.

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

7 years ago[NFC] Refactor DiagnosticRenderer to use FullSourceLoc
Christof Douma [Mon, 19 Jun 2017 12:05:58 +0000 (12:05 +0000)]
[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.

Patch by Sanne Wouda

Review: https://reviews.llvm.org/D31709

Change-Id: If351a112cdf6718e2d3ef6721b8da9c6376b32dd

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

7 years agoAdd missing OS check to r305678
Alex Lorenz [Mon, 19 Jun 2017 11:25:37 +0000 (11:25 +0000)]
Add missing OS check to r305678

That commit failed on non-macOS buildbots as I've forgotten to make sure that
the system on which Clang is running on is actually macOS.

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

7 years ago[driver][macOS] Pick the system version for the deployment target
Alex Lorenz [Mon, 19 Jun 2017 10:57:27 +0000 (10:57 +0000)]
[driver][macOS] Pick the system version for the deployment target
if the SDK is newer than the system

This commit improves the driver by making sure that it picks the system version
for the deployment target when the version of the macOS SDK is newer than the
system version.

rdar://29449467

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

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

7 years ago[analyzer] Fix logical not for pointers with different bit width
Daniel Marjamaki [Mon, 19 Jun 2017 08:55:51 +0000 (08:55 +0000)]
[analyzer] Fix logical not for pointers with different bit width

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

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

7 years agoclang-format: Improve understanding of combined typedef+record declarations
Daniel Jasper [Mon, 19 Jun 2017 07:45:41 +0000 (07:45 +0000)]
clang-format: Improve understanding of combined typedef+record declarations

Fixes an issue where struct A { int X; }; would be broken onto multiple
lines, but typedef struct A { int X; } A2; was collapsed onto a single
line.

Patch by Jacob Bandes-Storch. Thank you.

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

7 years agoclang-format: Handle "if constexpr".
Daniel Jasper [Mon, 19 Jun 2017 07:40:49 +0000 (07:40 +0000)]
clang-format: Handle "if constexpr".

c++1z adds the following constructions to the language:

  if constexpr (cond)
    statement1;
  else if constexpr (cond)
    statement2;
  else if constexpr (cond)
    statement3;
  else
    statement4;

A first version of this was proposed in reviews.llvm.org/D26953 by
Francis Visoiu Mistrih, but never commited. This patch additionally
fixes the behavior when allowing short if statements on a single line
and was authored by Jacob Bandes-Storch. Thank you to both authors.

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

7 years agoclang-format: Add capability to format the diff on save in vim.
Daniel Jasper [Mon, 19 Jun 2017 07:30:04 +0000 (07:30 +0000)]
clang-format: Add capability to format the diff on save in vim.

With this patch, one can configure a BufWrite hook that will make the
clang-format integration compute a diff of the current buffer with the file
that's on disk and format all changed lines. This should create a
zero-overhead auto-format solution that doesn't require the file to
already be clang-format clean to avoid spurious diffs.

Review: https://reviews.llvm.org/D32429

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

7 years ago[analyzer] Teach CloneDetection about Qt Meta-Object Compiler
Leslie Zhai [Mon, 19 Jun 2017 01:55:50 +0000 (01:55 +0000)]
[analyzer] Teach CloneDetection about Qt Meta-Object Compiler

Reviewers: v.g.vassilev, zaks.anna, NoQ, teemperor

Reviewed By: v.g.vassilev, zaks.anna, NoQ, teemperor

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

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

7 years agoCodeGen: make the type match the comment for a libcall
Saleem Abdulrasool [Sat, 17 Jun 2017 17:30:31 +0000 (17:30 +0000)]
CodeGen: make the type match the comment for a libcall

Fix the type for a (runtime) library call to match both the comment and
the runtime implementation.  As it happens, the type being used matched,
this just makes it more precise.

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

7 years agoCall setMustBuildLookupTable on TagDecls in ExternalASTMerger
Lang Hames [Sat, 17 Jun 2017 00:12:38 +0000 (00:12 +0000)]
Call setMustBuildLookupTable on TagDecls in ExternalASTMerger

Summary:
setMustBuildLookupTable should be called on imported TagDecls otherwise we may fail
to import their member decls (if they have any).

Not calling the setMustBuildLookupTable method results in a failure in the attached test
case when lookup for the 'x' member fails on struct S, which hasn't had its decls imported
elsewhere. (By contrast the member-in-struct testcase hasn't run into this issue
because the import of its decls is triggered when the struct instance is defined, and the
member access follows this).

Reviewers: spyffe, rsmith

Reviewed By: spyffe, rsmith

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

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

7 years ago[Driver] Do a PATH lookup if needed when using -no-canonical-prefixes
Petr Hosek [Fri, 16 Jun 2017 22:40:18 +0000 (22:40 +0000)]
[Driver] Do a PATH lookup if needed when using -no-canonical-prefixes

When -no-canonical-prefixes option is used and argv0 contains only
a program name, we need to do a PATH lookup to get an executable path,
otherwise the return value won't be a valid path and any subsequent
uses of it (e.g. when invoking -cc1) will fail with an error.

This patch fixes PR9576.

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

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

7 years ago[index] Fix typo: inferface -> interface
Marc-Andre Laperle [Fri, 16 Jun 2017 20:58:26 +0000 (20:58 +0000)]
[index] Fix typo: inferface -> interface

Reviewers: arphaman

Reviewed By: arphaman

Subscribers: cfe-commits

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

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

7 years agoKilling a tab and some other spurious whitespace; NFC.
Aaron Ballman [Fri, 16 Jun 2017 20:52:59 +0000 (20:52 +0000)]
Killing a tab and some other spurious whitespace; NFC.

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

7 years ago[PR33394] Avoid lexing editor placeholders when Clang is used only
Alex Lorenz [Fri, 16 Jun 2017 20:13:39 +0000 (20:13 +0000)]
[PR33394] Avoid lexing editor placeholders when Clang is used only
for preprocessing

r300667 added support for editor placeholder to Clang. That commit didn’t take
into account that users who use Clang for preprocessing only (-E) will get the
"editor placeholder in source file" error when preprocessing their source
(PR33394). This commit ensures that Clang doesn't lex editor placeholders when
running a preprocessor only action.

rdar://32718000

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

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

7 years agoIgnore return value in test.
Daniel Jasper [Fri, 16 Jun 2017 19:29:20 +0000 (19:29 +0000)]
Ignore return value in test.

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

7 years ago[ubsan] docs: Add a note about pointers to volatile
Vedant Kumar [Fri, 16 Jun 2017 18:38:43 +0000 (18:38 +0000)]
[ubsan] docs: Add a note about pointers to volatile

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

7 years agoFix a bug that warnings generated with -M or -MM flags
Yuka Takahashi [Fri, 16 Jun 2017 16:01:13 +0000 (16:01 +0000)]
Fix a bug that warnings generated with -M or -MM flags

This is a patch for bug: https://bugs.llvm.org/show_bug.cgi?id=6817

Warnings should not be emitted with -M and -MM flags, because this mode
is only used for generate MakeFiles.

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

7 years agoExpand vector oparation to as IR constants, PR28129.
Dinar Temirbulatov [Fri, 16 Jun 2017 12:09:52 +0000 (12:09 +0000)]
Expand vector oparation to as IR constants, PR28129.

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

7 years ago[ubsan] PR33081: Skip the standard type checks for volatile
Vedant Kumar [Fri, 16 Jun 2017 03:27:36 +0000 (03:27 +0000)]
[ubsan] PR33081: Skip the standard type checks for volatile

Skip checks for null dereference, alignment violation, object size
violation, and dynamic type violation if the pointer points to volatile
data.

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

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

7 years ago[XRay][clang] Support capturing the implicit `this` argument to C++ class member...
Dean Michael Berris [Fri, 16 Jun 2017 03:22:09 +0000 (03:22 +0000)]
[XRay][clang] Support capturing the implicit `this` argument to C++ class member functions

Summary:
Before this change, we couldn't capture the `this` pointer that's
implicitly the first argument of class member functions. There are some
interesting things we can do with capturing even just this single
argument for zero-argument member functions.

Reviewers: rnk, pelikan

Subscribers: cfe-commits

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

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

7 years ago[ODRHash] Hash VarDecl members.
Richard Trieu [Fri, 16 Jun 2017 02:44:29 +0000 (02:44 +0000)]
[ODRHash] Hash VarDecl members.

These VarDecl's are static data members of classes.  Since the initializers are
also hashed, this also provides checking for default arguments to methods.

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

7 years ago[Completion] Code complete the members for a dependent type after a '::'
Alex Lorenz [Thu, 15 Jun 2017 21:40:54 +0000 (21:40 +0000)]
[Completion] Code complete the members for a dependent type after a '::'

This commit is a follow up to r302797 which added support for dependent
completions after the '.' and '->' operators. This commit adds support for
dependent completions after the '::' operator.

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

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

7 years ago[index] Record C++17 global binding declarations
Alex Lorenz [Thu, 15 Jun 2017 21:19:01 +0000 (21:19 +0000)]
[index] Record C++17 global binding declarations

The global C++17 binding declarations should be indexed as variable symbols.

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

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

7 years agoAdded braces to work around gcc warning in googletest: suggest explicit braces to...
Galina Kistanova [Thu, 15 Jun 2017 21:01:24 +0000 (21:01 +0000)]
Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC.

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

7 years ago[index] Index static_assert declarations
Alex Lorenz [Thu, 15 Jun 2017 20:50:43 +0000 (20:50 +0000)]
[index] Index static_assert declarations

static_assert declarations have to be visited while indexing so that we can
gather the references to declarations that are present in their assert
expression.

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

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

7 years ago[coroutines] Remove pass-through operator co_await; Replace it with the input expression
Eric Fiselier [Thu, 15 Jun 2017 20:00:54 +0000 (20:00 +0000)]
[coroutines] Remove pass-through operator co_await; Replace it with the input expression

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

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

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

7 years ago[coroutines] Allow co_await and co_yield expressions that return an lvalue to compile
Eric Fiselier [Thu, 15 Jun 2017 19:43:36 +0000 (19:43 +0000)]
[coroutines] Allow co_await and co_yield expressions that return an lvalue to compile

Summary:
The title says it all.

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: rjmccall, cfe-commits

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

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

7 years agoLexerTest memory leak fix-
Erich Keane [Thu, 15 Jun 2017 18:34:47 +0000 (18:34 +0000)]
LexerTest memory leak fix-

A new LexerTest unittest introduced a memory leak.  This patch
uses a unique_ptr with a custom deleter to ensure it is properly
deleted.

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

7 years agoApply summary-based dead stripping to regular LTO modules with summaries.
Peter Collingbourne [Thu, 15 Jun 2017 17:26:13 +0000 (17:26 +0000)]
Apply summary-based dead stripping to regular LTO modules with summaries.

If a regular LTO module has a summary index, then instead of linking
it into the combined regular LTO module right away, add it to the
combined summary index and associate it with a special module that
represents the combined regular LTO module.

Any such modules are linked during LTO::run(), at which time we use
the results of summary-based dead stripping to control whether to
link prevailing symbols.

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

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

7 years ago[analyzer]: Improve test handling with multiple constraint managers
Dominic Chen [Thu, 15 Jun 2017 17:05:07 +0000 (17:05 +0000)]
[analyzer]: Improve test handling with multiple constraint managers

Summary: Modify the test infrastructure to properly handle tests that require z3, and merge together the output of all tests on success. This is required for D28954.

Reviewers: dcoughlin, zaks.anna, NoQ, xazax.hun

Subscribers: cfe-commits

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

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

7 years agoRevert "Load lazily the template specialization in multi-module setups."
Vassil Vassilev [Thu, 15 Jun 2017 11:05:32 +0000 (11:05 +0000)]
Revert "Load lazily the template specialization in multi-module setups."

This broke our libcxx modules builds.

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

7 years agoRevert "Define _GNU_SOURCE for rtems c++"
Daniel Jasper [Thu, 15 Jun 2017 09:17:12 +0000 (09:17 +0000)]
Revert "Define _GNU_SOURCE for rtems c++"

This reverts commit r305399.

This breaks a build in libcxx:
libcxx/src/system_error.cpp:90:16: error: assigning to 'int' from incompatible type 'char *'
    if ((ret = ::strerror_r(ev, buffer, strerror_buff_size)) != 0) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Which makes sense according to:
https://linux.die.net/man/3/strerror_r

Not entirely sure how this needs to be fixed.

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

7 years agoCorrect documentation about the AfterClass clang-format option
Eric Fiselier [Thu, 15 Jun 2017 03:38:08 +0000 (03:38 +0000)]
Correct documentation about the AfterClass clang-format option

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

7 years ago[ODRHash] Hash TemplateArgument::Pack and TemplateTypeParmType
Richard Trieu [Thu, 15 Jun 2017 01:35:06 +0000 (01:35 +0000)]
[ODRHash] Hash TemplateArgument::Pack and TemplateTypeParmType

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

7 years ago[Basic] Use a static_assert instead of using the old array of size -1 trick.
Craig Topper [Thu, 15 Jun 2017 01:27:58 +0000 (01:27 +0000)]
[Basic] Use a static_assert instead of using the old array of size -1 trick.

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

7 years ago[clang-format] Allow git-clang-format to handle empty extensions.
Eric Fiselier [Thu, 15 Jun 2017 00:54:08 +0000 (00:54 +0000)]
[clang-format] Allow git-clang-format to handle empty extensions.

Most of libc++'s header files don't use extension. This prevents
using git-clang-format on them, which is frustrating.

This patch allows empty extensions to be passed using either
the --extensions option, or the clangformat.extensions git-config
value.

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

7 years agoFix LexerTest signed/unsigned comparison.
Erich Keane [Thu, 15 Jun 2017 00:28:13 +0000 (00:28 +0000)]
Fix LexerTest signed/unsigned comparison.

Werror was catching a signed/unsigned compare in
an assert, correct the signed 'expected' value to be
unsigned.

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

7 years agoHandle -ast-dump-all when passed as the only option.
Aaron Ballman [Thu, 15 Jun 2017 00:00:08 +0000 (00:00 +0000)]
Handle -ast-dump-all when passed as the only option.

Patch by Don Hinton

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

7 years ago[Preprocessor]Correct Macro-Arg allocation of StringifiedArguments,
Erich Keane [Wed, 14 Jun 2017 23:09:01 +0000 (23:09 +0000)]
[Preprocessor]Correct Macro-Arg allocation of StringifiedArguments,
correct getNumArguments

StringifiedArguments is allocated (resized) based on the size the
getNumArguments function. However, this function ACTUALLY currently
returns the amount of total UnexpArgTokens which is minimum the same as
the new implementation of getNumMacroArguments, since empty/omitted arguments
result in 1 UnexpArgToken, and included ones at minimum include 2
(1 for the arg itself, 1 for eof).

This patch renames the otherwise unused getNumArguments to be more clear
that it is the number of arguments that the Macro expects, and thus the maximum
number that can be stringified. This patch also replaces the explicit memset
(which results in value instantiation of the new tokens, PLUS clearing the
memory) with brace initialization.

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

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

7 years agoAST: Add missing break at end of switch
Duncan P. N. Exon Smith [Wed, 14 Jun 2017 21:26:31 +0000 (21:26 +0000)]
AST: Add missing break at end of switch

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

7 years ago[PPC] Enhance altivec conversion function macros implementation.
Tony Jiang [Wed, 14 Jun 2017 17:23:43 +0000 (17:23 +0000)]
[PPC] Enhance altivec conversion function macros implementation.

Add checking for the second parameter of altivec conversion builtin to make sure
it is compile-time constant int.

This patch fixes PR33212: PPC vec_cst useless at -O0
Differential Revision: https://reviews.llvm.org/D34092

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

7 years agoDefine _GNU_SOURCE for rtems c++
James Y Knight [Wed, 14 Jun 2017 17:01:18 +0000 (17:01 +0000)]
Define _GNU_SOURCE for rtems c++

This is required by the libc++ locale support.

Patch by Walter Lee.

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

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

7 years agoBe more strict when checking the -flto option value
Yuka Takahashi [Wed, 14 Jun 2017 15:37:11 +0000 (15:37 +0000)]
Be more strict when checking the -flto option value

Summary:
It seems -flto must be either "thin" or "full". I think the use of
containValue is just a typo.

Reviewers: ruiu, tejohnson

Subscribers: mehdi_amini, inglorion

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

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

7 years agoCorrected some comment typos; NFC.
Aaron Ballman [Wed, 14 Jun 2017 12:48:18 +0000 (12:48 +0000)]
Corrected some comment typos; NFC.

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

7 years agoclang-format: Add CompactNamespaces option
Francois Ferrand [Wed, 14 Jun 2017 12:29:47 +0000 (12:29 +0000)]
clang-format: Add CompactNamespaces option

Summary:
Add CompactNamespaces option, to pack namespace declarations on the
same line (somewhat similar to C++17 nested namespace definition).

With this option, consecutive namespace declarations are kept on the
same line:

  namespace foo { namespace bar {
      ...
  }} // namespace foo::bar

Reviewers: krasimir, djasper, klimek

Reviewed By: djasper

Subscribers: kimgr, cfe-commits, klimek

Tags: #clang-tools-extra

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

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

7 years agoReverted 305379 (Function with unparsed body is a definition)
Serge Pavlov [Wed, 14 Jun 2017 10:57:56 +0000 (10:57 +0000)]
Reverted 305379 (Function with unparsed body is a definition)

It broke clang-x86_64-linux-selfhost-modules-2 and some other buildbots.

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

7 years agoFunction with unparsed body is a definition
Serge Pavlov [Wed, 14 Jun 2017 10:07:02 +0000 (10:07 +0000)]
Function with unparsed body is a definition

While a function body is being parsed, the function declaration is not considered
as a definition because it does not have a body yet. In some cases it leads to
incorrect interpretation, the case is presented in
https://bugs.llvm.org/show_bug.cgi?id=14785:
```
    template<typename T> struct Somewhat {
      void internal() const {}
      friend void operator+(int const &, Somewhat<T> const &) {}
    };
void operator+(int const &, Somewhat<char> const &x) { x.internal(); }
```
When statement `x.internal()` in the body of global `operator+` is parsed, the type
of `x` must be completed, so the instantiation of `Somewhat<char>` is started. It
instantiates the declaration of `operator+` defined inline, and makes a check for
redefinition. The check does not detect another definition because the declaration
of `operator+` is still not defining as does not have a body yet.

To solves this problem the function `isThisDeclarationADefinition` considers
a function declaration as a definition if it has flag `WillHaveBody` set.

This change fixes PR14785.

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

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

7 years agoFix for Itanium mangler issue with templates
Dmitry Polukhin [Wed, 14 Jun 2017 09:47:47 +0000 (09:47 +0000)]
Fix for Itanium mangler issue with templates

Patch by Serge Preis

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

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

7 years ago[coroutines] Fix co_await for range statement
Eric Fiselier [Wed, 14 Jun 2017 03:24:55 +0000 (03:24 +0000)]
[coroutines] Fix co_await for range statement

Summary:
Currently we build the co_await expressions on the wrong implicit statements of the implicit ranged for; Specifically we build the co_await expression wrapping the range declaration, but it should wrap the begin expression.

This patch fixes co_await on range for.

Reviewers: rsmith, GorNishanov

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

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

7 years ago[ODRHash] Remove debugging code from r305361
Richard Trieu [Wed, 14 Jun 2017 03:19:58 +0000 (03:19 +0000)]
[ODRHash] Remove debugging code from r305361

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

7 years ago[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.
Richard Trieu [Wed, 14 Jun 2017 03:17:26 +0000 (03:17 +0000)]
[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.

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

7 years ago[ODRHash] Hash Expr for TemplateArgument::Expression
Richard Trieu [Wed, 14 Jun 2017 01:28:00 +0000 (01:28 +0000)]
[ODRHash] Hash Expr for TemplateArgument::Expression

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

7 years ago[ODRHash] Add TemplateArgument kind to hash.
Richard Trieu [Tue, 13 Jun 2017 22:21:18 +0000 (22:21 +0000)]
[ODRHash] Add TemplateArgument kind to hash.

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

7 years agoPreserve cold attribute for function decls
Xinliang David Li [Tue, 13 Jun 2017 21:14:07 +0000 (21:14 +0000)]
Preserve cold attribute for function decls

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

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

7 years agoFix spurious Wunused-lambda-capture warning
Yi Kong [Tue, 13 Jun 2017 18:38:31 +0000 (18:38 +0000)]
Fix spurious Wunused-lambda-capture warning

Summary:
Clang emits unused-lambda-capture warning for captures in generic lambdas even though they are actually used.

Fixes PR31815.

Reviewers: malcolm.parsons, aaron.ballman, rsmith

Reviewed By: malcolm.parsons

Subscribers: ahatanak, cfe-commits

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

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

7 years agoAlign definition of DW_OP_plus with DWARF spec [2/3]
Florian Hahn [Tue, 13 Jun 2017 18:06:15 +0000 (18:06 +0000)]
Align definition of DW_OP_plus with DWARF spec [2/3]

Summary:
This patch is part of 3 patches that together form a single patch, but must be introduced in stages in order not to break things.
 
The way that LLVM interprets DW_OP_plus in DIExpression nodes is basically that of the DW_OP_plus_uconst operator since LLVM expects an unsigned constant operand. This unnecessarily restricts the DW_OP_plus operator, preventing it from being used to describe the evaluation of runtime values on the expression stack. These patches try to align the semantics of DW_OP_plus and DW_OP_minus with that of the DWARF definition, which pops two elements off the expression stack, performs the operation and pushes the result back on the stack.
 
This is done in three stages:
• The first patch (LLVM) adds support for DW_OP_plus_uconst and changes all uses (and tests) of DW_OP_plus to use DW_OP_plus_uconst.
 
• The second patch (Clang) contains changes to use DW_OP_plus_uconst instead of DW_OP_plus.
 
• The third patch (LLVM) changes the semantics of DW_OP_plus to be in line with it’s DWARF meaning. It also does this for DW_OP_minus.

Patch by Sander de Smalen.

Reviewers: echristo, pcc, aprantl

Reviewed By: aprantl

Subscribers: aprantl, cfe-commits

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

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

7 years agoAdd comma to comment.
Gheorghe-Teodor Bercea [Tue, 13 Jun 2017 15:35:27 +0000 (15:35 +0000)]
Add comma to comment.

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

7 years ago[clang-format] Document the StartOfTokenColumn parameter, NFC
Krasimir Georgiev [Tue, 13 Jun 2017 14:58:55 +0000 (14:58 +0000)]
[clang-format] Document the StartOfTokenColumn parameter, NFC

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

7 years agoRevert "Revert r301742 which made ExprConstant checking apply to all full-exprs."
Diana Picus [Tue, 13 Jun 2017 12:50:06 +0000 (12:50 +0000)]
Revert "Revert r301742 which made ExprConstant checking apply to all full-exprs."

This reverts commit r305239 because it broke the buildbots (the
diag-flags.cpp test is failing).

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

7 years agoclang-format: add option to merge empty function body
Francois Ferrand [Tue, 13 Jun 2017 07:02:43 +0000 (07:02 +0000)]
clang-format: add option to merge empty function body

Summary:
This option supplements the AllowShortFunctionsOnASingleLine flag, to
merge empty function body at the beginning of the line: e.g. when the
function is not short-enough and breaking braces after function.

  int f()
  {}

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[docs] Add some ubsan changes to the release notes
Vedant Kumar [Tue, 13 Jun 2017 02:52:31 +0000 (02:52 +0000)]
[docs] Add some ubsan changes to the release notes

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

7 years agoRevert r301742 which made ExprConstant checking apply to all full-exprs.
Nick Lewycky [Mon, 12 Jun 2017 21:59:18 +0000 (21:59 +0000)]
Revert r301742 which made ExprConstant checking apply to all full-exprs.

This patch also exposed pre-existing bugs in clang, see PR32864 and PR33140#c3 .

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

7 years ago[ODRHash] Add diagnostic messages for typedef and type alias.
Richard Trieu [Mon, 12 Jun 2017 21:58:22 +0000 (21:58 +0000)]
[ODRHash] Add diagnostic messages for typedef and type alias.

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

7 years agoRevert r303316, a change to ExprConstant to evaluate function arguments.
Nick Lewycky [Mon, 12 Jun 2017 21:15:44 +0000 (21:15 +0000)]
Revert r303316, a change to ExprConstant to evaluate function arguments.

The patch was itself correct but it uncovered other bugs which are going to be difficult to fix, per PR33140.

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

7 years agoIR: Replace the "Linker Options" module flag with "llvm.linker.options" named metadata.
Peter Collingbourne [Mon, 12 Jun 2017 20:10:48 +0000 (20:10 +0000)]
IR: Replace the "Linker Options" module flag with "llvm.linker.options" named metadata.

The new metadata is easier to manipulate than module flags.

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

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

7 years agoCorrect debug info bit offset calculation for big-endian targets
Reid Kleckner [Mon, 12 Jun 2017 19:57:56 +0000 (19:57 +0000)]
Correct debug info bit offset calculation for big-endian targets

Summary:
The change "[CodeView] Implement support for bit fields in
Clang" (r274201, https://reviews.llvm.org/rL274201) broke the
calculation of bit offsets for the debug info describing bitfields on
big-endian targets.

Prior to commit r274201 the debug info for bitfields got their offsets
from the ASTRecordLayout in CGDebugInfo::CollectRecordFields(), the
current field offset was then passed on to
CGDebugInfo::CollectRecordNormalField() and used directly in the
DIDerivedType.

Since commit r274201, the bit offset ending up in the DIDerivedType no
longer comes directly from the ASTRecordLayout. Instead
CGDebugInfo::CollectRecordNormalField() calls the new method
CGDebugInfo::createBitFieldType(), which in turn calls
CodeGenTypes::getCGRecordLayout().getBitFieldInfo() to fetch a
CGBitFieldInfo describing the field. The 'Offset' member of
CGBitFieldInfo is then used to calculate the bit offset of the
DIDerivedType. Unfortunately the previous and current method of
calculating the bit offset are only equivalent for little endian
targets, as CGRecordLowering::setBitFieldInfo() reverses the bit
offsets for big endian targets as the last thing it does.

A simple reproducer for this error is the following module:

struct fields {
  unsigned a : 4;
  unsigned b : 4;
} flags = {0x0f, 0x1};

Compiled for Mips, with commit r274200 both the DIDerivedType bit
offsets on the IR-level and the DWARF information on the ELF-level
will have the expected values: the offsets of 'a' and 'b' are 0 and 4
respectively. With r274201 the offsets are switched to 4 and 0. By
noting that the static initialization of 'flags' in both cases is the
same, we can eliminate a change in record layout as the cause of the
change in the debug info. Also compiling this example with gcc,
produces the same record layout and debug info as commit r274200.

In order to restore the previous function we extend
CGDebugInfo::createBitFieldType() to compensate for the reversal done
in CGRecordLowering::setBitFieldInfo().

Patch by Frej Drejhammar!

Reviewers: cfe-commits, majnemer, rnk, aaboud, echristo, aprantl

Reviewed By: rnk, aprantl

Subscribers: aprantl, arichardson, frej

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

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

7 years agoRecommit r305117: [libclang] Merge multiple availability clauses when
Alex Lorenz [Mon, 12 Jun 2017 19:06:30 +0000 (19:06 +0000)]
Recommit r305117: [libclang] Merge multiple availability clauses when
getting the platform's availability

Patch by Ronald Wampler!

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

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

7 years ago[ubsan] Detect invalid unsigned pointer index expression (clang)
Vedant Kumar [Mon, 12 Jun 2017 18:42:51 +0000 (18:42 +0000)]
[ubsan] Detect invalid unsigned pointer index expression (clang)

Adding an unsigned offset to a base pointer has undefined behavior if
the result of the expression would precede the base. An example from
@regehr:

  int foo(char *p, unsigned offset) {
    return p + offset >= p; // This may be optimized to '1'.
  }

  foo(p, -1); // UB.

This patch extends the pointer overflow check in ubsan to detect invalid
unsigned pointer index expressions. It changes the instrumentation to
only permit non-negative offsets in pointer index expressions when all
of the GEP indices are unsigned.

Testing: check-llvm, check-clang run on a stage2, ubsan-instrumented
build.

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

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

7 years agoAddress David Blaikie comment by replacing grep with FileCheck.
Yaron Keren [Mon, 12 Jun 2017 18:29:37 +0000 (18:29 +0000)]
Address David Blaikie comment by replacing grep with FileCheck.

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

7 years agoAdd regression test for r305179.
Yaron Keren [Mon, 12 Jun 2017 18:05:13 +0000 (18:05 +0000)]
Add regression test for r305179.

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

7 years ago[analyzer] Fix a crash when an ObjC object is constructed in AllocaRegion.
Artem Dergachev [Mon, 12 Jun 2017 17:59:50 +0000 (17:59 +0000)]
[analyzer] Fix a crash when an ObjC object is constructed in AllocaRegion.

Memory region allocated by alloca() carries no implicit type information.
Don't crash when resolving the init message for an Objective-C object
that is being constructed in such region.

rdar://problem/32517077

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

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

7 years ago[Sema] Use the right FoldingSet.
George Burgess IV [Mon, 12 Jun 2017 17:44:30 +0000 (17:44 +0000)]
[Sema] Use the right FoldingSet.

We were doing FindNodeOrInsertPos on SubstTemplateTypeParmPackTypes, so
we should presumably be inserting into SubstTemplateTypeParmPackTypes.

Looks like the FoldingSet API can be tweaked a bit so that we can catch
things like this at compile-time. I'll look into that shortly.

I'm unsure of how to test this; suggestions welcome.

Thanks to Vladimir Voskresensky for bringing this up!

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

7 years ago[Sema][C++1z] Ensure binding in dependent range for have non-null type
Erik Pilkington [Mon, 12 Jun 2017 16:11:06 +0000 (16:11 +0000)]
[Sema][C++1z] Ensure binding in dependent range for have non-null type

Fixes PR32172

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

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

7 years agoRevert r305164/5/7.
Daniel Jasper [Mon, 12 Jun 2017 08:08:18 +0000 (08:08 +0000)]
Revert r305164/5/7.

cc1as does not currently access the "--" version of this flag. At the
very least this needs to be fixed and proper test cases need to be
added.

Simple reproducer:
clang -Wa,--compress-debug-sections /tmp/test.cc

Result:
error: unknown argument: '--compress-debug-sections'

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

7 years agoDon't crash when forming a destructor name on an incomplete type.
John McCall [Sun, 11 Jun 2017 20:33:00 +0000 (20:33 +0000)]
Don't crash when forming a destructor name on an incomplete type.

Fixes PR25156.

Patch by Don Hinton!

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

7 years agotest: attempt to repair build bots
Saleem Abdulrasool [Sun, 11 Jun 2017 18:55:17 +0000 (18:55 +0000)]
test: attempt to repair build bots

Split the no-ias tests and give them a target to ensure that they go
down the GNU toolchain path.  Adjust the no compression support tests.

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

7 years agoDriver: add support for `-gz` and `-gz=`
Saleem Abdulrasool [Sun, 11 Jun 2017 17:49:23 +0000 (17:49 +0000)]
Driver: add support for `-gz` and `-gz=`

These options control the behaviour of the compression of debug info
sections on ELF targets.  Our behaviour slightly diverges from the
behaviour of GCC.  `-gz` maps to the `-compress-debug-sections` rather
than `-compress-debug-sections=zlib` or
`-compress-debug-sections=zlib-gnu`.  This small divergence allows us to
be compatible across versions of binutils (=zlib support was introduced
in 2.26, while earlier versions only support =zlib-gnu).  This also
allows users to not have to worry about the version of the assembler
they may be using if they are not using the IAS.  Previously, users
would have had to go through the internal option
`-compress-debug-sectionss` and pass that through to the assembler,
which is no longer needed.

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

7 years agoDriver: pass along [-]-[no]compress-debug-sections unfiltered
Saleem Abdulrasool [Sun, 11 Jun 2017 17:49:17 +0000 (17:49 +0000)]
Driver: pass along [-]-[no]compress-debug-sections unfiltered

Rather than validating the flags, pass them through without any
validation.  Arguments passed via -Wa or -Xassembler are passed directly
to the assembler without validation.  The validation was previously
required since we did not provide proper driver level support for
controlling the debug compression on ELF targets.  A subsequent change
will add support for the `-gz` and `-gz=` flags which provide proper
driver level control of the ELF compressed debug sections.

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

7 years agoRevert "[clang] Implement -Wcast-qual for C++"
Roman Lebedev [Sat, 10 Jun 2017 17:49:23 +0000 (17:49 +0000)]
Revert "[clang] Implement -Wcast-qual for C++"

Breaks -Werror builders.

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

7 years ago[clang] Implement -Wcast-qual for C++
Roman Lebedev [Sat, 10 Jun 2017 17:19:19 +0000 (17:19 +0000)]
[clang] Implement -Wcast-qual for C++

Summary:
This way, the behavior of that warning flag
more closely resembles that of GCC.

Do note that there is at least one false-negative (see FIXME in tests).

Fixes PR4802.

Testing:
```
ninja check-clang-sema check-clang-semacxx
```

Reviewers: dblaikie, majnemer, rnk

Reviewed By: dblaikie, rnk

Subscribers: cfe-commits, alexfh, rnk

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

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

7 years agoRevert r305110 to fix buildbot
Richard Trieu [Fri, 9 Jun 2017 23:03:40 +0000 (23:03 +0000)]
Revert r305110 to fix buildbot

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

7 years agoSupport operator keywords used in Windows SDK(fix ubsan)
Erich Keane [Fri, 9 Jun 2017 22:50:02 +0000 (22:50 +0000)]
Support operator keywords used in Windows SDK(fix ubsan)

UBSan found an issue with a nullptr being assigned to a reference.
This was because a following function went back and checked the
identifier in the CPPOperatorName case.  This patch corrects that
location with the original logic as well.

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

7 years ago27037: Use correct CVR qualifier on an upcast on method pointer call
Richard Smith [Fri, 9 Jun 2017 22:25:28 +0000 (22:25 +0000)]
27037: Use correct CVR qualifier on an upcast on method pointer call

Patch by Taiju Tsuiki!

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

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

7 years ago[clang] Cleanup fixit.c
Alexander Shaposhnikov [Fri, 9 Jun 2017 22:20:52 +0000 (22:20 +0000)]
[clang] Cleanup fixit.c

This diff removes temporary file t2 in fixit.c and updates the test command accordingly.
NFC.

Test plan:
make check-all

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

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

7 years agoRevert r305117
Alex Lorenz [Fri, 9 Jun 2017 22:06:36 +0000 (22:06 +0000)]
Revert r305117

It caused `Index/availability.c` test failure on Linux

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

7 years agoAttempt to fix shared library build: RewriteFrontend depends on Serialization after...
Richard Smith [Fri, 9 Jun 2017 22:02:33 +0000 (22:02 +0000)]
Attempt to fix shared library build: RewriteFrontend depends on Serialization after r305116.

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

7 years ago[modules] D29951: Load lazily the template specialization in multi-module setups.
Vassil Vassilev [Fri, 9 Jun 2017 21:54:18 +0000 (21:54 +0000)]
[modules] D29951: Load lazily the template specialization in multi-module setups.

Currently, we load all template specialization if we have more than one module
attached and we touch anything around the template definition.

This patch registers the template specializations as lazily-loadable entities.
In some TUs it reduces the amount of deserializations by 1%.

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

7 years ago[modules] Fix that global delete operator get's assigned to a submodule.
Vassil Vassilev [Fri, 9 Jun 2017 21:36:28 +0000 (21:36 +0000)]
[modules] Fix that global delete operator get's assigned to a submodule.

n the current local-submodule-visibility mode, as soon as we discover a virtual
destructor, we declare on demand a global delete operator. However, this causes
that this delete operator is owned by the submodule which contains said virtual
destructor. This means that other modules no longer can see the global delete
operator which is hidden inside another submodule and fail to compile.

This patch unhides those global allocation function once they're created to
prevent this issue.

Patch by Raphael Isemann (D33366)!

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

7 years ago[libclang] Merge multiple availability clauses when getting the platform's
Alex Lorenz [Fri, 9 Jun 2017 21:29:45 +0000 (21:29 +0000)]
[libclang] Merge multiple availability clauses when getting the platform's
availability

Patch by Ronald Wampler!

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

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

7 years agoAdd -frewrite-imports flag.
Richard Smith [Fri, 9 Jun 2017 21:24:02 +0000 (21:24 +0000)]
Add -frewrite-imports flag.

If specified, when preprocessing, the contents of imported .pcm files will be
included in preprocessed output. The resulting preprocessed file can then be
compiled standalone without the module sources or .pcm files.

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

7 years ago[ODRHash] Add support for TemplateArgument types.
Richard Trieu [Fri, 9 Jun 2017 21:00:10 +0000 (21:00 +0000)]
[ODRHash] Add support for TemplateArgument types.

Recommit r304592 that was reverted in r304618.  r305104 should have fixed the
issue.

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

7 years ago[ODRHash] Skip inline namespaces when hashing.
Richard Trieu [Fri, 9 Jun 2017 20:11:51 +0000 (20:11 +0000)]
[ODRHash] Skip inline namespaces when hashing.

Speculatively try to fix the underlying issue from r304592, of underlying types
being confused when inline namespaces are used.

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

7 years agoBringt back -triple so the test passes on non-x86.
Benjamin Kramer [Fri, 9 Jun 2017 19:47:36 +0000 (19:47 +0000)]
Bringt back -triple so the test passes on non-x86.

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

7 years agoAdd #pragma clang module build/endbuild pragmas for performing a module build
Richard Smith [Fri, 9 Jun 2017 19:22:32 +0000 (19:22 +0000)]
Add #pragma clang module build/endbuild pragmas for performing a module build
as part of a compilation.

This is intended for two purposes:

1) Writing self-contained test cases for modules: we can now write a single
source file test that builds some number of module files on the side and
imports them.

2) Debugging / test case reduction. A single-source testcase is much more
amenable to reduction, compared to a VFS tarball or .pcm files.

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

7 years ago[ASTMatchers] Fix use after free.
Benjamin Kramer [Fri, 9 Jun 2017 17:55:42 +0000 (17:55 +0000)]
[ASTMatchers] Fix use after free.

Found by asan.

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

7 years agoRepair 2010-05-31-palignr.c test
Vassil Vassilev [Fri, 9 Jun 2017 16:42:26 +0000 (16:42 +0000)]
Repair 2010-05-31-palignr.c test

This test was silently failing since a long time because it failed to include
stdlib.h (as it's running in a freestanding environment). However, because we
 used just not clang_cc1 instead of the verify mode, this regression was never
 noticed and the test was just always passing.

This adds -ffreestanding to the invocation, so that tmmintrin.h doesn't
indirectly include mm_malloc.h, which in turns includes the unavailable stdlib.h.
We also run now in the -verify mode to prevent that we silently regress again.

I've also updated the test to no longer check the return value of _mm_alignr_epi8
as this is also causing it to fail (and it's not really the job of this test to
test this).

Patch by Raphael Isemann (D34022)

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

7 years agosupport operator keywords used in Windows SDK
Erich Keane [Fri, 9 Jun 2017 16:29:35 +0000 (16:29 +0000)]
support operator keywords used in Windows SDK

to support operator keywords used in Windows SDK, alter token type when
seen in system headers

Hello, I submitted D33505 to address this problem, but the
proposal was rejected as too big a hammer.
This change will allow clang to parse the WindowsSDK header <query.h>
which uses the operator name "or" as a field name. Treat cpp operator
keywords as ordinary identifiers inside the Microsoft headers, but
treat them as usual in the user's program.

Original Submitter: Melanie Blower (mibintc)

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

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

7 years ago[DebugInfo] Fix comment, NFC.
Alexey Bataev [Fri, 9 Jun 2017 13:55:08 +0000 (13:55 +0000)]
[DebugInfo] Fix comment, NFC.

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