]> granicus.if.org Git - clang/log
clang
7 years agoSilence unused variable warning. NFC.
Benjamin Kramer [Mon, 1 May 2017 20:00:23 +0000 (20:00 +0000)]
Silence unused variable warning. NFC.

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

7 years ago[sanitizer-coverage] add a deprecation note to coverage_direct=1
Kostya Serebryany [Mon, 1 May 2017 19:52:01 +0000 (19:52 +0000)]
[sanitizer-coverage] add a deprecation note to coverage_direct=1

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

7 years agoImprove handling of arrays of unknown bound in constant expressions.
Richard Smith [Mon, 1 May 2017 18:49:04 +0000 (18:49 +0000)]
Improve handling of arrays of unknown bound in constant expressions.

Do not spuriously reject constexpr functions that access elements of an array
of unknown bound; this may later become valid once the bound is known. Permit
array-to-pointer decay on such arrays, but disallow pointer arithmetic (since
we do not know whether it will have defined behavior).

The standard is not clear on how this should work, but this seems to be a
decent answer.

Patch by Robert Haberlach!

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

7 years agoAdapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC
Sanjoy Das [Mon, 1 May 2017 17:08:00 +0000 (17:08 +0000)]
Adapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC

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

7 years agoRelax testcase to fix a PS4 buildbot failure.
Adrian Prantl [Mon, 1 May 2017 15:49:40 +0000 (15:49 +0000)]
Relax testcase to fix a PS4 buildbot failure.

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

7 years agoThe -coverage-file flag was removed in r280306, and this piece was missed; NFC.
Aaron Ballman [Mon, 1 May 2017 13:05:04 +0000 (13:05 +0000)]
The -coverage-file flag was removed in r280306, and this piece was missed; NFC.

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

7 years agoRemove unneeded struct; NFC
Sanjoy Das [Mon, 1 May 2017 06:12:13 +0000 (06:12 +0000)]
Remove unneeded struct; NFC

Summary:
Unless I'm missing something, the DeferredGlobal struct's GV field is
unused, removing which makes the struct itself trivial.

Reviewers: rafael, chandlerc

Subscribers: mcrosier, llvm-commits

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

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

7 years agoFix test that was incorrected merged between patches.
Nick Lewycky [Mon, 1 May 2017 02:20:06 +0000 (02:20 +0000)]
Fix test that was incorrected merged between patches.

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

7 years agoFix line endings (dos -> unix) and clang-format while I'm here
David Blaikie [Mon, 1 May 2017 02:11:39 +0000 (02:11 +0000)]
Fix line endings (dos -> unix) and clang-format while I'm here

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

7 years agoHandle expressions with non-literal types like ignored expressions if we are supposed...
Nick Lewycky [Mon, 1 May 2017 02:03:23 +0000 (02:03 +0000)]
Handle expressions with non-literal types like ignored expressions if we are supposed to continue evaluating them.

Also fix a crash casting a derived nullptr to a virtual base.

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

7 years agoutils: Silence -Wpedantic warning
Saleem Abdulrasool [Mon, 1 May 2017 00:26:59 +0000 (00:26 +0000)]
utils: Silence -Wpedantic warning

llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp:1673:67: warning: default argument specified for lambda parameter [-Wpedantic]
                    const Record *Constraint = nullptr) {
                                               ^~~~~~~

Found by gcc 5.4.0.

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

7 years ago[X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)
Simon Pilgrim [Sat, 29 Apr 2017 17:17:06 +0000 (17:17 +0000)]
[X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)

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

7 years agoRemove Sema::CheckForIntOverflow, and instead check all full-expressions.
Nick Lewycky [Sat, 29 Apr 2017 09:33:46 +0000 (09:33 +0000)]
Remove Sema::CheckForIntOverflow, and instead check all full-expressions.

CheckForIntOverflow used to implement a whitelist of top-level expressions to
send to the constant expression evaluator, which handled many more expressions
than the CheckForIntOverflow whitelist did.

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

7 years agoFix PR32831: 'this capture while instantiating generic lambda call operator specializ...
Faisal Vali [Sat, 29 Apr 2017 03:49:17 +0000 (03:49 +0000)]
Fix PR32831: 'this capture while instantiating generic lambda call operator specialization

When computing the appropriate cv-qualifiers for the 'this' capture, we have to examine each enclosing lambda - but when using the FunctionScopeInfo stack we have to ensure that the lambda below (outer) is the decl-context of the closure-class of the current lambda.

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

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

7 years agoRemove some apparently-unnecessary 'REQUIRES: system-darwin' from tests.
Richard Smith [Sat, 29 Apr 2017 01:38:29 +0000 (01:38 +0000)]
Remove some apparently-unnecessary 'REQUIRES: system-darwin' from tests.

Let's see if any buildbots actually have trouble with these. (They at least pass on Linux.)

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

7 years agoFix "REQUIRES: system-darwin" failing tests after r301725.
Richard Smith [Sat, 29 Apr 2017 01:29:44 +0000 (01:29 +0000)]
Fix "REQUIRES: system-darwin" failing tests after r301725.

Also remove the apparently-unneeded REQUIRES (the tests also pass on at least
Linux, and don't appear to have anything Darwin-specific in them).

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

7 years agoPR26771: don't forget the " 2" (returning from #included file) linemarker after inclu...
Richard Smith [Sat, 29 Apr 2017 00:54:03 +0000 (00:54 +0000)]
PR26771: don't forget the " 2" (returning from #included file) linemarker after including an empty file with -frewrite-includes.

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

7 years agoRemove unused, empty test directories.
Richard Smith [Sat, 29 Apr 2017 00:46:27 +0000 (00:46 +0000)]
Remove unused, empty test directories.

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

7 years agoAdd pragma to perform module import and use it in -E output.
Richard Smith [Sat, 29 Apr 2017 00:34:47 +0000 (00:34 +0000)]
Add pragma to perform module import and use it in -E output.

Many of our supported configurations support modules but do not have any
first-class syntax to perform a module import. This leaves us with a problem:
there is no way to represent the expansion of a #include that imports a module
in the -E output for such languages. (We don't want to just leave it as a
#include because that requires the consumer of the preprocessed source to have
the same file system layout and include paths as the creator.)

This patch adds a new pragma:

  #pragma clang module import MODULE.NAME.HERE

that imports a module, and changes -E and -frewrite-includes to use it when
rewriting a #include that maps to a module import. We don't make any attempt
to use a native language syntax import if one exists, to get more consistent
output. (If in the future, @import and #include have different semantics in
some way, the pragma will track the #include semantics.)

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

7 years agoObjCBoxedExpr can't be evaluated by the constant expression evaluator.
Nick Lewycky [Sat, 29 Apr 2017 00:07:27 +0000 (00:07 +0000)]
ObjCBoxedExpr can't be evaluated by the constant expression evaluator.

A boxed expression evaluates its subexpr and then calls an objc method to transform it into another value with pointer type. The objc method can never be constexpr and therefore this expression can never be evaluated. Fixes a miscompile boxing expressions with side-effects.

Also make ObjCBoxedExpr handling a normal part of the expression evaluator instead of being the only case besides full-expression where we check for integer overflow.

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

7 years agoAdapt to LLVM API change (DINamespace no longer takes line/file info).
Adrian Prantl [Fri, 28 Apr 2017 22:25:53 +0000 (22:25 +0000)]
Adapt to LLVM API change (DINamespace no longer takes line/file info).

rdar://problem/17484998
https://reviews.llvm.org/D32648

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

7 years ago[ODRHash] Add testcase with different paramter names. NFC
Richard Trieu [Fri, 28 Apr 2017 22:03:28 +0000 (22:03 +0000)]
[ODRHash] Add testcase with different paramter names.  NFC

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

7 years agoEnable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.
David Blaikie [Fri, 28 Apr 2017 20:50:25 +0000 (20:50 +0000)]
Enable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.

Since -gsplit-dwarf is specified on a backend compile (in ThinLTO
parlance) it isn't passed during the frontend compile (because no ELF
object/dwo file is produced then), yet the -fno-split-dwarf-inlining
value needs to be encoded in the LLVM DebugInfo metadata to have
effect...

So let it be specified & it'll be silently ignored if -gsplit-dwarf
isn't used in the end, otherwise it'll be used on a per-cu basis
depending on where it's specified in the frontend compile actions.

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

7 years ago[CodeGen][ObjC] Don't retain captured Objective-C pointers at block
Akira Hatanaka [Fri, 28 Apr 2017 18:50:57 +0000 (18:50 +0000)]
[CodeGen][ObjC] Don't retain captured Objective-C pointers at block
creation that are const-qualified.

When a block captures an ObjC object pointer, clang retains the pointer
to prevent prematurely destroying the object the pointer points to
before the block is called or copied.

When the captured object pointer is const-qualified, we can avoid
emitting the retain/release pair since the pointer variable cannot be
modified in the scope in which the block literal is introduced.

For example:

void test(const id x) {
    callee(^{ (void)x; });
}

This patch implements that optimization.

rdar://problem/28894510

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

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

7 years ago[DOXYGEN] Minor improvements in doxygen comments.
Ekaterina Romanova [Fri, 28 Apr 2017 16:45:39 +0000 (16:45 +0000)]
[DOXYGEN] Minor improvements in doxygen comments.

- I removed doxygen comments for the intrinsics that "alias" the other existing documented intrinsics and that only sligtly differ in spelling (single underscores vs. double underscores).
 #define _tzcnt_u16(a)     (__tzcnt_u16((a)))

It will be very hard to keep the documentation for these "aliases" in sync with the documentation for the intrinsics they alias to. Out of sync documentation will be more confusing than no documentation.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

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

7 years ago[libclang] Expose some target information via the C API.
Emilio Cobos Alvarez [Fri, 28 Apr 2017 15:56:39 +0000 (15:56 +0000)]
[libclang] Expose some target information via the C API.

This allows users to query the target triple and target pointer width, which
would make me able to fix https://github.com/servo/rust-bindgen/issues/593 and
other related bugs in an elegant way (without having to manually parse the
target triple in the command line arguments).

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

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

7 years agoUse the -Wunknown-warning-option group for the "unknown warning group"
Alex Lorenz [Fri, 28 Apr 2017 14:45:25 +0000 (14:45 +0000)]
Use the -Wunknown-warning-option group for the "unknown warning group"
diagnostic in #pragma diagnostic

This matches the warning group that's specified for the unknown warning options
that are passed-in as command line arguments.

rdar://29526025

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

7 years ago[Sema] Avoid an invalid redefinition error that was presented for
Alex Lorenz [Fri, 28 Apr 2017 12:30:05 +0000 (12:30 +0000)]
[Sema] Avoid an invalid redefinition error that was presented for
of a function whose previous definition was typo-corrected

rdar://28550928

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

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

7 years ago[X86][SSE] Add _mm_set_pd1 (PR32827)
Simon Pilgrim [Fri, 28 Apr 2017 10:28:32 +0000 (10:28 +0000)]
[X86][SSE] Add _mm_set_pd1 (PR32827)

Matches _mm_set_ps1 implementation

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

7 years ago[index] Handle vector types in USR generator
Alex Lorenz [Fri, 28 Apr 2017 09:46:36 +0000 (09:46 +0000)]
[index] Handle vector types in USR generator

rdar://25339187

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

7 years agoclang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1).
NAKAMURA Takumi [Fri, 28 Apr 2017 05:02:52 +0000 (05:02 +0000)]
clang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1).

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

7 years agoclang/test/Index/index-module.m: Relax expressions to satisfy DOSish path separator...
NAKAMURA Takumi [Fri, 28 Apr 2017 04:17:31 +0000 (04:17 +0000)]
clang/test/Index/index-module.m: Relax expressions to satisfy DOSish path separator \\, since r301597.

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

7 years agoMove functionality for handling module maps as inputs from the -emit-module
Richard Smith [Fri, 28 Apr 2017 01:49:42 +0000 (01:49 +0000)]
Move functionality for handling module maps as inputs from the -emit-module
action to the general FrontendAction infrastructure.

This permits applying -E, -ast-dump, -fsyntax-only, and so on to a module map
compilation. (The -E form is not currently especially useful yet as there's no
good way to take the output and use it to actually build a module.)

In order to support this, -cc1 now accepts -x <lang>-module-map in all cases
where it accepts -x <lang> for a language we can parse (not ir/ast). And for
uniformity, we also accept -x <lang>-header for all such languages (we used
to reject for cuda and renderscript), and -x <lang>-cpp-output for all such
languages (we used to reject for c, cl, and renderscript).

(None of these new alternatives are accepted by the driver yet, so no
user-visible changes.)

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

7 years ago[ASTImporter] Move structural equivalence context to its own file. NFCI
Bruno Cardoso Lopes [Fri, 28 Apr 2017 00:31:30 +0000 (00:31 +0000)]
[ASTImporter] Move structural equivalence context to its own file. NFCI

Create a header and impl file for the structural equivalence context.
This is to allow other users outside clang importer. NFCI

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

rdar://problem/30167717

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

7 years ago[ARCMigrate] When applying changes from remap files, disable the 'adjustRemovals...
Argyrios Kyrtzidis [Fri, 28 Apr 2017 00:25:06 +0000 (00:25 +0000)]
[ARCMigrate] When applying changes from remap files, disable the 'adjustRemovals' functionality of EditedSource

'adjustRemovals' is used to avoid situation when removing a range inadvertently causes 2 separate identifiers to get joined into one.
But it is not useful when the edits are character precise, as is the case with the remap files.

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

7 years agoUse a consistent style. NFC
George Burgess IV [Thu, 27 Apr 2017 23:59:45 +0000 (23:59 +0000)]
Use a consistent style. NFC

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

7 years ago[Modules] Improve diagnostics for incomplete umbrella
Bruno Cardoso Lopes [Thu, 27 Apr 2017 22:29:14 +0000 (22:29 +0000)]
[Modules] Improve diagnostics for incomplete umbrella

One of the -Wincomplete-umbrella warnings diagnoses when a header is present in
the directory but it's not present in the umbrella header. Currently, this
warning only happens on top level modules; any submodule using an umbrella
header does not get this warning. Fix that by also considering the submodules.

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

rdar://problem/22623686

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

7 years ago[Modules] Refactor logic for incomplete umbrella warnings. NFC
Bruno Cardoso Lopes [Thu, 27 Apr 2017 22:29:10 +0000 (22:29 +0000)]
[Modules] Refactor logic for incomplete umbrella warnings. NFC

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

7 years agoHeaders: Make the type of SIZE_MAX the same as size_t
Duncan P. N. Exon Smith [Thu, 27 Apr 2017 21:49:45 +0000 (21:49 +0000)]
Headers: Make the type of SIZE_MAX the same as size_t

size_t is usually defined as unsigned long, but on 64-bit platforms,
stdint.h currently defines SIZE_MAX using "ull" (unsigned long long).
Although this is the same width, it doesn't necessarily have the same
alignment or calling convention.  It also triggers printf warnings when
using the format flag "%zu" to print SIZE_MAX.

This changes SIZE_MAX to reuse the compiler-provided __SIZE_MAX__, and
provides similar fixes for the other integers:

  - INTPTR_MIN
  - INTPTR_MAX
  - UINTPTR_MAX
  - PTRDIFF_MIN
  - PTRDIFF_MAX
  - INTMAX_MIN
  - INTMAX_MAX
  - UINTMAX_MAX
  - INTMAX_C()
  - UINTMAX_C()

... and fixes the typedefs for intptr_t and uintptr_t to use
__INTPTR_TYPE__ and __UINTPTR_TYPE__ instead of int32_t, effectively
reverting r89224, r89226, and r89237 (r89221 already having been
effectively reverted).

We can probably also kill __INTPTR_WIDTH__, __INTMAX_WIDTH__, and
__UINTMAX_WIDTH__ in a follow-up, but I was hesitant to delete all the
per-target CHECK lines in this commit since those might serve their own
purpose.

rdar://problem/11811377

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

7 years agoPreprocessor: Suppress -Wnonportable-include-path for header maps
Duncan P. N. Exon Smith [Thu, 27 Apr 2017 21:41:51 +0000 (21:41 +0000)]
Preprocessor: Suppress -Wnonportable-include-path for header maps

If a file search involves a header map, suppress
-Wnonportable-include-path.  It's firing lots of false positives for
framework authors internally, and it's not trivial to fix.

Consider a framework called "Foo" with a main (installed) framework header
"Foo/Foo.h".  It's atypical for "Foo.h" to actually live inside a
directory called "Foo" in the source repository.  Instead, the
build system generates a header map while building the framework.
If Foo.h lives at the top-level of the source repository (common), and
the git repo is called ssh://some.url/foo.git, then the header map will
have something like:

    Foo/Foo.h -> /Users/myname/code/foo/Foo.h

where "/Users/myname/code/foo" is the clone of ssh://some.url/foo.git.

After #import <Foo/Foo.h>, the current implementation of
-Wnonportable-include-path will falsely assume that Foo.h was found in a
nonportable way, because of the name of the git clone (.../foo/Foo.h).
However, that directory name was not involved in the header search at
all.

This commit adds an extra parameter to Preprocessor::LookupFile and
HeaderSearch::LookupFile to track if the search used a header map,
making it easy to suppress the warning.  Longer term, once we find a way
to avoid the false positive, we should turn the warning back on.

rdar://problem/28863903

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

7 years agolibclang: remove unused variable.
Tim Northover [Thu, 27 Apr 2017 20:22:40 +0000 (20:22 +0000)]
libclang: remove unused variable.

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

7 years agoAdded an Importer test for in-class member initializers.
Sean Callanan [Thu, 27 Apr 2017 18:10:29 +0000 (18:10 +0000)]
Added an Importer test for in-class member initializers.

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

7 years ago[Profile] Add off-by-default -Wprofile-instr-missing warning
Vedant Kumar [Thu, 27 Apr 2017 17:30:58 +0000 (17:30 +0000)]
[Profile] Add off-by-default -Wprofile-instr-missing warning

Clang warns that a profile is out-of-date if it can't find a profile
record for any function in a TU. This warning became noisy after llvm
started allowing dead-stripping of instrumented functions.

To fix this, this patch changes the existing profile out-of-date warning
(-Wprofile-instr-out-of-date) so that it only complains about mismatched
data. Further, it introduces a new, off-by-default warning about missing
function data (-Wprofile-instr-missing).

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

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

7 years ago[libclang] Enhance clang_Cursor_isDynamicCall and clang_Cursor_getReceiverType to...
Argyrios Kyrtzidis [Thu, 27 Apr 2017 17:23:04 +0000 (17:23 +0000)]
[libclang] Enhance clang_Cursor_isDynamicCall and clang_Cursor_getReceiverType to handle ObjC property references

Also enhance clang_Cursor_getReceiverType to handle C++ method calls.

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

7 years agoclang-cl: Alias /d1reportAllClassLayout to -fdump-record-layouts (PR32826)
Hans Wennborg [Thu, 27 Apr 2017 17:19:07 +0000 (17:19 +0000)]
clang-cl: Alias /d1reportAllClassLayout to -fdump-record-layouts (PR32826)

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

7 years agoFix -Wpedantic about extra semicolons in CGStmtOpenMP.cpp
Hans Wennborg [Thu, 27 Apr 2017 17:02:25 +0000 (17:02 +0000)]
Fix -Wpedantic about extra semicolons in CGStmtOpenMP.cpp

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

7 years agoRemove leaking UnknownPragmaHandlers right after we are done with them.
Vassil Vassilev [Thu, 27 Apr 2017 16:58:33 +0000 (16:58 +0000)]
Remove leaking UnknownPragmaHandlers right after we are done with them.

The UnknownPragmaHandlers added by DoPrintPreprocessedInput conflict with the
real PragmaHandlers from clang::Parser because they try to handle the same
#pragma directives. This makes it impossible to use a Preprocessor (that was
previously passed to DoPrintPreprocessedInput), as an Preprocessor for a
clang::Parser instance which is what we currently do in cling.

This patch removes the added UnknownPragmaHandler to avoid conflicts these
conflicts and leave the PragmaHandlers of the Preprocessors in a the same state
as before calling DoPrintPreprocessedInput.

Patch by Raphael Isemann (D32486)!

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

7 years ago[OPENMP] Add a check for iterator not reached the end of stack, NFC.
Alexey Bataev [Thu, 27 Apr 2017 15:10:33 +0000 (15:10 +0000)]
[OPENMP] Add a check for iterator not reached the end of stack, NFC.

Add an extra check for the iterator during checks of the data-sharing
attributes.

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

7 years ago[index] Mark the ObjC implicit accessor method definitions as 'dynamic' as well
Argyrios Kyrtzidis [Thu, 27 Apr 2017 15:05:18 +0000 (15:05 +0000)]
[index] Mark the ObjC implicit accessor method definitions as 'dynamic' as well

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

7 years ago[OPENMP] Improve performance of the hasDSA() function, NFC.
Alexey Bataev [Thu, 27 Apr 2017 14:46:26 +0000 (14:46 +0000)]
[OPENMP] Improve performance of the hasDSA() function, NFC.

Remove some unneccesary code from the function after the fix for ASAN
buildbots.

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

7 years ago[libclang] Pass in the -fallow-editor-placeholders option
Alex Lorenz [Thu, 27 Apr 2017 13:47:03 +0000 (13:47 +0000)]
[libclang] Pass in the -fallow-editor-placeholders option

This will suppress any live diagnostics caused by editor placeholders in Xcode.

rdar://31833579

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

7 years agoclang/test/Modules/malformed-overload.m: Make sure module cache is clean.
NAKAMURA Takumi [Thu, 27 Apr 2017 13:08:48 +0000 (13:08 +0000)]
clang/test/Modules/malformed-overload.m: Make sure module cache is clean.

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

7 years agoclang-format: [JS] parse async function declarations.
Martin Probst [Thu, 27 Apr 2017 13:07:24 +0000 (13:07 +0000)]
clang-format: [JS] parse async function declarations.

Summary:
Previously, clang-format would accidentally parse an async function
declaration as a function expression, and thus not insert an unwrapped
line for async functions, causing subsequent functions to run into the
function:

    async function f() {
      x();
    } function g() { ...

With this change, async functions get parsed as top level function
declarations and get their own unwrapped line context.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoFix asan failures on OpenMP.
Haojian Wu [Thu, 27 Apr 2017 12:22:33 +0000 (12:22 +0000)]
Fix asan failures on OpenMP.

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

7 years ago[X86] Support of no_caller_saved_registers attribute
Oren Ben Simhon [Thu, 27 Apr 2017 12:01:00 +0000 (12:01 +0000)]
[X86] Support of no_caller_saved_registers attribute

Implements the Clang part for no_caller_saved_registers attribute as appears here:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5ed3cc7b66af4758f7849ed6f65f4365be8223be.

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

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

7 years ago[ObjC] Disallow vector parameters and return values in Objective-C methods
Alex Lorenz [Thu, 27 Apr 2017 10:43:48 +0000 (10:43 +0000)]
[ObjC] Disallow vector parameters and return values in Objective-C methods
for iOS < 9 and OS X < 10.11 X86 targets

This commit adds a new error that disallows methods that have parameters/return
values with a vector type for some older X86 targets. This diagnostic is
needed because objc_msgSend doesn't support SIMD vector registers/return values
on X86 in iOS < 9 and OS X < 10.11. Note that we don't necessarily know if the
vector argument/return value will use a SIMD register, so instead we chose to
be conservative and prohibit all vector types.

rdar://21662309

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

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

7 years agoConstify SourceManager input to MacroInfo::getDefinitionLengthSlow, NFC.
Yaron Keren [Thu, 27 Apr 2017 09:56:39 +0000 (09:56 +0000)]
Constify SourceManager input to MacroInfo::getDefinitionLengthSlow, NFC.

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

7 years agoDon't hard-code "modules-cache-path" in the test.
Haojian Wu [Thu, 27 Apr 2017 09:20:46 +0000 (09:20 +0000)]
Don't hard-code "modules-cache-path" in the test.

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

7 years agoIn the expression evaluator, visit the index of an ArraySubscriptExpr even if we...
Nick Lewycky [Thu, 27 Apr 2017 07:27:36 +0000 (07:27 +0000)]
In the expression evaluator, visit the index of an ArraySubscriptExpr even if we can't evaluate the base, if the evaluation mode tells us to continue evaluation.

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

7 years agoIn the expression evaluator, descend into both the true and false expressions of...
Nick Lewycky [Thu, 27 Apr 2017 07:11:09 +0000 (07:11 +0000)]
In the expression evaluator, descend into both the true and false expressions of a ConditionalOperator when the condition can't be evaluated and we're in an evaluation mode that says we should continue evaluating.

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

7 years agoDarwin: Define __STDC_NO_THREADS__ on Darwin targets
Duncan P. N. Exon Smith [Thu, 27 Apr 2017 01:47:22 +0000 (01:47 +0000)]
Darwin: Define __STDC_NO_THREADS__ on Darwin targets

Darwin doesn't support C11 threads.h.  Define `__STDC_NO_THREADS__` so
that users can check for it.

rdar://problem/18461003

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

7 years agoImprove diagnostics for bad -std= flag.
Richard Smith [Thu, 27 Apr 2017 01:17:05 +0000 (01:17 +0000)]
Improve diagnostics for bad -std= flag.

Don't list deprecated -std= values (c++0x etc). Only produce one line of output
per standard, even if we know it by multiple names.

In passing, add missing -std=gnu++03 alias (supported by GCC), and add new
spelling '-std=cl1.0' for OpenCL 1.0 for consistency with the other values,
with the same meaning as the preexisting '-std=cl'.

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

7 years agoclang/Lex/PPCallbacks.h: Fix a warning in r301472. [-Wdocumentation]
NAKAMURA Takumi [Thu, 27 Apr 2017 00:09:42 +0000 (00:09 +0000)]
clang/Lex/PPCallbacks.h: Fix a warning in r301472. [-Wdocumentation]

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

7 years agoRemove unnecessary and somewhat inaccurate "C89" flag from language standards.
Richard Smith [Wed, 26 Apr 2017 23:49:57 +0000 (23:49 +0000)]
Remove unnecessary and somewhat inaccurate "C89" flag from language standards.

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

7 years agoDon't accept -std= values that would switch us to a different source language.
Richard Smith [Wed, 26 Apr 2017 23:44:33 +0000 (23:44 +0000)]
Don't accept -std= values that would switch us to a different source language.

We already prohibited this in most cases (in r130710), but had some bugs in our
enforcement of this rule. Specifically, this prevents the following
combinations:

 * -x c -std=clN.M, which would previously effectively act as if -x cl were
   used, despite the input being a C source file. (-x cl -std=cNN continues
   to be disallowed.)

 * -x c++ -std=cuda, which would previously select C++98 + CUDA, despite that
   not being a C++ standard. (-x cuda -std=c++NN is still permitted, and
   selects CUDA with the given C++ standard as its base language.
   -x cuda -std=cuda is still supported with the meaning of CUDA + C++98.)

 * -x renderscript -std=c++NN, which would previously form a hybrid "C++ with
   RenderScript extensions" language. We could support such a thing, but
   shouldn't do so by accident.

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

7 years agoRevert r301487: Replace HashString algorithm with xxHash64
Rui Ueyama [Wed, 26 Apr 2017 23:15:10 +0000 (23:15 +0000)]
Revert r301487: Replace HashString algorithm with xxHash64

This reverts commit r301487 to make buildbots green.

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

7 years agoReplace HashString algorithm with xxHash64
Rui Ueyama [Wed, 26 Apr 2017 22:45:04 +0000 (22:45 +0000)]
Replace HashString algorithm with xxHash64

The previous algorithm processed one character at a time, which is very
painful on a modern CPU. Replace it with xxHash64, which both already
exists in the codebase and is fairly fast.

Patch from Scott Smith!

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

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

7 years agoFix comment. NFC
George Burgess IV [Wed, 26 Apr 2017 22:37:38 +0000 (22:37 +0000)]
Fix comment. NFC

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

7 years ago[ubsan] nullability-assign: Check assignments into C++ structs
Vedant Kumar [Wed, 26 Apr 2017 21:55:17 +0000 (21:55 +0000)]
[ubsan] nullability-assign: Check assignments into C++ structs

Fix the nullability-assign check so that it can handle assignments into
C++ structs. Previously, such assignments were not instrumented.

Testing: check-clang, check-ubsan, enabling the existing test in ObjC++
mode, and building some Apple frameworks with -fsanitize=nullability.

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

7 years agoRevert "Revert "PPCallbacks::MacroUndefined, change signature and add test.""
Vedant Kumar [Wed, 26 Apr 2017 21:05:44 +0000 (21:05 +0000)]
Revert "Revert "PPCallbacks::MacroUndefined, change signature and add test.""

This reverts commit r301469. It isn't needed with r301470, which fixes
the API break introduced in the original commit.

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

7 years agoFix API breaks
David Blaikie [Wed, 26 Apr 2017 20:58:21 +0000 (20:58 +0000)]
Fix API breaks

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

7 years agoRevert "PPCallbacks::MacroUndefined, change signature and add test."
Vedant Kumar [Wed, 26 Apr 2017 20:58:19 +0000 (20:58 +0000)]
Revert "PPCallbacks::MacroUndefined, change signature and add test."

This reverts commit r301449. It breaks the build with:

  MacroPPCallbacks.h:114:50: error: non-virtual member function marked 'override' hides virtual member function

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

7 years ago[Modules] Fix a crash-on-invalid with overloaded functions
Bruno Cardoso Lopes [Wed, 26 Apr 2017 20:13:45 +0000 (20:13 +0000)]
[Modules] Fix a crash-on-invalid with overloaded functions

Do not add an overload if the function doesn't have a prototype; this
can happen if, for instance, a misplaced/malformed call site is
considered like a declaration for recovery purposes.

rdar://problem/31306325

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

7 years agoPPCallbacks::MacroUndefined, change signature and add test.
Frederich Munch [Wed, 26 Apr 2017 19:47:31 +0000 (19:47 +0000)]
PPCallbacks::MacroUndefined, change signature and add test.

Summary:
The PPCallbacks::MacroUndefined callback is currently insufficient for clients that need to track the MacroDirectives.
This patch adds an additional argument to PPCallbacks::MacroUndefined that is the undef MacroDirective.

Reviewers: bruno, manmanren

Reviewed By: bruno

Subscribers: nemanjai, cfe-commits

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

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

7 years agoRefactor frontend InputKind to prepare for treating module maps as a distinct kind...
Richard Smith [Wed, 26 Apr 2017 18:57:40 +0000 (18:57 +0000)]
Refactor frontend InputKind to prepare for treating module maps as a distinct kind of input.

No functionality change intended.

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

7 years agoRevert "Update to LLVM's use of WeakTrackingVH; NFC"
Sanjoy Das [Wed, 26 Apr 2017 16:37:51 +0000 (16:37 +0000)]
Revert "Update to LLVM's use of WeakTrackingVH; NFC"

This reverts commit r301427.

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

7 years agoUpdate to LLVM's use of WeakTrackingVH; NFC
Sanjoy Das [Wed, 26 Apr 2017 16:22:36 +0000 (16:22 +0000)]
Update to LLVM's use of WeakTrackingVH; NFC

Summary: Depends on D32266

Reviewers: davide, dblaikie

Subscribers: mcrosier, llvm-commits

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

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

7 years ago[Sema] Avoid using a null type pointer (fixes PR32750)
Vedant Kumar [Wed, 26 Apr 2017 15:40:21 +0000 (15:40 +0000)]
[Sema] Avoid using a null type pointer (fixes PR32750)

isMicrosoftMissingTypename() uses a Type pointer without first checking
that it's non-null. PR32750 reports a case where the pointer is in fact
null. This patch adds in a defensive check and a regression test.

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

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

7 years ago[OPENMP] Fix failing test.
Alexey Bataev [Wed, 26 Apr 2017 15:30:36 +0000 (15:30 +0000)]
[OPENMP] Fix failing test.

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

7 years ago[OPENMP] Fix handling of OpenMP code during template instantiation.
Alexey Bataev [Wed, 26 Apr 2017 15:06:24 +0000 (15:06 +0000)]
[OPENMP] Fix handling of OpenMP code during template instantiation.

If some function template is instantiated during handling of OpenMP
code, currently it may cause crash of compiler because of trying of
capturing variables in non-capturing function scopes. Patch fixes this
bug.

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

7 years ago[OPENMP] Move handling of threadprivate vars from the stack, NFC.
Alexey Bataev [Wed, 26 Apr 2017 14:24:21 +0000 (14:24 +0000)]
[OPENMP] Move handling of threadprivate vars from the stack, NFC.

Threadprivate variables do no need to be handled in the Stack of all
directives, moving it out for better performance and memory.

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

7 years ago-Wunguarded-availability should support if (@available) checks in top-level
Alex Lorenz [Wed, 26 Apr 2017 14:20:02 +0000 (14:20 +0000)]
-Wunguarded-availability should support if (@available) checks in top-level
blocks and lambdas

Prior to this commit Clang emitted the old "partial availability" warning for
expressions that referred to declarations that were not yet introduced in
blocks and lambdas that were not in a function/method. This commit ensures that
top-level blocks and lambdas use the new unguarded availability checks.

rdar://31835952

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

7 years ago-Wdocumentation should not check the @returns command for Objective-C
Alex Lorenz [Wed, 26 Apr 2017 13:09:28 +0000 (13:09 +0000)]
-Wdocumentation should not check the @returns command for Objective-C
function/block pointer properties

The commit r300981 allowed @param/@return commands for function/block
pointer property declarations. This meant that -Wdocumentation started warning
about @return that was used to document properties whose function/block type
returned void. However, prior to that commit, we allowed @return for all
property declarations, because it can be used to document the value that's
returned by the property getter. This commit restores the previous behaviour:
now the @return command can be used to document all properties without warnings.

rdar://24978538

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

7 years ago[AST] Look through attribute type locs when searching for function type
Alex Lorenz [Wed, 26 Apr 2017 12:46:27 +0000 (12:46 +0000)]
[AST] Look through attribute type locs when searching for function type
loc

Prior to this commit -Wdocumentation crashed when checking the @returns command
for declarations whose function/block pointer type included an attribute like
_Nullable.

rdar://31818195

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

7 years agoclang-format: [JS/Java] ignore Objective-C constructs in JS & Java.
Martin Probst [Wed, 26 Apr 2017 12:36:49 +0000 (12:36 +0000)]
clang-format: [JS/Java] ignore Objective-C constructs in JS & Java.

Summary:
Java and JavaScript support annotations and decorators, respectively, that use a leading "@" token. clang-format currently detects this as an Objective-C construct and applies special formatting, for example no whitespace around "=" operators. This change disables the distinction for Java and JavaScript, which leads to normal formatting of single line annotated and initialized properties.

Before:
    class X {
      @foo() bar=false;
    }

After:
    class X {
      @foo() bar = false;
    }

Reviewers: djasper, bkramer

Subscribers: klimek, cfe-commits

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

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

7 years agoformatting
Martin Probst [Wed, 26 Apr 2017 12:34:18 +0000 (12:34 +0000)]
formatting

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

7 years agoclang-format: [JS] prevent wraps before class members.
Martin Probst [Wed, 26 Apr 2017 12:34:15 +0000 (12:34 +0000)]
clang-format: [JS] prevent wraps before class members.

Summary: In JavaScript/TypeScript, class member definitions that use modifiers can be subject to Automatic Semicolon Insertion (ASI). For example, "class X { get \n foo }" defines a property called "get" and a property called "foo", both with no type annotation. This change prevents wrapping after the modifier keywords (visibility modifiers, static, get and set) to prevent accidental ASI.

Reviewers: djasper, bkramer

Subscribers: klimek, cfe-commits

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

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

7 years ago[analyzer] Teach the MallocChecker about Glib API for two arguments
Leslie Zhai [Wed, 26 Apr 2017 05:33:14 +0000 (05:33 +0000)]
[analyzer] Teach the MallocChecker about Glib API for two arguments

Reviewers: zaks.anna, NoQ, danielmarjamaki

Reviewed By: zaks.anna, NoQ, danielmarjamaki

Subscribers: cfe-commits, kalev, pwithnall

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

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

7 years ago[Modules][ObjC] Check definition from canonical decl on designated initializers
Bruno Cardoso Lopes [Wed, 26 Apr 2017 05:06:20 +0000 (05:06 +0000)]
[Modules][ObjC] Check definition from canonical decl on designated initializers

Use definition from canonical decl when checking for designated
initializers. This is necessary since deserialization of a interface
might reuse the definition from the canonical one (see r281119).

rdar://problem/29360655

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

7 years ago[ubsan] Skip alignment checks on allocas with known alignment
Vedant Kumar [Wed, 26 Apr 2017 02:17:21 +0000 (02:17 +0000)]
[ubsan] Skip alignment checks on allocas with known alignment

It's possible to determine the alignment of an alloca at compile-time.
Use this information to skip emitting some runtime alignment checks.

Testing: check-clang, check-ubsan.

This significantly reduces the amount of alignment checks we emit when
compiling X86ISelLowering.cpp. Here are the numbers from patched/unpatched
clangs based on r301361.

  ------------------------------------------
  | Setup          | # of alignment checks |
  ------------------------------------------
  | unpatched, -O0 |                 47195 |
  | patched, -O0   |                 30876 | (-34.6%)
  ------------------------------------------

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

7 years ago[asan] Unconditionally enable GC of globals on COFF.
Evgeniy Stepanov [Wed, 26 Apr 2017 00:51:06 +0000 (00:51 +0000)]
[asan] Unconditionally enable GC of globals on COFF.

This change restores pre-r301225 behavior, where linker GC compatible global
instrumentation was used on COFF targets disregarding -f(no-)data-sections and/or
/Gw flags.

This instrumentation puts each global in a COMDAT with an ASan descriptor for that global.
It effectively enables -fdata-sections, but limits it to ASan-instrumented globals.

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

7 years ago[Hexagon] Handle -O4 when checking optimization level
Krzysztof Parzyszek [Tue, 25 Apr 2017 21:31:55 +0000 (21:31 +0000)]
[Hexagon] Handle -O4 when checking optimization level

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

7 years ago[Hexagon] Set -ffp-contract=fast at -O3 unless explicitly specified
Krzysztof Parzyszek [Tue, 25 Apr 2017 20:51:51 +0000 (20:51 +0000)]
[Hexagon] Set -ffp-contract=fast at -O3 unless explicitly specified

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

7 years agoMinor fix for distribute_parallel_for_num_threads_codegen on AARCH64
Carlo Bertolli [Tue, 25 Apr 2017 18:59:37 +0000 (18:59 +0000)]
Minor fix for distribute_parallel_for_num_threads_codegen on AARCH64

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

7 years ago[PGO/tests] Update comment to reflect reality.
Davide Italiano [Tue, 25 Apr 2017 18:04:31 +0000 (18:04 +0000)]
[PGO/tests] Update comment to reflect reality.

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

7 years agoRecommit of
Carlo Bertolli [Tue, 25 Apr 2017 17:52:12 +0000 (17:52 +0000)]
Recommit of
[OpenMP] Initial implementation of code generation for pragma 'distribute parallel for' on host

https://reviews.llvm.org/D29508

This patch makes the following additions:

It abstracts away loop bound generation code from procedures associated with pragma 'for' and loops in general, in such a way that the same procedures can be used for 'distribute parallel for' without the need for a full re-implementation.
It implements code generation for 'distribute parallel for' and adds regression tests. It includes tests for clauses.
It is important to notice that most of the clauses are implemented as part of existing procedures. For instance, firstprivate is already implemented for 'distribute' and 'for' as separate pragmas. As the implementation of 'distribute parallel for' is based on the same procedures, then we automatically obtain implementation for such clauses without the need to add new code. However, this requires regression tests that verify correctness of produced code.

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

7 years ago[PGO] Update test now that we don't call IndirectCallPromotion.
Davide Italiano [Tue, 25 Apr 2017 17:48:10 +0000 (17:48 +0000)]
[PGO] Update test now that we don't call IndirectCallPromotion.

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

7 years ago[libclang] Check for a record declaration before a template specialization
Alex Lorenz [Tue, 25 Apr 2017 16:59:07 +0000 (16:59 +0000)]
[libclang] Check for a record declaration before a template specialization

Fixes PR32539.

Patch by Emilio Cobos Álvarez!

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

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

7 years ago[index] Index type source info for class specializations
Alex Lorenz [Tue, 25 Apr 2017 15:13:42 +0000 (15:13 +0000)]
[index] Index type source info for class specializations

rdar://31758344

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

7 years ago[index] Record the 'SpecializationOf' relation for function specializations
Alex Lorenz [Tue, 25 Apr 2017 14:22:29 +0000 (14:22 +0000)]
[index] Record the 'SpecializationOf' relation for function specializations

rdar://31603531

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