]> granicus.if.org Git - clang/log
clang
6 years agoFix MSVC "uninitialized variable" warning.
Simon Pilgrim [Thu, 18 Jan 2018 13:28:54 +0000 (13:28 +0000)]
Fix MSVC "uninitialized variable" warning.

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

6 years ago[ASTMatcher] Add isScoped matcher for enumDecl.
Haojian Wu [Thu, 18 Jan 2018 09:47:57 +0000 (09:47 +0000)]
[ASTMatcher] Add isScoped matcher for enumDecl.

Summary:

Reviewers: bkramer, aaron.ballman

Subscribers: aaron.ballman, cfe-commits, klimek

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

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

6 years agoRevert rC322769: [RISCV] Propagate -mabi and -march values to GNU assembler.
Hiroshi Inoue [Thu, 18 Jan 2018 06:13:25 +0000 (06:13 +0000)]
Revert rC322769: [RISCV] Propagate -mabi and -march values to GNU assembler.

Temporarily revert rC322769 due to buildbot failurs.

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

6 years agoFix Scope::dump()
Richard Trieu [Thu, 18 Jan 2018 04:28:56 +0000 (04:28 +0000)]
Fix Scope::dump()

The dump function for Scope only has 20 out of the 24 flags.  Since it looped
until no flags were left, having an unknown flag lead to an infinite loop.
That loop has been changed to a single pass for each flag, plus an assert to
alert if new flags are added.

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

6 years ago[analyzer] a few helper methods for getting and comparing symbolic values
George Karpenkov [Thu, 18 Jan 2018 03:18:36 +0000 (03:18 +0000)]
[analyzer] a few helper methods for getting and comparing symbolic values

API calls should express intent, and that's a motivation behind this patch.

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

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

6 years agoUpdate for llvm change.
Rafael Espindola [Thu, 18 Jan 2018 02:08:38 +0000 (02:08 +0000)]
Update for llvm change.

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

6 years ago[analyzer] NFC: Remove unused method - BugReporter::RemoveUnneededCalls().
Artem Dergachev [Thu, 18 Jan 2018 01:40:31 +0000 (01:40 +0000)]
[analyzer] NFC: Remove unused method - BugReporter::RemoveUnneededCalls().

Patch by Henry Wong!

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

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

6 years ago[analyzer] NFC: RetainCount: Protect from dumping raw region to path notes.
Artem Dergachev [Thu, 18 Jan 2018 01:01:56 +0000 (01:01 +0000)]
[analyzer] NFC: RetainCount: Protect from dumping raw region to path notes.

MemRegion::getString() is a wrapper around MemRegion::dump(), which is not
user-friendly and should never be used for diagnostic messages.

Actual cases where raw dumps were reaching the user were unintentionally fixed
in r315736; these were noticed accidentally and shouldn't be reproducible
anymore. For now RetainCountChecker only tracks pointers through variable
regions, and for those dumps are "fine". However, we should still use a less
dangerous method for producing our path notes.

This patch replaces the dump with printing a variable name, asserting that this
is indeed a variable.

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

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

6 years ago[analyzer] NFC: Use "= default" for default ProgramPoint constructors.
Artem Dergachev [Thu, 18 Jan 2018 00:55:29 +0000 (00:55 +0000)]
[analyzer] NFC: Use "= default" for default ProgramPoint constructors.

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

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

6 years ago[analyzer] operator new: Fix callback order for CXXNewExpr.
Artem Dergachev [Thu, 18 Jan 2018 00:53:50 +0000 (00:53 +0000)]
[analyzer] operator new: Fix callback order for CXXNewExpr.

PreStmt<CXXNewExpr> was never called.

Additionally, under c++-allocator-inlining=true, PostStmt<CXXNewExpr> was
called twice when the allocator was inlined: once after evaluating the
new-expression itself, once after evaluating the allocator call which, for the
lack of better options, uses the new-expression as the call site.

This patch fixes both problems.

Differential Revision: https://reviews.llvm.org/D41934
rdar://problem/12180598

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

6 years ago[analyzer] operator new: Add a new ProgramPoint for check::NewAllocator.
Artem Dergachev [Thu, 18 Jan 2018 00:50:19 +0000 (00:50 +0000)]
[analyzer] operator new: Add a new ProgramPoint for check::NewAllocator.

Add PostAllocatorCall program point to represent the moment in the analysis
between the operator new() call and the constructor call. Pointer cast from
"void *" to the correct object pointer type has already happened by this point.

The new program point, unlike the previously used PostImplicitCall, contains a
reference to the new-expression, which allows adding path diagnostics over it.

Differential Revision: https://reviews.llvm.org/D41800
rdar://problem/12180598

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

6 years ago[analyzer] Suppress "this" pointer escape during construction.
Artem Dergachev [Thu, 18 Jan 2018 00:44:41 +0000 (00:44 +0000)]
[analyzer] Suppress "this" pointer escape during construction.

Pointer escape event notifies checkers that a pointer can no longer be reliably
tracked by the analyzer. For example, if a pointer is passed into a function
that has no body available, or written into a global, MallocChecker would
no longer report memory leaks for such pointer.

In case of operator new() under -analyzer-config c++-allocator-inlining=true,
MallocChecker would start tracking the pointer allocated by operator new()
only to immediately meet a pointer escape event notifying the checker that the
pointer has escaped into a constructor (assuming that the body of the
constructor is not available) and immediately stop tracking it. Even though
it is theoretically possible for such constructor to put "this" into
a global container that would later be freed, we prefer to preserve the old
behavior of MallocChecker, i.e. a memory leak warning, in order to
be able to find any memory leaks in C++ at all. In fact, c++-allocator-inlining
*reduces* the amount of false positives coming from this-pointers escaping in
constructors, because it'd be able to inline constructors in some cases.

With other checkers working similarly, we simply suppress the escape event for
this-value of the constructor, regardless of analyzer options.

Differential Revision: https://reviews.llvm.org/D41797
rdar://problem/12180598

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

6 years agoUse an enum value instead of a string.
Rafael Espindola [Thu, 18 Jan 2018 00:20:03 +0000 (00:20 +0000)]
Use an enum value instead of a string.

The old StringSwitch use was also broken. It assumed that a
StringSwitch returns Optional<T> instead of T and was missing a
.Default.

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

6 years ago[analyzer] operator new: Fix path diagnostics around the operator call.
Artem Dergachev [Thu, 18 Jan 2018 00:10:21 +0000 (00:10 +0000)]
[analyzer] operator new: Fix path diagnostics around the operator call.

Implements finding appropriate source locations for intermediate diagnostic
pieces in path-sensitive bug reports that need to descend into an inlined
operator new() call that was called via new-expression. The diagnostics have
worked correctly when operator new() was called "directly".

Differential Revision: https://reviews.llvm.org/D41409
rdar://problem/12180598

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

6 years ago[analyzer] NFC: operator new: Fix new(nothrow) definition in tests.
Artem Dergachev [Thu, 18 Jan 2018 00:03:43 +0000 (00:03 +0000)]
[analyzer] NFC: operator new: Fix new(nothrow) definition in tests.

Fix the const qualifier so that the operator defined in the tests indeed does
override the default global nothrow version of new.

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

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

6 years ago[analyzer] operator new: Add a new checker callback, check::NewAllocator.
Artem Dergachev [Wed, 17 Jan 2018 23:46:13 +0000 (23:46 +0000)]
[analyzer] operator new: Add a new checker callback, check::NewAllocator.

The callback runs after operator new() and before the construction and allows
the checker to access the casted return value of operator new() (in the
sense of r322780) which is not available in the PostCall callback for the
allocator call.

Update MallocChecker to use the new callback instead of PostStmt<CXXNewExpr>,
which gets called after the constructor.

Differential Revision: https://reviews.llvm.org/D41406
rdar://problem/12180598

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

6 years ago[ASTMatchers] Support generating docs for single-line matchers
Benjamin Kramer [Wed, 17 Jan 2018 23:14:49 +0000 (23:14 +0000)]
[ASTMatchers] Support generating docs for single-line matchers

clang-format likes this format. PR35989.

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

6 years ago[analyzer] operator new: Fix ambigious type name.
Artem Dergachev [Wed, 17 Jan 2018 23:03:25 +0000 (23:03 +0000)]
[analyzer] operator new: Fix ambigious type name.

Hopefully fixes an MSVC buildbot failure.

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

6 years ago[analyzer] operator new: Fix memory space for the returned region.
Artem Dergachev [Wed, 17 Jan 2018 22:58:35 +0000 (22:58 +0000)]
[analyzer] operator new: Fix memory space for the returned region.

Make sure that with c++-allocator-inlining=true we have the return value of
conservatively evaluated operator new() in the correct memory space (heap).
This is a regression/omission that worked well in c++-allocator-inlining=false.

Heap regions are superior to regular symbolic regions because they have
stricter aliasing constraints: heap regions do not alias each other or global
variables.

Differential Revision: https://reviews.llvm.org/D41266
rdar://problem/12180598

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

6 years ago[Sema] Allow conversion between long double and __float128.
Benjamin Kramer [Wed, 17 Jan 2018 22:56:57 +0000 (22:56 +0000)]
[Sema] Allow conversion between long double and __float128.

We should only ban this if long double is a double double. x86's 80 bit
long double is fine and supported by the backend.

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

6 years ago[DOXYGEN] Fix doxygen and content issues in xmmintrin.h
Douglas Yung [Wed, 17 Jan 2018 22:53:15 +0000 (22:53 +0000)]
[DOXYGEN] Fix doxygen and content issues in xmmintrin.h

- Fix inaccurate instruction listings.
- Fix small issues in _mm_getcsr and _mm_setcsr.
- Fix description of NaN handling in comparison intrinsics.
- Fix inaccurate description of _mm_movemask_pi8.
- Fix inaccurate instruction mappings.
- Fix typos.
- Clarify wording on some descriptions.
- Fix bit ranges in return value.
- Fix typo in _mm_move_ms intrinsic instruction since it operates on singe-precision values, not double.
- This patch was made by Craig Flores

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

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

6 years ago[analyzer] operator new: Model the cast of returned pointer into object type.
Artem Dergachev [Wed, 17 Jan 2018 22:51:19 +0000 (22:51 +0000)]
[analyzer] operator new: Model the cast of returned pointer into object type.

According to [basic.stc.dynamic.allocation], the return type of any C++
overloaded operator new() is "void *". However, type of the new-expression
"new T()" and the type of "this" during construction of "T" are both "T *".

Hence an implicit cast, which is not present in the AST, needs to be performed
before the construction. This patch adds such cast in the case when the
allocator was indeed inlined. For now, in the case where the allocator was *not*
inlined we still use the same symbolic value (which is a pure SymbolicRegion of
type "T *") because it is consistent with how we represent the casts and causes
less surprise in the checkers after switching to the new behavior.

The better approach would be to represent that value as a cast over a
SymbolicRegion of type "void *", however we have technical difficulties
conjuring such region without any actual expression of type "void *" present in
the AST.

Differential Revision: https://reviews.llvm.org/D41250
rdar://problem/12180598

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

6 years ago[analyzer] NFC: Forbid array elements of void type.
Artem Dergachev [Wed, 17 Jan 2018 22:40:36 +0000 (22:40 +0000)]
[analyzer] NFC: Forbid array elements of void type.

Represent the symbolic value for results of pointer arithmetic on void pointers
in a different way: instead of making void-typed element regions, make
char-typed element regions.

Add an assertion that ensures that no void-typed regions are ever constructed.

This is a refactoring of internals that should not immediately affect
the analyzer's (default) behavior.

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

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

6 years ago[analyzer] operator new: Use the correct region for the constructor.
Artem Dergachev [Wed, 17 Jan 2018 22:34:23 +0000 (22:34 +0000)]
[analyzer] operator new: Use the correct region for the constructor.

The -analyzer-config c++-allocator-inlining experimental option allows the
analyzer to reason about C++ operator new() similarly to how it reasons about
regular functions. In this mode, operator new() is correctly called before the
construction of an object, with the help of a special CFG element.

However, the subsequent construction of the object was still not performed into
the region of memory returned by operator new(). The patch fixes it.

Passing the value from operator new() to the constructor and then to the
new-expression itself was tricky because operator new() has no call site of its
own in the AST. The new expression itself is not a good call site because it
has an incorrect type (operator new() returns 'void *', while the new expression
is a pointer to the allocated object type). Additionally, lifetime of the new
expression in the environment makes it unsuitable for passing the value.
For that reason, an additional program state trait is introduced to keep track
of the return value.

Finally this patch relaxes restrictions on the memory region class that are
required for inlining the constructor. This change affects the old mode as well
(c++-allocator-inlining=false) and seems safe because these restrictions were
an overkill compared to the actual problems observed.

Differential Revision: https://reviews.llvm.org/D40560
rdar://problem/12180598

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

6 years ago[RISCV] Propagate -mabi and -march values to GNU assembler.
Ana Pazos [Wed, 17 Jan 2018 22:09:58 +0000 (22:09 +0000)]
[RISCV] Propagate -mabi and -march values to GNU assembler.

When using -fno-integrated-as flag, the gnu assembler produces code
with some default march/mabi which later causes linker failure due
to incompatible mabi/march.

In this patch we explicitly propagate -mabi and -march flags to the
GNU assembler.

In this patch we explicitly propagate -mabi and -march flags to the GNU assembler.

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

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

6 years ago[analyzer] introduce getSVal(Stmt *) helper on ExplodedNode, make sure the helper...
George Karpenkov [Wed, 17 Jan 2018 20:27:29 +0000 (20:27 +0000)]
[analyzer] introduce getSVal(Stmt *) helper on ExplodedNode, make sure the helper is used consistently

In most cases using
`N->getState()->getSVal(E, N->getLocationContext())`
is ugly, verbose, and also opens up more surface area for bugs if an
inconsistent location context is used.

This patch introduces a helper on an exploded node, and ensures
consistent usage of either `ExplodedNode::getSVal` or
`CheckContext::getSVal` across the codebase.
As a result, a large number of redundant lines is removed.

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

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

6 years ago[analyzer] Make isSubRegionOf reflexive
George Karpenkov [Wed, 17 Jan 2018 20:27:26 +0000 (20:27 +0000)]
[analyzer] Make isSubRegionOf reflexive

All usages of isSubRegionOf separately check for reflexive case, and in
any case, set theory tells us that each set is a subset of itself.

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

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

6 years ago[analyzer] Better UI in html reports for displaying shortcuts help
George Karpenkov [Wed, 17 Jan 2018 20:06:26 +0000 (20:06 +0000)]
[analyzer] Better UI in html reports for displaying shortcuts help

Make the help window accessible, but don't show by default.
Use a different CSS class from macro.

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

6 years ago[clang-format] Replace unordered_set with an array
Krasimir Georgiev [Wed, 17 Jan 2018 20:01:02 +0000 (20:01 +0000)]
[clang-format] Replace unordered_set with an array

Summary: This replaces an unordered_set from r322690 with an array and binary search.

Reviewers: bkramer, benhamilton

Reviewed By: bkramer, benhamilton

Subscribers: jolesiak, benhamilton, klimek, cfe-commits

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

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

6 years ago[ASTMatchers] Add isNoReturn() match narrower for FunctionDeclarations
Roman Lebedev [Wed, 17 Jan 2018 19:40:55 +0000 (19:40 +0000)]
[ASTMatchers] Add isNoReturn() match narrower for FunctionDeclarations

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: dblaikie, klimek, cfe-commits

Tags: #clang

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

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

6 years ago[DeclPrinter] Fix two cases that crash clang -ast-print.
Artem Belevich [Wed, 17 Jan 2018 19:29:39 +0000 (19:29 +0000)]
[DeclPrinter] Fix two cases that crash clang -ast-print.

Both are related to handling anonymous structures.
* clang didn't handle () around an anonymous struct variable.
* clang also crashed on syntax errors that could lead to other
  syntactic constructs following the declaration of an
  anonymous struct. While the code is invalid, that's not
  a good reason to panic compiler.

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

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

6 years ago[Parse] Forward brace locations to TypeConstructExpr
Vedant Kumar [Wed, 17 Jan 2018 18:53:51 +0000 (18:53 +0000)]
[Parse] Forward brace locations to TypeConstructExpr

When parsing C++ type construction expressions with list initialization,
forward the locations of the braces to Sema.

Without these locations, the code coverage pass crashes on the given test
case, because the pass relies on getLocEnd() returning a valid location.

Here is what this patch does in more detail:

  - Forwards init-list brace locations to Sema (ParseExprCXX),
  - Builds an InitializationKind with these locations (SemaExprCXX), and
  - Uses these locations for constructor initialization (SemaInit).

The remaining changes fall out of introducing a new overload for
creating direct-list InitializationKinds.

Testing: check-clang, and a stage2 coverage-enabled build of clang with
asserts enabled.

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

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

6 years ago[Index] Fix GCC warning again :-(
Sam McCall [Wed, 17 Jan 2018 18:20:57 +0000 (18:20 +0000)]
[Index] Fix GCC warning again :-(

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

6 years ago[Tooling] Don't deduplicate tool results in the All-TUs executor.
Eric Liu [Wed, 17 Jan 2018 17:37:11 +0000 (17:37 +0000)]
[Tooling] Don't deduplicate tool results in the All-TUs executor.

Summary:
As result deduplication or reduction is not supported in the framework,
we should leave the deplication to tools (if needed) until the framework supports it.

Reviewers: bkramer

Subscribers: klimek, cfe-commits

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

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

6 years ago[Format] Improve ObjC header guessing heuristic
Ben Hamilton [Wed, 17 Jan 2018 17:33:08 +0000 (17:33 +0000)]
[Format] Improve ObjC header guessing heuristic

Summary:
This improves upon the previous Objective-C header guessing heuristic
from rC320479.

Now, we run the lexer on C++ header files and look for Objective-C
keywords and syntax. We also look for Foundation types.

Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, krasimir

Reviewed By: jolesiak

Subscribers: klimek, cfe-commits

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

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

6 years agoUpdate dump_ast_matchers for many recent changes.
Benjamin Kramer [Wed, 17 Jan 2018 16:50:14 +0000 (16:50 +0000)]
Update dump_ast_matchers for many recent changes.

The html file hasn't been updated in a long time so there are quite a
few changes in there. No matchers were removed though.

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

6 years ago[clang-format] adds enclosing function detection to raw string formatting
Krasimir Georgiev [Wed, 17 Jan 2018 16:17:26 +0000 (16:17 +0000)]
[clang-format] adds enclosing function detection to raw string formatting

Summary: This patch adds enclosing function detection to raw string formatting.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: klimek, cfe-commits

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

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

6 years agoAttempt to fix test/Driver/masm.c on the ARM bots.
Nico Weber [Wed, 17 Jan 2018 16:03:08 +0000 (16:03 +0000)]
Attempt to fix test/Driver/masm.c on the ARM bots.

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

6 years ago[Index] Fix GCC warning. This is silly, but no llvm_unreachable and no C99.
Sam McCall [Wed, 17 Jan 2018 15:57:14 +0000 (15:57 +0000)]
[Index] Fix GCC warning. This is silly, but no llvm_unreachable and no C99.

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

6 years ago[Sema] Add visited contexts to CodeCompleteContext
Haojian Wu [Wed, 17 Jan 2018 14:29:25 +0000 (14:29 +0000)]
[Sema] Add visited contexts to CodeCompleteContext

Summary:
This would allow code completion clients to know which context is visited during Sema code completion.

Also some changes:
 * add `EnteredContext` callback in VisibleDeclConsumer.
 * add a simple unittest for sema code completion (only for visited contexts at the moment).

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, bkramer, cfe-commits

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

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

6 years ago[clang-cl] Let /FA output use intel assembly.
Nico Weber [Wed, 17 Jan 2018 13:34:20 +0000 (13:34 +0000)]
[clang-cl] Let /FA output use intel assembly.

cl's assembly output is in intel syntax, so clang-cl's should be too, PR35031.
https://reviews.llvm.org/D42157

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

6 years ago[clang-format] Reorganize RawStringFormat based on language
Krasimir Georgiev [Wed, 17 Jan 2018 12:24:59 +0000 (12:24 +0000)]
[clang-format] Reorganize RawStringFormat based on language

Summary:
This patch changes the structure for raw string formatting options by making it
language based (enumerate delimiters per language) as opposed to delimiter-based
(specify the language for a delimiter). The raw string formatting now uses an
appropriate style from the .clang-format file, if exists.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, klimek

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

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

6 years ago[CodeGen] Fix a crash on mangling multiversioned functions
George Burgess IV [Wed, 17 Jan 2018 04:46:04 +0000 (04:46 +0000)]
[CodeGen] Fix a crash on mangling multiversioned functions

`multiVersionSortPriority` expects features to have no prefix. We
currently carry them around in the format "+${feature}".

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

6 years ago[analyzer] support a mode to only show relevant lines in HTML diagnostics
George Karpenkov [Wed, 17 Jan 2018 02:59:11 +0000 (02:59 +0000)]
[analyzer] support a mode to only show relevant lines in HTML diagnostics

HTML diagnostics can be an overwhelming blob of pages of code.
This patch adds a checkbox which filters this list down to only the
lines *relevant* to the counterexample by e.g. skipping branches which
analyzer has assumed to be infeasible at a time.

The resulting amount of output is much smaller, and often fits on one
screen, and also provides a much more readable diagnostics.

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

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

6 years agoMake DiagnosticsEngine() take DiagOpts as DiagnosticsEngine.
Nico Weber [Wed, 17 Jan 2018 02:55:27 +0000 (02:55 +0000)]
Make DiagnosticsEngine() take DiagOpts as DiagnosticsEngine.

No behavior change, but makes it a bit clearer that DiagnosticsEngine adds a
ref to DiagOpts.

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

6 years agoAdd context to why test was disabled on Windows
Richard Trieu [Tue, 16 Jan 2018 19:53:06 +0000 (19:53 +0000)]
Add context to why test was disabled on Windows

test/Modules/odr_hash-Friend.cpp triggers an assertion in MicrosoftMangle.cpp
This has been reported in PR35939

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

6 years agoMove target MV resolver to COMDAT
Erich Keane [Tue, 16 Jan 2018 19:49:52 +0000 (19:49 +0000)]
Move target MV resolver to COMDAT

As reported here: https://bugs.llvm.org/show_bug.cgi?id=35921
The resolver functions should be in their own
COMDAT regions. This patch sets that up.

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

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

6 years ago[DOCS] Updated current status of OpenMP support, NFC.
Alexey Bataev [Tue, 16 Jan 2018 19:22:49 +0000 (19:22 +0000)]
[DOCS] Updated current status of OpenMP support, NFC.

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

6 years ago[OPENMP] Add support for `depend` clauses on `target teams distribute
Alexey Bataev [Tue, 16 Jan 2018 19:18:24 +0000 (19:18 +0000)]
[OPENMP] Add support for `depend` clauses on `target teams distribute
parallel for simd` directives.

Added codegen for `depend` clauses on `#pragma omp target teams
distribute parallel for simd` directives.

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

6 years ago[OPENMP] Add support for `depend` on `target teams distribute parallel
Alexey Bataev [Tue, 16 Jan 2018 19:02:33 +0000 (19:02 +0000)]
[OPENMP] Add support for `depend` on `target teams distribute parallel
for` directives.

Added codegen for `depend` clauses on `#pragma omp target teams
distribute parallel for` directives.

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

6 years ago[OPENMP] Add support for `depend` clauses on `target parallel for simd`
Alexey Bataev [Tue, 16 Jan 2018 17:55:15 +0000 (17:55 +0000)]
[OPENMP] Add support for `depend` clauses on `target parallel for simd`
directives.

Added codegen for `depend` clauses on `#pragma omp target parallel for
simd` directives.

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

6 years ago[OPENMP] Add support for `depend` clauses on `target parallel for`
Alexey Bataev [Tue, 16 Jan 2018 17:41:04 +0000 (17:41 +0000)]
[OPENMP] Add support for `depend` clauses on `target parallel for`
directives.

Added codegen for `depend` clause on `#pragma omp target parallel for`
directives.

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

6 years ago[OPENMP] Add support for `depend` clauses on `target teams distribute
Alexey Bataev [Tue, 16 Jan 2018 17:22:50 +0000 (17:22 +0000)]
[OPENMP] Add support for `depend` clauses on `target teams distribute
simd` directives.

Added codegen for `depend` clauses on `#pragma omp target teams
distribute simd` directives.

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

6 years agoAdd va_start()/va_copy()/va_end to Builtins.def
Nico Weber [Tue, 16 Jan 2018 16:55:41 +0000 (16:55 +0000)]
Add va_start()/va_copy()/va_end to Builtins.def

That way, clang suggests including stdarg.h when these are used in C files.
https://reviews.llvm.org/D42085

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

6 years ago[OPENMP] Add support for `depend` clause on `target teams distribute`.
Alexey Bataev [Tue, 16 Jan 2018 16:46:46 +0000 (16:46 +0000)]
[OPENMP] Add support for `depend` clause on `target teams distribute`.

Added codegen for `depend` clauses on `#pragma omp target teams
distribute` directives.

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

6 years ago[OPENMP] Add support for `depend` clauses on `target parallel` directive.
Alexey Bataev [Tue, 16 Jan 2018 16:27:49 +0000 (16:27 +0000)]
[OPENMP] Add support for `depend` clauses on `target parallel` directive.

Added codegen for `depend` clauses on `#pragma omp target parallel`
directives.

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

6 years ago[OPENMP] Add support for `depend` clauses on `target teams`.
Alexey Bataev [Tue, 16 Jan 2018 15:57:07 +0000 (15:57 +0000)]
[OPENMP] Add support for `depend` clauses on `target teams`.

Added codegen for `depend` clause on `#pragma omp target teams`
directives.

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

6 years ago[SystemZ] Support vector registers with inline asm
Ulrich Weigand [Tue, 16 Jan 2018 15:39:23 +0000 (15:39 +0000)]
[SystemZ] Support vector registers with inline asm

Allow using vector register names and the "v" constraint
in inline asm to ensure compatibility with GCC.

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

6 years ago[OPENMP] Add support for `depend` clauses on `target simd`.
Alexey Bataev [Tue, 16 Jan 2018 15:05:16 +0000 (15:05 +0000)]
[OPENMP] Add support for `depend` clauses on `target simd`.

Added codegen for `depend` clauses on `#pragma omp target simd`
directives.

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

6 years ago[NFC] fix trivial typo in document
Hiroshi Inoue [Tue, 16 Jan 2018 13:19:31 +0000 (13:19 +0000)]
[NFC] fix trivial typo in document

"the the" -> "the"

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

6 years agoSquash -Wcovered-switch-default wairning
Sam McCall [Tue, 16 Jan 2018 12:54:28 +0000 (12:54 +0000)]
Squash -Wcovered-switch-default wairning

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

6 years agoEnsure code complete with !LoadExternal sees all local decls.
Sam McCall [Tue, 16 Jan 2018 12:33:46 +0000 (12:33 +0000)]
Ensure code complete with !LoadExternal sees all local decls.

Summary:
noload_lookups() was too lazy: in addition to avoiding external decls, it
avoided populating the lazy lookup structure for internal decls.
This is the right behavior for the existing callsite in ASTDumper, but I think
it's not a very useful default, so we populate it by default.

While here:
 - remove an unused test file accidentally added in r322371.
 - remove lookups_begin()/lookups_end() in favor of lookups().begin(), which is
   more common and more efficient.

Reviewers: ilya-biryukov

Subscribers: cfe-commits, rsmith

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

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

6 years agoAdd missing CINDEX_LINKAGE
Ivan Donchevskii [Tue, 16 Jan 2018 12:11:59 +0000 (12:11 +0000)]
Add missing CINDEX_LINKAGE

Follow up for [libclang] Add PrintingPolicy for pretty printing declarations

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

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

6 years ago[libclang] Add PrintingPolicy for pretty printing declarations
Jonathan Coe [Tue, 16 Jan 2018 10:19:56 +0000 (10:19 +0000)]
[libclang] Add PrintingPolicy for pretty printing declarations

Summary:
Introduce clang_getCursorPrettyPrinted() for pretty printing
declarations. Expose also PrintingPolicy, so the user gets more
fine-grained control of the entities being printed.

The already existing clang_getCursorDisplayName() is pretty limited -
for example, it does not handle return types, parameter names or default
arguments for function declarations. Addressing these issues in
clang_getCursorDisplayName() would mean to duplicate existing code
(e.g. clang::DeclPrinter), so rather expose new API to access the
existing functionality.

Reviewed By: jbcoe

Subscribers: cfe-commits

Tags: #clang

Patch by nik (Nikolai Kosjar)

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

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

6 years ago[Sema] Fix a crash on invalid features in multiversioning
George Burgess IV [Tue, 16 Jan 2018 03:01:50 +0000 (03:01 +0000)]
[Sema] Fix a crash on invalid features in multiversioning

We were trying to emit a diag::err_bad_multiversion_option diagnostic,
which expects an int as its first argument, with a string argument. As
it happens, the string `Feature` that was causing this was shadowing an
int `Feature` from the surrounding scope. :)

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

6 years agoRevert 319303: Add _Float128 as alias to __float128 to enable compilations on Fedora2...
Erich Keane [Mon, 15 Jan 2018 21:16:25 +0000 (21:16 +0000)]
Revert 319303: Add _Float128 as alias to __float128 to enable compilations on Fedora27/glibc2

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

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

6 years ago[Driver] Suggest valid integrated tools
Brian Gesiak [Mon, 15 Jan 2018 21:05:40 +0000 (21:05 +0000)]
[Driver] Suggest valid integrated tools

Summary:
There are only two valid integrated Clang driver tools: `-cc1` and
`-cc1as`. If a user asks for an unknown tool, such as `-cc1asphalt`,
an error message is displayed to indicate that there is no such tool,
but the message doesn't indicate what the valid options are.

Include the valid options in the error message.

Test Plan: `check-clang`

Reviewers: sepavloff, bkramer, phosek

Reviewed By: bkramer

Subscribers: cfe-commits

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

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

6 years ago[OPENMP] Update status of OpenMP support, NFC.
Alexey Bataev [Mon, 15 Jan 2018 21:01:29 +0000 (21:01 +0000)]
[OPENMP] Update status of OpenMP support, NFC.

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

6 years ago[OPENMP] Initial codegen for `target teams distribute parallel for
Alexey Bataev [Mon, 15 Jan 2018 20:59:40 +0000 (20:59 +0000)]
[OPENMP] Initial codegen for `target teams distribute parallel for
simd`.

Added host codegen + codegen for devices with default codegen for
`#pragma omp target teams distribute parallel for simd` directive.

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

6 years ago[RISCV] Fix test failures on non-assert builds introduced in r322494
Alex Bradbury [Mon, 15 Jan 2018 20:45:15 +0000 (20:45 +0000)]
[RISCV] Fix test failures on non-assert builds introduced in r322494

Thanks to Eli Friedman, who suggested the reason these tests failed on a few
buildbots yet works fine locally is because non-assert builds don't emit value
labels.

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

6 years agoFixed memory leak in unit test introduced in my previous commit r322503
Cameron Desrochers [Mon, 15 Jan 2018 20:37:35 +0000 (20:37 +0000)]
Fixed memory leak in unit test introduced in my previous commit r322503

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

6 years ago[PCH] Serialize skipped preprocessor ranges
Cameron Desrochers [Mon, 15 Jan 2018 19:14:16 +0000 (19:14 +0000)]
[PCH] Serialize skipped preprocessor ranges

The skipped preprocessor ranges are now serialized in the AST PCH file. This fixes, for example, libclang's clang_getSkippedRanges() returning zero ranges after reparsing a translation unit.

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

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

6 years ago[OPENMP] Update docs for OpenMP status, NFC.
Alexey Bataev [Mon, 15 Jan 2018 19:08:36 +0000 (19:08 +0000)]
[OPENMP] Update docs for OpenMP status, NFC.

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

6 years ago[OPENMP] Add codegen for `depend` clauses on `target` directive.
Alexey Bataev [Mon, 15 Jan 2018 19:06:12 +0000 (19:06 +0000)]
[OPENMP] Add codegen for `depend` clauses on `target` directive.

Added basic support for codegen of `depend` clauses on `target`
directive.

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

6 years ago[RISCV] Implement RISCV ABI lowering
Alex Bradbury [Mon, 15 Jan 2018 17:54:52 +0000 (17:54 +0000)]
[RISCV] Implement RISCV ABI lowering

RISCVABIInfo is implemented in terms of XLen, supporting both RV32 and RV64.
Unfortunately we need to count argument registers in the frontend in order to
determine when to emit signext and zeroext attributes. Integer scalars are
extended according to their type up to 32-bits and then sign-extended to XLen
when passed in registers, but are anyext when passed on the stack. This patch
only implements the base integer (soft float) ABIs.

For more information on the RISC-V ABI, see [the ABI
doc](https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md),
my [golden model](https://github.com/lowRISC/riscv-calling-conv-model), and
the [LLVM RISC-V calling convention
patch](https://reviews.llvm.org/D39898#2d1595b4) (specifically the comment
documenting frontend expectations).

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

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

6 years ago[clang-format] Adds a FormatStyleSet
Krasimir Georgiev [Mon, 15 Jan 2018 12:06:16 +0000 (12:06 +0000)]
[clang-format] Adds a FormatStyleSet

Summary:
This patch adds a FormatStyleSet for storing per-language FormatStyles for the
purposes of formatting code blocks inside the main code.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: klimek, djasper, bkramer, cfe-commits

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

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

6 years agoClang counterpart change for fuzzer FreeBSD support
Kamil Rytarowski [Mon, 15 Jan 2018 05:56:44 +0000 (05:56 +0000)]
Clang counterpart change for fuzzer FreeBSD support

Summary: Providing fuzzer sanitizer support for FreeBSD (but only for X86/64 architectures).

Reviewers: kimgr, EricWF, martell

Reviewed By: martell

Patch by David CARLIER.

Subscribers: krytarowski, kimgr, emaste, cfe-commits

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

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

6 years ago[X86] Implement old kunpck intrinsics using vector ops on vXi1 instead of integer...
Craig Topper [Sun, 14 Jan 2018 19:23:50 +0000 (19:23 +0000)]
[X86] Implement old kunpck intrinsics using vector ops on vXi1 instead of integer shift/and/or

Summary:
kunpck intrinsics were removed in favor of native IR a few months ago. The implementation lowers them as by operation on the integer types passed to the intrinsic and then just shifting, masking, and oring them together. A special X86 DAG combine was added to recognize this patter and turn it into a concat_vector operation.

I think it makes more sense to keep the IR implementation closer to vector operations on vXi1. Given that we expect these builtins to be used around other builtins that operate on k-registers which we try to represent in IR with vXi1. InstCombine should be able to get rid of the bitcasts between integers and vXi1 leaving only the vector operations.

Reviewers: RKSimon, spatel, zvi, jina.nahias

Reviewed By: RKSimon

Subscribers: cfe-commits

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

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

6 years agoReland "[Driver] Update default sanitizer blacklist location"
Petr Hosek [Sun, 14 Jan 2018 03:43:17 +0000 (03:43 +0000)]
Reland "[Driver] Update default sanitizer blacklist location"

This is related to moving the sanitizer blacklists to share/
subdirectory.

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

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

6 years ago[clang-format] [NFC] Remove comment
Mark Zeren [Sat, 13 Jan 2018 22:52:34 +0000 (22:52 +0000)]
[clang-format] [NFC] Remove comment

Remove inaccurate comment that came in with  r312125.

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

6 years ago[docs] Use monospace for PCH option flags
Brian Gesiak [Sat, 13 Jan 2018 18:34:07 +0000 (18:34 +0000)]
[docs] Use monospace for PCH option flags

Summary:
Use monospace for option flags in the PCH section, instead of the
italics that were being used previously.

I believe these used to be links, for which single backticks would
have been appropriate, but since they were un-link-ified in
https://reviews.llvm.org/rL275560, I believe monospace is now more
appropriate, and so two backticks are needed.

Test Plan:
Build the `docs-clang-html` target and confirm the options are rendered
using monospace font.

Reviewers: sepavloff, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[Driver] Add "did you mean?" suggestions to -cc1as
Brian Gesiak [Sat, 13 Jan 2018 17:09:11 +0000 (17:09 +0000)]
[Driver] Add "did you mean?" suggestions to -cc1as

Summary:
In https://reviews.llvm.org/D41733, the driver was modified such that,
when a user provided a mispelled option such as `-hel`, it would
suggest a valid option with a nearby edit distance: "did you mean
'-help'?".

Add these suggestions to invocations of `clang -cc1as` as well.

Test Plan: `check-clang`

Reviewers: v.g.vassilev, bruno

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

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

6 years ago[Sema] Fix crash for type-dependent base classes
Jan Korous [Sat, 13 Jan 2018 15:24:16 +0000 (15:24 +0000)]
[Sema] Fix crash for type-dependent base classes

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

6 years agoFix test/Driver/riscv32-toolchain.c for builds setting CLANG_DEFAULT_LINKER
Alex Bradbury [Sat, 13 Jan 2018 09:21:11 +0000 (09:21 +0000)]
Fix test/Driver/riscv32-toolchain.c for builds setting CLANG_DEFAULT_LINKER

Petr Hosek reported an external buildbot was failing on riscv32-toolchain.c,
seemingly as it set CLANG_DEFAULT_LINKER to lld. Address this by explicitly
setting -fuse-ld=ld in the tests.

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

6 years agoDR126: partially implement the const-correct rules for exception handler matching.
Richard Smith [Sat, 13 Jan 2018 05:05:45 +0000 (05:05 +0000)]
DR126: partially implement the const-correct rules for exception handler matching.

While here, fix up the myriad other ways in which Sema's two "can this handler
catch that exception?" implementations get things wrong and unify them.

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

6 years agoRemove unused addIfPresent function.
Eric Christopher [Sat, 13 Jan 2018 00:46:47 +0000 (00:46 +0000)]
Remove unused addIfPresent function.

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

6 years agoTry to suppress Windows testing again.
Richard Trieu [Fri, 12 Jan 2018 23:13:33 +0000 (23:13 +0000)]
Try to suppress Windows testing again.

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

6 years agoFix test on Windows that was added in r322382.
Douglas Yung [Fri, 12 Jan 2018 22:32:01 +0000 (22:32 +0000)]
Fix test on Windows that was added in r322382.

The test was using "%clang++" which on Windows became "clang.exe++". Use %clangxx instead.

Reviewed by Paul Robinson

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

6 years agoWhen rebuilding an InitListExpr, don't give it a type.
Richard Smith [Fri, 12 Jan 2018 22:21:33 +0000 (22:21 +0000)]
When rebuilding an InitListExpr, don't give it a type.

InitListExprs without types (well, with type 'void') represent not-yet-analyzed
initializer lists; InitListExpr with types fool Sema into thinking they don't
need further analysis in some cases (particularly C++17 copy omission).

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

6 years ago[DWARFv5] Have -gdwarf-5 generate MD5 checksums
Paul Robinson [Fri, 12 Jan 2018 22:19:03 +0000 (22:19 +0000)]
[DWARFv5] Have -gdwarf-5 generate MD5 checksums

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

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

6 years ago[analyzer] Don't flag strcpy of string literals into sufficiently large buffers.
Artem Dergachev [Fri, 12 Jan 2018 22:12:11 +0000 (22:12 +0000)]
[analyzer] Don't flag strcpy of string literals into sufficiently large buffers.

In the security package, we have a simple syntactic check that warns about
strcpy() being insecure, due to potential buffer overflows.

Suppress that check's warning in the trivial situation when the source is an
immediate null-terminated string literal and the target is an immediate
sufficiently large buffer.

Patch by AndrĂ¡s Leitereg!

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

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

6 years agoAllocate and access NormalCleanupDest with the natural alignment of i32.
John McCall [Fri, 12 Jan 2018 22:07:01 +0000 (22:07 +0000)]
Allocate and access NormalCleanupDest with the natural alignment of i32.

This alignment can be less than 4 on certain embedded targets, which may
not even be able to deal with 4-byte alignment on the stack.

Patch by Jacob Young!

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

6 years agoDisable test for Windows to fix Windows buildbots.
Richard Trieu [Fri, 12 Jan 2018 21:49:20 +0000 (21:49 +0000)]
Disable test for Windows to fix Windows buildbots.

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

6 years agoRefactor handling of signext/zeroext in ABIArgInfo
Alex Bradbury [Fri, 12 Jan 2018 20:08:16 +0000 (20:08 +0000)]
Refactor handling of signext/zeroext in ABIArgInfo

As @rjmccall suggested in D40023, we can get rid of
ABIInfo::shouldSignExtUnsignedType (used to handle cases like the Mips calling
convention where 32-bit integers are always sign extended regardless of the
sign of the type) by adding a SignExt field to ABIArgInfo. In the common case,
this new field is set automatically by ABIArgInfo::getExtend based on the sign
of the type. For targets that want greater control, they can use
ABIArgInfo::getSignExtend or ABIArgInfo::getZeroExtend when necessary. This
change also cleans up logic in CGCall.cpp.

There is no functional change intended in this patch, and all tests pass
unchanged. As noted in D40023, Mips might want to sign-extend unsigned 32-bit
integer return types. A future patch might modify
MipsABIInfo::classifyReturnType to use MipsABIInfo::extendType.

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

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

6 years ago[OPENMP] Replace calls of getAssociatedStmt().
Alexey Bataev [Fri, 12 Jan 2018 19:39:11 +0000 (19:39 +0000)]
[OPENMP] Replace calls of getAssociatedStmt().

getAssociatedStmt() returns the outermost captured statement for the
OpenMP directive. It may return incorrect region in case of combined
constructs. Reworked the code to reduce the number of calls of
getAssociatedStmt() and used getInnermostCapturedStmt() and
getCapturedStmt() functions instead.
In case of firstprivate variables it may lead to an extra allocas
generation for private copies even if the variable is passed by value
into outlined function and could be used directly as private copy.

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

6 years ago[Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.
Volodymyr Sapsai [Fri, 12 Jan 2018 18:54:35 +0000 (18:54 +0000)]
[Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.

Fix makes the loop in LexAngledStringLiteral more like the loops in
LexStringLiteral, LexCharConstant. When we skip a character after
backslash, we need to check if we reached the end of the file instead of
reading the next character unconditionally.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3832

rdar://problem/35572754

Reviewers: arphaman, kcc, rsmith, dexonsmith

Reviewed By: rsmith, dexonsmith

Subscribers: cfe-commits, rsmith, dexonsmith

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

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

6 years ago[WebAssembly] Support -stdlib=libc++ switch
Sam Clegg [Fri, 12 Jan 2018 17:54:49 +0000 (17:54 +0000)]
[WebAssembly] Support -stdlib=libc++ switch

Referenced implementation from Fuchsia and Darwin Toolchain.
Still only support CST_Libcxx.  Now checks that the argument
is really '-stdlib=libc++', and display error.

Also, now will pass -lc++ and -lc++abi to the linker.

Patch by Patrick Cheng!

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

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

6 years ago[CodeComplete] Add an option to omit results from the preamble.
Sam McCall [Fri, 12 Jan 2018 14:51:47 +0000 (14:51 +0000)]
[CodeComplete] Add an option to omit results from the preamble.

Summary:
Enumerating the contents of a namespace or global scope will omit any
decls that aren't already loaded, instead of deserializing them from the
PCH.

This allows a fast hybrid code completion where symbols from headers are
provided by an external index. (Sema already exposes the information
needed to do a reasonabl job of filtering them).
Clangd plans to implement this hybrid.

This option is just a hint - callers still need to postfilter results if
they want to *avoid* completing decls outside the main file.

Reviewers: bkramer, ilya-biryukov

Subscribers: cfe-commits

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

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

6 years ago[ODRHash] Don't hash friend functions.
Richard Trieu [Fri, 12 Jan 2018 04:42:27 +0000 (04:42 +0000)]
[ODRHash] Don't hash friend functions.

In certain combinations of templated classes and friend functions, the body
of friend functions does not get propagated along with function signature.
Exclude friend functions for hashing to avoid this case.

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

6 years ago[Docs] Fix typo in toolchain documentation
Craig Topper [Fri, 12 Jan 2018 02:57:02 +0000 (02:57 +0000)]
[Docs] Fix typo in toolchain documentation

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