Commit Graph

70101 Commits

Author SHA1 Message Date
Richard Smith 7b5a8bf643 Fix up the -Wc++XX-compat warnings to properly handle C++2a.
llvm-svn: 311750
2017-08-25 02:25:07 +00:00
Richard Smith cae37ca3b0 Fix MSVC bots which include '__attribute__((thiscall))' in pretty-printed member function types.
We really shouldn't be including inferred calling conventions here, but let's get the bots green first...

llvm-svn: 311746
2017-08-25 01:55:50 +00:00
Richard Smith 2592327dae [c++2a] P0704R1: Allow pointers to const& member functions to be called on rvalues.
Patch by Blitz Rakete!

llvm-svn: 311744
2017-08-25 01:47:55 +00:00
Erich Keane 26f73e39f1 Remove .gitattributes, add comment to lineendings.
llvm-svn: 311732
2017-08-24 23:25:05 +00:00
Mandeep Singh Grang 01cbd18ee9 [clang] Remove unit test which uses reverse-iterate flag
Summary: This patch is in response to https://reviews.llvm.org/D35043 which removed -reverse-iterate flag.

Reviewers: dblaikie, mehdi_amini

Reviewed By: dblaikie

Subscribers: cfe-commits, llvm-commits

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

llvm-svn: 311720
2017-08-24 22:40:32 +00:00
Kostya Serebryany a38bbe30eb [sanitizer-coverage] document -fsanitize-coverage=pc-table and -fsanitize-coverage=inline-8bit-counters
llvm-svn: 311719
2017-08-24 22:40:03 +00:00
Dehao Chen 5e97f23441 Expose -mllvm -accurate-sample-profile to clang.
Summary: With accurate sample profile, we can do more aggressive size optimization. For some size-critical application, this can reduce the text size by 20%

Reviewers: davidxl, rsmith

Reviewed By: davidxl, rsmith

Subscribers: mehdi_amini, eraman, sanjoy, cfe-commits

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

llvm-svn: 311707
2017-08-24 21:37:33 +00:00
Richard Smith 376c28e296 [ubsan] PR34266: When sanitizing the 'this' value for a member function that happens to be a lambda call operator, use the lambda's 'this' pointer, not the captured enclosing 'this' pointer (if any).
Do not sanitize the 'this' pointer of a member call operator for a lambda with
no capture-default, since that call operator can legitimately be called with a
null this pointer from the static invoker function. Any actual call with a null
this pointer should still be caught in the caller (if it is being sanitized).

This reinstates r311589 (reverted in r311680) with the above fix.

llvm-svn: 311695
2017-08-24 20:10:33 +00:00
Erich Keane 5a2b322e0d [Preprocessor] Correct internal token parsing of newline characters in CRLF
Discovered due to a goofy git setup, the test system-headerline-directive.c 
(and a few others) failed because the token-consumption will consume only the 
'\r' in CRLF, making the preprocessor's printed value give the wrong line number 
when returning from an include. For example:

(line 1):#include <noline.h>\r\n

The "file exit" code causes the printer to try to print the 'returned to the 
main file' line. It looks up what the current line number is. However, since the 
current 'token' is the '\n' (since only the \r was consumed), it will give the 
line number as '1", not '2'. This results in a few failed tests, but more 
importantly, results in error messages being incorrect when compiling a 
previously preprocessed file.

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

llvm-svn: 311683
2017-08-24 18:36:07 +00:00
Adrian Prantl 1b6d8713e4 Revert "[ubsan] PR34266: When sanitizing the 'this' value for a member function that happens to be a lambda call operator, use the lambda's 'this' pointer, not the captured enclosing 'this' pointer (if any)."
This reverts commit r311589 because of bot breakage.
http://green.lab.llvm.org/green/job/clang-stage2-cmake-RgSan_check/4115/consoleFull#15752874848254eaf0-7326-4999-85b0-388101f2d404.

llvm-svn: 311680
2017-08-24 18:18:24 +00:00
Krasimir Georgiev 33bd852408 [clang-format] Emit absolute splits before lines for comments, try 2
Summary:
This recommits https://reviews.llvm.org/D36956 with an update to the added test
case to not use raw string literals, since this makes gcc unhappy.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 311672
2017-08-24 16:41:10 +00:00
Petar Jovanovic 5076511ed6 [mips] Introducing option -mabs=[legacy/2008]
In patch r205628 using abs.[ds] instruction is forced, as they should behave
in accordance with flags Has2008 and ABS2008. Unfortunately for revisions
prior mips32r6 and mips64r6, abs.[ds] is not generating correct result when
working with NaNs. To generate a sequence which always produce a correct
result but also to allow user more control on how his code is compiled,
option -mabs is added where user can choose legacy or 2008.
By default legacy mode is used on revisions prior R6. Mips32r6 and mips64r6
use abs2008 mode by default.

Patch by Aleksandar Beserminji

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

llvm-svn: 311669
2017-08-24 16:06:30 +00:00
Alex Lorenz 39265ca89f Fix use-after-free in Clang's ASTSelection unittest
llvm-svn: 311664
2017-08-24 14:53:48 +00:00
Chad Rosier 38aa163611 [Driver][AArch64] Add tests for RDM feature.
Differential Revision: https://reviews.llvm.org/D37106

llvm-svn: 311660
2017-08-24 14:32:55 +00:00
Alex Lorenz 0eaa48322e Add missing std::move call
This should fix
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental_build/41578/

llvm-svn: 311656
2017-08-24 14:08:18 +00:00
Alex Lorenz a844f396ce [refactor] Add the AST source selection component
This commit adds the base AST source selection component to the refactoring
library. AST selection is represented using a tree of SelectedASTNode values.
Each selected node gets its own selection kind, which can actually be None even
in the middle of tree (e.g. statement in a macro whose child is in a macro
argument). The initial version constructs a "raw" selection tree, without
applying filters and canonicalisation operations to the nodes.

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

llvm-svn: 311655
2017-08-24 13:51:09 +00:00
Coby Tayree 7b49dc9c68 [Clang][x86][Inline Asm] support for GCC style inline asm - Y<x> constraints
This patch is intended to enable the use of basic double letter constraints used in GCC extended inline asm {Yi Y2 Yz Y0 Ym Yt}.
Supersedes D35205
llvm counterpart: D36369

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

llvm-svn: 311643
2017-08-24 09:07:34 +00:00
Krasimir Georgiev c602af9a5e Revert "[clang-format] Break non-trailing block comments"
This reverts commit r311457. It reveals some dormant bugs in comment
reflowing, like breaking a single line jsdoc type annotation before a
parameter into multiple lines.

llvm-svn: 311641
2017-08-24 08:55:07 +00:00
Coby Tayree cfa3810aa0 Fixups to FE tests affected by D36793
Differential Revision: https://reviews.llvm.org/D36794

llvm-svn: 311640
2017-08-24 08:47:26 +00:00
Leo Li 23bb21cb92 [Driver] Register effective triple before get arm float abi.
Summary:
We need to register effective triple before calling `getARMFloatABI`.
Add missing code when `--print-libgcc-file-name` is passed.

Reviewers: atanasyan, rsmith, mgorny, peter.smith, kristof.beyls, compnerd, jroelofs

Reviewed By: compnerd

Subscribers: llvm-commits, aemerson, javed.absar, srhines, kristof.beyls, pirama

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

llvm-svn: 311624
2017-08-24 01:51:51 +00:00
George Karpenkov 8d15bbb019 Fix ClangFormatFuzzer.
llvm-svn: 311621
2017-08-24 00:30:28 +00:00
Saleem Abdulrasool 5a3e50a3e6 ObjC++: decorate ObjC interfaces in MSABI properly
`id` needs to be handled specially since it is a `TypedefType` which is
sugar for an `ObjCObjectPointerType` whose pointee is an
`ObjCObjectType` with base `BuiltinType::ObjCIdType` and no protocols
and the first level of pointer gets it own type implementation.  `Class`
is similar with the `ObjCClassType` as the base instead.

The qualifiers on the base type of the `ObjCObjectType` need to be
dropped because the innermost `mangleType` will handle the qualifiers
itself.

`id` is desugared to `struct objc_object *` which should be encoded as
`PAUobjc_object@@`.  `Class` is desugared to `struct objc_class *` which
should be encoded as `PAUobjc_class@@`.

We were previously applying an extra modifier `A` which will be handled
during the recursive call.

This now properly decorates interface types as well as `Class` and `id`.
This corrects the interactions between C++ and ObjC++ for the type
specifier decoration.

llvm-svn: 311617
2017-08-23 22:38:58 +00:00
Richard Smith 39eca9b95a Fix mangling for dependent "type { expr-list }" expressions, and add mangling for designated initializers matching recent cxx-abi-dev discussion.
llvm-svn: 311612
2017-08-23 22:12:08 +00:00
Adrian Prantl 8040a215c9 Fix a bug in CGDebugInfo::EmitInlineFunctionStart causing DILocations to be
parented in function declarations.

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

llvm-svn: 311601
2017-08-23 21:24:12 +00:00
Reid Kleckner 6d353348e5 Parse and print DIExpressions inline to ease IR and MIR testing
Summary:
Most DIExpressions are empty or very simple. When they are complex, they
tend to be unique, so checking them inline is reasonable.

This also avoids the need for CodeGen passes to append to the
llvm.dbg.mir named md node.

See also PR22780, for making DIExpression not be an MDNode.

Reviewers: aprantl, dexonsmith, dblaikie

Subscribers: qcolombet, javed.absar, eraman, hiraditya, llvm-commits

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

llvm-svn: 311594
2017-08-23 20:31:27 +00:00
Matt Morehouse c01994b5fe [clang-proto-fuzzer] Fix clang-proto-to-cxx build.
llvm-svn: 311592
2017-08-23 19:58:07 +00:00
Richard Smith e3a5e8f03d [ubsan] PR34266: When sanitizing the 'this' value for a member function that happens to be a lambda call operator, use the lambda's 'this' pointer, not the captured enclosing 'this' pointer (if any).
llvm-svn: 311589
2017-08-23 19:39:04 +00:00
Saleem Abdulrasool 65101adb16 Headers: explicitly specify double-word alignment
GCC will interpret `__attribute__((__aligned__))` as 8-byte alignment on
ARM, but clang will not.  Explicitly specify the alignment.  This
mirrors the declaration in libunwind.

llvm-svn: 311576
2017-08-23 16:57:55 +00:00
Johannes Altmanninger 38df0fa640 [clang-diff] Properly clear the selection in HTML diff
Reviewers: arphaman

Subscribers: cfe-commits

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

llvm-svn: 311575
2017-08-23 16:52:15 +00:00
Johannes Altmanninger a3c4923a53 [clang-diff] Reformat test, NFC
llvm-svn: 311571
2017-08-23 16:32:35 +00:00
Johannes Altmanninger 8796049fc5 [clang-diff] HTML diff navigation
Summary:
This adds shortcuts j and k to jump between changes.
It is especially useful in diffs with few changes.

Reviewers: arphaman

Subscribers: cfe-commits

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

llvm-svn: 311570
2017-08-23 16:32:13 +00:00
Johannes Altmanninger 1a2676924a [analyzer] Make StmtDataCollector customizable
Summary:
This moves the data collection macro calls for Stmt nodes
to lib/AST/StmtDataCollectors.inc

Users can subclass ConstStmtVisitor and include StmtDataCollectors.inc
to define visitor methods for each Stmt subclass. This makes it also
possible to customize the visit methods as exemplified in
lib/Analysis/CloneDetection.cpp.

Move helper methods for data collection to a new module,
AST/DataCollection.

Add data collection for DeclRefExpr, MemberExpr and some literals.

Reviewers: arphaman, teemperor!

Subscribers: mgorny, xazax.hun, cfe-commits

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

llvm-svn: 311569
2017-08-23 16:28:26 +00:00
Krasimir Georgiev 48a9f36876 Revert "[clang-format] Emit absolute splits before lines for comments"
This reverts commit r311559, which added a test containing raw string
literals in macros, which chokes gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55971

llvm-svn: 311566
2017-08-23 15:58:10 +00:00
Saleem Abdulrasool 75cfabef35 Headers: give _Unwind_Control_Block double-word alignment
The C++ ABI requires that the exception object (which under AEABI is the
`_Unwind_Control_Block`) is double-word aligned.  The attribute was
applied to the `_Unwind_Exception` type, but not the
`_Unwind_Control_Block`.  This should fix the libunwind test for the
alignment of the exception type.

llvm-svn: 311563
2017-08-23 15:35:33 +00:00
Nico Weber 699670e764 Implement CFG construction for __try / __except / __leave.
This makes -Wunreachable-code work for programs containing SEH (except for
__finally, which is still missing for now).

__try is modeled like try (but simpler since it can only have a single __except
or __finally), __except is fairly similar to catch (but simpler, since it can't
contain declarations). __leave is implemented similarly to break / continue.

Use the existing addTryDispatchBlock infrastructure (which
FindUnreachableCode() in ReachableCode.cpp uses via cfg->try_blocks_begin()) to
mark things in the __except blocks as reachable.

Re-use TryTerminatedBlock. This means we add EH edges from calls to the __try
block, but not from all other statements. While this is incomplete, it matches
LLVM's SEH codegen support. Also, in practice, BuildOpts.AddEHEdges is always
false in practice from what I can tell, so we never even insert the call EH
edges either.

https://reviews.llvm.org/D36914

llvm-svn: 311561
2017-08-23 15:33:16 +00:00
Krasimir Georgiev 7f7c3dc0aa [clang-format] Emit absolute splits before lines for comments
Summary:
This patch makes the splits emitted for the beginning of comment lines during
reformatting absolute. Previously, they were relative to the start of the
non-whitespace content of the line, which messes up further TailOffset
calculations in breakProtrudingToken. This fixes an assertion failure reported
in bug 34236: https://bugs.llvm.org/show_bug.cgi?id=34236.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 311559
2017-08-23 15:16:47 +00:00
Rui Ueyama a93f087d3e Revert r311552: [Bash-autocompletion] Add support for static analyzer flags
This reverts commit r311552 because it broke ubsan and asan bots.

llvm-svn: 311557
2017-08-23 14:48:58 +00:00
Yuka Takahashi 5e7071f5d7 [Bash-autocompletion] Add support for static analyzer flags
Summary:
This is a patch for clang autocomplete feature.

It will collect values which -analyzer-checker takes, which is defined in
clang/StaticAnalyzer/Checkers/Checkers.inc, dynamically.
First, from ValuesCode class in Options.td, TableGen will generate C++
code in Options.inc. Options.inc will be included in DriverOptions.cpp, and
calls OptTable's addValues function. addValues function will add second
argument to Option's Values class. Values contains string like "foo,bar,.."
which is handed to Values class
in OptTable.

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: hiraditya, cfe-commits

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

llvm-svn: 311552
2017-08-23 13:39:47 +00:00
Johannes Altmanninger 1aa18f2063 Fix typos, remove unused private members of CommonOptionsParser, NFC
llvm-svn: 311544
2017-08-23 10:43:26 +00:00
Krasimir Georgiev 4a9c260751 [clang-format] Align trailing comments if ColumnLimit is 0
Summary:
ColumnLimit = 0 means no limit, so comment should always be aligned if requested. This was broken with

  https://llvm.org/svn/llvm-project/cfe/trunk@304687

introduced via

  https://reviews.llvm.org/D33830

and is included in 5.0.0-rc2. This commit fixes it and adds a unittest for this property.

Should go into clang-5.0 IMHO.

Contributed by @pboettch!

Reviewers: djasper, krasimir

Reviewed By: djasper, krasimir

Subscribers: hans, klimek

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

llvm-svn: 311532
2017-08-23 07:18:36 +00:00
Yonghong Song c4ea1010c1 bpf: add -mcpu=# support for bpf
-mcpu=# will support:
  . generic: the default insn set
  . v1: insn set version 1, the same as generic
  . v2: insn set version 2, version 1 + additional jmp insns
  . probe: the compiler will probe the underlying kernel to
           decide proper version of insn set.

Examples:
$ clang -target bpf -mcpu=v1 -c t.c
$ clang -target bpf -mcpu=v2 -c t.c
$ clang -target bpf -mcpu=generic -c t.c
$ clang -target bpf -mcpu=probe -c t.c
$ clang -target bpf -mcpu=v3 -c t.c
error: unknown target CPU 'v3'

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 311523
2017-08-23 04:26:17 +00:00
Richard Trieu 498117bf11 [ODRHash] Diagnose differing template parameters.
llvm-svn: 311519
2017-08-23 02:43:59 +00:00
George Karpenkov ac385b7775 Update Clang fuzzers to use libFuzzer bundled with the toolchain.
Differential Revision: https://reviews.llvm.org/D37043

llvm-svn: 311516
2017-08-23 00:42:22 +00:00
George Karpenkov aed7d74236 Remove LLVMFuzzer from list of bundled libraries for Fuchsia
As of now, libFuzzer is located in compiler-rt and is bundled with
Clang's toolchain by default.

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

llvm-svn: 311514
2017-08-23 00:09:33 +00:00
Dan Albert 79865d98d0 Degeneralize more tests.
As before, not every platform supports LTO. Make sure the platform
we're targeting is one that supports it (regardless of the *host*
platform).

llvm-svn: 311488
2017-08-22 21:16:22 +00:00
Dan Albert c3a11d5a00 Revert "Revert "Revert "Revert "Fix LLVMgold plugin name/path for non-Linux.""""
With tests fixed for Windows style paths now that they are going
through path canonicalization.

llvm-svn: 311487
2017-08-22 21:05:01 +00:00
Volodymyr Sapsai b0f1aae9b3 [Parser] Correct initalizer typos before lambda capture type is deduced.
This is the same assertion as in https://reviews.llvm.org/D25206 that is
triggered when RecordLayoutBuilder tries to compute the size of a field
(for capture "typo_boo" in the test case) whose type hasn't been
deduced.

The fix is to add CorrectDelayedTyposInExpr call to the cases when we
aren't disambiguating between an Obj-C message send and a lambda
expression.

rdar://problem/31760839

Reviewers: rsmith, ahatanak

Reviewed By: arphaman

Subscribers: cfe-commits

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

llvm-svn: 311480
2017-08-22 17:55:19 +00:00
Alexey Bataev 6a71f364f1 [OPENMP] Fix for PR34014: OpenMP 4.5: Target construct in static method
of class fails to map class static variable.

If the global variable is captured and it has several redeclarations,
sometimes it may lead to a compiler crash. Patch fixes this by working
only with canonical declarations.

llvm-svn: 311479
2017-08-22 17:54:52 +00:00
Jacob Gravelle 46307d7350 [clang-diff] Refactor stop-after command-line flag
Summary:
Rename stop-after to stop-diff-after. When building LLVM with
-DLLVM_BUILD_LLVM_DYLIB=ON, stop-after collides with the stop-after
already present in LLVM.

Reviewers: johannes, arphaman

Subscribers: klimek, aheejin, cfe-commits

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

llvm-svn: 311476
2017-08-22 17:42:44 +00:00
Volodymyr Sapsai 7a8ad2e7f0 Test commit access.
llvm-svn: 311474
2017-08-22 17:39:25 +00:00
Krasimir Georgiev fe268fc1c8 [clang-format] Break non-trailing block comments
Summary:
This patch is an alternative to https://reviews.llvm.org/D36614, by resolving a
non-idempotency issue by breaking non-trailing comments:

Consider formatting the following code with column limit at `V`:
```
                    V
const /* comment comment */ A = B;
```
The comment is not a trailing comment, breaking before it doesn't bring it under
the column limit. The formatter breaks after it, resulting in:

```
                    V
const /* comment comment */
    A = B;
```
For a next reformat, the formatter considers the comment as a trailing comment,
so it is free to break it further, resulting in:

```
                    V
const /* comment
         comment */
    A = B;
```
This patch improves the situation by directly producing the third case.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 311457
2017-08-22 14:40:05 +00:00
Krasimir Georgiev 5fb51ddf29 [clang-format] Fix lines regression in clang-format.py
Summary:
This patch fixes a regression after https://reviews.llvm.org/rL305665,
which updates the structure of the `lines` variable.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 311456
2017-08-22 14:28:01 +00:00
Petar Jovanovic 9d1c094670 [mips] Rename getSupportedNanEncoding() to getIEEE754Standard()
Rename the function getSupportedNanEncoding() to getIEEE754Standard(), since
this function will be used for non-nan related features.

Patch by Aleksandar Beserminji.

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

llvm-svn: 311454
2017-08-22 13:35:27 +00:00
Erik Verbruggen aa603c3bef Revert r311442 (Fix templated type alias completion when using global completion cache)
Failing Tests (2):
    Clang :: CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp
    Clang :: SemaCXX/alias-template.cpp

llvm-svn: 311445
2017-08-22 10:54:40 +00:00
Alex Lorenz 34d070f3e5 [ObjC] Check written attributes only when synthesizing ambiguous property
This commit fixes a bug introduced in r307903. The attribute ambiguity checker
that was introduced in r307903 checked all property attributes, which caused
errors for source-compatible properties, like:

@property (nonatomic, readonly) NSObject *prop;
@property (nonatomic, readwrite) NSObject *prop;

because the readwrite property would get implicit 'strong' attribute. The
ambiguity checker should be concerned about explicitly specified attributes
only.

rdar://33748089

llvm-svn: 311443
2017-08-22 10:38:07 +00:00
Erik Verbruggen 1ca8bbb078 Fix templated type alias completion when using global completion cache
When we have enabled cache for global completions we did not have
diagnostics for Bar and could not complete Ba as in provided code
example.

template <typename T>
struct Foo { T member; };

template<typename T> using Bar = Foo<T>;

int main() {
    Ba
}

Patch by Ivan Donchevskii!

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

llvm-svn: 311442
2017-08-22 10:25:48 +00:00
Johannes Altmanninger bc7d817c22 [clang-diff] Fix getRelativeName
Handle the case when DeclContext is null.

llvm-svn: 311434
2017-08-22 08:59:13 +00:00
Johannes Altmanninger 2b955ffaed [clang-diff] Use the relative name for NamedDecl
Summary:
If a node referring to a name is within a class or namespace, do not use
the full qualified name, but strip the namespace prefix.

Reviewers: arphaman, bkramer

Subscribers: klimek

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

llvm-svn: 311433
2017-08-22 08:56:26 +00:00
Vitaly Buka 46f15d3788 Update libprotobuf-mutator revision
llvm-svn: 311428
2017-08-22 05:18:28 +00:00
George Karpenkov 5509c73a14 Test fix: only add shared libraries to rpath.
llvm-svn: 311422
2017-08-22 02:10:53 +00:00
George Karpenkov a2f383d072 Fixed driver tests for -fsanitize=fuzzer.
llvm-svn: 311412
2017-08-22 00:04:05 +00:00
George Karpenkov 9f6f74c2c5 Moving libFuzzer to compiler-rt: required updates to the Clang driver.
Differential Revision: https://reviews.llvm.org/D36909

llvm-svn: 311406
2017-08-21 23:25:19 +00:00
Akira Hatanaka a423cb431d [Driver][Darwin] Do not pass -munwind-table if -fno-excpetions is
supplied.

With this change, -fno-exceptions disables unwind tables unless
-funwind-tables is supplied too or the target is x86-64 (x86-64 requires
emitting unwind tables).

rdar://problem/33934446

llvm-svn: 311397
2017-08-21 22:46:46 +00:00
Stephan T. Lavavej 4c30b74390 [Driver] Recognize DevDiv internal builds of MSVC, with a different directory structure.
This is a reasonably non-intrusive change, which I've verified
works for both x86 and x64 DevDiv-internal builds.

The idea is to change `bool IsVS2017OrNewer` into a 3-state
`ToolsetLayout VSLayout`. Either a build is DevDiv-internal,
released VS 2017 or newer, or released VS 2015 or older. When looking at
the directory structure, if instead of `"VC"` we see `"x86ret"`, `"x86chk"`,
`"amd64ret"`, or `"amd64chk"`, we recognize this as a DevDiv-internal build.

After we get past the directory structure validation, we use this knowledge
to regenerate paths appropriately. `llvmArchToDevDivInternalArch()` knows how
we use `"i386"` subdirectories, and `MSVCToolChain::getSubDirectoryPath()`
uses that. It also knows that DevDiv-internal builds have an `"inc"`
subdirectory instead of `"include"`.

This may still not be the "right" fix in any sense, but I believe that it's
non-intrusive in the sense that if the special directory names aren't found,
no codepaths are affected. (`ToolsetLayout::OlderVS` and
`ToolsetLayout::VS2017OrNewer` correspond to `IsVS2017OrNewer` being `false`
or `true`, respectively.) I searched for all references to `IsVS2017OrNewer`,
which are places where Clang cares about VS's directory structure, and the
only one that isn't being patched is some logic to deal with
cross-compilation. I'm fine with that not working for DevDiv-internal builds
for the moment (we typically test the native compilers), so I added a comment.

Fixes D36860.

llvm-svn: 311391
2017-08-21 22:19:33 +00:00
Kamil Rytarowski d986545df6 Enable libfuzzer on NetBSD/amd64
Summary:
Enable SanitizerKind::Fuzzer and SanitizerKind::FuzzerNoLink on x86_64.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, george.karpenkov

Reviewed By: vitalybuka

Subscribers: cfe-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 311365
2017-08-21 19:12:14 +00:00
Sam Elliott 2307905561 [clang] Fix tests for Emitting Single Inline Remark
Summary: This change depends on https://reviews.llvm.org/D36054 and should be landed at the same time.

Reviewers: anemet

Reviewed By: anemet

Subscribers: cfe-commits

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

llvm-svn: 311347
2017-08-21 16:40:35 +00:00
Peter Szecsi 3c3e1b0b54 [StaticAnalyzer] LoopUnrolling: Track a LoopStack in order to completely unroll specific loops
The LoopExit CFG information provides the opportunity to not mark the loops but
having a stack which tracks if a loop is unrolled or not. So in case of
simulating a loop we just add it and the information if it meets the
requirements to be unrolled to the top of the stack.

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

llvm-svn: 311346
2017-08-21 16:32:57 +00:00
Matt Morehouse bf6c9bb84b [clang-proto-fuzzer] Update README.
Add instructions on how to modify the compiler invocation.

llvm-svn: 311345
2017-08-21 16:18:43 +00:00
Peter Szecsi 4aa5e10fcc [StaticAnalyzer] Handle LoopExit CFGElement in the analyzer
This patch adds handling of the LoopExit CFGElements to the StaticAnalyzer.
This is reached by introducing a new ProgramPoint.
Tests will be added in a following commit.

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

llvm-svn: 311344
2017-08-21 16:10:19 +00:00
Simon Atanasyan 29706f24e2 [mips] Remove checking of the redundant condition. NFC
llvm-svn: 311334
2017-08-21 14:08:29 +00:00
Ilya Biryukov f315000613 Fixed a crash on replaying Preamble's PP conditional stack.
Summary:
The crash occurs when the first token after a preamble is a macro
expansion.
Fixed by moving replayPreambleConditionalStack from Parser into
Preprocessor. It is now called right after the predefines file is
processed.

Reviewers: erikjv, bkramer, klimek, yvvan

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 311330
2017-08-21 12:03:08 +00:00
Oliver Stannard 7f18864473 [ObjC] Use consistent comment style in inline asm
The comment markers accepted by the assembler vary between different targets,
but '//' is always accepted, so we should use that for consistency.

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

llvm-svn: 311325
2017-08-21 09:54:46 +00:00
Sam Parker ffccda6303 [ARM][AArch64] Cortex-A75 and Cortex-A55 tests
Add frontend tests for Cortex-A75 and Cortex-A55, Arm's latest
big.LITTLE A-class cores. They implement the ARMv8.2-A architecture,
including the cryptography and RAS extensions, plus the optional dot
product extension. They also implement the RCpc AArch64 extension
from ARMv8.3-A.

Cortex-A75:
https://developer.arm.com/products/processors/cortex-a/cortex-a75

Cortex-A55:
https://developer.arm.com/products/processors/cortex-a/cortex-a55

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

llvm-svn: 311319
2017-08-21 08:52:45 +00:00
Johannes Altmanninger d6491f2c4a Allow thiscall attribute in test/Tooling/clang-diff-ast.cpp
llvm-svn: 311301
2017-08-20 20:13:33 +00:00
Johannes Altmanninger 0dd86dc5f1 [clang-diff] Improve and test getNodeValue
Summary: Use qualified names if available.

Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311292
2017-08-20 16:18:43 +00:00
Benjamin Kramer bffdf4ce93 [ODRHash] Move into anonymous namespace. NFC.
llvm-svn: 311286
2017-08-20 13:02:57 +00:00
Johannes Altmanninger d196930799 [clang-diff] Fix similarity computation
Summary:
Add separate tests for the top-down and the bottom-up phase, as well as
one for the optimal matching.

Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311284
2017-08-20 12:09:07 +00:00
Johannes Altmanninger d5b56a8619 [clang-diff] Filter AST nodes
Summary:
Ignore macros and implicit AST nodes, as well as anything outside of the
main source file.

Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311280
2017-08-20 10:22:32 +00:00
NAKAMURA Takumi 6adf81b1d5 clang/test/Tooling/clang-diff-ast.cpp: Satisfy thiscall.
clang/test/Tooling/clang-diff-ast.cpp:45:12: error: expected string not found in input
   // CHECK: CXXConstructorDecl: X(void (char, int))
             ^
  <stdin>:43:25: note: scanning from here
   AccessSpecDecl: public(42)
                          ^
  <stdin>:44:2: note: possible intended match here
   CXXConstructorDecl: X(void (char, int) __attribute__((thiscall)))(43)
   ^

llvm-svn: 311270
2017-08-20 00:02:20 +00:00
Johannes Altmanninger 51321aef8e [clang-diff] Simplify mapping
Summary:
Until we find a decent heuristic on how to choose between multiple
identical trees, there is no point in supporting multiple mappings.

This also enables matching of nodes with parents of different types,
because there are many instances where this is appropriate.  For
example for and foreach statements; functions in the global or
other namespaces.

Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311251
2017-08-19 17:53:01 +00:00
Johannes Altmanninger 4933a6a2b2 Add clang-diff to tool_patterns in test/lit.cfg
llvm-svn: 311250
2017-08-19 17:52:29 +00:00
Johannes Altmanninger e1a89fbf6d [clang-diff] Fix compiler warning
llvm-svn: 311249
2017-08-19 17:12:25 +00:00
Johannes Altmanninger a29d6aeced [clang-diff] Add HTML side-by-side diff output
Reviewers: arphaman

Subscribers: mgorny

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

llvm-svn: 311241
2017-08-19 15:40:45 +00:00
Johannes Altmanninger 14be1839e8 [clang-diff] Fix warning about useless comparison
llvm-svn: 311240
2017-08-19 13:29:44 +00:00
Johannes Altmanninger 683876ca6d [clang-diff] Make printing of matches optional
Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311237
2017-08-19 12:04:04 +00:00
Peter Szecsi 999a25ff72 [CFG] Add LoopExit information to CFG
This patch introduces a new CFG element CFGLoopExit that indicate when a loop
ends. It does not deal with returnStmts yet (left it as a TODO).
It hidden behind a new analyzer-config flag called cfg-loopexit (false by
default).
Test cases added.

The main purpose of this patch right know is to make loop unrolling and loop
widening easier and more efficient. However, this information can be useful for
future improvements in the StaticAnalyzer core too.

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

llvm-svn: 311235
2017-08-19 11:19:16 +00:00
Peter Szecsi 8de103f2f0 [StaticAnalyzer] LoopUnrolling: Exclude cases where the counter is escaped before the loop
Adding escape check for the counter variable of the loop.
It is achieved by jumping back on the ExplodedGraph to its declStmt.

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

llvm-svn: 311234
2017-08-19 10:24:52 +00:00
Johannes Altmanninger c58ac104d1 [clang-diff] Fix test
llvm-svn: 311233
2017-08-19 10:05:24 +00:00
Johannes Altmanninger a1d2b5d54f [clang-diff] Add option to dump the AST, one node per line
Summary:
This is done with -ast-dump; the JSON variant has been renamed to
-ast-dump-json.

Reviewers: arphaman

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

llvm-svn: 311232
2017-08-19 09:36:14 +00:00
Faisal Vali 8194a3e975 [c++2a] Implement P0409R2 - Allow lambda capture [=,this] (by hamzasood)
This patch, by hamzasood, implements P0409R2, and allows [=, this] pre-C++2a as an extension (with appropriate warnings) for consistency.

https://reviews.llvm.org/D36572

Thanks Hamza!

llvm-svn: 311224
2017-08-19 03:43:07 +00:00
Johannes Altmanninger e0fe5cd4f3 Revert "Revert "[clang-diff] Move printing of matches and changes to clang-diff""
Fix build by renaming ChangeKind -> Change

This reverts commit 0c78c5729f29315d7945988efd048c0cb86c07ce.

llvm-svn: 311222
2017-08-19 02:56:35 +00:00
Johannes Altmanninger b2d26c303e [clang-diff] Fix test for python 3
llvm-svn: 311220
2017-08-19 01:34:24 +00:00
Johannes Altmanninger 0da12c841a Revert "Revert "[clang-diff] Move the JSON export function to clang-diff""
This reverts commit eac4c13ac9ea8f12bc049e040c7b9c8a517f54e7, the
original commit *should* not have caused the build failure.

llvm-svn: 311216
2017-08-19 00:57:38 +00:00
Vlad Tsyrklevich deb2a2adc8 Revert "[clang-diff] Move the JSON export function to clang-diff"
This reverts commit r311199, it was causing widespread build failures.

llvm-svn: 311211
2017-08-18 23:21:11 +00:00
Vlad Tsyrklevich ebcb773f7d Revert "[clang-diff] Move printing of matches and changes to clang-diff"
This reverts commit r311200, it was causing widespread build failures.

llvm-svn: 311210
2017-08-18 23:21:10 +00:00
Johannes Altmanninger 69774d67c8 [clang-diff] Move printing of matches and changes to clang-diff
Summary:
This also changes the output order of the changes. Now the matches are
printed in pre-order, intertwined with insertions, updates, and moves.
Deletions are printed afterwards.

Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311200
2017-08-18 21:26:34 +00:00
Johannes Altmanninger 0ad4cc61ac [clang-diff] Move the JSON export function to clang-diff
Reviewers: arphaman

Subscribers: klimek

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

llvm-svn: 311199
2017-08-18 21:26:13 +00:00
Erik Pilkington ba87c626f9 [Sema] Don't emit -Wunguarded-availability for switch cases
This made it awkward to switch over an enum where some entries
are partial and is unlikley to catch any bugs.

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

llvm-svn: 311191
2017-08-18 20:20:56 +00:00
Matt Morehouse 5c7fc76983 [SanitizerCoverage] Add stack depth tracing instrumentation.
Summary:
Augment SanitizerCoverage to insert maximum stack depth tracing for
use by libFuzzer.  The new instrumentation is enabled by the flag
-fsanitize-coverage=stack-depth and is compatible with the existing
trace-pc-guard coverage.  The user must also declare the following
global variable in their code:
  thread_local uintptr_t __sancov_lowest_stack

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

Reviewers: vitalybuka, kcc

Reviewed By: vitalybuka

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

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

llvm-svn: 311186
2017-08-18 18:43:30 +00:00
Matt Morehouse 6178cfaf7b [clang-proto-fuzzer] Allow user-specified compiler arguments.
Summary:
Arguments can be specified after -ignore_remaining_args=1 to modify
the compiler invocation.  For example, the following command-line
will fuzz LLVM with a custom optimization level and target triple:
  clang-proto-fuzzer CORPUS/ -ignore_remaining_args -O3 \
      -triple arm64-apple-ios9

Reviewers: vitalybuka, kcc

Reviewed By: vitalybuka

Subscribers: aemerson, cfe-commits, kristof.beyls

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

llvm-svn: 311185
2017-08-18 18:34:39 +00:00