]> granicus.if.org Git - clang/log
clang
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

6 years ago[analyzer] Partial revert of https://reviews.llvm.org/D49050
George Karpenkov [Wed, 11 Jul 2018 01:58:08 +0000 (01:58 +0000)]
[analyzer] Partial revert of https://reviews.llvm.org/D49050

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

6 years ago[analyzer] Pass through all arguments from the registerChecker() to the checker const...
George Karpenkov [Wed, 11 Jul 2018 01:23:27 +0000 (01:23 +0000)]
[analyzer] Pass through all arguments from the registerChecker() to the checker constructor

A lot of checkers could be cleaned up in a similar way

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

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

6 years ago[SemaCXX] Remove comment from coroutines test, NFC
Brian Gesiak [Wed, 11 Jul 2018 01:00:53 +0000 (01:00 +0000)]
[SemaCXX] Remove comment from coroutines test, NFC

Summary:
The file name was accidentally included when the test file was added.

Test Plan: check-clang

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

6 years agoRemove qualtype qualifier in coroutine error to prevent assert in debug
Brian Gesiak [Wed, 11 Jul 2018 00:45:48 +0000 (00:45 +0000)]
Remove qualtype qualifier in coroutine error to prevent assert in debug

Summary:
A forward-declared coroutine_traits should trip an error; we need
a complete type.

Unfortunately, in debug mode only, we trip an assert when attempting
to provide the fully qualified type for the error message.
If you try to compile a program with a forward-declared
coroutine_traits in debug mode, clang will crash.

I've included a test for the behavior and removed the q modifier
on the error message. This prevents the crash in debug mode and
does not change the behavior for the error message on a
forward-declaration of a coroutine_traits type.

Test Plan:
I've included a test for the forward-declaration.

Patch by Tanoy Sinha!

Reviewers: modocache, GorNishanov

Reviewed By: modocache

Subscribers: cfe-commits

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

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

6 years ago[docs] List correct default for -ftemplate-depth; also add missing
Richard Smith [Wed, 11 Jul 2018 00:34:54 +0000 (00:34 +0000)]
[docs] List correct default for -ftemplate-depth; also add missing
documentation for -fconstexpr-steps.

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

6 years agoPR38095: Allow constant-folding of loads through bitcasted pointers if
Richard Smith [Wed, 11 Jul 2018 00:29:05 +0000 (00:29 +0000)]
PR38095: Allow constant-folding of loads through bitcasted pointers if
the bitcast only changed cvr-qualifications within the pointer type.

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

6 years agoDR330: look through array types when forming the cv-decomposition of a type.
Richard Smith [Wed, 11 Jul 2018 00:19:19 +0000 (00:19 +0000)]
DR330: look through array types when forming the cv-decomposition of a type.

This allows more qualification conversions, eg. conversion from
   'int *(*)[]' -> 'const int *const (*)[]'
is now permitted, along with all the consequences of that: more types
are similar, more cases are permitted by const_cast, and conversely,
fewer "casting away constness" cases are permitted by reinterpret_cast.

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

6 years ago[X86] Also fix the test for _mm512_mullo_epi64 to test the intrinsic instead of a...
Craig Topper [Tue, 10 Jul 2018 23:28:05 +0000 (23:28 +0000)]
[X86] Also fix the test for _mm512_mullo_epi64 to test the intrinsic instead of a copy of the intrinsic implementation.

This had the same issue I just fixed in r336739. Apparently I copy pasted _mm512_mullo_epi64 when I added _mm512_mullox_epi64.

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

6 years ago[X86] Fix the test for _mm512_mullox_epi64 to test the intrinsic instead of a copy...
Craig Topper [Tue, 10 Jul 2018 23:13:01 +0000 (23:13 +0000)]
[X86] Fix the test for _mm512_mullox_epi64 to test the intrinsic instead of a copy of the intrinsic implementation.

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

6 years agoFix determination of whether a reinterpret_cast casts away constness.
Richard Smith [Tue, 10 Jul 2018 23:04:35 +0000 (23:04 +0000)]
Fix determination of whether a reinterpret_cast casts away constness.

The "casts away constness" check doesn't care at all how the different
layers of the source and destination type were formed: for example, if
the source is a pointer and the destination is a pointer-to-member, the
types are still decomposed and their pointee qualifications are still
checked.

This rule is bizarre and somewhat ridiculous, so as an extension we
accept code making use of such reinterpret_casts with a warning outside
of SFINAE contexts.

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

6 years ago[NFC] Switch CodeGenFunction to use value init instead of member init lists
Erich Keane [Tue, 10 Jul 2018 21:07:50 +0000 (21:07 +0000)]
[NFC] Switch CodeGenFunction to use value init instead of member init lists

The member init list for the sole constructor for CodeGenFunction
has gotten out of hand, so this patch moves the non-parameter-dependent
initializations into the member value inits.

Note: This is what was intended to be committed in r336726

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

6 years agoRevert -r336726, which included more files than intended.
Erich Keane [Tue, 10 Jul 2018 20:51:41 +0000 (20:51 +0000)]
Revert -r336726, which included more files than intended.

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

6 years ago[NFC] Switch CodeGenFunction to use value init instead of member init lists
Erich Keane [Tue, 10 Jul 2018 20:46:46 +0000 (20:46 +0000)]
[NFC] Switch CodeGenFunction to use value init instead of member init lists

The member init list for the sole constructor for CodeGenFunction
has gotten out of hand, so this patch moves the non-parameter-dependent
initializations into the member value inits.

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

6 years agoPatch to fix pragma metadata for do-while loops
Bjorn Pettersson [Tue, 10 Jul 2018 19:55:02 +0000 (19:55 +0000)]
Patch to fix pragma metadata for do-while loops

Summary:
Make sure that loop metadata only is put on the backedge
when expanding a do-while loop.
Previously we added the loop metadata also on the branch
in the pre-header. That could confuse optimization passes
and result in the loop metadata being associated with the
wrong loop.

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

Committing on behalf of deepak2427 (Deepak Panickal)

Reviewers: #clang, ABataev, hfinkel, aaron.ballman, bjope

Reviewed By: bjope

Subscribers: bjope, rsmith, shenhan, zzheng, xbolva00, lebedev.ri, cfe-commits

Tags: #clang

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

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

6 years agoRevert r336590 "[libclang] evalute compound statement cursors before trying to evaluate"
Evgeniy Stepanov [Tue, 10 Jul 2018 19:49:07 +0000 (19:49 +0000)]
Revert r336590 "[libclang] evalute compound statement cursors before trying to evaluate"

New memory leaks in
LibclangParseTest_EvaluateChildExpression_Test::TestBody()

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

6 years agoRevert r336591 "[libclang] NFC, simplify clang_Cursor_Evaluate"
Evgeniy Stepanov [Tue, 10 Jul 2018 19:48:53 +0000 (19:48 +0000)]
Revert r336591 "[libclang] NFC, simplify clang_Cursor_Evaluate"

This change is blocking r336590 which is being reverted due to memory leaks.

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

6 years agoFix a typo/regression in r335495.
John Baldwin [Tue, 10 Jul 2018 17:44:08 +0000 (17:44 +0000)]
Fix a typo/regression in r335495.

Use getTriple.isMIPS64() to detect 64-bit MIPS ABIs in
FreeBSD::getSupportedSanitizers() instead of getTriple.isMIPS32().

Reviewed By: atanasyan

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

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

6 years agoSupport -fdebug-prefix-map for assembler source (pass to cc1as). This
Paul Robinson [Tue, 10 Jul 2018 15:15:24 +0000 (15:15 +0000)]
Support -fdebug-prefix-map for assembler source (pass to cc1as).  This
is useful to omit the debug compilation dir when compiling assembly
files with -g.  Part of PR38050.

Patch by Siddhartha Bagaria!

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

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

6 years agoAMDGPU: Try to fix test again
Matt Arsenault [Tue, 10 Jul 2018 14:47:31 +0000 (14:47 +0000)]
AMDGPU: Try to fix test again

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

6 years agoUpdate test for backend error message change
Matt Arsenault [Tue, 10 Jul 2018 14:03:50 +0000 (14:03 +0000)]
Update test for backend error message change

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

6 years ago[analyzer] Add option to set maximum symbol complexity threshold
Mikhail R. Gadelha [Tue, 10 Jul 2018 13:46:05 +0000 (13:46 +0000)]
[analyzer] Add option to set maximum symbol complexity threshold

Summary:
This adds an option, max-symbol-complexity, so an user can set the maximum symbol complexity threshold.

Note that the current behaviour is equivalent to max complexity = 0, when taint analysis is not enabled and tests show that in a number of tests, having complexity = 25 yields the same results as complexity = 10000.

This patch was extracted and modified from Dominic Chen's patch, D35450.

Reviewers: george.karpenkov, NoQ, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts
Yuka Takahashi [Tue, 10 Jul 2018 12:17:34 +0000 (12:17 +0000)]
[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts

Summary:
Reproducer and errors:
https://bugs.llvm.org/show_bug.cgi?id=37878

lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't
find ModuleName in (proper) search paths. This was causing iteration over all
files in the search path subdirectories for example "/usr/include/foobar" in
bugzilla case.

Users don't expect Clang to load modulemaps in subdirectories implicitly, and
also the disk access is not cheap.

if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName.

Reviewers: rsmith, aprantl, bruno

Subscribers: cfe-commits, teemperor, v.g.vassilev

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

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

6 years agoFixing builtin __atomic_fetch_min declaration
Omer Paparo Bivas [Tue, 10 Jul 2018 12:04:04 +0000 (12:04 +0000)]
Fixing builtin __atomic_fetch_min declaration

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

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

6 years ago[MinGW] Skip adding default win32 api libraries if -lwindowsapp is specified
Martin Storsjo [Tue, 10 Jul 2018 10:46:51 +0000 (10:46 +0000)]
[MinGW] Skip adding default win32 api libraries if -lwindowsapp is specified

In this setup, skip adding all the default windows import libraries,
if linking to windowsapp (which replaces them, when targeting the
windows store/UWP api subset).

With GCC, the same is achieved by using a custom spec file, but
since clang doesn't use spec files, we have to allow other means of
overriding what default libraries to use (without going all the
way to using -nostdlib, which would exclude everything). The same
approach, in detecting certain user specified libraries and omitting
others from the defaults, was already used in SVN r314138.

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

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

6 years ago[MinGW] Treat any -lucrt* as replacing -lmsvcrt
Martin Storsjo [Tue, 10 Jul 2018 10:46:45 +0000 (10:46 +0000)]
[MinGW] Treat any -lucrt* as replacing -lmsvcrt

Since SVN r314138, we check if the user has specified any particular
alternative msvcrt/ucrt version, and skip the default -lmsvcrt
in those cases.

In addition to the existing names checked, we should also treat
a plain -lucrt in the same way, mingw-w64 has now added a separate
import library named libucrt.a, in addition to libucrtbase.a.

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

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

6 years ago[X86] Lowering integer truncation intrinsics to native IR
Mikhail Dvoretckii [Tue, 10 Jul 2018 08:22:44 +0000 (08:22 +0000)]
[X86] Lowering integer truncation intrinsics to native IR

This patch lowers the _mm[256|512]_cvtepi{64|32|16}_epi{32|16|8} intrinsics to
native IR in cases where the result's length is less than 128 bits.

The resulting IR for 256-bit inputs is folded into VPMOV instructions, while for
128-bit inputs the vpshufb (or, in the 64-to-32-bit case, vinsertps)
instructions are generated instead

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

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

6 years agoTest commit
Stephen Kelly [Tue, 10 Jul 2018 06:55:12 +0000 (06:55 +0000)]
Test commit

Add redundant doc.

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

6 years ago[X86] Use masked the masked scalar fma builtins to implement the default rounding...
Craig Topper [Tue, 10 Jul 2018 04:38:29 +0000 (04:38 +0000)]
[X86] Use masked the masked scalar fma builtins to implement the default rounding version of the fma intrinsics.

The rounding mode is checked in CGBuiltin.cpp to generate the correct intrinsic call.

Making this switch switchs the masking to use the i8 bitcast to <8 x i1> and extract i1 version of the IR for the mask. Previously we ended up with a scalar 'and' plus an icmp.

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

6 years ago[Sema] Fix a structured binding typo correction bug
Erik Pilkington [Tue, 10 Jul 2018 02:15:07 +0000 (02:15 +0000)]
[Sema] Fix a structured binding typo correction bug

BindingDecls have null type until their initializer is processed, so we can't
assume that a correction candidate has non-null type.

rdar://41559582

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

6 years ago[ODRHash] Merge the two function hashes into one.
Richard Trieu [Tue, 10 Jul 2018 01:40:50 +0000 (01:40 +0000)]
[ODRHash] Merge the two function hashes into one.

Functions that are a sub-Decl of a record were hashed differently than other
functions.  This change keeps the AddFunctionDecl function and the hash of
records now calls this function.  In addition, AddFunctionDecl has an option
to perform a hash as if the body was absent, which is required for some
checks after loading modules.  Additional logic prevents multiple error
message from being printed.

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

6 years agoUpdate crash diagnostics test to avoid attempting to write into various
Eric Christopher [Tue, 10 Jul 2018 01:01:38 +0000 (01:01 +0000)]
Update crash diagnostics test to avoid attempting to write into various
directories if possible and to not require %t to have "Output" in the name.

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

6 years agoFix parsing of privacy annotations in os_log format strings.
Akira Hatanaka [Tue, 10 Jul 2018 00:50:25 +0000 (00:50 +0000)]
Fix parsing of privacy annotations in os_log format strings.

Privacy annotations shouldn't have to appear in the first
comma-delimited string in order to be recognized. Also, they should be
ignored if they are preceded or followed by non-whitespace characters.

rdar://problem/40706280

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

6 years ago[X86] Remove custom handling for __builtin_ia32_divss_round_mask and __builtin_ia32_d...
Craig Topper [Tue, 10 Jul 2018 00:50:03 +0000 (00:50 +0000)]
[X86] Remove custom handling for __builtin_ia32_divss_round_mask and __builtin_ia32_divsd_round_mask.

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

6 years ago[X86] Add __builtin_ia32_selectss_128 and __builtin_ia32_selectsd_128 that is suitabl...
Craig Topper [Tue, 10 Jul 2018 00:37:25 +0000 (00:37 +0000)]
[X86] Add __builtin_ia32_selectss_128 and __builtin_ia32_selectsd_128 that is suitable for use in scalar mask intrinsics.

This will convert the i8 mask argument to <8 x i1> and extract an i1 and then emit a select instruction. This replaces the '(__U & 1)" and ternary operator used in some of intrinsics. The old sequence was lowered to a scalar and and compare. The new sequence uses an i1 vector that will interoperate better with other mask intrinsics.

This removes the need to handle div_ss/sd specially in CGBuiltin.cpp. A follow up patch will add the GCCBuiltin name back in llvm and remove the custom handling.

I made some adjustments to legacy move_ss/sd intrinsics which we reused here to do a simpler extract and insert instead of 2 extracts and two inserts or a shuffle.

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

6 years agoRename function calls missed in r336605
Richard Trieu [Mon, 9 Jul 2018 22:09:33 +0000 (22:09 +0000)]
Rename function calls missed in r336605

NextIsLatest -> isFirst

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

6 years ago[Index] Add index::IndexingOptions::IndexImplicitInstantiation
Fangrui Song [Mon, 9 Jul 2018 21:49:06 +0000 (21:49 +0000)]
[Index] Add index::IndexingOptions::IndexImplicitInstantiation

Summary:
With IndexImplicitInstantiation=true, the following case records an occurrence of B::bar in A::foo, which will benefit cross reference tools.

template <class T> struct B { void bar() {}};
template <class T> struct A { void foo(B<T> *x) { x->bar(); }};
int main() { A<int> a; a.foo(0); }

Reviewers: akyrtzi, arphaman, rsmith

Subscribers: cfe-commits

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

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

6 years ago[AST] Rename some Redeclarable functions to reduce confusion
Fangrui Song [Mon, 9 Jul 2018 21:31:20 +0000 (21:31 +0000)]
[AST] Rename some Redeclarable functions to reduce confusion

Reviewers: rsmith, akyrtzi

Subscribers: cfe-commits

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

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

6 years agoAdded -fcrash-diagnostics-dir flag
Bob Haarman [Mon, 9 Jul 2018 21:07:20 +0000 (21:07 +0000)]
Added -fcrash-diagnostics-dir flag

Summary:
New flag causes crash reports to be written in the specified directory
rather than the temp directory.

Patch by Chijioke Kamanu.

Reviewers: hans, inglorion, rnk

Reviewed By: hans

Subscribers: zturner, hiraditya, llvm-commits, cfe-commits

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

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

6 years ago[Power9] [CLANG] Add __float128 support for trunc to double round to odd
Stefan Pintilie [Mon, 9 Jul 2018 20:09:52 +0000 (20:09 +0000)]
[Power9] [CLANG] Add __float128 support for trunc to double round to odd

Add support for this builtin:
double builtin_truncf128_round_to_odd(float128)

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

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

6 years ago[OPENMP] Do not mark local variables as declare target.
Alexey Bataev [Mon, 9 Jul 2018 19:58:08 +0000 (19:58 +0000)]
[OPENMP] Do not mark local variables as declare target.

When the parsing of the functions happens inside of the declare target
region, we may erroneously mark local variables as declare target
thought they are not. This attribute can be applied only to global
variables.

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

6 years ago[libclang] NFC, simplify clang_Cursor_Evaluate
Alex Lorenz [Mon, 9 Jul 2018 19:56:45 +0000 (19:56 +0000)]
[libclang] NFC, simplify clang_Cursor_Evaluate

Take advantage of early returns as suggested by Duncan in
https://reviews.llvm.org/D49051

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

6 years ago[libclang] evalute compound statement cursors before trying to evaluate
Alex Lorenz [Mon, 9 Jul 2018 19:41:28 +0000 (19:41 +0000)]
[libclang] evalute compound statement cursors before trying to evaluate
the cursor like a declaration

This change fixes a bug in libclang in which it tries to evaluate a statement
cursor as a declaration cursor, because that statement still has a pointer to
the declaration parent.

rdar://38888477

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

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