]> granicus.if.org Git - clang/log
clang
5 years ago[NFC][clang] Test updates for CreateAlignmentAssumption() changes in D54653
Roman Lebedev [Thu, 24 Jan 2019 19:32:49 +0000 (19:32 +0000)]
[NFC][clang] Test updates for CreateAlignmentAssumption() changes in D54653

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

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

5 years agoAdd a priority field to availability attributes to prioritize explicit
Alex Lorenz [Thu, 24 Jan 2019 19:14:39 +0000 (19:14 +0000)]
Add a priority field to availability attributes to prioritize explicit
attributes from declaration over attributes from '#pragma clang attribute'

Before this commit users had an issue when using #pragma clang attribute with
availability attributes:

The explicit attribute that's specified next to the declaration is not
guaranteed to be preferred over the attribute specified in the pragma.

This commit fixes this by introducing a priority field to the availability
attribute to control how they're merged. Attributes with higher priority are
applied over attributes with lower priority for the same platform. The
implicitly inferred attributes are given the lower priority. This ensures that:

- explicit attributes are preferred over all other attributes.
- implicitly inferred attributes that are inferred from an explicit attribute
  are discarded if there's an explicit attribute or an attribute specified
  using a #pragma for the same platform.
- implicitly inferred attributes that are inferred from an attribute in the
  #pragma are not used if there's an explicit, explicit #pragma, or an
  implicit attribute inferred from an explicit attribute for the declaration.

This is the resulting ranking:

`platform availability > platform availability from pragma > inferred availability > inferred availability from pragma`

rdar://46390243

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

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

5 years ago[FileManager] Revert r347205 to avoid PCH file-descriptor leak.
Sam McCall [Thu, 24 Jan 2019 18:55:24 +0000 (18:55 +0000)]
[FileManager] Revert r347205 to avoid PCH file-descriptor leak.

Summary:
r347205 fixed a bug in FileManager: first calling
getFile(shouldOpen=false) and then getFile(shouldOpen=true) results in
the file not being open.

Unfortunately, some code was (inadvertently?) relying on this bug: when
building with a PCH, the file entries are obtained first by passing
shouldOpen=false, and then later shouldOpen=true, without any intention
of reading them. After r347205, they do get unneccesarily opened.
Aside from extra operations, this means they need to be closed. Normally
files are closed when their contents are read. As these files are never
read, they stay open until clang exits. On platforms with a low
open-files limit (e.g. Mac), this can lead to spurious file-not-found
errors when building large projects with PCH enabled, e.g.
  https://bugs.chromium.org/p/chromium/issues/detail?id=924225

Fixing the callsites to pass shouldOpen=false when the file won't be
read is not quite trivial (that info isn't available at the direct
callsite), and passing shouldOpen=false is a performance regression (it
results in open+fstat pairs being replaced by stat+open).

So an ideal fix is going to be a little risky and we need some fix soon
(especially for the llvm 8 branch).
The problem addressed by r347205 is rare and has only been observed in
clangd. It was present in llvm-7, so we can live with it for now.

Reviewers: bkramer, thakis

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

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

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

5 years agoRevert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of...
Julian Lettner [Thu, 24 Jan 2019 18:04:21 +0000 (18:04 +0000)]
Revert "[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls"

This reverts commit cea84ab93aeb079a358ab1c8aeba6d9140ef8b47.

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

5 years agoFix failing buildbots
Gabor Marton [Thu, 24 Jan 2019 16:27:21 +0000 (16:27 +0000)]
Fix failing buildbots

Fix remaining unittest errors caused by
__attribute__((no_caller_saved_registers))
Related commit which caused the buildbots to fail:
rL352050

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

5 years agoFix failing buildbots
Gabor Marton [Thu, 24 Jan 2019 15:42:20 +0000 (15:42 +0000)]
Fix failing buildbots

Related commit which caused the buildbots to fail:
rL352050

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

5 years ago[CPU-Dispatch] Make pentium_iii_no_xmm_regs and pentium_iii alias.
Erich Keane [Thu, 24 Jan 2019 15:28:57 +0000 (15:28 +0000)]
[CPU-Dispatch] Make pentium_iii_no_xmm_regs and pentium_iii alias.

I discovered that in ICC (where this list comes from), that the two
pentium_iii versions were actually identical despite the two different
names (despite them implying a difference). Because of this, they ended
up having identical manglings, which obviously caused problems when used
together.

This patch makes pentium_iii_no_xmm_regs an alias for pentium_iii so
that it can still be used, but has the same meaning as ICC. However, we
still prohibit using the two together which is different (albeit better)
behavior.

Change-Id: I4f3c9a47e48490c81525c8a3d23ed4201921b288

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

5 years ago[ASTImporter] Fix inequality of functions with different attributes
Gabor Marton [Thu, 24 Jan 2019 14:47:44 +0000 (14:47 +0000)]
[ASTImporter] Fix inequality of functions with different attributes

Summary:
FunctionType::ExtInfo holds such properties of a function which are needed
mostly for code gen. We should not compare these bits when checking for
structural equivalency.
Checking ExtInfo caused false ODR errors during CTU analysis (of tmux).

Reviewers: a_sidorin, a.sidorin, shafik

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

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

5 years ago[Sema] Don't crash when recovering from a misspelled pseudo destructor call to an...
Bruno Ricci [Thu, 24 Jan 2019 13:52:47 +0000 (13:52 +0000)]
[Sema] Don't crash when recovering from a misspelled pseudo destructor call to an incomplete type.

When attempting to correct a misspelled pseudo destructor call as in:

struct Foo;
void foo(Foo *p) {
  p.~Foo();
}

a call is made in canRecoverDotPseudoDestructorCallsOnPointerObjects
to LookupDestructor without checking that the record has a definition.

This causes an assertion later in LookupSpecialMember which assumes that
the record has a definition.

Patch By Roman Zhikharevich!

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

Reviewed By: riccibruno

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

5 years agoTest commit: fix typo.
Pierre Gousseau [Thu, 24 Jan 2019 11:44:24 +0000 (11:44 +0000)]
Test commit: fix typo.

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

5 years ago[CodeComplete] [clangd] Fix crash on ValueDecl with a null type
Ilya Biryukov [Thu, 24 Jan 2019 10:41:43 +0000 (10:41 +0000)]
[CodeComplete] [clangd] Fix crash on ValueDecl with a null type

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

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

5 years agoFix python3 compability issue in clang binding
Serge Guelton [Thu, 24 Jan 2019 10:34:44 +0000 (10:34 +0000)]
Fix python3 compability issue in clang binding

The file contents could be of str type. Should use byte length instead
of str length, otherwise utf-8 encoded files may not get properly parsed
for completion.

Source issue: https://github.com/ncm2/ncm2-pyclang#2

Commited on behalf of `roxma'

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

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

5 years agoReland r345009 "[DebugInfo] Generate debug information for labels."
Hsiangkai Wang [Thu, 24 Jan 2019 05:34:29 +0000 (05:34 +0000)]
Reland r345009 "[DebugInfo] Generate debug information for labels."

Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

After fixing PR37395.
After fixing problems in LiveDebugVariables.
After fixing NULL symbol problems in AddressPool when enabling
split-dwarf-file.
After fixing PR39094.
After landing D54199 and D54465 to fix Chromium build failed.

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

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

5 years ago[CMake][Fuchsia] Enable hermetic static libc++abi for Fuchsia
Petr Hosek [Thu, 24 Jan 2019 03:24:37 +0000 (03:24 +0000)]
[CMake][Fuchsia] Enable hermetic static libc++abi for Fuchsia

Similarly to libc++, we want to use hermetic static libc++abi.

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

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

5 years agoImprove diagnostic for -fvisibility mismatch between module/PCH build
Richard Smith [Thu, 24 Jan 2019 02:41:46 +0000 (02:41 +0000)]
Improve diagnostic for -fvisibility mismatch between module/PCH build
and use.

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

5 years ago[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn...
Julian Lettner [Thu, 24 Jan 2019 01:06:19 +0000 (01:06 +0000)]
[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls

Summary:
UBSan wants to detect when unreachable code is actually reached, so it
adds instrumentation before every `unreachable` instruction. However,
the optimizer will remove code after calls to functions marked with
`noreturn`. To avoid this UBSan removes `noreturn` from both the call
instruction as well as from the function itself. Unfortunately, ASan
relies on this annotation to unpoison the stack by inserting calls to
`_asan_handle_no_return` before `noreturn` functions. This is important
for functions that do not return but access the the stack memory, e.g.,
unwinder functions *like* `longjmp` (`longjmp` itself is actually
"double-proofed" via its interceptor). The result is that when ASan and
UBSan are combined, the `noreturn` attributes are missing and ASan
cannot unpoison the stack, so it has false positives when stack
unwinding is used.

Changes:
  # UBSan now adds the `expect_noreturn` attribute whenever it removes
    the `noreturn` attribute from a function
  # ASan additionally checks for the presence of this attribute

Generated code:
```
call void @__asan_handle_no_return    // Additionally inserted to avoid false positives
call void @longjmp
call void @__asan_handle_no_return
call void @__ubsan_handle_builtin_unreachable
unreachable
```

The second call to `__asan_handle_no_return` is redundant. This will be
cleaned up in a follow-up patch.

rdar://problem/40723397

Reviewers: delcypher, eugenis

Tags: #sanitizers

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

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

5 years ago[Sema] Fix Modified Type in address_space AttributedType
Leonard Chan [Thu, 24 Jan 2019 00:11:35 +0000 (00:11 +0000)]
[Sema] Fix Modified Type in address_space AttributedType

This is a fix for https://reviews.llvm.org/D51229 where we pass the
address_space qualified type as the modified type of an AttributedType. This
change now instead wraps the AttributedType with either the address_space
qualifier or a DependentAddressSpaceType.

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

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

5 years ago[Documentation] Fix problem in docs/SafeStack.rst introduced in r351976.
Eugene Zelenko [Wed, 23 Jan 2019 20:51:06 +0000 (20:51 +0000)]
[Documentation] Fix problem in docs/SafeStack.rst introduced in r351976.

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

5 years ago[Documentation] Use HTTPS whenever possible
Eugene Zelenko [Wed, 23 Jan 2019 20:39:07 +0000 (20:39 +0000)]
[Documentation] Use HTTPS whenever possible

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

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

5 years agoMerge similar target diagnostics for interrupt attribute into one; NFC
Aaron Ballman [Wed, 23 Jan 2019 18:02:17 +0000 (18:02 +0000)]
Merge similar target diagnostics for interrupt attribute into one; NFC

Patch by Kristina Bessonova!

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

5 years ago[ubsan] Check the correct size when sanitizing array new.
Richard Smith [Wed, 23 Jan 2019 03:37:29 +0000 (03:37 +0000)]
[ubsan] Check the correct size when sanitizing array new.

We previously forgot to multiply the element size by the array bound.

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

5 years ago[Sema][ObjC] Check whether a DelayedDiagnosticPool has been pushed
Akira Hatanaka [Wed, 23 Jan 2019 00:55:48 +0000 (00:55 +0000)]
[Sema][ObjC] Check whether a DelayedDiagnosticPool has been pushed
before adding a delayed diagnostic to DelayedDiagnostics.

This fixes an assertion failure in Sema::DelayedDiagnostics::add that
was caused by the changes made in r141037.

rdar://problem/42782323

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

5 years ago[mips] Replace help-text for '-m{no}-relax-pic-calls'. NFC
Vladimir Stefanovic [Tue, 22 Jan 2019 22:33:53 +0000 (22:33 +0000)]
[mips] Replace help-text for '-m{no}-relax-pic-calls'. NFC

Thanks to Simon Dardis for the new text.

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

5 years ago[analyzer] Insert notes in RetainCountChecker where our dynamic cast modeling assumes...
George Karpenkov [Tue, 22 Jan 2019 19:51:00 +0000 (19:51 +0000)]
[analyzer] Insert notes in RetainCountChecker where our dynamic cast modeling assumes 'null' output

rdar://47397214

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

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

5 years ago[analyzer] Model another special-case kind of cast for OSObject RetainCountChecker
George Karpenkov [Tue, 22 Jan 2019 19:50:47 +0000 (19:50 +0000)]
[analyzer] Model another special-case kind of cast for OSObject RetainCountChecker

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

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

5 years ago[ASTImporter] Fix importing OperatorDelete from CXXConstructorDecl
Raphael Isemann [Tue, 22 Jan 2019 17:59:45 +0000 (17:59 +0000)]
[ASTImporter] Fix importing OperatorDelete from CXXConstructorDecl

Summary:
Shafik found out that importing a CXXConstructorDecl will create a translation unit that
causes Clang's CodeGen to crash. The reason for that is that we don't copy the OperatorDelete
from the CXXConstructorDecl when importing. This patch fixes it and adds a test case for that.

Reviewers: shafik, martong, a_sidorin, a.sidorin

Reviewed By: martong, a_sidorin

Subscribers: rnkovacs, cfe-commits

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

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

5 years agoReleaseNotes: remove openmp notes from r351580
Hans Wennborg [Tue, 22 Jan 2019 17:01:39 +0000 (17:01 +0000)]
ReleaseNotes: remove openmp notes from r351580

They were for the 8.0 branch, and have been committed there in r351839.

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

5 years ago[CodeGen] Always use string computed in Sema for PredefinedExpr
Eli Friedman [Tue, 22 Jan 2019 00:11:17 +0000 (00:11 +0000)]
[CodeGen] Always use string computed in Sema for PredefinedExpr

We can't use any other string, anyway, because its type wouldn't
match the type of the PredefinedExpr.

With this change, we don't compute a "nice" name for the __func__ global
when it's used in the initializer for a constant. This doesn't seem like
a great loss, and I'm not sure how to fix it without either storing more
information in the AST, or somehow threading through the information
from ExprConstant.cpp.

This could break some situations involving BlockDecl; currently,
CodeGenFunction::EmitPredefinedLValue has some logic to intentionally
emit a string different from what Sema computed.  This code skips that
logic... but that logic can't work correctly in general anyway.  (For
example, sizeof(__func__) returns the wrong result.) Hopefully this
doesn't affect practical code.

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

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

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

5 years ago[test] Pass -ccc-install-dir in mac compilation db test
Michal Gorny [Mon, 21 Jan 2019 17:05:43 +0000 (17:05 +0000)]
[test] Pass -ccc-install-dir in mac compilation db test

Pass -ccc-install-dir explicitly as the compilation database code does
not pass argv[0] to getMainExecutable(), while some systems require it
to return the correct path.  Since the relevant code is apparently only
applicable to Darwin, just pass correct -ccc-install-dir to make
the tests pass on *BSD systems.

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

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

5 years agoMark the lambda function pointer conversion operator as noexcept.
Aaron Ballman [Mon, 21 Jan 2019 16:25:08 +0000 (16:25 +0000)]
Mark the lambda function pointer conversion operator as noexcept.

This implements CWG DR 1722 and fixes PR40309. Patch by Ignat Loskutov.

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

5 years agoRegenerating the C++ DR status page from the latest Core issues list.
Aaron Ballman [Mon, 21 Jan 2019 16:21:14 +0000 (16:21 +0000)]
Regenerating the C++ DR status page from the latest Core issues list.

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

5 years ago[OpenCL] Allow address spaces as method qualifiers.
Anastasia Stulova [Mon, 21 Jan 2019 16:01:38 +0000 (16:01 +0000)]
[OpenCL] Allow address spaces as method qualifiers.

Methods can now be qualified with address spaces to prevent
undesirable conversions to generic or to provide custom
implementation to be used if the object is located in certain
memory segments.

This commit extends parsing and standard C++ overloading to
work for an address space of a method (i.e. implicit 'this'
parameter).

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

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

5 years ago[Analyzer] Remove extra blank line from Iterator Checker (test commit)
Adam Balogh [Mon, 21 Jan 2019 15:31:23 +0000 (15:31 +0000)]
[Analyzer] Remove extra blank line from Iterator Checker (test commit)

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

5 years ago[NFC] Fix comparison warning issues by MSVC
Johannes Doerfert [Mon, 21 Jan 2019 14:23:46 +0000 (14:23 +0000)]
[NFC] Fix comparison warning issues by MSVC

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

5 years ago[clang] add tests to ExprMutAnalyzer that reproduced a crash in ASTMatchers
Jonas Toth [Mon, 21 Jan 2019 13:26:18 +0000 (13:26 +0000)]
[clang] add tests to ExprMutAnalyzer that reproduced a crash in ASTMatchers

Summary:
This patch adds two unit-tests that are the result of reducing a crashing TU
when running ExprMutAnalyzer over it. They are added only to ensure the regression
that has been fixed with https://reviews.llvm.org/D56444 don't creep back.

Reviewers: aaron.ballman, sammccall, rsmith, george.karpenkov

Reviewed By: sammccall

Subscribers: baloghadamsoftware, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits

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

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

5 years ago[AArch64] Use LL for 64-bit intrinsic arguments
Sam Parker [Mon, 21 Jan 2019 11:01:05 +0000 (11:01 +0000)]
[AArch64] Use LL for 64-bit intrinsic arguments

The ACLE states that 64-bit crc32, wsr, rsr and rbit operands are
uint64_t so we should have the clang builtin match this description
- which is what we already do for AArch32.

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

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

5 years ago[ASTImporter] Add test for importing anonymous namespaces.
Raphael Isemann [Mon, 21 Jan 2019 10:14:31 +0000 (10:14 +0000)]
[ASTImporter] Add test for importing anonymous namespaces.

Reviewers: a.sidorin, a_sidorin

Reviewed By: a_sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

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

5 years agoFix typos throughout the license files that somehow I and my reviewers
Chandler Carruth [Mon, 21 Jan 2019 09:52:34 +0000 (09:52 +0000)]
Fix typos throughout the license files that somehow I and my reviewers
all missed!

Thanks to Alex Bradbury for pointing this out, and the fact that I never
added the intended `legacy` anchor to the developer policy. Add that
anchor too. With hope, this will cause the links to all resolve
successfully.

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

5 years ago[Driver] Don't pass default value to getCompilerRTArgString
Petr Hosek [Mon, 21 Jan 2019 01:34:09 +0000 (01:34 +0000)]
[Driver] Don't pass default value to getCompilerRTArgString

Using static library is already a default.

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

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

5 years ago[CMake][Fuchsia] Drop -DNDEBUG, re-enable modules
Petr Hosek [Mon, 21 Jan 2019 01:06:50 +0000 (01:06 +0000)]
[CMake][Fuchsia] Drop -DNDEBUG, re-enable modules

-DNDEBUG is no longer needed now that we don't enable assertions,
modules should improve build times for the second stage.

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

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

5 years ago[X86] Add missing test cases for some int/fp->fp conversion intrinsics with rounding...
Craig Topper [Sun, 20 Jan 2019 23:49:50 +0000 (23:49 +0000)]
[X86] Add missing test cases for some int/fp->fp conversion intrinsics with rounding mode. Use non-default rounding mode on some tests.

For some reason we were missing tests for several unmasked conversion intrinsics, but had their mask form.

Also use a non-default rounding mode on some tests to provide better coverage for a future patch.

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

5 years agoTentative fix for r351701 and gcc 6.2 build on ubuntu
Serge Guelton [Sun, 20 Jan 2019 23:43:37 +0000 (23:43 +0000)]
Tentative fix for r351701 and gcc 6.2 build on ubuntu

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

5 years agoReplace llvm::isPodLike<...> by llvm::is_trivially_copyable<...>
Serge Guelton [Sun, 20 Jan 2019 21:19:56 +0000 (21:19 +0000)]
Replace llvm::isPodLike<...>  by llvm::is_trivially_copyable<...>

As noted in https://bugs.llvm.org/show_bug.cgi?id=36651, the specialization for
isPodLike<std::pair<...>> did not match the expectation of
std::is_trivially_copyable which makes the memcpy optimization invalid.

This patch renames the llvm::isPodLike trait into llvm::is_trivially_copyable.
Unfortunately std::is_trivially_copyable is not portable across compiler / STL
versions. So a portable version is provided too.

Note that the following specialization were invalid:

    std::pair<T0, T1>
    llvm::Optional<T>

Tests have been added to assert that former specialization are respected by the
standard usage of llvm::is_trivially_copyable, and that when a decent version
of std::is_trivially_copyable is available, llvm::is_trivially_copyable is
compared to std::is_trivially_copyable.

As of this patch, llvm::Optional is no longer considered trivially copyable,
even if T is. This is to be fixed in a later patch, as it has impact on a
long-running bug (see r347004)

Note that GCC warns about this UB, but this got silented by https://reviews.llvm.org/D50296.

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

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

5 years ago[X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp...
Craig Topper [Sun, 20 Jan 2019 19:04:56 +0000 (19:04 +0000)]
[X86] Remove the cvtuqq2ps256/cvtqq2ps256 mask builtins. Replace with uitofp/sitofp and select.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: kristina, cfe-commits

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

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

5 years ago[X86] Replace VPCOM/VPCOMU with generic integer comparisons (clang)
Simon Pilgrim [Sun, 20 Jan 2019 16:40:33 +0000 (16:40 +0000)]
[X86] Replace VPCOM/VPCOMU with generic integer comparisons (clang)

These intrinsics can always be replaced with generic integer comparisons without any regression in codegen, even for -O0/-fast-isel cases.

Noticed while cleaning up vector integer comparison costs for PR40376.

A future commit will remove/autoupgrade the existing VPCOM/VPCOMU llvm intrinsics.

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

5 years ago[FIX] Generalize the expected results for callback clang tests
Johannes Doerfert [Sat, 19 Jan 2019 20:46:10 +0000 (20:46 +0000)]
[FIX] Generalize the expected results for callback clang tests

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

5 years agoUpdate the license mentioned in this documentation.
Chandler Carruth [Sat, 19 Jan 2019 11:48:15 +0000 (11:48 +0000)]
Update the license mentioned in this documentation.

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

5 years ago[ASTDump] NFC: Convert iterative loops to cxx_range_for
Stephen Kelly [Sat, 19 Jan 2019 09:57:59 +0000 (09:57 +0000)]
[ASTDump] NFC: Convert iterative loops to cxx_range_for

This is coming up a lot in reviews. Better just to change them all at
once.

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

5 years ago[ASTDump] NFC: Use `const auto` in cxx_range_for loops
Stephen Kelly [Sat, 19 Jan 2019 09:57:51 +0000 (09:57 +0000)]
[ASTDump] NFC: Use `const auto` in cxx_range_for loops

This is coming up a lot in reviews. Better just to do them all at once.

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

5 years ago[FIX] Restrict callback pthreads_create test to linux only
Johannes Doerfert [Sat, 19 Jan 2019 09:40:10 +0000 (09:40 +0000)]
[FIX] Restrict callback pthreads_create test to linux only

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

5 years ago[NFC] Generalize expected output for callback test
Johannes Doerfert [Sat, 19 Jan 2019 09:40:08 +0000 (09:40 +0000)]
[NFC] Generalize expected output for callback test

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

5 years agoUpdate the license header in this man-page file.
Chandler Carruth [Sat, 19 Jan 2019 09:24:38 +0000 (09:24 +0000)]
Update the license header in this man-page file.

It contains an `$Id$` expansion and so can only be updated from a true
Subversion client.

See the details of this update in r351636.

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

5 years agoMove decl context dumping to TextNodeDumper
Stephen Kelly [Sat, 19 Jan 2019 09:05:55 +0000 (09:05 +0000)]
Move decl context dumping to TextNodeDumper

Summary: Only an obscure case is moved.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoUpdate the file headers across all of the LLVM projects in the monorepo
Chandler Carruth [Sat, 19 Jan 2019 08:50:56 +0000 (08:50 +0000)]
Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

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

5 years agoConvert two more files that were using Windows line endings and remove
Chandler Carruth [Sat, 19 Jan 2019 06:36:08 +0000 (06:36 +0000)]
Convert two more files that were using Windows line endings and remove
a stray single '\r' from one file. These are the last line ending issues
I can find in the files containing parts of LLVM's file headers.

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

5 years agoRemove random windows line endings that snuck into the middle of this
Chandler Carruth [Sat, 19 Jan 2019 06:36:00 +0000 (06:36 +0000)]
Remove random windows line endings that snuck into the middle of this
code.

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

5 years agoUpdate some code used in our visual studio plugins to use linux file
Chandler Carruth [Sat, 19 Jan 2019 06:29:07 +0000 (06:29 +0000)]
Update some code used in our visual studio plugins to use linux file
endings. We already used them in some cases, and this makes things
consistent. This will also simplify updating the licenses in these
files.

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

5 years agoInstall new LLVM license structure and new developer policy.
Chandler Carruth [Sat, 19 Jan 2019 06:14:24 +0000 (06:14 +0000)]
Install new LLVM license structure and new developer policy.

This installs the new developer policy and moves all of the license
files across all LLVM projects in the monorepo to the new license
structure. The remaining projects will be moved independently.

Note that I've left odd formatting and other idiosyncracies of the
legacy license structure text alone to make the diff easier to read.
Critically, note that we do not in any case *remove* the old license
notice or terms, as that remains necessary until we finish the
relicensing process.

I've updated a few license files that refer to the LLVM license to
instead simply refer generically to whatever license the LLVM project is
under, basically trying to minimize confusion.

This is really the culmination of so many people. Chris led the
community discussions, drafted the policy update and organized the
multi-year string of meeting between lawyers across the community to
figure out the strategy. Numerous lawyers at companies in the community
spent their time figuring out initial answers, and then the Foundation's
lawyer Heather Meeker has done *so* much to help refine and get us ready
here. I could keep going on, but I just want to make sure everyone
realizes what a huge community effort this has been from the begining.

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

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

5 years agoEmit !callback metadata and introduce the callback attribute
Johannes Doerfert [Sat, 19 Jan 2019 05:36:54 +0000 (05:36 +0000)]
Emit !callback metadata and introduce the callback attribute

  With commit r351627, LLVM gained the ability to apply (existing) IPO
  optimizations on indirections through callbacks, or transitive calls.
  The general idea is that we use an abstraction to hide the middle man
  and represent the callback call in the context of the initial caller.
  It is described in more detail in the commit message of the LLVM patch
  r351627, the llvm::AbstractCallSite class description, and the
  language reference section on callback-metadata.

  This commit enables clang to emit !callback metadata that is
  understood by LLVM. It does so in three different cases:
    1) For known broker functions declarations that are directly
       generated, e.g., __kmpc_fork_call for the OpenMP pragma parallel.
    2) For known broker functions that are identified by their name and
       source location through the builtin detection, e.g.,
       pthread_create from the POSIX thread API.
    3) For user annotated functions that carry the "callback(callee, ...)"
       attribute. The attribute has to include the name, or index, of
       the callback callee and how the passed arguments can be
       identified (as many as the callback callee has). See the callback
       attribute documentation for detailed information.

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

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

5 years ago[analyzer] pr37688: Fix a crash upon evaluating a deleted destructor of a union.
Artem Dergachev [Fri, 18 Jan 2019 23:05:07 +0000 (23:05 +0000)]
[analyzer] pr37688: Fix a crash upon evaluating a deleted destructor of a union.

Add a defensive check against an invalid destructor in the CFG.

Unions with fields with destructors have their own destructor implicitly
deleted. Due to a bug in the CFG we're still trying to evaluate them
at the end of the object's lifetime and crash because we are unable
to find the destructor's declaration.

rdar://problem/47362608

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

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

5 years ago[analyzer] Do not try to body-farm Objective-C properties with custom accessors.
Artem Dergachev [Fri, 18 Jan 2019 22:52:13 +0000 (22:52 +0000)]
[analyzer] Do not try to body-farm Objective-C properties with custom accessors.

If a property is defined with a custom getter, we should not behave as if
the getter simply returns an instance variable. We don't support setters,
so they aren't affected.

On top of being the right thing to do, this also fixes a crash on
the newly added test - in which a property and its getter are defined
in two separate categories.

rdar://problem/47051544

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

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

5 years ago[ASTDump] Add test for current AST dump behavior
Stephen Kelly [Fri, 18 Jan 2019 22:15:13 +0000 (22:15 +0000)]
[ASTDump] Add test for current AST dump behavior

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

5 years ago[ASTDump] NFC: Move variable into if() statement
Stephen Kelly [Fri, 18 Jan 2019 22:15:09 +0000 (22:15 +0000)]
[ASTDump] NFC: Move variable into if() statement

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

5 years ago[ASTDump] NFC: Remove redundant condition
Stephen Kelly [Fri, 18 Jan 2019 22:15:05 +0000 (22:15 +0000)]
[ASTDump] NFC: Remove redundant condition

These conditions are duplicated from the dumpDeclContext function called
within the if(). This is presumably an attempt to avoid calling the
function in the case it will do nothing.

That may have made sense in the past if the code was different, but it
doesn't make sense now.

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

5 years ago[ASTDump] NFC: Remove non-needed braces
Stephen Kelly [Fri, 18 Jan 2019 22:14:59 +0000 (22:14 +0000)]
[ASTDump] NFC: Remove non-needed braces

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

5 years ago[ASTDump] Mark null params with a tag rather than a child node
Stephen Kelly [Fri, 18 Jan 2019 22:00:16 +0000 (22:00 +0000)]
[ASTDump] Mark null params with a tag rather than a child node

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[ASTDump] Mark BlockDecls which capture this with a tag
Stephen Kelly [Fri, 18 Jan 2019 21:55:24 +0000 (21:55 +0000)]
[ASTDump] Mark BlockDecls which capture this with a tag

Summary:
Removal of the child node makes it easier to separate traversal from
output generation.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[ASTDump] Mark variadic declarations with a tag instead of child node
Stephen Kelly [Fri, 18 Jan 2019 21:38:30 +0000 (21:38 +0000)]
[ASTDump] Mark variadic declarations with a tag instead of child node

Summary:
This makes it easier to separate traversal of the AST from output
generation.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[Sema] Suppress a warning about a forward-declared fixed enum in C mode
Erik Pilkington [Fri, 18 Jan 2019 21:33:23 +0000 (21:33 +0000)]
[Sema] Suppress a warning about a forward-declared fixed enum in C mode

As of r343360, we support fixed-enums in C. This lead to some
warnings in project headers where a fixed enum is forward declared
then later defined. In C++, this is fine, the forward declaration is
treated as a complete type even though the definition isn't present.
We use this rule in C too, but still warn about the forward
declaration anyways. This patch suppresses the warning.

rdar://problem/47356469

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

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

5 years ago[Fixed Point Arithmetic] Fixed Point Addition Constant Expression Evaluation
Leonard Chan [Fri, 18 Jan 2019 21:04:25 +0000 (21:04 +0000)]
[Fixed Point Arithmetic] Fixed Point Addition Constant Expression Evaluation

This patch includes logic for constant expression evaluation of fixed point additions.

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

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

5 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Fri, 18 Jan 2019 20:40:35 +0000 (20:40 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.

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

5 years ago[OPENMP][DOCS] Release notes/OpenMP support updates, NFC.
Kelvin Li [Fri, 18 Jan 2019 19:57:37 +0000 (19:57 +0000)]
[OPENMP][DOCS] Release notes/OpenMP support updates, NFC.

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

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

5 years ago[mips] Add '-mrelax-pic-calls', '-mno-relax-pic-calls'
Vladimir Stefanovic [Fri, 18 Jan 2019 19:54:51 +0000 (19:54 +0000)]
[mips] Add '-mrelax-pic-calls', '-mno-relax-pic-calls'

These two options enable/disable emission of R_{MICRO}MIPS_JALR fixups along
with PIC calls. The linker may then try to turn PIC calls into direct jumps.
By default, these fixups do get emitted by the backend, use
'-mno-relax-pic-calls' to omit them.

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

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

5 years ago[NFC] Fix wParentheses warning in ASTContext getFixedPointSemantics
Erich Keane [Fri, 18 Jan 2019 19:31:54 +0000 (19:31 +0000)]
[NFC] Fix wParentheses warning in ASTContext getFixedPointSemantics

Change-Id: I862f00a548236872fe24f7da8eb2bf7917e123ff

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

5 years agoRevert "Fix failing MSan bots"
George Karpenkov [Fri, 18 Jan 2019 19:24:55 +0000 (19:24 +0000)]
Revert "Fix failing MSan bots"

This reverts commit 2cedaaef383d8d6142046074ffebc2bb5a914778.

Revert with a fix.

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

5 years ago[clang] Change to range-based invocation of llvm::sort
Mandeep Singh Grang [Fri, 18 Jan 2019 18:45:26 +0000 (18:45 +0000)]
[clang] Change to range-based invocation of llvm::sort

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

5 years ago[X86] Only define _XCR_XFEATURE_ENABLED_MASK in xsaveintrin.h when _MSC_VER is define...
Craig Topper [Fri, 18 Jan 2019 17:51:51 +0000 (17:51 +0000)]
[X86] Only define _XCR_XFEATURE_ENABLED_MASK in xsaveintrin.h when _MSC_VER is defined. Remove from intrin.h.

I think this was my intention when I added it xsaveintrin.h

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

5 years ago[clang][slh] add Clang attr no_speculative_load_hardening
Zola Bridges [Fri, 18 Jan 2019 17:20:46 +0000 (17:20 +0000)]
[clang][slh] add Clang attr no_speculative_load_hardening

Summary:
This attribute will allow users to opt specific functions out of
speculative load hardening. This compliments the Clang attribute
named speculative_load_hardening. When this attribute or the attribute
speculative_load_hardening is used in combination with the flags
-mno-speculative-load-hardening or -mspeculative-load-hardening,
the function level attribute will override the default during LLVM IR
generation. For example, in the case, where the flag opposes the
function attribute, the function attribute will take precendence.
The sticky inlining behavior of the speculative_load_hardening attribute
may cause a function with the no_speculative_load_hardening attribute
to be tagged with the speculative_load_hardening tag in
subsequent compiler phases which is desired behavior since the
speculative_load_hardening LLVM attribute is designed to be maximally
conservative.

If both attributes are specified for a function, then an error will be
thrown.

Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

Subscribers: llvm-commits

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

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

5 years agoRevert "Clang side support for @cc assembly operands."
Nirav Dave [Fri, 18 Jan 2019 16:03:08 +0000 (16:03 +0000)]
Revert "Clang side support for @cc assembly operands."

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

5 years agoClang side support for @cc assembly operands.
Nirav Dave [Fri, 18 Jan 2019 15:57:23 +0000 (15:57 +0000)]
Clang side support for @cc assembly operands.

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

5 years agoFix test failure from r351495
Erich Keane [Fri, 18 Jan 2019 13:58:10 +0000 (13:58 +0000)]
Fix test failure from r351495

The test has problems due to some platforms having a different type for
ptrdiff_t, so the error message is different.  The error message doesn't
matter to the test for anything other than an incompatible intger to
pointer conversion, so this patch removes the integral type from the
expected message.

Change-Id: I80e786f9b80268163813774bbf25a9ca25b6c60c

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

5 years ago[OpenCL] Fix overloading ranking rules for addrspace conversions.
Anastasia Stulova [Fri, 18 Jan 2019 11:38:16 +0000 (11:38 +0000)]
[OpenCL] Fix overloading ranking rules for addrspace conversions.

Extend ranking to work with address spaces correctly when
resolving overloads.

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

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

5 years ago[analyzer] Unbreak building of SymbolReaperTest true BUILD_SHARED_LIBS=True
Alex Bradbury [Fri, 18 Jan 2019 10:13:07 +0000 (10:13 +0000)]
[analyzer] Unbreak building of SymbolReaperTest true BUILD_SHARED_LIBS=True

Extra dependencies need to be listed for StaticAnalysisTests in order for
linking to succeed when BUILD_SHARED_LIBS=True.

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

5 years ago[tooling] Add a new argument adjuster for deleting plugin related command line args
Kadir Cetinkaya [Fri, 18 Jan 2019 09:00:31 +0000 (09:00 +0000)]
[tooling] Add a new argument adjuster for deleting plugin related command line args

Summary:
Currently both clangd and clang-tidy makes use of this mechanism so
putting it into tooling so that all tools can make use of it.

Reviewers: ilya-biryukov, sammccall

Subscribers: ioeric, cfe-commits

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

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

5 years agoFix failing MSan bots
Vlad Tsyrklevich [Fri, 18 Jan 2019 08:43:22 +0000 (08:43 +0000)]
Fix failing MSan bots

Revert r351508-351514, this block of changes introduced a consistent
MSan failure on the sanitizer bots.

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

5 years ago[analyzer] Introduce proper diagnostic for freeing unowned object
George Karpenkov [Fri, 18 Jan 2019 03:13:53 +0000 (03:13 +0000)]
[analyzer] Introduce proper diagnostic for freeing unowned object

Insert a note when the object becomes not (exclusively) owned.

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

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

5 years ago[analyzer] Extend the PathDiagnosticLocation constructor to handle CallExitEnd
George Karpenkov [Fri, 18 Jan 2019 03:13:40 +0000 (03:13 +0000)]
[analyzer] Extend the PathDiagnosticLocation constructor to handle CallExitEnd

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

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

5 years ago[analyzer] [NFC] Clean up messy handling of bug categories in RetainCountChecker
George Karpenkov [Fri, 18 Jan 2019 03:13:27 +0000 (03:13 +0000)]
[analyzer] [NFC] Clean up messy handling of bug categories in RetainCountChecker

https://reviews.llvm.org/D56887

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

5 years ago[analyzer] const-ify reference to bug type used in BugReporter
George Karpenkov [Fri, 18 Jan 2019 03:13:14 +0000 (03:13 +0000)]
[analyzer] const-ify reference to bug type used in BugReporter

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

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

5 years ago[analyzer] Extend BugType constructor to accept "SuppressOnSink" as a parameter
George Karpenkov [Fri, 18 Jan 2019 03:13:01 +0000 (03:13 +0000)]
[analyzer] Extend BugType constructor to accept "SuppressOnSink" as a parameter

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

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

5 years ago[analyzer] [RetainCountChecker] Produce a correct message when OSTypeAlloc is used
George Karpenkov [Fri, 18 Jan 2019 03:12:48 +0000 (03:12 +0000)]
[analyzer] [RetainCountChecker] Produce a correct message when OSTypeAlloc is used

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

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

5 years ago[analyzer] [RetainCountChecker] Smart pointer support.
George Karpenkov [Fri, 18 Jan 2019 03:12:35 +0000 (03:12 +0000)]
[analyzer] [RetainCountChecker] Smart pointer support.

rdar://47323216

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

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

5 years ago[analyzer] A speculative fix for buildbot failures in the new SymbolReaperTest.
Artem Dergachev [Fri, 18 Jan 2019 01:37:14 +0000 (01:37 +0000)]
[analyzer] A speculative fix for buildbot failures in the new SymbolReaperTest.

I expect an xvalue to be easier to convert.

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

5 years ago[analyzer] MoveChecker: Add one more common resetting method, "append".
Artem Dergachev [Fri, 18 Jan 2019 00:16:25 +0000 (00:16 +0000)]
[analyzer] MoveChecker: Add one more common resetting method, "append".

This is especially crucial for reports related to use-after-move of
standard library objects.

rdar://problem/47338505

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

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

5 years ago[analyzer] Make sure base-region and its sub-regions are either all alive or all...
Artem Dergachev [Fri, 18 Jan 2019 00:08:56 +0000 (00:08 +0000)]
[analyzer] Make sure base-region and its sub-regions are either all alive or all dead.

SymbolReaper now realizes that our liveness analysis isn't sharp enough
to discriminate between liveness of, say, variables and their fields.
Surprisingly, this didn't quite work before: having a variable live only
through Environment (eg., calling a C++ method on a local variable
as the last action ever performed on that variable) would not keep the
region value symbol of a field of that variable alive.

It would have been broken in the opposite direction as well, but both
Environment and RegionStore use the scanReachableSymbols mechanism for finding
live symbols regions within their values, and due to that they accidentally
end up marking the whole chain of super-regions as live when at least one
sub-region is known to be live.

It is now a direct responsibility of SymbolReaper to maintain this invariant,
and a unit test was added in order to make sure it stays that way.

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

rdar://problem/46914108

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

5 years agoMake integral-o-pointer conversions in SFINAE illegal.
Erich Keane [Thu, 17 Jan 2019 23:11:15 +0000 (23:11 +0000)]
Make integral-o-pointer conversions in SFINAE illegal.

As reported in PR40362, allowing the conversion from an integral to a
pointer type (despite being illegal in the C++ standard) will cause
surprsing results when testing for certain behaviors in SFINAE.  This
patch converts the error to a SFINAE Error and adds a test to ensure
that it is still a warning in non-SFINAE but an error in it.

Change-Id: I1f475637fa4d83217ae37dc6b5dbf653e118fae4

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

5 years agoFix cleanup registration for lambda captures.
Richard Smith [Thu, 17 Jan 2019 22:05:50 +0000 (22:05 +0000)]
Fix cleanup registration for lambda captures.

Lambda captures should be destroyed if an exception is thrown only if
the construction of the complete lambda-expression has not completed.
(If the lambda-expression has been fully constructed, any exception will
invoke its destructor, which will destroy the captures.)

This is directly modeled after how we handle the equivalent situation in
InitListExprs.

Note that EmitLambdaLValue was unreachable because in C++11 onwards the
frontend never creates the awkward situation where a prvalue expression
(such as a lambda) is used in an lvalue context (such as the left-hand
side of a class member access).

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

5 years agoAdd -Wctad-maybe-unsupported to diagnose CTAD on types with no user defined deduction...
Eric Fiselier [Thu, 17 Jan 2019 21:44:24 +0000 (21:44 +0000)]
Add -Wctad-maybe-unsupported to diagnose CTAD on types with no user defined deduction guides.

Summary:
Some style guides want to allow using CTAD only on types that "opt-in"; i.e. on types that are designed to support it and not just types that *happen* to work with it.

This patch implements the `-Wctad-maybe-unsupported` warning, which is off by default, which warns when CTAD is used on a type that does not define any deduction guides.

The following pattern can be used to suppress the warning in cases where the type intentionally doesn't define any deduction guides:

```
struct allow_ctad_t;

template <class T>
struct TestSuppression {
  TestSuppression(T) {}
};
TestSuppression(allow_ctad_t)->TestSuppression<void>; // guides with incomplete parameter types are never considered.
```

Reviewers: rsmith, james.dennett, gromer

Reviewed By: rsmith

Subscribers: jdennett, Quuxplusone, lebedev.ri, cfe-commits

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

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

5 years agoFix -Wsign-compare in new tests
Reid Kleckner [Thu, 17 Jan 2019 20:52:46 +0000 (20:52 +0000)]
Fix -Wsign-compare in new tests

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

5 years agoRevert r351209 (which was a revert of r350891) with a fix.
Aaron Ballman [Thu, 17 Jan 2019 20:21:34 +0000 (20:21 +0000)]
Revert r351209 (which was a revert of r350891) with a fix.

The test case had a parse error that was causing the condition string to be misreported. We now have better fallback code for error cases.

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