Commit Graph

338034 Commits

Author SHA1 Message Date
Fangrui Song 0792ef7256 [Driver] Verify -mrecord-mcount in Driver, instead of CodeGen after D71627
GCC's x86 and s390 ports support -mrecord-mcount. Other ports reject the
option.

  aarch64-linux-gnu-gcc: error: unrecognized command line option ‘-mrecord-mcount’

Allowing this option can cause failures when building Linux kernel for
aarch64, powerpc64, etc, which will think the feature is available if
the clang command returns 0.
2019-12-21 22:47:24 -08:00
Jonas Devlieghere ba0eb7b66f [lldb/ScriptInterpreter] Fix stale/bogus error messages
Fix the nonsensical error messages for when breakpoint and watchpoint
callbacks are not supported.
2019-12-21 22:33:02 -08:00
Jonas Devlieghere 68cb7d8542 [lldb/Commands] Honor the scripting language passed (2/2)
This ensures that watchpoint command honors the scripting language
passed with `-s`. Currently the argument ignores the actual language and
only uses it to differentiate between lldb and script commands.
2019-12-21 22:32:13 -08:00
Jonas Devlieghere acdda1344a [lldb/Lua] Add missing boiler plate to ScriptInterpreter.
- Fix enum entry order.
 - Fix missing enum case in CommandObjectBreakpointCommand.
 - Add Lua entry to swtich in LanguageToString and simplify the code.
2019-12-21 21:54:44 -08:00
LLVM GN Syncbot 0fe131aebb [gn build] Port 7376d9eb38 2019-12-22 02:15:02 +00:00
Nico Weber 541a342742 [gn build] fixup after c3d13d9c56 2019-12-21 21:14:26 -05:00
Jonas Devlieghere 1ff01cfe3e [lldb/Commands] Use the default scripting langauge for BP functions
When a function is used as a breakpoint command, use to the debugger's
default scripting language, unless a language is explicitly specified.
2019-12-21 18:12:37 -08:00
Nico Weber c3d13d9c56 [gn build] fold Basic:version into Basic
This now defines HAVE_VCS_VERSION_INC for all files in Basic,
but now the BUILD.gn file has only a single "sources" field again,
and the automerger requires that. Having the automerger work for
clang/lib/Basic is a very nice to have, and the downside seems tiny.
2019-12-21 21:10:02 -05:00
Yaxun (Sam) Liu 7376d9eb38 [NFC] Separate getLastArgIntValue to Basic
getLastArgIntValue is a useful utility function to get command line argument as an integer.
Currently it is in Frontend so that it can only be used by clang -cc1. Move it to basic so
that it can also be used by clang driver.

Differential Revision: https://reviews.llvm.org/D71080
2019-12-21 20:39:31 -05:00
Jonas Devlieghere 5e32eb1c7a [lldb/Commands] Honor the scripting language passed
This ensures that breakpoint command honors the scripting language
passed with `-s`. Currently the argument ignores the actual language and
only uses it to differentiate between lldb and script commands.
2019-12-21 17:35:29 -08:00
Jonas Devlieghere 8983d69144 [lldb/Commands] Fix bogus enum entry and add Lua (NFC)
Fixes a bogus enum value for the scripting language options, adds an
entry for Lua and refactored the code to use an exhaustive switch.
2019-12-21 17:21:32 -08:00
Jonas Devlieghere bbf70c0467 [lldb/Core] Support asking the debugger for a specific script interpreter
Rather than holding on to one script interpreter, it should be possible
to request a script interpreter for a specific scripting language. The
GetScriptInterpreter method now takes an optional scripting language
argument.

(NFC)
2019-12-21 17:11:12 -08:00
Jonas Devlieghere 4164be7206 [Lldb/Lua] Persist Lua state across script interpreter calls.
Don't create a new lua state on every operation. Share a single state
across the lifetime of the script interpreter. Add simple locking to
prevent two threads from modifying the state concurrently.
2019-12-21 15:00:35 -08:00
Raphael Isemann ceb433ad16 [lldb] Fix windows build after getASTContext() change 2019-12-21 23:27:27 +01:00
Raphael Isemann f9f49d3594 [lldb][NFC] Return a reference from ClangASTContext::getASTContext and remove dead nullptr checks
ClangASTContext::getASTContext() currently returns a ptr but we have an assert there since a
while that the ASTContext is not a nullptr. This causes that we still have a lot of code
that is doing nullptr checks on the result of getASTContext() which is all unreachable code.

This patch changes the return value to a reference to make it clear this can't be a nullptr
and deletes all the nullptr checks.
2019-12-21 22:51:35 +01:00
Jonas Devlieghere bf03e17c57 [Lldb/Lua] Generate Lua Bindings
This patch uses SWIG to generate the Lua bindings for the SB API. It
covers most of the API, but some methods require a type map similar to
Python.

Discussion on the mailing list:
http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html

Differential revision: https://reviews.llvm.org/D71235
2019-12-21 11:28:41 -08:00
Artem Dergachev 2203089a60 [analyzer] exploded-graph-rewriter: Fix string encodings in python3.
Makes sure that the script works fine both in python2 and python3.

Patch by Pavel Samolysov!

Differential Revision: https://reviews.llvm.org/D71746
2019-12-21 10:59:38 -08:00
Stepan Dyatkovskiy fc5102fb6e [NFC] test commit reverted 2019-12-21 22:12:07 +04:00
Stepan Dyatkovskiy 452ca8e73f [NFC] test commit 2019-12-21 22:11:34 +04:00
John Baldwin 189b7393d5 [lld][RISCV] Use an e_flags of 0 if there are only binary input files.
Summary:
If none of the input files are ELF object files (for example, when
generating an object file from a single binary input file via
"-b binary"), use a fallback value for the ELF header flags instead
of crashing with an assertion failure.

Reviewers: MaskRay, ruiu, espindola

Reviewed By: MaskRay, ruiu

Subscribers: kevans, grimar, emaste, arichardson, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, llvm-commits, jrtc27

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71101
2019-12-21 17:59:37 +00:00
Simon Pilgrim 6945d383b9 Fix "result of 32-bit shift implicitly converted to 64 bits" warning. NFC. 2019-12-21 17:45:30 +00:00
Alex Zinenko dcc14f0865 Make Type and Attribute classes trivially copyable
This requires using explicitly default copy constructor and copy assignment
operator instead of hand-rolled ones. These classes are indeed cheap to copy
since they are wrappers around a pointer to the implementation. This change
makes sure templated code can use standard type traits to understand that
copying such objects is cheap and appeases analysis tools such as clang-tidy.

PiperOrigin-RevId: 286725565
2019-12-21 09:45:24 -08:00
Simon Pilgrim d76202d3e3 Fix Wpedantic 'extra semicolon' warning. NFC. 2019-12-21 17:32:00 +00:00
Michael Liao 7cee288586 Fix `-Wunused-variable` warning. NFC. 2019-12-21 11:10:35 -05:00
Sanjay Patel 79c7fa31f3 [InstCombine] check alloc size in bitcast of geps fold (PR44321)
We missed a constraint in D44833
when folding a bitcast into a GEP with vector/array types.
If the alloc sizes specified by the datalayout don't match,
this could miscompile as shown in:
https://bugs.llvm.org/show_bug.cgi?id=44321

Differential Revision: https://reviews.llvm.org/D71771
2019-12-21 10:31:21 -05:00
Sanjay Patel 19f9f374d9 [SimplifyLibCalls] require fast-math-flags for pow(X, -0.5) transforms
As discussed in PR44330:
https://bugs.llvm.org/show_bug.cgi?id=44330
...the transform from pow(X, -0.5) libcall/intrinsic to
reciprocal square root can result in small deviations from
the expected result due to differences in the pow()
implementation and/or the extra rounding step from the division.

This patch proposes to allow that difference with either the
'approximate functions' or 'reassociate' FMF:
http://llvm.org/docs/LangRef.html#fast-math-flags

In practice, this likely means that the code is compiled with
all of 'fast' (-ffast-math), but I have preserved the existing
specializations for -0.0/-INF that enable generating safe code
if those special values are allowed simultaneously with
allowing approximation/reassociation.

The question about whether a similar restriction is needed for
the non-reciprocal case -- pow(X, 0.5) -- is deferred. That
transform is allowed without FMF currently, and this patch does
not change that behavior.

Differential Revision: https://reviews.llvm.org/D71706
2019-12-21 10:00:53 -05:00
Raphael Isemann 49b206f958 [lldb][NFC] Remove all ASTContext getter wrappers from ClangASTContext
Their naming is misleading as they only return the
ClangASTContext-owned variables. For ClangASTContext instances constructed
for a given clang::ASTContext they silently generated duplicated instances
(e.g., a second IdentifierTable) that were essentially unusable.

This removes all these getters as they are anyway not very useful in comparison
to just calling the clang::ASTContext getters. The initialization
code has been moved to the CreateASTContext initialization method so that all
code for making our own clang::ASTContext is in one place.
2019-12-21 15:41:18 +01:00
Florian Hahn d269255b95 [AArch64] Respect reserved registers while renaming in LdSt opt.
We cannot pick reserved registers as rename registers.

Fixes https://bugs.llvm.org/show_bug.cgi?id=44358
2019-12-21 15:10:07 +01:00
Mark de Wever 70d592d68c [Analyzer] Use a reference in a range-based for
This avoids unneeded copies when using a range-based for loops.

This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.

Differential Revision: https://reviews.llvm.org/D70869
2019-12-21 14:52:29 +01:00
Mark de Wever be1a9b3863 [Wdocumentation] Implement \anchor
Differential revision: https://reviews.llvm.org/D69223
2019-12-21 14:52:21 +01:00
Pavel Labath 2947da9ff7 [lldb] disable thread-step-out-ret-addr-check on windows
I'm unable to get this test working there.
2019-12-21 14:20:47 +01:00
Pavel Labath e192cc1f1b [lldb] One more attempt to fix thread-step-out-ret-addr-check on windows 2019-12-21 13:33:42 +01:00
David Zarzycki 75e500dd47
Add missing `REQUIRES: hexagon-registered-target`
After d567b0ba84, the test suite no longer
passes if hexagon is disabled.
2019-12-21 06:45:30 -05:00
Pavel Labath ce3ce9f464 [lldb] Force the preprocessor to run in thread-step-out-ret-addr-check.test
It does not seem to run automatically on windows.
2019-12-21 12:25:02 +01:00
Stephen Kelly 5a79cfa32d Customize simplified dumping and matching of LambdaExpr
Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D71680
2019-12-21 11:02:11 +00:00
Pavel Labath 1805d1f87d [lldb] Fix -Wstringop-truncation in PythonReadline.cpp
The size is known and the truncation is deliberate -- use memcpy instead
of strncpy.
2019-12-21 11:35:26 +01:00
Jan Kratochvil 4706a60e8a [lldb] [testsuite] Fix Linux fail: Unwind/thread-step-out-ret-addr-check.test
D71372 introduced: `Unwind/thread-step-out-ret-addr-check.test` failing on
Fedora 30 Linux x86_64.
  [lldb] Add additional validation on return address in 'thread step-out'
  https://reviews.llvm.org/D71372

One problem is the underscored `_nonstandard_stub` in the `.s` file but not in
the LLDB command:
  (lldb) breakpoint set -n nonstandard_stub
  Breakpoint 1: no locations (pending).
  WARNING:  Unable to resolve breakpoint to any actual locations.
  (lldb) process launch
  Process 21919 exited with status = 0 (0x00000000)
  Process 21919 launched: '/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/test/Unwind/Output/thread-step-out-ret-addr-check.test.tmp' (x86_64)
  (lldb) thread step-out
  error: invalid thread
  (lldb) _

Another problem is that Fedora Linux has executable stack by default and all
programs indicate non-executable stack by `PT_GNU_STACK`, after fixing the
underscore I was getting:
  (lldb) thread step-out
  Process 22294 exited with status = 0 (0x00000000)
  (lldb) _

A different approach was tried as:
  [lldb] Refactor thread-step-out-ret-addr-check test to use .data instead of stack variable
  https://reviews.llvm.org/D71789

Differential revision: https://reviews.llvm.org/D71784
2019-12-21 11:27:54 +01:00
Jan Kratochvil df6879ec02 [lldb] Fix ARM32 inferior calls
echo -e '#include <unistd.h>\nint main(void){\nsync();return 0;}'|./bin/clang -g -x c -;./bin/lldb -o 'file ./a.out' -o 'b main' -o r -o 'p (void)sync()'

Actual:

  error: Expression can't be run, because there is no JIT compiled function

Expected:

  <nothing, sync() has been executed>

This patch has been checked by:
  D71707: clang-tidy: new bugprone-pointer-cast-widening
  https://reviews.llvm.org/D71707

Casting from 32-bit `void *` to `uint64_t` requires an intermediate `uintptr_t` cast otherwise the pointer gets sign-extended:

  echo -e '#include <stdio.h>\n#include <stdint.h>\nint main(void){void *p=(void *)0x80000000;unsigned long long ull=(unsigned long long)p;unsigned long long ull2=(unsigned long
long)(uintptr_t)p;printf("p=%p ull=0x%llx ull2=0x%llx\\n",p,ull,ull2);return 0;}'|gcc -Wall -m32 -x c -;./a.out
  <stdin>: In function ‘main’:
  <stdin>:3:66: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  p=0x80000000 ull=0xffffffff80000000 ull2=0x80000000

With debug output:
Actual:

  IRMemoryMap::WriteMemory (0xb6ff8640, 0xffffffffb6f82158, 0x112) went to [0xb6ff8640..0xb6ff86b3)
  Code can be run in the target.
  Found function, has local address 0xffffffffb6f84000 and remote address 0xffffffffffffffff
  Couldn't disassemble function : Couldn't find code range for function _Z12$__lldb_exprPv
  Sections:
  [0xb6f84000+0x3c]->0xb6ff9020 (alignment 4, section ID 0, name .text)
  ...
  HandleCommand, command did not succeed
  error: Expression can't be run, because there is no JIT compiled function

Expected:

  IRMemoryMap::WriteMemory (0xb6ff8640, 0xb6faa15c, 0x128) went to [0xb6ff8640..0xb6ff86c3)
  IRExecutionUnit::GetRemoteAddressForLocal() found 0xb6fac000 in [0xb6fac000..0xb6fac040], and returned 0xb6ff9020 from [0xb6ff9020..0xb6ff9060].
  Code can be run in the target.
  Found function, has local address 0xb6fac000 and remote address 0xb6ff9020
  Function's code range is [0xb6ff9020+0x40]
  ...
  Function data has contents:
  0xb6ff9020: 10 4c 2d e9 08 b0 8d e2 08 d0 4d e2 00 40 a0 e1
  ...
  Function disassembly:
  0xb6ff9020: 0xe92d4c10   push   {r4, r10, r11, lr}

Differential revision: https://reviews.llvm.org/D71498
2019-12-21 11:12:17 +01:00
Matt Arsenault 4af6866708 AMDGPU: Fix repeated word in comment 2019-12-21 04:57:35 -05:00
Matt Arsenault f9677c4757 Mips: Make test resistant to future changes
This seems to have been relying on extra spills being inserted in
these blocks to increase the code size to trigger branch
relaxation. This broke when these spills were avoided. Add some asm to
pad the size of the blocks to make it not matter.
2019-12-21 04:56:20 -05:00
Matt Arsenault 42a26445f9 AMDGPU/GlobalISel: Fix misuse of div_scale intrinsics
Confusingly, the intrinsic operands do not match the
instruction/custom node. The order is shuffled, and the 3rd operand is
an immediate to select operands.

I'm not 100% sure I did this right, but fdiv still doesn't select end
to end and it will be easier to tell when it does. This at least
avoids an assertion in RegBankSelect and allows hitting the fallback
on selection.
2019-12-21 04:55:36 -05:00
Matt Arsenault dff3f8d742 AMDGPU/GlobalISel: Fix missing scc imp-def on scalar and/or/xor 2019-12-21 04:55:36 -05:00
Matt Arsenault d688a6739d AMDGPU/GlobalISel: Simplify code
This can directly access the register bank, and doesn't need to get it
through the ID.
2019-12-21 04:55:36 -05:00
Sylvestre Ledru 7ece0ee3dd features.html: Remove some old info 2019-12-21 10:52:39 +01:00
Sylvestre Ledru a0ce615573 clang is now under the apache2 license 2019-12-21 10:52:30 +01:00
Sylvestre Ledru 384a287a99 Remove a gcc 4.9 comparison as it doesn't make sense 2019-12-21 10:46:45 +01:00
Ruslan Baratov 6e8659c351 [libc++] Fix typo in std::midpoint
Reviewed By: mclow.lists

Differential Revision: https://reviews.llvm.org/D71525
2019-12-21 01:26:24 -08:00
River Riddle ee71ca1d5c NFC: Move the classes related to Pass options into a new header file PassOptions.h
This will make refactoring and adding additional features to the pass options infrastructure simpler in followup commits.

PiperOrigin-RevId: 286687564
2019-12-20 22:45:52 -08:00
Jonas Devlieghere 60236fedc9 Revert "[msan] Check qsort input." and "[msan] Intercept qsort, qsort_r."
Temporarily revert the qsort changes because they fail to build on bots
that build with modules:

> error: thread-local storage is not supported for the current
> target (iossim)

http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/1820/console
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/4983/console

This reverts commit ddf897fc80.
This reverts commit 07861e955d.
2019-12-20 21:34:35 -08:00
Jonas Devlieghere 3fa39c3a79 [lldb/test] Update !DIModule for isysroot rename
The isysroot field in DIModule was renamed to sysroot but the test in
LLDB wasn't updated. This fixes that.
2019-12-20 21:11:50 -08:00