]> granicus.if.org Git - clang/log
clang
7 years ago[c++2a] Implement P0306 __VA_OPT__ (Comma omission and comma deletion)
Faisal Vali [Sun, 15 Oct 2017 01:26:26 +0000 (01:26 +0000)]
[c++2a] Implement P0306 __VA_OPT__ (Comma omission and comma deletion)

This patch implements an extension to the preprocessor:

__VA_OPT__(contents) --> which expands into its contents if variadic arguments are supplied to the parent macro, or behaves as an empty token if none.

  - Currently this feature is only enabled for C++2a (this could be enabled, with some careful tweaks, for other dialects with the appropriate extension or compatibility warnings)

  - The patch was reviewed here: https://reviews.llvm.org/D35782 and asides from the above (and moving some of the definition and expansion recognition logic into the corresponding state machines), I believe I incorporated all of Richard's suggestions.

A few technicalities (most of which were clarified through private correspondence between rsmith, hubert and thomas) are worth mentioning.  Given:

    #define F(a,...) a #__VA_OPT__(a ## a)  a ## __VA_OPT__(__VA_ARGS__)

    - The call F(,) Does not supply any tokens for the variadic arguments and hence VA_OPT behaves as a placeholder.
    - When expanding VA_OPT (for e.g. F(,1) token pasting occurs eagerly within its contents if the contents need to be stringified.
    - A hash or a hashhash prior to VA_OPT does not inhibit expansion of arguments if they are the first token within VA_OPT.
    - When a variadic argument is supplied, argument substitution occurs within the contents as does stringification - and these resulting tokens are inserted back into the macro expansions token stream just prior to the entire stream being rescanned and concatenated.

See wg21.link/P0306 for further details on the feature.

Acknowledgment: This patch would have been poorer if not for Richard Smith's usual thoughtful analysis and feedback.

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

7 years agoRevert "Mark test as unsupported until r315808 is fixed"
Konstantin Zhuravlyov [Sat, 14 Oct 2017 22:24:31 +0000 (22:24 +0000)]
Revert "Mark test as unsupported until r315808 is fixed"

Test is fixed in r315830

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

7 years agoMark test as unsupported until r315808 is fixed
Bruno Cardoso Lopes [Sat, 14 Oct 2017 22:14:23 +0000 (22:14 +0000)]
Mark test as unsupported until r315808 is fixed

This is causing:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/43381

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

7 years agoRe-land r315787, "[Sema] Warn about unused variables if we can constant evaluate...
Benjamin Kramer [Sat, 14 Oct 2017 15:59:34 +0000 (15:59 +0000)]
Re-land r315787, "[Sema] Warn about unused variables if we can constant evaluate the initializer."

The warnings in libc++ tests were fixed in the meantime.

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

7 years agoRevert rL315787, "[Sema] Warn about unused variables if we can constant evaluate...
NAKAMURA Takumi [Sat, 14 Oct 2017 14:46:04 +0000 (14:46 +0000)]
Revert rL315787, "[Sema] Warn about unused variables if we can constant evaluate the initializer."

check-libcxx dislikes it.

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

7 years agoFix build failure on android due to missing std::to_string()
Yaxun Liu [Sat, 14 Oct 2017 12:51:52 +0000 (12:51 +0000)]
Fix build failure on android due to missing std::to_string()

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

7 years ago[OpenCL] Emit enqueued block as kernel
Yaxun Liu [Sat, 14 Oct 2017 12:23:50 +0000 (12:23 +0000)]
[OpenCL] Emit enqueued block as kernel

In OpenCL the kernel function and non-kernel function has different calling conventions.
For certain targets they have different argument ABIs. Also kernels have special function
attributes and metadata for runtime to launch them.

The blocks passed to enqueue_kernel is supposed to be executed as kernels. As such,
the block invoke function should be emitted as kernel with proper calling convention and
argument ABI.

This patch emits enqueued block as kernel. If a block is both called directly and passed
to enqueue_kernel, separate functions will be generated.

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

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

7 years ago[Sema] Warn about unused variables if we can constant evaluate the initializer.
Benjamin Kramer [Sat, 14 Oct 2017 01:30:49 +0000 (01:30 +0000)]
[Sema] Warn about unused variables if we can constant evaluate the initializer.

If the variable construction can be constant evaluated it doesn't have
side effects, so removing it is always safe. We only try to evaluate
variables that are unused, there should be no impact on compile time.

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

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

7 years ago[ubsan] Don't emit function signatures for non-static member functions
Vedant Kumar [Sat, 14 Oct 2017 01:23:30 +0000 (01:23 +0000)]
[ubsan] Don't emit function signatures for non-static member functions

The function sanitizer only checks indirect calls through function
pointers. This excludes all non-static member functions (constructor
calls, calls through thunks, etc. all use a separate code path). Don't
emit function signatures for functions that won't be checked.

Apart from cutting down on code size, this should fix a regression on
Linux caused by r313096. For context, see the mailing list discussion:

r313096 - [ubsan] Function Sanitizer: Don't require writable text segments

Testing: check-clang, check-ubsan

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

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

7 years ago[Lex] Avoid out-of-bounds dereference in SkipLineComment
Alex Lorenz [Sat, 14 Oct 2017 01:18:30 +0000 (01:18 +0000)]
[Lex] Avoid out-of-bounds dereference in SkipLineComment

Credit to OSS-Fuzz for discovery:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3145

rdar://34526482

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

7 years agoFix backwards warning for use of C++17 attributes-on-namespaces-and-enumerators feature.
Richard Smith [Sat, 14 Oct 2017 00:56:24 +0000 (00:56 +0000)]
Fix backwards warning for use of C++17 attributes-on-namespaces-and-enumerators feature.

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

7 years agoAllow building libFuzzer tests in two-stage compiler-rt build.
George Karpenkov [Fri, 13 Oct 2017 23:50:53 +0000 (23:50 +0000)]
Allow building libFuzzer tests in two-stage compiler-rt build.

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

7 years agoRevert r315738
Alex Lorenz [Fri, 13 Oct 2017 22:47:44 +0000 (22:47 +0000)]
Revert r315738

The ParsedSourceRange class does not work correctly on Windows with the ':'
drive separators

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

7 years ago[Sema] Avoid iterator invalidation when code completing.
Benjamin Kramer [Fri, 13 Oct 2017 22:14:34 +0000 (22:14 +0000)]
[Sema] Avoid iterator invalidation when code completing.

It's possible for the code completion consumer to add new decls to the
current scope while lookup happens on it. Avoid this by making a copy
first.

Sadly I wasn't able to get a self-contained test case for this as it
requires code completion + precompiled preamble + the stars aligning to
deserialize at exactly the right time.

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

7 years agoAllow building libFuzzer in two-stage compiler-rt build
George Karpenkov [Fri, 13 Oct 2017 22:03:09 +0000 (22:03 +0000)]
Allow building libFuzzer in two-stage compiler-rt build

When LLVM_BUILD_EXTERNAL_COMPILER_RT option is set to true,
all of projects in compiler-rt are built with a freshly-built compiler using
a recursive CMake invocation.
(e.g. that's how compiler-rt is used in Swift)

Just now I have noticed that libFuzzer binaries were missing in such a case,
and ninja fuzzer returned "no such target", while ninja asan worked just fine.

To my surprise, the list of allowed targets was actually hardcoded in Clang!
While the current setup is clearly suboptimal, for the lack of a better fix
I'm just adding `fuzzer` to a list of `compiler-rt` targets.

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

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

7 years agoFix -Woverloaded-virtual warning in clang-refactor
Alex Lorenz [Fri, 13 Oct 2017 21:15:25 +0000 (21:15 +0000)]
Fix -Woverloaded-virtual warning in clang-refactor

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

7 years ago[analyzer] pr28449: Fix support for various array initializers.
Artem Dergachev [Fri, 13 Oct 2017 20:54:56 +0000 (20:54 +0000)]
[analyzer] pr28449: Fix support for various array initializers.

In some cases the analyzer didn't expect an array-type variable to be
initialized with anything other than a string literal. The patch essentially
removes the assertion, and ensures relatively sane behavior.

There is a bigger problem with these initializers. Currently our memory model
(RegionStore) is being ordered to initialize the array with a region that
is assumed to be storing the initializer rvalue, and it guesses to copy
the contents of that region to the array variable. However, it would make
more sense for RegionStore to receive the correct initializer in the first
place. This problem isn't addressed with this patch.

rdar://problem/27248428
Differential Revision: https://reviews.llvm.org/D23963

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

7 years ago[analyzer] CStringChecker: pr34460: Avoid a crash when a cast is not modeled.
Artem Dergachev [Fri, 13 Oct 2017 20:11:00 +0000 (20:11 +0000)]
[analyzer] CStringChecker: pr34460: Avoid a crash when a cast is not modeled.

The checker used to crash when a mempcpy's length argument is symbolic. In this
case the cast from 'void *' to 'char *' failed because the respective
ElementRegion that represents cast is hard to add on top of the existing
ElementRegion that represents the offset to the last copied byte, while
preseving a sane memory region structure.

Additionally, a few test cases are added (to casts.c) which demonstrate problems
caused by existing sloppy work we do with multi-layer ElementRegions. If said
cast would be modeled properly in the future, these tests would need to be
taken into account.

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

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

7 years agoBasic: adjust attributes on `nan` LIBBUILTINs
Saleem Abdulrasool [Fri, 13 Oct 2017 20:07:30 +0000 (20:07 +0000)]
Basic: adjust attributes on `nan` LIBBUILTINs

The `nan` family of functions will inspect the contents of the parameter
that they are passed. As a result, the function cannot be annotated as
`const`.  The documentation of the `const` attribute explicitly states
this:
  Note that a function that has pointer arguments and examines the data
  pointed to must not be declared const.
Adjust the annotations on this family of functions.

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

7 years agoRevert "[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue...
Ivan A. Kosarev [Fri, 13 Oct 2017 19:55:01 +0000 (19:55 +0000)]
Revert "[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info", r315731.

With this change we fail on the clang-x86_64-linux-selfhost-modules builder.

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

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

7 years ago[clang-refactor] Apply source replacements
Alex Lorenz [Fri, 13 Oct 2017 19:42:05 +0000 (19:42 +0000)]
[clang-refactor] Apply source replacements

This commit actually brings clang-refactor to a usable state as it can now
apply the refactoring changes to source files.
The -selection option is now also fully supported.

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

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

7 years ago[analyzer] RetainCount: Ignore annotations on user-made CFRetain wrappers.
Artem Dergachev [Fri, 13 Oct 2017 19:10:42 +0000 (19:10 +0000)]
[analyzer] RetainCount: Ignore annotations on user-made CFRetain wrappers.

It is not uncommon for the users to make their own wrappers around
CoreFoundation's CFRetain and CFRelease functions that are defensive
against null references. In such cases CFRetain is often incorrectly
marked as CF_RETURNS_RETAINED. Ignore said annotation and treat such
wrappers similarly to the regular CFRetain.

rdar://problem/31699502
Differential Revision: https://reviews.llvm.org/D38877

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

7 years ago[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base...
Ivan A. Kosarev [Fri, 13 Oct 2017 18:40:18 +0000 (18:40 +0000)]
[CodeGen] EmitPointerWithAlignment() to generate TBAA info along with LValue base info

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

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

7 years ago[X86] Remove 'knm' defines from predefined-arch-macros.c test.
Craig Topper [Fri, 13 Oct 2017 18:38:10 +0000 (18:38 +0000)]
[X86] Remove 'knm' defines from predefined-arch-macros.c test.

Direction seems to be that we dont' want to keep adding these, but I forgot to remove it from the test before I committed r315723.

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

7 years ago[X86] Add skeleton support for knm cpu
Craig Topper [Fri, 13 Oct 2017 18:14:24 +0000 (18:14 +0000)]
[X86] Add skeleton support for knm cpu

This adds support Knights Mill CPU. Preprocessor defines match gcc's implementation.

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

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

7 years ago[CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue base...
Ivan A. Kosarev [Fri, 13 Oct 2017 17:34:18 +0000 (17:34 +0000)]
[CodeGen] emitOMPArraySectionBase() to generate TBAA info along with LValue base info

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

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

7 years agoRevert "[lit] Raise the logic for enabling clang & lld substitutions to llvm."
Bruno Cardoso Lopes [Fri, 13 Oct 2017 17:11:13 +0000 (17:11 +0000)]
Revert "[lit] Raise the logic for enabling clang & lld substitutions to llvm."

This reverts commit r315627, fixing bot failures:
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA

LIT is failing to properly apply substitution to debuginfo-tests
after this change.

rdar://problem/34979568

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

7 years ago[CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base...
Ivan A. Kosarev [Fri, 13 Oct 2017 16:58:30 +0000 (16:58 +0000)]
[CodeGen] getNaturalTypeAlignment() to generate TBAA info along with LValue base info

This patch should not bring in any functional changes.

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

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

7 years ago[SEH] Use the SEH personality on frontend-outlined funclets
Reid Kleckner [Fri, 13 Oct 2017 16:55:14 +0000 (16:55 +0000)]
[SEH] Use the SEH personality on frontend-outlined funclets

This allows __try inside __finally to work.

Fixes PR34939

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

7 years ago[CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base info
Ivan A. Kosarev [Fri, 13 Oct 2017 16:50:50 +0000 (16:50 +0000)]
[CodeGen] EmitLoadOfReference() to generate TBAA info along with LValue base info

This patch should not bring in any functional changes.

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

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

7 years ago[CodeGen] EmitLoadOfPointer() to generate TBAA info along with LValue base info
Ivan A. Kosarev [Fri, 13 Oct 2017 16:47:22 +0000 (16:47 +0000)]
[CodeGen] EmitLoadOfPointer() to generate TBAA info along with LValue base info

This patch should not bring in any functional changes.

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

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

7 years ago[CodeGen] EmitCXXMemberDataPointerAddress() to generate TBAA info along with LValue...
Ivan A. Kosarev [Fri, 13 Oct 2017 16:38:32 +0000 (16:38 +0000)]
[CodeGen] EmitCXXMemberDataPointerAddress() to generate TBAA info along with LValue base info

This patch should not bring in any functional changes.

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

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

7 years agoHide "#pragma optimize("", off)" from clang when it pretends to be MSVC 2017
Reid Kleckner [Fri, 13 Oct 2017 16:18:32 +0000 (16:18 +0000)]
Hide "#pragma optimize("", off)" from clang when it pretends to be MSVC 2017

These pragmas work around a bug in VC 1911 that isn't present in clang,
and clang warns about them.

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

7 years agoFix an unused-variable warning.
Haojian Wu [Fri, 13 Oct 2017 15:37:53 +0000 (15:37 +0000)]
Fix an unused-variable warning.

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

7 years agoRemove an unused variable.
Haojian Wu [Fri, 13 Oct 2017 15:34:03 +0000 (15:34 +0000)]
Remove an unused variable.

Fix -Wunused-but-set-variable warning.

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

7 years agoFix regression of test/CodeGenOpenCL/address-spaces.cl on ppc
Yaxun Liu [Fri, 13 Oct 2017 13:53:06 +0000 (13:53 +0000)]
Fix regression of test/CodeGenOpenCL/address-spaces.cl on ppc

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

7 years ago[OpenCL] Add LangAS::opencl_private to represent private address space in AST
Yaxun Liu [Fri, 13 Oct 2017 03:37:48 +0000 (03:37 +0000)]
[OpenCL] Add LangAS::opencl_private to represent private address space in AST

Currently Clang uses default address space (0) to represent private address space for OpenCL
in AST. There are two issues with this:

Multiple address spaces including private address space cannot be diagnosed.
There is no mangling for default address space. For example, if private int* is emitted as
i32 addrspace(5)* in IR. It is supposed to be mangled as PUAS5i but it is mangled as
Pi instead.

This patch attempts to represent OpenCL private address space explicitly in AST. It adds
a new enum LangAS::opencl_private and adds it to the variable types which are implicitly
private:

automatic variables without address space qualifier

function parameter

pointee type without address space qualifier (OpenCL 1.2 and below)

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

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

7 years ago[clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA
Alexander Shaposhnikov [Fri, 13 Oct 2017 03:21:39 +0000 (03:21 +0000)]
[clang] Enable clang build with LLVM_BUILD_INSTRUMENTED without setting LLVM_PROFTDATA

At the moment if LLVM_BUILD_INSTRUMENTED is set to True
one has to set LLVM_PROFTDATA even if it's not really used
(because of message(FATAL_ERROR ...)).
Building the instrumented version of Clang can be useful even if
one doesn't plan to build the target generate-profdata
(currently that target would only compile utils/perf-training/cxx/hello_world.cpp).
For example, one can run the instrumented version of Clang
via a separate build system against a different codebase,
collect/analyze the profiles and merge them by llvm-profdata later.

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

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

7 years agoSupport for destroying operator delete, per C++2a proposal P0722.
Richard Smith [Fri, 13 Oct 2017 01:55:36 +0000 (01:55 +0000)]
Support for destroying operator delete, per C++2a proposal P0722.

This feature is not (yet) approved by the C++ committee, so this is liable to
be reverted or significantly modified based on committee feedback.

No functionality change intended for existing code (a new type must be defined
in namespace std to take advantage of this feature).

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

7 years agoRecommit r315087 "[refactor] add support for refactoring options"
Alex Lorenz [Fri, 13 Oct 2017 01:53:13 +0000 (01:53 +0000)]
Recommit r315087 "[refactor] add support for refactoring options"

The recommit fixes a UB bug that occurred only on a small number of bots.

Original message:

This commit adds initial support for refactoring options. One can now use
optional and required std::string options.

This commit also adds a NewNameOption for the local-rename refactoring action to
allow rename to work with custom names.

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

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

7 years ago[MS] Don't bail on replacing dllimport vbase dtors with base dtors
Reid Kleckner [Fri, 13 Oct 2017 00:53:02 +0000 (00:53 +0000)]
[MS] Don't bail on replacing dllimport vbase dtors with base dtors

Fix PR32990 by effectively reverting r283063 and solving it a different
way.

We want to limit the hack to not replace equivalent available_externally
dtors specifically to libc++, which uses always_inline. It seems certain
versions of libc++ do not provide all the symbols that an explicit
template instantiation is expected to provide.

If we get to the code that forms a real alias, only *then* check if this
is available_externally, and do that by asking a better question, which
is "is this a declaration for the linker?", because *that's* what means
we can't form an alias to it.

As a follow-on simplification, remove the InEveryTU parameter. Its last
use guarded this code for forming aliases, but we should never form
aliases to declarations, regardless of what we know about every TU.

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

7 years ago[Analyzer] Assume that CFBooleanRef const globals are non-null
George Karpenkov [Fri, 13 Oct 2017 00:51:41 +0000 (00:51 +0000)]
[Analyzer] Assume that CFBooleanRef const globals are non-null

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

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

7 years agoTypos in tutorial
Jan Korous [Fri, 13 Oct 2017 00:31:07 +0000 (00:31 +0000)]
Typos in tutorial

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

7 years agoHandle/assert on DK_Remark
Adam Nemet [Thu, 12 Oct 2017 23:56:54 +0000 (23:56 +0000)]
Handle/assert on DK_Remark

We don't generate remarks during inline assembly parsing so no need to handle
these for now.

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

7 years ago[Sema][ObjC] Complete merging ObjC methods before checking their
Akira Hatanaka [Thu, 12 Oct 2017 23:24:38 +0000 (23:24 +0000)]
[Sema][ObjC] Complete merging ObjC methods before checking their
overriding methods.

This should fix test case Analysis/retain-release.m that was failing on
the reverse iteration bot:

http://lab.llvm.org:8011/builders/reverse-iteration

The test used to fail because the loop in CheckObjCMethodOverrides would
merge attribute ns_returns_retained on methods while checking whether
the overriding methods were compatible. Since OverrideSearch::Overridden
is a SmallPtrSet and the order in which the elements of the set are
visited is non-deterministic, the test would fail when method 'clone' of
the protocol 'F18P' was visited before F18(Cat)'s method 'clone' was
visited.

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

7 years ago[Sema][Crash] Correctly handle an non-dependent noexcept expr in function template
Erich Keane [Thu, 12 Oct 2017 23:01:53 +0000 (23:01 +0000)]
[Sema][Crash] Correctly handle an non-dependent noexcept expr in function template

It seems that all of the other templated cases are handled correctly,
however the function template case was not correctly handled. This
patch recovers from this condition by setting the function to noexcept
after diagnosing. Previously it simply set NoexceptExpr to null,
which caused an Assert when this was evaluated during substitution.

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

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

7 years agoRevert "[Sema] Diagnose tautological comparison with type's min/max values"
Roman Lebedev [Thu, 12 Oct 2017 22:03:20 +0000 (22:03 +0000)]
Revert "[Sema] Diagnose tautological comparison with type's min/max values"

This reverts r315614,r315615,r315621,r315622
Breaks http://bb9.pgr.jp/#/builders/20/builds/59

/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:95:17: error: comparison 'long long' > 9223372036854775807 is always false [-Werror,-Wtautological-constant-compare]
    if (max_sec > Lim::max()) return false;
        ~~~~~~~ ^ ~~~~~~~~~~
/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:13: error: comparison 'long long' < -9223372036854775808 is always false [-Werror,-Wtautological-constant-compare]
    if (sec < Lim::min() || sec > Lim::max())   return false;
        ~~~ ^ ~~~~~~~~~~
/home/bb9/bootstrap-clang-libcxx-lld-i686-linux/llvm-project/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp:124:33: error: comparison 'long long' > 9223372036854775807 is always false [-Werror,-Wtautological-constant-compare]
    if (sec < Lim::min() || sec > Lim::max())   return false;
                            ~~~ ^ ~~~~~~~~~~
3 errors generated.
--

I'm not yet sure what is the proper fix.

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

7 years ago[cmake] Rename LIB_FUZZING_ENGINE to LLVM_LIB_FUZZING_ENGINE.
Matt Morehouse [Thu, 12 Oct 2017 22:00:09 +0000 (22:00 +0000)]
[cmake] Rename LIB_FUZZING_ENGINE to LLVM_LIB_FUZZING_ENGINE.

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

7 years ago[lit] Raise the logic for enabling clang & lld substitutions to llvm.
Zachary Turner [Thu, 12 Oct 2017 21:56:05 +0000 (21:56 +0000)]
[lit] Raise the logic for enabling clang & lld substitutions to llvm.

This paves the way for other projects which might /use/ clang or
lld but not necessarily need to the full set of functionality
available to clang and lld tests to be able to have a basic set
of substitutions that allow a project to run the clang or lld
executables.

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

7 years ago[CUDA] Added __hmma_m16n16k16_* builtins to support mma instructions on sm_70
Artem Belevich [Thu, 12 Oct 2017 21:32:19 +0000 (21:32 +0000)]
[CUDA] Added __hmma_m16n16k16_* builtins to support mma instructions on sm_70

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

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

7 years ago[Analysis] Un-silence -Wtautological-unsigned-zero-compare in null-deref-ps.c
Roman Lebedev [Thu, 12 Oct 2017 21:15:26 +0000 (21:15 +0000)]
[Analysis] Un-silence -Wtautological-unsigned-zero-compare in null-deref-ps.c

Stage-2 builds failed:

error: 'warning' diagnostics expected but not seen:
  File /home/buildbot/modules-slave-2/clang-x86_64-linux-selfhost-modules-2/llvm.src/tools/clang/test/Analysis/null-deref-ps.c Line 238: always true

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

7 years ago[SemaChecking] Suppress a GCC warning. NFCI.
Davide Italiano [Thu, 12 Oct 2017 21:08:29 +0000 (21:08 +0000)]
[SemaChecking] Suppress a GCC warning. NFCI.

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

7 years ago[Analysis] Silence -Wtautological-constant-compare in two tests
Roman Lebedev [Thu, 12 Oct 2017 20:27:41 +0000 (20:27 +0000)]
[Analysis] Silence -Wtautological-constant-compare in two tests

Yes, did not check that. Need to do better :(
I do not believe it makes sense to do expect that warning here.

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

7 years ago[Sema] Diagnose tautological comparison with type's min/max values
Roman Lebedev [Thu, 12 Oct 2017 20:16:51 +0000 (20:16 +0000)]
[Sema] Diagnose tautological comparison with type's min/max values

Summary:
Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`),
and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the
`std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak

Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147
Continuation of https://reviews.llvm.org/D37565

Reviewers: rjmccall, rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: rtrieu, jroelofs, cfe-commits

Tags: #clang

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

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

7 years ago[OPENMP] Fix PR34927: Emit initializer for reduction array with declare
Alexey Bataev [Thu, 12 Oct 2017 20:03:39 +0000 (20:03 +0000)]
[OPENMP] Fix PR34927: Emit initializer for reduction array with declare
reduction.

If the reduction is an array or an array section and reduction operation
is declare reduction without initializer, it may lead to crash.

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

7 years ago[X86] Add CLWB intrinsic. clang part
Craig Topper [Thu, 12 Oct 2017 18:57:15 +0000 (18:57 +0000)]
[X86] Add CLWB intrinsic. clang part

Reviewers: RKSimon, zvi, igorb

Reviewed By: RKSimon

Subscribers: cfe-commits

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

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

7 years ago[clang-format] Allow building fuzzer with OSS-Fuzz flags.
Matt Morehouse [Thu, 12 Oct 2017 18:39:10 +0000 (18:39 +0000)]
[clang-format] Allow building fuzzer with OSS-Fuzz flags.

Reviewers: kcc, bogner

Reviewed By: kcc

Subscribers: cfe-commits, mgorny

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

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

7 years ago[X86] Use -ffreestanding instead of using the mm_malloc.h include guard hack on more...
Craig Topper [Thu, 12 Oct 2017 17:21:01 +0000 (17:21 +0000)]
[X86] Use -ffreestanding instead of using the mm_malloc.h include guard hack on more of the builtin tests.

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

7 years ago[OPENMP] Fix PR34926: Fix handling of the array sections passed as
Alexey Bataev [Thu, 12 Oct 2017 15:18:41 +0000 (15:18 +0000)]
[OPENMP] Fix PR34926: Fix handling of the array sections passed as
function params.

Codegen could crash if the array section base expression is the
function parameter.

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

7 years ago[OPENMP] Fix PR34925: Fix getting thread_id lvalue for inlined regions
Alexey Bataev [Thu, 12 Oct 2017 13:51:32 +0000 (13:51 +0000)]
[OPENMP] Fix PR34925: Fix getting thread_id lvalue for inlined regions
in C.

If we try to get the lvalue for thread_id variables in inlined regions,
we did not use the correct version of function. Fixed this bug by adding
overrided version of the function getThreadIDVariableLValue for inlined
regions.

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

7 years ago[CodeGen] Generate TBAA info along with LValue base info
Ivan A. Kosarev [Thu, 12 Oct 2017 11:29:46 +0000 (11:29 +0000)]
[CodeGen] Generate TBAA info along with LValue base info

This patch enables explicit generation of TBAA information in all
cases where LValue base info is propagated or constructed in
non-trivial ways. Eventually, we will consider each of these
cases to make sure the TBAA information is correct and not too
conservative. For now, we just fall back to generating TBAA info
from the access type.

This patch should not bring in any functional changes.

This is part of D38126 reworked to be a separate patch to
simplify review.

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

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

7 years agoFix warnings. [-Wdocumentation]
NAKAMURA Takumi [Thu, 12 Oct 2017 09:42:14 +0000 (09:42 +0000)]
Fix warnings. [-Wdocumentation]

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

7 years agoSVal::getAsSymbol(bool IncludeBaseRegions): Follow clang/StaticAnalyzer/Core/PathSens...
NAKAMURA Takumi [Thu, 12 Oct 2017 09:42:12 +0000 (09:42 +0000)]
SVal::getAsSymbol(bool IncludeBaseRegions): Follow clang/StaticAnalyzer/Core/PathSensitive/SVals.h, s/IncludeBaseRegion/IncludeBaseRegions/g [-Wdocumentation]

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

7 years agoSplit the AlignTrailingComments on several lines. The comments were applied to the...
Sylvestre Ledru [Thu, 12 Oct 2017 08:07:53 +0000 (08:07 +0000)]
Split the AlignTrailingComments on several lines. The comments were applied to the right columns

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

7 years ago[COFF, ARM64] Add MS builtins __dmb, __dsb, __isb
Martin Storsjo [Thu, 12 Oct 2017 07:05:37 +0000 (07:05 +0000)]
[COFF, ARM64] Add MS builtins __dmb, __dsb, __isb

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

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

7 years agoclang/module.modulemap: Create Clang_Frontend_CodeGenOptions to remove some dependenc...
NAKAMURA Takumi [Thu, 12 Oct 2017 06:39:44 +0000 (06:39 +0000)]
clang/module.modulemap: Create Clang_Frontend_CodeGenOptions to remove some dependencies in clangBasic.

- Clang_Analysis
- Clang_C
- Clang_Frontend
- Clang_Lex
- Clang_Sema
- Clang_Serialization
- Clang_StaticAnalyzer_Core

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

7 years ago[X86] Remove a few unnecessary check lines from the predefined-arch-macros test.
Craig Topper [Thu, 12 Oct 2017 02:06:17 +0000 (02:06 +0000)]
[X86] Remove a few unnecessary check lines from the predefined-arch-macros test.

These were testing OS macros and clang/llvm macros.

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

7 years agoRevert "[ADT] Make Twine's copy constructor private."
Zachary Turner [Wed, 11 Oct 2017 23:54:34 +0000 (23:54 +0000)]
Revert "[ADT] Make Twine's copy constructor private."

This reverts commit 4e4ee1c507e2707bb3c208e1e1b6551c3015cbf5.

This is failing due to some code that isn't built on MSVC
so I didn't catch.  Not immediately obvious how to fix this
at first glance, so I'm reverting for now.

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

7 years agoUpdate cc1as_main for MCCodeEmitter ownership change in r315531.
Lang Hames [Wed, 11 Oct 2017 23:35:27 +0000 (23:35 +0000)]
Update cc1as_main for MCCodeEmitter ownership change in r315531.

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

7 years ago[ADT] Make Twine's copy constructor private.
Zachary Turner [Wed, 11 Oct 2017 23:33:06 +0000 (23:33 +0000)]
[ADT] Make Twine's copy constructor private.

There's a lot of misuse of Twine scattered around LLVM.  This
ranges in severity from benign (returning a Twine from a function
by value that is just a string literal) to pretty sketchy (storing
a Twine by value in a class).  While there are some uses for
copying Twines, most of the very compelling ones are confined
to the Twine class implementation itself, and other uses are
either dubious or easily worked around.

This patch makes Twine's copy constructor private, and fixes up
all callsites.

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

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

7 years ago[Driver] Export symbols needed to use profile runtime
Vedant Kumar [Wed, 11 Oct 2017 21:54:09 +0000 (21:54 +0000)]
[Driver] Export symbols needed to use profile runtime

Apple's API verification tool (tapi) checks that the symbols exported
from a program match a whitelist. When the program uses the profile
runtime, some additional symbols which are typically not part of the
regular whitelist must be exported.

If we're using symbol export directives along with the profile runtime
on Darwin, the driver needs to export the additional symbols to avoid
verification failures.

rdar://problem/30067753

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

7 years ago[X86] Add support for 'amdfam17h' to __builtin_cpu_is to match gcc.
Craig Topper [Wed, 11 Oct 2017 21:42:02 +0000 (21:42 +0000)]
[X86] Add support for 'amdfam17h' to __builtin_cpu_is to match gcc.

The compiler-rt implementation already supported it, it just wasn't exposed.

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

7 years ago[Analyzer] Support bodyfarming libstdc++ implementation of std::call_once.
George Karpenkov [Wed, 11 Oct 2017 20:53:01 +0000 (20:53 +0000)]
[Analyzer] Support bodyfarming libstdc++ implementation of std::call_once.

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

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

7 years ago[clang-fuzzer] Build with newer protobuf-mutator.
Matt Morehouse [Wed, 11 Oct 2017 20:45:10 +0000 (20:45 +0000)]
[clang-fuzzer] Build with newer protobuf-mutator.

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

7 years ago[Analyzer] Fix introduced regression: properly check for nullable attribute.
George Karpenkov [Wed, 11 Oct 2017 19:13:15 +0000 (19:13 +0000)]
[Analyzer] Fix introduced regression: properly check for nullable attribute.

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

7 years ago[Analyzer] Remove dead code from testing scripts
George Karpenkov [Wed, 11 Oct 2017 18:42:39 +0000 (18:42 +0000)]
[Analyzer] Remove dead code from testing scripts

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

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

7 years ago[Analyzer] Assume that string-like const globals are non-nil.
George Karpenkov [Wed, 11 Oct 2017 18:39:40 +0000 (18:39 +0000)]
[Analyzer] Assume that string-like const globals are non-nil.

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

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

7 years ago[clang-fuzzer] Allow linking with any fuzzing engine.
Matt Morehouse [Wed, 11 Oct 2017 18:29:24 +0000 (18:29 +0000)]
[clang-fuzzer] Allow linking with any fuzzing engine.

Summary:
Makes clang-[proto-]fuzzer compatible with flags specified by OSS-Fuzz.

https://llvm.org/pr34314

Reviewers: vitalybuka, kcc

Reviewed By: kcc

Subscribers: cfe-commits, mgorny

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

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

7 years ago[X86] Correct type for argument to clflushopt intrinsic.
Craig Topper [Wed, 11 Oct 2017 16:06:08 +0000 (16:06 +0000)]
[X86] Correct type for argument to clflushopt intrinsic.

Summary: According to Intel docs this should take void const *. We had char*. The lack of const is the main issue.

Reviewers: RKSimon, zvi, igorb

Reviewed By: igorb

Subscribers: llvm-commits

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

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

7 years ago[OPENMP] Remove extra if, NFC.
Alexey Bataev [Wed, 11 Oct 2017 15:56:38 +0000 (15:56 +0000)]
[OPENMP] Remove extra if, NFC.

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

7 years agoReland "[clang-fuzzer] Allow building without coverage instrumentation."
Matt Morehouse [Wed, 11 Oct 2017 15:51:12 +0000 (15:51 +0000)]
Reland "[clang-fuzzer] Allow building without coverage instrumentation."

This relands r315336 after fixing bot breakage.

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

7 years ago[OPENMP] Fix PR34916: Crash on mixing taskloop|tasks directives.
Alexey Bataev [Wed, 11 Oct 2017 15:29:40 +0000 (15:29 +0000)]
[OPENMP] Fix PR34916: Crash on mixing taskloop|tasks directives.

If both taskloop and task directives are used at the same time in one
program, we may ran into the situation when the particular type for task
directive is reused for taskloop directives. Patch fixes this problem.

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

7 years ago[clang-fuzzer] Fix shared library dependencies.
Matt Morehouse [Wed, 11 Oct 2017 15:13:53 +0000 (15:13 +0000)]
[clang-fuzzer] Fix shared library dependencies.

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

7 years ago[Analyzer] Clarify error messages for undefined result
Daniel Marjamaki [Wed, 11 Oct 2017 14:49:35 +0000 (14:49 +0000)]
[Analyzer] Clarify error messages for undefined result

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

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

7 years ago[clang-rename] Add more unittest.
Haojian Wu [Wed, 11 Oct 2017 14:00:42 +0000 (14:00 +0000)]
[clang-rename] Add more unittest.

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

7 years ago[OpenCL] Allow function declaration with empty argument list.
Alexey Bader [Wed, 11 Oct 2017 11:16:31 +0000 (11:16 +0000)]
[OpenCL] Allow function declaration with empty argument list.

Treat 'f()' as 'f(void)' rather than a function w/o a prototype.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia, yaxunl

Subscribers: cfe-commits, echuraev, chapuni

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

Re-apply revision 306653.

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

7 years ago[clang-rename] Don't add prefix qualifiers to the declaration and definition of the...
Haojian Wu [Wed, 11 Oct 2017 11:15:48 +0000 (11:15 +0000)]
[clang-rename] Don't add prefix qualifiers to the declaration and definition of the renamed symbol.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits, arphaman

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

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

7 years agoRevert r314955: "Remove PendingBody mechanism for function and ObjC method deserializ...
Daniel Jasper [Wed, 11 Oct 2017 07:47:54 +0000 (07:47 +0000)]
Revert r314955: "Remove PendingBody mechanism for function and ObjC method deserialization."

This is breaking a build of https://github.com/abseil/abseil-cpp and so
likely not really NFC. Also reverted subsequent r314956/7.

I'll forward reproduction instructions to Richard.

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

7 years agoReorder.
NAKAMURA Takumi [Wed, 11 Oct 2017 04:54:05 +0000 (04:54 +0000)]
Reorder.

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

7 years agoClangCodeGenTests: Update libdeps in rL315392, +clangAST.
NAKAMURA Takumi [Wed, 11 Oct 2017 04:20:19 +0000 (04:20 +0000)]
ClangCodeGenTests: Update libdeps in rL315392, +clangAST.

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

7 years agoUpdate cc1as_main for MCAsmBackend ownership change in r315410.
Lang Hames [Wed, 11 Oct 2017 01:58:08 +0000 (01:58 +0000)]
Update cc1as_main for MCAsmBackend ownership change in r315410.

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

7 years ago[modules] Fix visibility checking for using declarations via ADL.
Richard Smith [Wed, 11 Oct 2017 01:49:57 +0000 (01:49 +0000)]
[modules] Fix visibility checking for using declarations via ADL.

We want to check whether the using (shadow) declaration itself is visible, not
whether its target is visible.

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

7 years ago[modules] Only take visible using-directives into account during name lookup.
Richard Smith [Wed, 11 Oct 2017 01:19:11 +0000 (01:19 +0000)]
[modules] Only take visible using-directives into account during name lookup.

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

7 years agoA '<' with a trigraph '#' is not a valid editor placeholder
Alex Lorenz [Wed, 11 Oct 2017 00:41:20 +0000 (00:41 +0000)]
A '<' with a trigraph '#' is not a valid editor placeholder

Credit to OSS-Fuzz for discovery:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3137#c5

rdar://34923985

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

7 years ago[Modules TS] Diagnose missing/duplicate module-declaration.
Richard Smith [Wed, 11 Oct 2017 00:36:56 +0000 (00:36 +0000)]
[Modules TS] Diagnose missing/duplicate module-declaration.

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

7 years agoInclude getting generated struct offsets in CodegenABITypes
Adrian Prantl [Tue, 10 Oct 2017 23:54:21 +0000 (23:54 +0000)]
Include getting generated struct offsets in CodegenABITypes

This change adds a new function, CodeGen::getFieldNumber, that
enables a user of clang's code generation to get the field number
in a generated LLVM IR struct that corresponds to a particular field
in a C struct.

It is important to expose this information in Clang's code generation
interface because there is no reasonable way for users of Clang's code
generation to get this information. In particular:

LLVM struct types do not include field names.
Clang adds a non-trivial amount of logic to the code generation of LLVM IR types for structs, in particular to handle padding and bit fields.

Patch by Michael Ferguson!

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

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

7 years ago[Modules TS] Diagnose attempts to enter module implementation units without the modul...
Richard Smith [Tue, 10 Oct 2017 22:35:27 +0000 (22:35 +0000)]
[Modules TS] Diagnose attempts to enter module implementation units without the module interface being available.

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

7 years ago[Modules TS] Module ownership semantics for redeclarations.
Richard Smith [Tue, 10 Oct 2017 22:33:17 +0000 (22:33 +0000)]
[Modules TS] Module ownership semantics for redeclarations.

When declaring an entity in the "purview" of a module, it's never a
redeclaration of an entity in the purview of a default module or in no module
("in the global module"). Don't consider those other declarations as possible
redeclaration targets if they're not visible, and reject any cases where we
pick a prior visible declaration that violates this rule.

This reinstates r315251 and r315256, reverted in r315309 and r315308
respectively, tweaked to avoid triggering a linkage calculation when declaring
implicit special members (this exposed our pre-existing issue with typedef
names for linkage changing the linkage of types whose linkage has already been
computed and cached in more cases). A testcase for that regression has been
added in r315366.

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

7 years agoSupport: Have directory_iterator::status() return FindFirstFileEx/FindNextFile result...
Peter Collingbourne [Tue, 10 Oct 2017 22:19:46 +0000 (22:19 +0000)]
Support: Have directory_iterator::status() return FindFirstFileEx/FindNextFile results on Windows.

This allows clients to avoid an unnecessary fs::status() call on each
directory entry. Because the information returned by FindFirstFileEx
is a subset of the information returned by a regular status() call,
I needed to extract a base class from file_status that contains only
that information.

On my machine, this reduces the time required to enumerate a ThinLTO
cache directory containing 520k files from almost 4 minutes to less
than 2 seconds.

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

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

7 years agoFix indexer crash for default template template parameter value
Jan Korous [Tue, 10 Oct 2017 21:09:49 +0000 (21:09 +0000)]
Fix indexer crash for default template template parameter value

rdar://33058798

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

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