]> granicus.if.org Git - clang/log
clang
6 years agoSupport implicit _Atomic struct load / store
JF Bastien [Wed, 18 Jul 2018 18:01:41 +0000 (18:01 +0000)]
Support implicit _Atomic struct load / store

Summary:
Using _Atomic to do implicit load / store is just a seq_cst atomic_load / atomic_store. Stores currently assert in Sema::ImpCastExprToType with 'can't implicitly cast lvalue to rvalue with this cast kind', but that's erroneous. The codegen is fine as the test shows.

While investigating I found that Richard had found the problem here: https://reviews.llvm.org/D46112#1113557

<rdar://problem/40347123>

Reviewers: dexonsmith

Subscribers: cfe-commits, efriedma, rsmith, aaron.ballman

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

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

6 years ago[CodeComplete] Allow getDeclaration on RK_Pattern result.
Eric Liu [Wed, 18 Jul 2018 15:17:52 +0000 (15:17 +0000)]
[CodeComplete] Allow getDeclaration on RK_Pattern result.

Summary:
RK_Pattern results can also have associated declarations e.g. field
decls in constructor initializers.

Reviewers: bkramer

Subscribers: cfe-commits

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

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

6 years agoClear properties inadvertantly added to tests in R336379
Erich Keane [Wed, 18 Jul 2018 13:07:13 +0000 (13:07 +0000)]
Clear properties inadvertantly added to tests in R336379

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

6 years agoMention clang-cl improvements from r335466 and r336379 in ReleaseNotes.rst
Nico Weber [Wed, 18 Jul 2018 11:55:03 +0000 (11:55 +0000)]
Mention clang-cl improvements from r335466 and r336379 in ReleaseNotes.rst

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

6 years ago[modules] Print input files when -module-file-info file switch is passed.
Vassil Vassilev [Wed, 18 Jul 2018 06:49:33 +0000 (06:49 +0000)]
[modules] Print input files when -module-file-info file switch is passed.

This patch improves traceability of duplicated header files which end
up in multiple pcms.

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

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

6 years ago[AArch64] Define TARGET_HEADER_BUILTIN
Martin Storsjo [Wed, 18 Jul 2018 06:15:09 +0000 (06:15 +0000)]
[AArch64] Define TARGET_HEADER_BUILTIN

Without it, the new intrinsics became available for all language
variants. This was missed in SVN r337327.

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

6 years agoRe-land r337333, "Teach Clang to emit address-significance tables.",
Peter Collingbourne [Wed, 18 Jul 2018 00:27:07 +0000 (00:27 +0000)]
Re-land r337333, "Teach Clang to emit address-significance tables.",
which was reverted in r337336.

The problem that required a revert was fixed in r337338.

Also added a missing "REQUIRES: x86-registered-target" to one of
the tests.

Original commit message:
> Teach Clang to emit address-significance tables.
>
> By default, we emit an address-significance table on all ELF
> targets when the integrated assembler is enabled. The emission of an
> address-significance table can be controlled with the -faddrsig and
> -fno-addrsig flags.
>
> Differential Revision: https://reviews.llvm.org/D48155

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

6 years agoRevert r337333, "Teach Clang to emit address-significance tables."
Peter Collingbourne [Tue, 17 Jul 2018 23:56:30 +0000 (23:56 +0000)]
Revert r337333, "Teach Clang to emit address-significance tables."

Causing multiple failures on sanitizer bots due to TLS symbol errors,
e.g.

/usr/bin/ld: __msan_origin_tls: TLS definition in /home/buildbots/ppc64be-clang-test/clang-ppc64be/stage1/lib/clang/7.0.0/lib/linux/libclang_rt.msan-powerpc64.a(msan.cc.o) section .tbss.__msan_origin_tls mismatches non-TLS reference in /tmp/lit_tmp_0a71tA/mallinfo-3ca75e.o

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

6 years agoTeach Clang to emit address-significance tables.
Peter Collingbourne [Tue, 17 Jul 2018 23:17:16 +0000 (23:17 +0000)]
Teach Clang to emit address-significance tables.

By default, we emit an address-significance table on all ELF
targets when the integrated assembler is enabled. The emission of an
address-significance table can be controlled with the -faddrsig and
-fno-addrsig flags.

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

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

6 years agoReplace LLVM_ALIGNAS with just alignas.
Richard Smith [Tue, 17 Jul 2018 22:24:11 +0000 (22:24 +0000)]
Replace LLVM_ALIGNAS with just alignas.

Various places in Clang and LLVM are already using alignas; it seems
our minimum host configuration now requires it.

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

6 years agoRestructure checking for, and warning on, lifetime extension.
Richard Smith [Tue, 17 Jul 2018 22:24:09 +0000 (22:24 +0000)]
Restructure checking for, and warning on, lifetime extension.

This change implements C++ DR1696, which makes initialization of a
reference member of a class from a temporary object ill-formed. The
standard wording here is imprecise, but we interpret it as meaning that
any time a mem-initializer would result in lifetime extension, the
program is ill-formed.

This reinstates r337226, reverted in r337255, with a fix for the
InitializedEntity alignment problem that was breaking ARM buildbots.

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

6 years ago[COFF] Add more missing MSVC ARM64 intrinsics
Mandeep Singh Grang [Tue, 17 Jul 2018 22:03:24 +0000 (22:03 +0000)]
[COFF] Add more missing MSVC ARM64 intrinsics

Summary:
Added the following intrinsics:
_BitScanForward, _BitScanReverse, _BitScanForward64, _BitScanReverse64
_InterlockedAnd64, _InterlockedDecrement64, _InterlockedExchange64,
_InterlockedExchangeAdd64, _InterlockedExchangeSub64,
_InterlockedIncrement64, _InterlockedOr64, _InterlockedXor64.

Reviewers: compnerd, mstorsjo, rnk, javed.absar

Reviewed By: mstorsjo

Subscribers: kristof.beyls, chrib, llvm-commits

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

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

6 years agoRemove unnecessary trailing ; in macro intrinsic definition.
Eric Christopher [Tue, 17 Jul 2018 20:22:17 +0000 (20:22 +0000)]
Remove unnecessary trailing ; in macro intrinsic definition.

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

6 years ago[analyzer] Fix Z3 backend after D48205
Mikhail R. Gadelha [Tue, 17 Jul 2018 17:40:34 +0000 (17:40 +0000)]
[analyzer] Fix Z3 backend after D48205

Summary:
An assertion was added in D48205 to catch places where a `nonloc::SymbolVal` was wrapping a `loc` object.

This patch fixes that in the Z3 backend by making the `SValBuilder` object accessible from inherited instances of `SimpleConstraintManager` and calling `SVB.makeSymbolVal(foo)` instead of `nonloc::SymbolVal(foo)`.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years agoclang-cl: Postpone Wmsvc-not-found emission until link.exe gets used.
Nico Weber [Tue, 17 Jul 2018 15:07:40 +0000 (15:07 +0000)]
clang-cl: Postpone Wmsvc-not-found emission until link.exe gets used.

Wmsvc-not-found was added in r297851 to help diagnose why link.exe can't be
executed. However, it's emitted even when using -fuse-ld=lld, and in cross
builds there's no way to get rid of the warning other than disabling it.

Instead, emit it when we look up link.exe and it ends up not being executable.
That way, when passing -fuse-ld=lld it will never be printed.
It will also not be printed if we find link.exe on PATH.

(We might want to eventually default to lld one day, at least when running on a
non-Win host, but that's for another day.)

Fixes PR38016.

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

6 years ago[Fixed Point Arithmetic] Fix for bug where integer literals could be treated as fixed...
Leonard Chan [Tue, 17 Jul 2018 14:58:49 +0000 (14:58 +0000)]
[Fixed Point Arithmetic] Fix for bug where integer literals could be treated as fixed point literals

This addresses a bug brought up in https://bugs.llvm.org/show_bug.cgi?id=38161 where integer literals could be treated as fixed point types and throw errors related to fixed point types when the 'k' or 'r' suffix used. The fix also addresses the second issue brought up with the assertion by not treating integers as fixed point types in the first place.

Integers that have suffixes 'k' and 'r' now throw the error `invalid suffix 'k/r' on integer constant`.

A few more tests were also added to ensure that fixed point types, and any errors/warnings related to them, are limited to C for now.

Prior discussion also at https://reviews.llvm.org/D46915.

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

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

6 years agoRemove superfluous ; to fix -Wpedantic warning from gcc
Nico Weber [Tue, 17 Jul 2018 14:20:02 +0000 (14:20 +0000)]
Remove superfluous ; to fix -Wpedantic warning from gcc

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

6 years ago[Tooling] Add operator== to CompileCommand
Simon Marchi [Tue, 17 Jul 2018 14:13:05 +0000 (14:13 +0000)]
[Tooling] Add operator== to CompileCommand

Summary:
It does the obvious thing of comparing all fields.  This will be needed
for a clangd patch I have in the pipeline.

Subscribers: dblaikie, ilya-biryukov, ioeric, cfe-commits

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

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

6 years agoRevert "[Sema] Reword warning for constant captures that are not required"
Benjamin Kramer [Tue, 17 Jul 2018 13:17:01 +0000 (13:17 +0000)]
Revert "[Sema] Reword warning for constant captures that are not required"

This reverts commit r337152. This applies to non-constants too. The real
explanation is that the capture is not ODR-used, but putting that into
the warning message seems ... worse.

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

6 years agoAlways use __mcount on NetBSD. Some platforms don't provide _mcount.
Joerg Sonnenberger [Tue, 17 Jul 2018 13:13:34 +0000 (13:13 +0000)]
Always use __mcount on NetBSD. Some platforms don't provide _mcount.

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

6 years ago[ASTImporter] Fix poisonous structural equivalence cache
Gabor Marton [Tue, 17 Jul 2018 12:39:27 +0000 (12:39 +0000)]
[ASTImporter] Fix poisonous structural equivalence cache

Summary:
Implementation functions call into the member functions of
ASTStructuralEquivalence, thus they can falsely alter the DeclsToCheck state
(they add decls).  This results that some leaf declarations can be stated as
inequivalent as a side effect of one inequivalent element in the DeclsToCheck
list.  And since we store the non-equivalencies, any (otherwise independent)
decls will be rendered as non-equivalent.  Solution: I tried to clearly
separate the implementation functions (the static ones) and the public
interface.  From now on, the implementation functions do not call any public
member functions, only other implementation functions.

Reviewers: a.sidorin, a_sidorin, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years agoFor NetBSD, unwind data is emitted by default, so also enable frame
Joerg Sonnenberger [Tue, 17 Jul 2018 12:38:57 +0000 (12:38 +0000)]
For NetBSD, unwind data is emitted by default, so also enable frame
pointer optimisation by default when using optimisation.

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

6 years agoBy popular demand, switch in64_t on NetBSD/AArch64 and NetBSD/PowerPC64
Joerg Sonnenberger [Tue, 17 Jul 2018 12:33:19 +0000 (12:33 +0000)]
By popular demand, switch in64_t on NetBSD/AArch64 and NetBSD/PowerPC64
to long for consistency with other 64bit platforms.

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

6 years ago[ASTImporter] Fix import of unnamed structs
Gabor Marton [Tue, 17 Jul 2018 12:06:36 +0000 (12:06 +0000)]
[ASTImporter] Fix import of unnamed structs

Summary:
D48773 simplified ASTImporter nicely, but it introduced a new error: Unnamed
structs are not imported correctly, if they appear in a recursive context.
This patch provides a fix for structural equivalency.

Reviewers: a.sidorin, a_sidorin, balazske, gerazo

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[ASTImporter] Import described template (if any) of function.
Balazs Keri [Tue, 17 Jul 2018 09:52:41 +0000 (09:52 +0000)]
[ASTImporter] Import described template (if any) of function.

Summary:
When a function is imported, check if it has a described template.
The name lookup is corrected to find the templated entity in this case.
The described template of the function is imported too.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

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

6 years agoTemporarily revert r337226 "Restructure checking for, and warning on, lifetime extens...
Florian Hahn [Tue, 17 Jul 2018 09:23:31 +0000 (09:23 +0000)]
Temporarily revert r337226 "Restructure checking for, and warning on, lifetime extension."

This change breaks on ARM because pointers to clang::InitializedEntity are only
4 byte aligned and do not have 3 bits to store values. A possible solution
would be to change the fields in clang::InitializedEntity to enforce a bigger
alignment requirement.

The error message is

llvm/include/llvm/ADT/PointerIntPair.h:132:3: error: static_assert failed "PointerIntPair with integer size too large for pointer"
  static_assert(IntBits <= PtrTraits::NumLowBitsAvailable,
include/llvm/ADT/PointerIntPair.h:73:13: note: in instantiation of template class 'llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> >' requested here
    Value = Info::updateInt(Info::updatePointer(0, PtrVal),
llvm/include/llvm/ADT/PointerIntPair.h:51:5: note: in instantiation of member function 'llvm::PointerIntPair<const clang::InitializedEntity *, 3, (anonymous namespace)::LifetimeKind, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *>, llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> > >::setPointerAndInt' requested here
    setPointerAndInt(PtrVal, IntVal);
    ^
llvm/tools/clang/lib/Sema/SemaInit.cpp:6237:12: note: in instantiation of member function 'llvm::PointerIntPair<const clang::InitializedEntity *, 3, (anonymous namespace)::LifetimeKind, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *>, llvm::PointerIntPairInfo<const clang::InitializedEntity *, 3, llvm::PointerLikeTypeTraits<const clang::InitializedEntity *> > >::PointerIntPair' requested here
    return {Entity, LK_Extended};

Full log here:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-global-isel/builds/1330
http://lab.llvm.org:8011/builders/clang-cmake-armv7-full/builds/1394

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

6 years agoHarden/relax clang/test/CodeGen/opt-record-MIR.c test
Roman Lebedev [Tue, 17 Jul 2018 07:12:08 +0000 (07:12 +0000)]
Harden/relax clang/test/CodeGen/opt-record-MIR.c test

Summary:
If the build path is short, `Line` field can end up fitting on the same line as `File`,
but the `{{.*}}` would consume it. Keeping in mind rL293149, i think we can fix it,
while keeping it working when there are and there are not any quotations.
At least this fixes this test for me.

Reviewers: anemet, aaron.ballman, hfinkel

Reviewed By: anemet

Subscribers: cfe-commits, llvm-commits

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

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

6 years ago[Driver] Add -fno-digraphs
Jacob Bandes-Storch [Tue, 17 Jul 2018 04:56:22 +0000 (04:56 +0000)]
[Driver] Add -fno-digraphs

Summary: Add a flag `-fno-digraphs` to disable digraphs in the lexer, similar to `-fno-operator-names` which disables alternative names for C++ operators.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: rsmith, cfe-commits

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

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

6 years ago[analyzer] Fix size_t in tests.
Artem Dergachev [Tue, 17 Jul 2018 01:39:25 +0000 (01:39 +0000)]
[analyzer] Fix size_t in tests.

Should fix a buildbot. No functional change intended.

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

6 years ago[CFG] [analyzer] Allow elidable copies to have more than one arguments.
Artem Dergachev [Tue, 17 Jul 2018 00:57:57 +0000 (00:57 +0000)]
[CFG] [analyzer] Allow elidable copies to have more than one arguments.

Copy-constructors and move-constructors may have default arguments. It is
incorrect to assert that they only have one argument, i.e. the reference to the
object being copied or moved. Remove the assertion.

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

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

6 years ago[analyzer] pr37802: Fix symbolic-pointer-to-boolean casts during load.
Artem Dergachev [Tue, 17 Jul 2018 00:42:35 +0000 (00:42 +0000)]
[analyzer] pr37802: Fix symbolic-pointer-to-boolean casts during load.

The canonical representation of pointer &SymRegion{$x} casted to boolean is
"$x != 0", not "$x". Assertion added in r337227 catches that.

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

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

6 years ago[analyzer] Assert that nonloc::SymbolVal always wraps a non-Loc-type symbol.
Artem Dergachev [Tue, 17 Jul 2018 00:22:27 +0000 (00:22 +0000)]
[analyzer] Assert that nonloc::SymbolVal always wraps a non-Loc-type symbol.

In the current SVal hierarchy there are multiple ways of representing certain
values but few are actually used and expected to be seen by the code.

In particular, a value of a symbolic pointer is always represented by a
loc::MemRegionVal that wraps a SymbolicRegion that wraps the pointer symbol
and never by a nonloc::SymbolVal that wraps that symbol directly.

Assert the aforementioned fact. Fix one minor violation of it.

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

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

6 years agoRestructure checking for, and warning on, lifetime extension.
Richard Smith [Tue, 17 Jul 2018 00:11:41 +0000 (00:11 +0000)]
Restructure checking for, and warning on, lifetime extension.

This change implements C++ DR1696, which makes initialization of a
reference member of a class from a temporary object ill-formed. The
standard wording here is imprecise, but we interpret it as meaning that
any time a mem-initializer would result in lifetime extension, the
program is ill-formed.

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

6 years ago[analyzer] Make checkEndFunction() give access to the return statement.
Reka Kovacs [Mon, 16 Jul 2018 20:47:45 +0000 (20:47 +0000)]
[analyzer] Make checkEndFunction() give access to the return statement.

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

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

6 years ago[ASTMatchers] Quickfix for tests.
George Karpenkov [Mon, 16 Jul 2018 20:42:37 +0000 (20:42 +0000)]
[ASTMatchers] Quickfix for tests.

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

6 years ago[analyzer] Bugfix for an overly eager suppression for null pointer return from macros.
George Karpenkov [Mon, 16 Jul 2018 20:33:25 +0000 (20:33 +0000)]
[analyzer] Bugfix for an overly eager suppression for null pointer return from macros.

Only suppress those cases where the null which came from the macro is
relevant to the bug, and was not overwritten in between.

rdar://41497323

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

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

6 years ago[analyzer] Fix GCDAntipatternChecker to only fire when the semaphore is initialized...
George Karpenkov [Mon, 16 Jul 2018 20:32:57 +0000 (20:32 +0000)]
[analyzer] Fix GCDAntipatternChecker to only fire when the semaphore is initialized to zero

Initializing a semaphore with a different constant most likely signals a different intent

rdar://41802552

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

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

6 years ago[analyzer] Provide a symmetric method for generating a PathDiagnosticLocation from...
George Karpenkov [Mon, 16 Jul 2018 20:32:32 +0000 (20:32 +0000)]
[analyzer] Provide a symmetric method for generating a PathDiagnosticLocation from Decl

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

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

6 years ago[ASTMatchers] Introduce Objective-C matchers `hasReceiver` and `isInstanceMessage...
George Karpenkov [Mon, 16 Jul 2018 20:22:12 +0000 (20:22 +0000)]
[ASTMatchers] Introduce Objective-C matchers `hasReceiver` and `isInstanceMessage` for ObjCMessageExpr

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

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

6 years ago[OPENMP] Fix checks for declare target link entries.
Alexey Bataev [Mon, 16 Jul 2018 20:05:25 +0000 (20:05 +0000)]
[OPENMP] Fix checks for declare target link entries.

If the declare target link entries are created but not used, the
compiler will produce an error message. Patch improves handling of such
situations + improves checks for possibly lost declare target variables.

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

6 years ago[OPENMP] Fix syntactic errors in error messages.
Alexey Bataev [Mon, 16 Jul 2018 18:12:18 +0000 (18:12 +0000)]
[OPENMP] Fix syntactic errors in error messages.

Fixed spelling of the offloading error messages.

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

6 years ago[OPENMP, NVPTX] Globalize only captured variables.
Alexey Bataev [Mon, 16 Jul 2018 16:49:20 +0000 (16:49 +0000)]
[OPENMP, NVPTX] Globalize only captured variables.

Sometimes we can try to globalize non-variable declarations, which may
lead to compiler crash.

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

6 years agoRestore "[ThinLTO] Ensure we always select the same function copy to import"
Teresa Johnson [Mon, 16 Jul 2018 15:30:36 +0000 (15:30 +0000)]
Restore "[ThinLTO] Ensure we always select the same function copy to import"

This reverts commit r337082, restoring r337051, since the LLVM side
patch has been restored.

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

6 years ago[ASTImporter] Changed constant int to unsigned int in test code.
Balazs Keri [Mon, 16 Jul 2018 14:05:18 +0000 (14:05 +0000)]
[ASTImporter] Changed constant int to unsigned int in test code.

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

6 years ago[analyzer] Fix the Z3 backend always generating unsigned APSInt
Mikhail R. Gadelha [Mon, 16 Jul 2018 13:32:22 +0000 (13:32 +0000)]
[analyzer] Fix the Z3 backend always generating unsigned APSInt

Summary:
In `toAPSInt`, the Z3 backend was not checking the variable `Int`'s type and was always generating unsigned `APSInt`s.

This was found by accident when I removed:
```
    llvm::APSInt ConvertedLHS, ConvertedRHS;
    QualType LTy, RTy;
    std::tie(ConvertedLHS, LTy) = fixAPSInt(*LHS);
    std::tie(ConvertedRHS, RTy) = fixAPSInt(*RHS);
-    doIntTypePromotion<llvm::APSInt, Z3ConstraintManager::castAPSInt>(
-        ConvertedLHS, LTy, ConvertedRHS, RTy);
    return BVF.evalAPSInt(BSE->getOpcode(), ConvertedLHS, ConvertedRHS);
```

And the `BasicValueFactory` started to complain about different `signedness`.

Reviewers: george.karpenkov, NoQ, ddcc

Reviewed By: ddcc

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[analyzer] Fix constraint being dropped when analyzing a program without taint tracki...
Mikhail R. Gadelha [Mon, 16 Jul 2018 13:14:46 +0000 (13:14 +0000)]
[analyzer] Fix constraint being dropped when analyzing a program without taint tracking enabled

Summary:
This patch removes the constraint dropping when taint tracking is disabled.

It also voids the crash reported in D28953 by treating a SymSymExpr with non pointer symbols as an opaque expression.

Updated the regressions and verifying the big projects now; I'll update here when they're done.

Based on the discussion on the mailing list and the patches by @ddcc.

Reviewers: george.karpenkov, NoQ, ddcc, baloghadamsoftware

Reviewed By: george.karpenkov

Subscribers: delcypher, llvm-commits, rnkovacs, xazax.hun, szepet, a.sidorin, ddcc

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

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

6 years ago[ASTImporter] Import implicit methods of existing class.
Balazs Keri [Mon, 16 Jul 2018 12:16:39 +0000 (12:16 +0000)]
[ASTImporter] Import implicit methods of existing class.

Summary:
When an already existing class is encountered during import,
check if it has implicit methods that are missing in the existing one,
and import these.
The to-be-imported code may use the same class in different way than the
existing (before the import) code. This may result in that there are
implicit methods that are not generated for the existing code.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

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

6 years ago[Sema] Reword warning for constant captures that are not required
Benjamin Kramer [Mon, 16 Jul 2018 09:52:02 +0000 (09:52 +0000)]
[Sema] Reword warning for constant captures that are not required

This is one of the darker corners of C++, make it clear that this is
about constants and rephrase it a bit.

Before: lambda capture 'i' is not required to be captured for this use
After:  lambda capture of constant 'i' is not required for this use

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

6 years ago[Analyzer] Mark `SymbolData` parts of iterator position as live in program state...
Adam Balogh [Mon, 16 Jul 2018 09:27:27 +0000 (09:27 +0000)]
[Analyzer] Mark `SymbolData` parts of iterator position as live in program state maps

Marking a symbolic expression as live is non-recursive. In our checkers we
either use conjured symbols or conjured symbols plus/minus integers to
represent abstract position of iterators, so in this latter case we also
must mark the `SymbolData` part of these symbolic expressions as live to
prevent them from getting reaped.

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

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

6 years ago[Sema] Add fixit for unused lambda captures
Alexander Shaposhnikov [Mon, 16 Jul 2018 07:23:47 +0000 (07:23 +0000)]
[Sema] Add fixit for unused lambda captures

This diff adds a fixit to suggest removing unused lambda captures
in the appropriate diagnostic.

Patch by Andrew Comminos!

Test plan: make check-all

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

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

6 years ago[MinGW] Automatically mangle Windows-specific entry points as C
Martin Storsjo [Mon, 16 Jul 2018 05:42:25 +0000 (05:42 +0000)]
[MinGW] Automatically mangle Windows-specific entry points as C

This mangles entry points wmain, WinMain, wWinMain or DllMain as C
functions, to match the ABI for these functions.

We already did the same for these functions in MSVC mode, but we also
should do the same in the Itanium ABI.

This fixes PR38124.

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

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

6 years agoRun thread safety tests with both lock and capability attributes; NFC to the analysis...
Aaron Ballman [Sun, 15 Jul 2018 12:08:52 +0000 (12:08 +0000)]
Run thread safety tests with both lock and capability attributes; NFC to the analysis behavior.

Patch thanks to Aaron Puchert.

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

6 years ago[CMake] Use libc++ and compiler-rt for sanitizers
Petr Hosek [Sun, 15 Jul 2018 03:11:43 +0000 (03:11 +0000)]
[CMake] Use libc++ and compiler-rt for sanitizers

When building runtimes for Linux as part of Fuchsia toolchain, use
libc++ and compiler-rt for sanitizers.

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

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

6 years agoAdd caching when looking up coroutine_traits
Brian Gesiak [Sat, 14 Jul 2018 18:21:44 +0000 (18:21 +0000)]
Add caching when looking up coroutine_traits

Summary:
Currently clang looks up the coroutine_traits ClassTemplateDecl
everytime it looks up the promise type. This is unnecessary
as coroutine_traits doesn't change between promise type lookups.

This diff caches the coroutine_traits lookup.

Patch by Tanoy Sinha!

Test Plan:
I added log statements in the new lookupCoroutineTraits function
to ensure that LookupQualifiedName was only called once even
when multiple coroutines existed in the source file.

Reviewers: modocache, GorNishanov

Reviewed By: modocache

Subscribers: cfe-commits

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

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

6 years agoRevert "[ThinLTO] Ensure we always select the same function copy to import"
Teresa Johnson [Sat, 14 Jul 2018 01:50:14 +0000 (01:50 +0000)]
Revert "[ThinLTO] Ensure we always select the same function copy to import"

This reverts commit r337051.

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

6 years ago[ThinLTO] Ensure we always select the same function copy to import
Teresa Johnson [Fri, 13 Jul 2018 21:35:58 +0000 (21:35 +0000)]
[ThinLTO] Ensure we always select the same function copy to import

Clang change to reflect the FunctionsToImportTy type change
in the llvm changes for D48670.

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

6 years ago[Hexagon] Fix hvx-length feature name in testcases
Krzysztof Parzyszek [Fri, 13 Jul 2018 21:32:33 +0000 (21:32 +0000)]
[Hexagon] Fix hvx-length feature name in testcases

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

6 years agoMake BuiltinType constructor private, and befriend ASTContext.
Richard Smith [Fri, 13 Jul 2018 21:29:31 +0000 (21:29 +0000)]
Make BuiltinType constructor private, and befriend ASTContext.

This reflects the fact that only ASTContext should ever create an
instance of BuiltinType, and matches what we do for all the other Type
subclasses.

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

6 years agoUse external layout information to layout bit-fields for MS ABI.
Richard Smith [Fri, 13 Jul 2018 21:07:42 +0000 (21:07 +0000)]
Use external layout information to layout bit-fields for MS ABI.

Patch by Aleksandr Urakov!

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

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

6 years agoCodeGen: specify alignment + inbounds for automatic variable initialization
JF Bastien [Fri, 13 Jul 2018 20:33:23 +0000 (20:33 +0000)]
CodeGen: specify alignment + inbounds for automatic variable initialization

Summary: Automatic variable initialization was generating default-aligned stores (which are deprecated) instead of using the known alignment from the alloca. Further, they didn't specify inbounds.

Subscribers: dexonsmith, cfe-commits

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

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

6 years ago[X86] Change the rounding mode used when testing the sqrt_round intrinsics.
Craig Topper [Fri, 13 Jul 2018 20:16:38 +0000 (20:16 +0000)]
[X86] Change the rounding mode used when testing the sqrt_round intrinsics.

Using CUR_DIRECTION is not a realistic scenario. That is equivalent to the intrinsic without rounding.

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

6 years agoSafeStack: Add builtins to read unsafe stack top/bottom
Vlad Tsyrklevich [Fri, 13 Jul 2018 19:48:35 +0000 (19:48 +0000)]
SafeStack: Add builtins to read unsafe stack top/bottom

Summary:
Introduce built-ins to read the unsafe stack top and bottom. The unsafe
stack top is required to implement garbage collection scanning for
Oilpan. Currently there is already a built-in 'get_unsafe_stack_start'
to read the bottom of the unsafe stack, but I chose to duplicate this
API because 'start' is ambiguous (e.g. Oilpan uses WTF::GetStackStart to
read the safe stack top.)

Reviewers: pcc

Reviewed By: pcc

Subscribers: llvm-commits, kcc

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

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

6 years agoPR15730/PR16986 Allow dependently typed vector_size types.
Erich Keane [Fri, 13 Jul 2018 19:46:04 +0000 (19:46 +0000)]
PR15730/PR16986 Allow dependently typed vector_size types.

As listed in the above PRs, vector_size doesn't allow
dependent types/values. This patch introduces a new
DependentVectorType to handle a VectorType that has a dependent
size or type.

In the future, ALL the vector-types should be able to create one
of these to handle dependent types/sizes as well. For example,
DependentSizedExtVectorType could likely be switched to just use
this instead, though that is left as an exercise for the future.

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

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

6 years agoFix PR34668 - P0704R1 implementation is too permissive
Nicolas Lesser [Fri, 13 Jul 2018 16:27:45 +0000 (16:27 +0000)]
Fix PR34668 - P0704R1 implementation is too permissive

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

Pretty straightforward.

Reviewers: rsmith, Rakete1111

Reviewed By: Rakete1111

Subscribers: Rakete1111, cfe-commits

Tags: #clang

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

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

6 years ago[OpenMP] Initialize data sharing stack for SPMD case
Gheorghe-Teodor Bercea [Fri, 13 Jul 2018 16:18:24 +0000 (16:18 +0000)]
[OpenMP] Initialize data sharing stack for SPMD case

Summary: In the SPMD case, we need to initialize the data sharing and globalization infrastructure. This covers the case when an SPMD region calls a function in a different compilation unit.

Reviewers: ABataev, carlo.bertolli, caomhin

Reviewed By: ABataev

Subscribers: Hahnfeld, jholewinski, guansong, cfe-commits

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

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

6 years ago[NFC] Rename clang::AttributeList to clang::ParsedAttr
Erich Keane [Fri, 13 Jul 2018 15:07:47 +0000 (15:07 +0000)]
[NFC] Rename clang::AttributeList to clang::ParsedAttr

Since The type no longer contains the 'next' item anymore, it isn't a list,
so rename it to ParsedAttr to be more accurate.

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

6 years ago[Analyzer] alpha.unix.cstring.OutOfBounds checker enable/disable fix
Adam Balogh [Fri, 13 Jul 2018 13:44:44 +0000 (13:44 +0000)]
[Analyzer] alpha.unix.cstring.OutOfBounds checker enable/disable fix

It was not possible to disable alpha.unix.cstring.OutOfBounds checker's reports
since unix.Malloc checker always implicitly enabled the filter. Moreover if the
checker was disabled from command line (-analyzer-disable-checker ..) the out
of bounds warnings were nevertheless emitted under different checker names such
as unix.cstring.NullArg, or unix.Malloc.

This patch fixes the case sot that Malloc checker only enables implicitly the
underlying modeling of strcpy, memcpy etc. but not the warning messages that
would have been emmitted by alpha.unix.cstring.OutOfBounds

Patch by: Dániel Krupp

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

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

6 years ago[analyzer][UninitializedObjectChecker] Fixed captured lambda variable name
Kristof Umann [Fri, 13 Jul 2018 12:54:47 +0000 (12:54 +0000)]
[analyzer][UninitializedObjectChecker] Fixed captured lambda variable name

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

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

6 years ago[analyzer][UninitializedObjectChecker] Support for MemberPointerTypes
Kristof Umann [Fri, 13 Jul 2018 12:21:38 +0000 (12:21 +0000)]
[analyzer][UninitializedObjectChecker] Support for MemberPointerTypes

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

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

6 years agoPR38136: improve handling of template argument deduction of non-trailing
Richard Smith [Thu, 12 Jul 2018 23:32:39 +0000 (23:32 +0000)]
PR38136: improve handling of template argument deduction of non-trailing
function parameter packs.

This makes our handling of non-trailing function parameter packs
consistent between the case of deduction at the top level in a function
call and other cases where deduction encounters a non-trailing function
parameter pack.

Instead of treating a non-trailing pack and all later parameters as
being non-deduced, we treat a non-trailing pack as exactly matching
any explicitly-specified template arguments (or being an empty pack
if there are no such arguments). This corresponds to the "never deduced"
rule in [temp.deduct.call]p1, but generalized to all deduction contexts.

Non-trailing template argument packs still result in the entire
template argument list being treated as non-deduced, as specified in
[temp.deduct.type]p9.

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

6 years agoSupport linking static PIE binaries on NetBSD
Joerg Sonnenberger [Thu, 12 Jul 2018 21:21:29 +0000 (21:21 +0000)]
Support linking static PIE binaries on NetBSD

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

6 years agoPR38141: check whether noexcept-specifications are equivalent in redeclarations
Richard Smith [Thu, 12 Jul 2018 21:11:25 +0000 (21:11 +0000)]
PR38141: check whether noexcept-specifications are equivalent in redeclarations

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

6 years agoAttributeList de-listifying:
Erich Keane [Thu, 12 Jul 2018 21:09:05 +0000 (21:09 +0000)]
AttributeList de-listifying:

Basically, "AttributeList" loses all list-like mechanisms, ParsedAttributes is
switched to use a TinyPtrVector (and a ParsedAttributesView is created to
have a non-allocating attributes list). DeclaratorChunk gets the later kind,
Declarator/DeclSpec keep ParsedAttributes.

Iterators are added to the ParsedAttribute types so that for-loops work.

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

6 years ago[Driver] Conform warn_drv_object_size_disabled_O0 to DefaultWarnNoError
Vedant Kumar [Thu, 12 Jul 2018 19:53:15 +0000 (19:53 +0000)]
[Driver] Conform warn_drv_object_size_disabled_O0 to DefaultWarnNoError

This diagnostic triggers when -fsanitize=object-size is explicitly
specified but will be a no-op (i.e, at -O0).

This diagnostic should not fail a -Werror build because it's just an
explanatory note to the user. It's not always actionable.

For example, a user may not be able to simply disable object-size,
because they want it enabled in optimized builds.

rdar://42128447

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

6 years ago[Hexagon] Fix testcases failing after r336933
Krzysztof Parzyszek [Thu, 12 Jul 2018 19:44:39 +0000 (19:44 +0000)]
[Hexagon] Fix testcases failing after r336933

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

6 years ago[Hexagon] Diagnose intrinsics not supported by selected CPU/HVX
Krzysztof Parzyszek [Thu, 12 Jul 2018 18:54:04 +0000 (18:54 +0000)]
[Hexagon] Diagnose intrinsics not supported by selected CPU/HVX

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

6 years agoAdd tests for function conversions in conversion function template
Richard Smith [Thu, 12 Jul 2018 18:49:13 +0000 (18:49 +0000)]
Add tests for function conversions in conversion function template
deduction.

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

6 years ago[C++17] Disallow lambdas in template parameters (PR33696).
Nicolas Lesser [Thu, 12 Jul 2018 18:45:41 +0000 (18:45 +0000)]
[C++17] Disallow lambdas in template parameters (PR33696).

Summary: This revision disallows lambdas in template parameters, as reported in PR33696.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years ago[Tooling] Make standalone executor support user-provided vfs.
Eric Liu [Thu, 12 Jul 2018 18:32:11 +0000 (18:32 +0000)]
[Tooling] Make standalone executor support user-provided vfs.

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

6 years ago[C++11] Fix warning when dropping cv-qualifiers when assigning to a reference with...
Nicolas Lesser [Thu, 12 Jul 2018 17:43:49 +0000 (17:43 +0000)]
[C++11] Fix warning when dropping cv-qualifiers when assigning to a reference with a braced initializer list

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

6 years agoRevert "[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts"
Bruno Cardoso Lopes [Thu, 12 Jul 2018 17:38:48 +0000 (17:38 +0000)]
Revert "[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts"

This reverts commit f40124d4f05ecf4f880cf4e8f26922d861f705f3 / r336660.

This change shouldn't be affecting `@import` behavior, but turns out it is:
https://ci.swift.org/view/swift-master-next/job/oss-swift-incremental-RA-osx-master-next/2800/consoleFull#-12570166563122a513-f36a-4c87-8ed7-cbc36a1ec144

Working on a reduced testcase for this, reverting in the meantime.

rdar://problem/42102222

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

6 years ago[Tooling] Get working directory properly without assuming real file system.
Eric Liu [Thu, 12 Jul 2018 14:54:25 +0000 (14:54 +0000)]
[Tooling] Get working directory properly without assuming real file system.

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

6 years ago[analyzer][UninitializedObjectChecker] Moved non-member functions out of the anonymou...
Kristof Umann [Thu, 12 Jul 2018 13:13:46 +0000 (13:13 +0000)]
[analyzer][UninitializedObjectChecker] Moved non-member functions out of the anonymous namespace

As the code for the checker grew, it became increasinly difficult to see
whether a function was global or statically defined. In this patch,
anything that isn't a type declaration or definition was moved out of the
anonymous namespace and is marked as static.

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

6 years ago[ASTImporter] Fix infinite recursion on function import with struct definition in...
Gabor Marton [Thu, 12 Jul 2018 11:50:21 +0000 (11:50 +0000)]
[ASTImporter] Fix infinite recursion on function import with struct definition in parameters

Summary:
Importing a function having a struct definition in the parameter list
causes a crash in the importer via infinite recursion. This patch avoids
the crash and reports such functions as not supported. Unit tests make
sure that normal struct definitions inside function bodies work normally
on the other hand and LLDB-like type imports also do.

Reviewers: a.sidorin, martong

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

Patch by Zoltan Gera!

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

6 years ago[ASTImporter] Refactor Decl creation
Gabor Marton [Thu, 12 Jul 2018 09:42:05 +0000 (09:42 +0000)]
[ASTImporter] Refactor Decl creation

Summary:
Generalize the creation of Decl nodes during Import.  With this patch we do the
same things after and before a new AST node is created (::Create) The import
logic should be really simple, we create the node, then we mark that as
imported, then we recursively import the parts for that node and then set them
on that node.  However, the AST is actually a graph, so we have to handle
circles.  If we mark something as imported (`MapImported()`) then we return with
the corresponding `To` decl whenever we want to import that node again, this way
circles are handled.  In order to make this algorithm work we must ensure
things, which are handled in the generic CreateDecl<> template:
* There are no `Import()` calls in between any node creation (::Create)
and the `MapImported()` call.
* Before actually creating an AST node (::Create), we must check if
the Node had been imported already, if yes then return with that one.
One very important case for this is connected to templates: we may
start an import both from the templated decl of a template and from
the template itself.

Now, the virtual `Imported` function is called in `ASTImporter::Impor(Decl *)`,
but only once, when the `Decl` is imported.  One point of this refactor is to
separate responsibilities. The original `Imported()` had 3 responsibilities:
- notify subclasses when an import happened
- register the decl into `ImportedDecls`
- initialise the Decl (set attributes, etc)
Now all of these are in separate functions:
- `Imported`
- `MapImported`
- `InitializeImportedDecl`
I tried to check all the clients, I executed tests for `ExternalASTMerger.cpp`
and some unittests for lldb.

Reviewers: a.sidorin, balazske, xazax.hun, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years agoFix deduction for conversion function templates converting to reference
Richard Smith [Wed, 11 Jul 2018 23:19:41 +0000 (23:19 +0000)]
Fix deduction for conversion function templates converting to reference
types.

We previously tried to use the "parameter is a reference" logic here,
but that doesn't work because it gets P and A backwards. Instead, add
a separate implementation of the "deduced A can be less qualified than
A" rule.

This also exposes that we incorrectly stripped cv-qualifiers from the
referent of A if it was a reference. However, if we don't do that, we
get the wrong results when P is a reference. In an attempt to match
what sanity dictates and what other implementations are doing, we now
remove cv-qualifiers from A and P unless both are reference types. I've
brought this up on the core reflector too, to try to get the standard
fixed.

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

6 years agoos_log: When there are multiple privacy annotations in the format
Akira Hatanaka [Wed, 11 Jul 2018 22:19:14 +0000 (22:19 +0000)]
os_log: When there are multiple privacy annotations in the format
string, choose the strictest one instead of the last.

Also fix an undefined behavior. Move the pointer update to a later point to
avoid adding StringRef::npos to the pointer.

rdar://problem/40706280

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

6 years agoFix determination of whether one set of cvr-qualifiers is compatible
Richard Smith [Wed, 11 Jul 2018 21:07:04 +0000 (21:07 +0000)]
Fix determination of whether one set of cvr-qualifiers is compatible
with another in template argument deduction.

We happened to typically get away with getting this wrong, because the
cases where we'd produce a bogus deduction were caught by the final
"deduced A is compatible with A" check.

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

6 years ago[FileCheck] Add -allow-deprecated-dag-overlap to failing clang tests
Joel E. Denny [Wed, 11 Jul 2018 20:26:20 +0000 (20:26 +0000)]
[FileCheck] Add -allow-deprecated-dag-overlap to failing clang tests

See https://reviews.llvm.org/D47106 for details.

Reviewed By: probinson

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

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

6 years agoFix setting of empty implicit-section-name attribute
Petr Pavlu [Wed, 11 Jul 2018 20:17:54 +0000 (20:17 +0000)]
Fix setting of empty implicit-section-name attribute

Code in `CodeGenModule::SetFunctionAttributes()` could set an empty
attribute `implicit-section-name` on a function that is affected by
`#pragma clang text="section"`. This is incorrect because the attribute
should contain a valid section name. If the function additionally also
used `__attribute__((section("section")))` then this could result in
emitting the function in a section with an empty name.

The patch fixes the issue by removing the problematic code that sets
empty `implicit-section-name` from
`CodeGenModule::SetFunctionAttributes()` because it is sufficient to set
this attribute only from a similar code in `setNonAliasAttributes()`
when the function is emitted.

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

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

6 years ago[NFC] typo
JF Bastien [Wed, 11 Jul 2018 19:51:40 +0000 (19:51 +0000)]
[NFC] typo

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

6 years ago[NFC] Replace usage of QualType.getTypePtr()-> with operator->
Erich Keane [Wed, 11 Jul 2018 19:09:21 +0000 (19:09 +0000)]
[NFC] Replace usage of QualType.getTypePtr()-> with operator->

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

6 years ago[analyzer] Track multiple raw pointer symbols in DanglingInternalBufferChecker.
Reka Kovacs [Wed, 11 Jul 2018 19:08:02 +0000 (19:08 +0000)]
[analyzer] Track multiple raw pointer symbols in DanglingInternalBufferChecker.

Previously, the checker only tracked one raw pointer symbol for each
container object. But member functions returning a pointer to the
object's inner buffer may be called on the object several times. These
pointer symbols are now collected in a set inside the program state map
and thus all of them is checked for use-after-free problems.

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

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

6 years agoRevert "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the...
Eric Liu [Wed, 11 Jul 2018 18:43:07 +0000 (18:43 +0000)]
Revert "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name"

This reverts commit r336807. This breaks users of
ClangTool::mapVirtualFile. Will try to investigate a fix. See also the
discussion on https://reviews.llvm.org/D48903

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

6 years ago[AST] Fix for structural equivalence tests in rL336776.
Balazs Keri [Wed, 11 Jul 2018 15:26:26 +0000 (15:26 +0000)]
[AST] Fix for structural equivalence tests in rL336776.

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

6 years ago[clangd] Uprank delcarations when "using q::name" is present in the main file
Kirill Bobyrev [Wed, 11 Jul 2018 14:49:49 +0000 (14:49 +0000)]
[clangd] Uprank delcarations when "using q::name" is present in the main file

Having `using qualified::name;` for some symbol is an important signal
for clangd code completion as the user is more likely to use such
symbol.  This patch helps to uprank the relevant symbols by saving
UsingShadowDecl in the new field of CodeCompletionResult and checking
whether the corresponding UsingShadowDecl is located in the main file
later in ClangD code completion routine. While the relative importance
of such signal is a subject to change in the future, this patch simply
bumps DeclProximity score to the value of 1.0 which should be enough for
now.

The patch was tested using

`$ ninja check-clang check-clang-tools`

No unexpected failures were noticed after running the relevant testsets.

Reviewers: sammccall, ioeric

Subscribers: MaskRay, jkorous, cfe-commits

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

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

6 years ago[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested...
Simon Marchi [Wed, 11 Jul 2018 14:08:17 +0000 (14:08 +0000)]
[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

Summary:
InMemoryFileSystem::status behaves differently than
RealFileSystem::status.  The Name contained in the Status returned by
RealFileSystem::status will be the path as requested by the caller,
whereas InMemoryFileSystem::status returns the normalized path.

For example, when requested the status for "../src/first.h",
RealFileSystem returns a Status with "../src/first.h" as the Name.
InMemoryFileSystem returns "/absolute/path/to/src/first.h".

The reason for this change is that I want to make a unit test in the
clangd testsuite (where we use an InMemoryFileSystem) to reproduce a
bug I get with the clangd program (where a RealFileSystem is used).
This difference in behavior "hides" the bug in the unit test version.

In general, I guess it's good if InMemoryFileSystem works as much as
possible like RealFileSystem.

Doing so made the FileEntry::RealPathName value (assigned in
FileManager::getFile) wrong when using the InMemoryFileSystem.  That's
because it assumes that vfs::File::getName will always return the real
path.  I changed to to use FileSystem::getRealPath instead.

Subscribers: ilya-biryukov, ioeric, cfe-commits

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

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

6 years ago[mips] Add '-mvirt', '-mno-virt', '-mginv', '-mno-ginv' options
Vladimir Stefanovic [Wed, 11 Jul 2018 12:45:25 +0000 (12:45 +0000)]
[mips] Add '-mvirt', '-mno-virt', '-mginv', '-mno-ginv' options

'-mvirt'/'-mno-virt' enables/disables Virtualization ASE.
'-mginv'/'-mno-ginv' enables/disables GINV (Global Invalidate) ASE.

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

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

6 years ago[AST] Structural equivalence of methods
Balazs Keri [Wed, 11 Jul 2018 09:37:24 +0000 (09:37 +0000)]
[AST] Structural equivalence of methods

Summary:
Added structural equivalence check for C++ methods.
Improved structural equivalence tests.
Added related ASTImporter tests.

Reviewers: a.sidorin, szepet, xazax.hun, martong, a_sidorin

Reviewed By: martong, a_sidorin

Subscribers: a_sidorin, rnkovacs, cfe-commits

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

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

6 years ago[analyzer] Fix bots by changing the analyzer-config tests.
George Karpenkov [Wed, 11 Jul 2018 02:01:18 +0000 (02:01 +0000)]
[analyzer] Fix bots by changing the analyzer-config tests.

To be investigated.

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