Commit Graph

76434 Commits

Author SHA1 Message Date
Adrian Prantl c2a44ecf39 Remove CGDebugInfo::getOrCreateFile() and use TheCU->getFile() directly.
llvm-svn: 348866
2018-12-11 16:58:46 +00:00
Adrian Prantl aa5bad449b Reuse code from CGDebugInfo::getOrCreateFile() when creating the file
for the DICompileUnit.

This addresses post-commit feedback for D55085. Without this patch, a
main source file with an absolute paths may appear in different
DIFiles, once with the absolute path and once with the common prefix
between the absolute path and the current working directory.

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

llvm-svn: 348865
2018-12-11 16:58:43 +00:00
Eric Fiselier 743ae6045d Pass PartialOverloading argument to the correct corresponding parameter
llvm-svn: 348864
2018-12-11 16:53:25 +00:00
Max Moroz c5c28ff4ae [ASan] Minor documentation fix: clarify static linking limitation.
Summary:
ASan does not support statically linked binaries, but ASan runtime itself can
be statically linked into a target binary executable.

Reviewers: eugenis, kcc

Reviewed By: eugenis

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 348863
2018-12-11 16:47:12 +00:00
Aaron Ballman 059b85e7ff Adding tests for -ast-dump; NFC.
This adds tests for expressions in C++.

llvm-svn: 348860
2018-12-11 16:34:59 +00:00
Stefan Pintilie 5e3dc68c6a Revert "[PowerPC] Make no-PIC default to match GCC - CLANG"
This reverts commit rL348299.

llvm-svn: 348858
2018-12-11 15:47:57 +00:00
Gabor Horvath 2d7f3a3132 [analyzer] Fix a minor typo.
llvm-svn: 348848
2018-12-11 14:40:48 +00:00
Clement Courbet f44c6f402c Reland r348741 "[Sema] Further improvements to to static_assert diagnostics."
Fix a dangling reference to temporary, never return nullptr.

llvm-svn: 348834
2018-12-11 08:39:11 +00:00
Clement Courbet 4ba13bd394 Revert r348830 "[Sema]improve static_assert(!expr)"
Submitted the wrong change.

llvm-svn: 348831
2018-12-11 07:28:00 +00:00
Clement Courbet 67b03de9a2 [Sema]improve static_assert(!expr)
llvm-svn: 348830
2018-12-11 07:04:49 +00:00
Richard Trieu 6368818fd5 Move CodeGenOptions from Frontend to Basic
Basic uses CodeGenOptions and should not depend on Frontend.

llvm-svn: 348827
2018-12-11 03:18:39 +00:00
George Karpenkov e8240f4df0 [analyzer] Remove memoization from RunLoopAutoreleaseLeakChecker
Memoization dose not seem to be necessary, as other statement visitors
run just fine without it,
and in fact seems to be causing memory corruptions.
Just removing it instead of investigating the root cause.

rdar://45945002

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

llvm-svn: 348822
2018-12-11 01:14:17 +00:00
George Karpenkov d1081ec508 [analyzer] Hack for backwards compatibility for options for RetainCountChecker.
To be removed once the clients update.

llvm-svn: 348821
2018-12-11 01:13:58 +00:00
George Karpenkov ff01486753 [analyzer] Display a diagnostics when an inlined function violates its os_consumed summary
This is currently a diagnostics, but might be upgraded to an error in the future,
especially if we introduce os_return_on_success attributes.

rdar://46359592

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

llvm-svn: 348820
2018-12-11 01:13:40 +00:00
George Karpenkov 79ed11c12e [analyzer] Resolve another bug where the name of the leaked object was not printed properly
Differential Revision: https://reviews.llvm.org/D55528

llvm-svn: 348819
2018-12-11 01:13:20 +00:00
Matt Arsenault 6242a39d56 Update test for instcombine change
llvm-svn: 348809
2018-12-10 23:02:40 +00:00
Stephen Kelly 677e3aec9e Revert "Change InitListExpr dump to label and pointer"
This reverts commit r348794.

llvm-svn: 348799
2018-12-10 21:20:05 +00:00
Stephen Kelly 1be0bea084 Fix nits
llvm-svn: 348798
2018-12-10 21:04:04 +00:00
Stephen Kelly 43835951f4 Re-order content of template parameter dumps
Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348797
2018-12-10 21:03:00 +00:00
Stephen Kelly 266dc19e4e Re-order content in OMPDeclareReductionDecl dump
Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348795
2018-12-10 20:53:39 +00:00
Stephen Kelly a1005921eb Change InitListExpr dump to label and pointer
Summary: Don't add a child just for the label.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348794
2018-12-10 20:53:32 +00:00
Aaron Ballman ce2837f880 Add an explicit triple to this test to fix failing test bots.
llvm-svn: 348790
2018-12-10 19:18:11 +00:00
Bruno Cardoso Lopes 5c1399a582 [constexpr][c++2a] Try-catch blocks in constexpr functions
Implement support for try-catch blocks in constexpr functions, as
proposed in http://wg21.link/P1002 and voted in San Diego for c++20.

The idea is that we can still never throw inside constexpr, so the catch
block is never entered. A try-catch block like this:

try { f(); } catch (...) { }

is then morally equivalent to just

{ f(); }

Same idea should apply for function/constructor try blocks.

rdar://problem/45530773

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

llvm-svn: 348789
2018-12-10 19:03:12 +00:00
Aaron Ballman 2ead087b6d Adding tests for -ast-dump; NFC.
This adds tests for expressions in C.

llvm-svn: 348786
2018-12-10 18:37:47 +00:00
Fangrui Song d906e731ec ComputeLineNumbers: delete SSE2 vectorization
Summary:
SSE2 vectorization was added in 2012, but it is 2018 now and I can't
observe any performance boost (testing clang -E [all Sema/* CodeGen/* with proper -I options]) with the existing _mm_movemask_epi8+countTrailingZeros or the following SSE4.2 (compiling with -msse4.2):

  __m128i C = _mm_setr_epi8('\r','\n',0,0,0,0,0,0,0,0,0,0,0,0,0,0);
  _mm_cmpestri(C, 2, Chunk, 16, _SIDD_UBYTE_OPS | _SIDD_CMP_EQUAL_ANY | _SIDD_POSITIVE_POLARITY | _SIDD_LEAST_SIGNIFICANT)

Delete the vectorization to simplify the code.

Also simplify the code a bit and don't check the line ending sequence \n\r

Reviewers: bkramer, #clang

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 348777
2018-12-10 18:10:35 +00:00
Ivan Donchevskii c5929138f5 [libclang] Revert removal of tidy plugin support from libclang introduced in r347496
Differential Revision: https://reviews.llvm.org/D55415

llvm-svn: 348764
2018-12-10 15:58:50 +00:00
Michael Kruse 157a355f3b Use zip_longest for iterator range comparisons. NFC.
Use zip_longest in two locations that compare iterator ranges.
zip_longest allows the iteration using a range-based for-loop and to be
symmetric over both ranges instead of prioritizing one over the other.
In that latter case code have to handle the case that the first is
longer than the second, the second is longer than the first, and both
are of the same length, which must partially be checked after the loop.

With zip_longest, this becomes an element comparison within the loop
like the comparison of the elements themselves. The symmetry makes it
clearer that neither the first and second iterators are handled
differently. The iterators are not event used directly anymore, just
the ranges.

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

llvm-svn: 348762
2018-12-10 15:16:37 +00:00
Raphael Isemann b23ccecbb0 Misc typos fixes in ./lib folder
Summary: Found via `codespell -q 3 -I ../clang-whitelist.txt -L uint,importd,crasher,gonna,cant,ue,ons,orign,ned`

Reviewers: teemperor

Reviewed By: teemperor

Subscribers: teemperor, jholewinski, jvesely, nhaehnle, whisperity, jfb, cfe-commits

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

llvm-svn: 348755
2018-12-10 12:37:46 +00:00
Andrew Savonichev 1bf1a156d6 [OpenCL][CodeGen] Fix replacing memcpy with addrspacecast
Summary:
If a function argument is byval and RV is located in default or alloca address space
an optimization of creating addrspacecast instead of memcpy is performed. That is
not correct for OpenCL, where that can lead to a situation of address space casting
from __private * to __global *. See an example below:

```
typedef struct {
  int x;
} MyStruct;

void foo(MyStruct val) {}

kernel void KernelOneMember(__global MyStruct* x) {
  foo (*x);
}
```

for this code clang generated following IR:
...
%0 = load %struct.MyStruct addrspace(1)*, %struct.MyStruct addrspace(1)**
%x.addr, align 4
%1 = addrspacecast %struct.MyStruct addrspace(1)* %0 to %struct.MyStruct*
...

So the optimization was disallowed for OpenCL if RV is located in an address space
different than that of the argument (0).


Reviewers: yaxunl, Anastasia

Reviewed By: Anastasia

Subscribers: cfe-commits, asavonic

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

llvm-svn: 348752
2018-12-10 12:03:00 +00:00
Clement Courbet d872041f8f Revert r348741 "[Sema] Further improvements to to static_assert diagnostics."
Seems to break build bots.

llvm-svn: 348742
2018-12-10 08:53:17 +00:00
Clement Courbet 057f7695de [Sema] Further improvements to to static_assert diagnostics.
Summary:
We're now handling cases like `static_assert(!expr)` and
static_assert(!(expr))`.

Reviewers: aaron.ballman, Quuxplusone

Subscribers: cfe-commits

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

llvm-svn: 348741
2018-12-10 08:19:38 +00:00
Craig Topper 6d7a7ef9eb [X86] Remove the addcarry builtins. Leaving only the addcarryx builtins since that matches gcc.
The addcarry and addcarryx builtins do the same thing. The only difference is that addcarryx previously required adx feature.

This commit removes the adx feature check from addcarryx and removes the addcarry builtin. This matches the builtins that gcc has. We don't guarantee compatibility in builtins, but we generally try to be consistent if its not a burden.

llvm-svn: 348738
2018-12-10 06:07:59 +00:00
Aaron Ballman 543826dec0 Move the make_const_ptr trait into STLExtras; use add_pointer where possible; NFC.
llvm-svn: 348730
2018-12-09 19:53:24 +00:00
Stephen Kelly 2413638a6d NFC: Rename TemplateDecl dump utilities
There is a clang::TemplateDecl AST type, so a method called
VisitTemplateDecl looks like it should 'override' the method from the
base visitor, but it does not because of the extra parameters it takes.

In reality, these methods are utilities, so name them like utilities.

llvm-svn: 348720
2018-12-09 13:33:30 +00:00
Stephen Kelly e26a88aaa8 NFC: Move dump of individual comment nodes to NodeDumper
Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348719
2018-12-09 13:30:17 +00:00
Stephen Kelly 50a29bd40b Revert "Introduce optional labels to dumpStmt"
This reverts commit 933402caa09963792058198578522a95f013c69c.

llvm-svn: 348718
2018-12-09 13:24:40 +00:00
Stephen Kelly 3283535dc8 Introduce optional labels to dumpStmt
If the label is present, it is added as a child, with the statement a
child of the label.  This preserves behavior of the InitListExpr dump
output.

llvm-svn: 348717
2018-12-09 13:23:07 +00:00
Stephen Kelly 39271a195b Inline hasNodes into only caller
It is easier to refactor with fewer utility methods.

llvm-svn: 348716
2018-12-09 13:20:43 +00:00
Stephen Kelly 570b297673 Inline dumpFullComment into callers
It causes confusion over whether it or dumpComment is the more
important. It is easier to refactor with fewer utility methods.

llvm-svn: 348715
2018-12-09 13:18:55 +00:00
Stephen Kelly 7ec37b2b29 Re-order content from InitListExpr
Summary:
This causes no change in the output of ast-dump-stmt.cpp due to the way
child nodes are printed with a delay.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 348714
2018-12-09 13:15:18 +00:00
Stephen Kelly 2ac0c371d0 Fix InitListExpr test
Wrong case of Check meant this has no effect.

llvm-svn: 348713
2018-12-09 13:13:41 +00:00
Fangrui Song eae2b49fe3 SourceManager: insert(make_pair(..)) -> try_emplace. NFC
llvm-svn: 348709
2018-12-09 01:46:01 +00:00
Pete Cooper e388680dfa Convert some ObjC msgSends to runtime calls.
It is faster to directly call the ObjC runtime for methods such as alloc/allocWithZone instead of sending a message to those functions.

This patch adds support for converting messages to alloc/allocWithZone to their equivalent runtime calls.

Tests included for the positive case of applying this transformation, negative tests that we ensure we only convert "alloc" to objc_alloc, not "alloc2", and also a driver test to ensure we enable this only for supported runtime versions.

Reviewed By: rjmccall

https://reviews.llvm.org/D55349

llvm-svn: 348687
2018-12-08 05:13:50 +00:00
Richard Trieu d076608d58 Move diagnostic enums into Basic.
Move enums from */*Diagnostic.h to Basic/Diagnostic*.h.  Basic/AllDiagnostics.h
needs all the enums and moving the sources to Basic prevents a Basic->*->Basic
dependency loop.  This also allows each Basic/Diagnostics*Kinds.td to have a
header at Basic/Diagnostic*.h (except for Common).  The old headers are kept in place since other packages are still using them.

llvm-svn: 348685
2018-12-08 05:05:03 +00:00
George Karpenkov 041c9fa8ba Stop tracking retain count of OSObject after escape to void * / other primitive types
Escaping to void * / uint64_t / others non-OSObject * should stop tracking,
as such functions can have heterogeneous semantics depending on context,
and can not always be annotated.

rdar://46439133

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

llvm-svn: 348675
2018-12-08 01:18:40 +00:00
Stella Stamenova 0ef54dbd64 [tests] Fix the FileManagerTest getVirtualFile test on Windows
Summary: The test passes on Windows only when it is executed on the C: drive. If the build and tests run on a different drive, the test is currently failing.

Reviewers: kadircet, asmith

Subscribers: cfe-commits

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

llvm-svn: 348665
2018-12-07 23:50:05 +00:00
Artem Belevich 43cfce88b4 [CUDA] Added missing 'inline' for functions defined in a header.
llvm-svn: 348662
2018-12-07 22:20:53 +00:00
Volodymyr Sapsai 978be4c1a3 [Preprocessor] Don't avoid entering included files after hitting a fatal error.
Change in r337953 violated the contract for `CXTranslationUnit_KeepGoing`:

> Do not stop processing when fatal errors are encountered.

Use different approach to fix long processing times with multiple inclusion
cycles. Instead of stopping preprocessing for fatal errors, do this after
reaching the max allowed include depth and only for the files that were
processed already. It is likely but not guaranteed those files cause a cycle.

rdar://problem/46108547

Reviewers: erik.pilkington, arphaman

Reviewed By: erik.pilkington

Subscribers: jkorous, dexonsmith, ilya-biryukov, Dmitry.Kozhevnikov

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

llvm-svn: 348641
2018-12-07 20:29:54 +00:00
George Karpenkov 27db33075c [analyzer] Move out tracking retain count for OSObjects into a separate checker
Allow enabling and disabling tracking of ObjC/CF objects
separately from tracking of OS objects.

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

llvm-svn: 348638
2018-12-07 20:21:51 +00:00
George Karpenkov 936a9c978c [analyzer] RetainCountChecker: remove untested, unused, incorrect option IncludeAllocationLine
The option has no tests, is not used anywhere, and is actually
incorrect: it prints the line number without the reference to a file,
which can be outright incorrect.

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

llvm-svn: 348637
2018-12-07 20:21:37 +00:00