]> granicus.if.org Git - clang/log
clang
5 years ago[OpenCL] Change type of block pointer for OpenCL
Alexey Bader [Tue, 19 Feb 2019 15:19:06 +0000 (15:19 +0000)]
[OpenCL] Change type of block pointer for OpenCL

Summary:

For some reason OpenCL blocks in LLVM IR are represented as function pointers.
These pointers do not point to any real function and never get called. Actually
they point to some structure, which in turn contains pointer to the real block
invoke function.
This patch changes represntation of OpenCL blocks in LLVM IR from function
pointers to pointers to `%struct.__block_literal_generic`.
Such representation allows to avoid unnecessary bitcasts and simplifies
further processing (e.g. translation to SPIR-V ) of the module for targets
which do not support function pointers.

Patch by: Alexey Sotkin.

Reviewers: Anastasia, yaxunl, svenvh

Reviewed By: Anastasia

Subscribers: alexbatashev, cfe-commits

Tags: #clang

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

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

5 years ago[clang][test] Fix FileManagerTest.getFileDontOpenRealPath for Windows
Jan Korous [Mon, 18 Feb 2019 23:12:29 +0000 (23:12 +0000)]
[clang][test] Fix FileManagerTest.getFileDontOpenRealPath for Windows

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

5 years agoReland "[clang][FileManager] fillRealPathName even if we aren't opening the file"
Jan Korous [Mon, 18 Feb 2019 22:33:40 +0000 (22:33 +0000)]
Reland "[clang][FileManager] fillRealPathName even if we aren't opening the file"

This reverts commit e2bb3121fd4ab5b01f9ec1d2e3e9877db9c6a54c.
+ fixed test for Windows

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

5 years ago[ASTImporter] Find previous friend function template
Gabor Marton [Mon, 18 Feb 2019 13:09:27 +0000 (13:09 +0000)]
[ASTImporter] Find previous friend function template

Reviewers: a_sidorin, shafik, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

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

5 years ago[ARM] Add pre-defined macros for ROPI and RWPI
Oliver Stannard [Mon, 18 Feb 2019 12:39:47 +0000 (12:39 +0000)]
[ARM] Add pre-defined macros for ROPI and RWPI

This adds ACLE-defined macros to test for code being compiled in the ROPI and
RWPI position-independence modes.

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

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

5 years ago[clang][Index] Fix usage of IndexImplicitInstantiation
Kadir Cetinkaya [Mon, 18 Feb 2019 11:30:43 +0000 (11:30 +0000)]
[clang][Index] Fix usage of IndexImplicitInstantiation

Summary:
Indexing context was skipping explicit template instantiations as well.
This patch makes sure it only skips implicit ones.

Subscribers: arphaman, jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Unify redecl chain tests as type parameterized tests
Gabor Marton [Mon, 18 Feb 2019 11:09:56 +0000 (11:09 +0000)]
[ASTImporter] Unify redecl chain tests as type parameterized tests

Summary:
This patch unifies all those tests which check the correctness of the
redecl chains. Previously we had several structurally very similar test
cases for each language construct (class, function, variable, function
template, ...).

We still use value-parameterized tests for the different AST
compatibility switches (-fdelayed-template-parsing, -fms-compatibility).
Gtest makes it possible to have either value-parameterized or
type-parameterized fixtures. However, we cannot have both value- and
type-parameterized test fixtures. So we use a value-parameterized test
fixture in the gtest sense. We intend to mimic gtest's type-parameters
via the type template parameter. We manually instantiate the different
tests with the each types.

After this patch I am planning to put the "generic redecl chain" related
tests into their own separate test file (in another patch).

Reviewers: a_sidorin, shafik, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

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

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

5 years ago[analyzer] Make valist.Uninitialized depend on ValistBase
Kristof Umann [Sun, 17 Feb 2019 19:51:42 +0000 (19:51 +0000)]
[analyzer] Make valist.Uninitialized depend on ValistBase

Accidentally left this dependency out, resulting in an assert failure if
only valist.Uninitialized is enabled from the valist package.

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

5 years ago[NFC] Add a llvm_unreachable to silence a warning in SubstObjCTypeArgsVisitor
Bruno Ricci [Sun, 17 Feb 2019 19:18:38 +0000 (19:18 +0000)]
[NFC] Add a llvm_unreachable to silence a warning in SubstObjCTypeArgsVisitor

All cases in the switch are covered. NFC.

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

5 years agoRecommit "[AST] Factor out the logic of the various Expr::Ignore*"
Bruno Ricci [Sun, 17 Feb 2019 18:50:51 +0000 (18:50 +0000)]
Recommit "[AST] Factor out the logic of the various Expr::Ignore*"

(Originally commited in r354215 and reverted in r354216 because of a
 missed failing clang-tidy test (fix in r354228))

Now that the implementation of all of the Expr::Ignore* is in Expr.cpp
we can try to remove some duplication. Do this by separating the logic
of the Expr::Ignore* from the iterative loop.

This is NFC, except for one change: IgnoreParenImpCasts now skips,
among other things, everything that IgnoreImpCasts skips. This means
FullExpr are now skipped by IgnoreParenImpCasts. This was likely an
oversight when FullExpr was added to the nodes skipped by IgnoreImpCasts.

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

Reviewed By: aaron.ballman (with comments from void and rnk)

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

5 years ago[RISCV] Default enable RISCV linker relaxation
Shiva Chen [Sun, 17 Feb 2019 16:05:51 +0000 (16:05 +0000)]
[RISCV] Default enable RISCV linker relaxation

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

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

5 years agoRevert "[AST] Factor out the logic of the various Expr::Ignore*"
Bruno Ricci [Sun, 17 Feb 2019 13:47:29 +0000 (13:47 +0000)]
Revert "[AST] Factor out the logic of the various Expr::Ignore*"

This breaks some clang-tidy checks. For some reason they were
not included in check-clang ?

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

5 years ago[AST] Factor out the logic of the various Expr::Ignore*
Bruno Ricci [Sun, 17 Feb 2019 13:32:39 +0000 (13:32 +0000)]
[AST] Factor out the logic of the various Expr::Ignore*

Now that the implementation of all of the Expr::Ignore* is in Expr.cpp
we can try to remove some duplication. Do this by separating the logic of
the Expr::Ignore* from the iterative loop.

This is NFC, except for one change: IgnoreParenImpCasts now skips, among
other things, everything that IgnoreImpCasts skips. This means FullExpr
are now skipped by IgnoreParenImpCasts. This was likely an oversight when
FullExpr was added to the nodes skipped by IgnoreImpCasts.

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

Reviewed By: aaron.ballman (with comments from void and rnk)

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

5 years ago[X86] Prevent clang clobber checking for asm flag constraints.
Nirav Dave [Sun, 17 Feb 2019 03:53:23 +0000 (03:53 +0000)]
[X86] Prevent clang clobber checking for asm flag constraints.

Update getConstraintRegister as X86 Asm flag output constraints are no
longer fully alphanumeric,

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

5 years ago[Driver][Gnu] Support -nolibc flag
Petr Hosek [Sun, 17 Feb 2019 02:42:48 +0000 (02:42 +0000)]
[Driver][Gnu] Support -nolibc flag

This can be used to disable libc linking. This flag is supported by
GCC since version 9 as well as some Clang target toolchains.

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

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

5 years ago[Driver][Fuchsia] Support -nolibc flag
Petr Hosek [Sun, 17 Feb 2019 01:02:40 +0000 (01:02 +0000)]
[Driver][Fuchsia] Support -nolibc flag

This can be used to disable libc linking. This flag is supported by
GCC since version 9 as well as some Clang target toolchains. This
change also includes tests for all -no* flags which previously weren't
covered.

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

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

5 years agoMove multiline raw string literal out of macro. NFC
David Green [Sat, 16 Feb 2019 11:19:04 +0000 (11:19 +0000)]
Move multiline raw string literal out of macro. NFC

Certain combinations of gcc and ccache fail when the raw
string literal is preprocessed. This just moves the string
out as is done elsewhere in the same file.

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

5 years agoFix some tests I broke in r354190
Erik Pilkington [Sat, 16 Feb 2019 01:51:19 +0000 (01:51 +0000)]
Fix some tests I broke in r354190

This was breaking on MSVC, since long double and double have the same
semantics there.

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

5 years ago[Sema] Diagnose floating point conversions based on target semantics
Erik Pilkington [Sat, 16 Feb 2019 01:11:47 +0000 (01:11 +0000)]
[Sema] Diagnose floating point conversions based on target semantics

...instead of just comparing rank. Also, fix a bad warning about
_Float16, since its declared out of order in BuiltinTypes.def,
meaning comparing rank using BuiltinType::getKind() is incorrect.

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

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

5 years ago[ObjC generics] Fix applying `__kindof` to the type parameter.
Volodymyr Sapsai [Sat, 16 Feb 2019 01:01:08 +0000 (01:01 +0000)]
[ObjC generics] Fix applying `__kindof` to the type parameter.

Fixes the warning about incompatible pointer types on assigning to a
subclass of type argument an expression of type `__kindof TypeParam`.

We already have a mechanism in `ASTContext::canAssignObjCInterfaces`
that handles `ObjCObjectType` with `__kindof`. But it wasn't triggered
because during type substitution `__kindof TypeParam` was represented as
`AttributedType` with attribute `ObjCKindOf` and equivalent type
`TypeArg`. For assignment type checking we use canonical types so
attributed type was desugared and the attribute was ignored.

The fix is in checking transformed `AttributedType` and pushing
`__kindof` down into `ObjCObjectType` when necessary.

rdar://problem/38514910

Reviewers: ahatanak, erik.pilkington, doug.gregor

Reviewed By: doug.gregor

Subscribers: jkorous, dexonsmith, manmanren, jordan_rose, doug.gregor, cfe-commits

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

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

5 years agoclang-format with UseTab: Always sometimes doesn't insert the right amount of tabs.
Alexander Kornienko [Fri, 15 Feb 2019 23:07:43 +0000 (23:07 +0000)]
clang-format with UseTab: Always sometimes doesn't insert the right amount of tabs.

Trailing comments are not always aligned properly when UseTab is set to Always.

Consider:

int a;        // x
int bbbbbbbb; // x
With .clang-format:

---
Language:        Cpp
BasedOnStyle: LLVM
UseTab: Always
...
The trailing comments of this code block should be aligned, but aren't

To align the first trailing comment it needs to insert 8 spaces. This should be
one tab plus six spaces. It skips the logic of the first partial tab in
FirstTabWidth (=2) + Style.TabWidth (=8) <= Spaces (=8) and only inserts one
tab. Proposed fix and test is attached.

Patch by Hylke Kleve.

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

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

5 years ago[ObjC] For type substitution in generics use a regular recursive type visitor.
Volodymyr Sapsai [Fri, 15 Feb 2019 22:14:58 +0000 (22:14 +0000)]
[ObjC] For type substitution in generics use a regular recursive type visitor.

Switch to the inheritance-based visitor from the lambda-based visitor to
allow both preorder and postorder customizations during type
transformation. NFC intended.

Reviewers: ahatanak, erik.pilkington

Reviewed By: erik.pilkington

Subscribers: jkorous, dexonsmith, cfe-commits

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

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

5 years agoFix implementation of [temp.local]p4.
Richard Smith [Fri, 15 Feb 2019 21:53:07 +0000 (21:53 +0000)]
Fix implementation of [temp.local]p4.

When a template-name is looked up, we need to give injected-class-name
declarations of class templates special treatment, as they denote a
template rather than a type.

Previously we achieved this by applying a filter to the lookup results
after completing name lookup, but that is incorrect in various ways, not
least of which is that it lost all information about access and how
members were named, and the filtering caused us to generally lose
all ambiguity errors between templates and non-templates.

We now preserve the lookup results exactly, and the few places that need
to map from a declaration found by name lookup into a declaration of a
template do so explicitly. Deduplication of repeated lookup results of
the same injected-class-name declaration is done by name lookup instead
of after the fact.

This reinstates r354091, which was previously reverted in r354097
because it exposed bugs in lldb and compiler-rt. Those bugs were fixed
in r354173 and r354174 respectively.

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

5 years agoRevert r354075 "[clang][FileManager] fillRealPathName even if we aren't opening the...
Reid Kleckner [Fri, 15 Feb 2019 20:48:12 +0000 (20:48 +0000)]
Revert r354075 "[clang][FileManager] fillRealPathName even if we aren't opening the file"

The new test doesn't pass on Windows.

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

5 years ago[Driver] Default all Android ARM targets to NEON.
Dan Albert [Fri, 15 Feb 2019 20:31:54 +0000 (20:31 +0000)]
[Driver] Default all Android ARM targets to NEON.

Summary:
There are an insignificant number of ARM Android devices that don't
support NEON. Default to using NEON since that will improve
performance on the majority of devices. Users that need to target
non-NEON devices can still explicitly disable NEON.

Reviewers: srhines, pirama, kristof.beyls

Reviewed By: pirama

Subscribers: efriedma, javed.absar, cfe-commits

Tags: #clang

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

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

5 years agoRelax assertion to account for private framework modules, too.
Adrian Prantl [Fri, 15 Feb 2019 20:24:26 +0000 (20:24 +0000)]
Relax assertion to account for private framework modules, too.

rdar://problem/48116069

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

5 years ago[ObjC] Fix non-canonical types preventing type arguments substitution.
Volodymyr Sapsai [Fri, 15 Feb 2019 20:17:45 +0000 (20:17 +0000)]
[ObjC] Fix non-canonical types preventing type arguments substitution.

`QualType::substObjCTypeArgs` doesn't go past non-canonical types and as
the result misses some of the substitutions like `ObjCTypeParamType`.

Update `SimpleTransformVisitor` to traverse past the type sugar.

Reviewers: ahatanak, erik.pilkington

Reviewed By: erik.pilkington

Subscribers: jkorous, dexonsmith, cfe-commits

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

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

5 years ago[MSVC] Recognize `static_assert` keyword in C and C++98
Reid Kleckner [Fri, 15 Feb 2019 19:59:45 +0000 (19:59 +0000)]
[MSVC] Recognize `static_assert` keyword in C and C++98

Summary:
The main effect is that clang now accepts the following conforming C11
code with MSVC headers:
  #include <assert.h>
  static_assert(1, "true");

This is a non-conforming extension (the keyword is outside the
implementer's namespace), so it is placed under -fms-compatibility
instead of -fms-extensions like most MSVC-specific keyword extensions.

Normally, in C11, the compiler is supposed to provide the _Static_assert
keyword, and assert.h should define static_assert to _Static_assert.
However, that is not what MSVC does, and MSVC doesn't even provide
_Static_assert.

This also has the less important side effect of enabling static_assert
in C++98 mode with -fms-compatibility. It's exceptionally difficult to
use modern MSVC headers without C++14 even, so this is relatively
unimportant.

Fixes PR26672

Patch by Andrey Bokhanko!

Reviewers: rsmith, thakis

Subscribers: cfe-commits, STL_MSFT

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

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

5 years ago[Sema][NFC] SequenceChecker: Add tests for references/members, and prepare for the...
Bruno Ricci [Fri, 15 Feb 2019 18:12:58 +0000 (18:12 +0000)]
[Sema][NFC] SequenceChecker: Add tests for references/members, and prepare for the C++17 tests

Add some tests for unsequenced operations with members and references.
For now most of it is unhandled but it shows what work needs to be done.

Also merge the tests for the C++17 sequencing rules in warn-unsequenced.cpp
since we want to make sure that the appropriate warnings are still present
in C++17 without duplicating the whole content of warn-unsequenced.cpp.

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

5 years agoVariable auto-init of blocks capturing self after init bugfix
JF Bastien [Fri, 15 Feb 2019 17:26:29 +0000 (17:26 +0000)]
Variable auto-init of blocks capturing self after init bugfix

Summary:
Blocks that capture themselves (and escape) after initialization currently codegen wrong because this:

  bool capturedByInit =
      Init && emission.IsEscapingByRef && isCapturedBy(D, Init);

  Address Loc =
      capturedByInit ? emission.Addr : emission.getObjectAddress(*this);

Already adjusts Loc from thr alloca to a GEP. This code:

    if (emission.IsEscapingByRef)
      Loc = emitBlockByrefAddress(Loc, &D, /*follow=*/false);

Was trying to do the same adjustment, and a GEP on a GEP (returning an int) triggers an assertion.

<rdar://problem/47943027>

Reviewers: ahatanak

Subscribers: jkorous, dexonsmith, cfe-commits, rjmccall

Tags: #clang

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

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

5 years ago[clang] Add build and install targets for clang libraries
Shoaib Meenai [Fri, 15 Feb 2019 15:59:04 +0000 (15:59 +0000)]
[clang] Add build and install targets for clang libraries

This is modeled after the existing llvm-libraries target. It's a
convenient way to include all clang libraries in a distribution.

This differs slightly from the llvm-libraries target in that it adds any
library added via add_clang_library, whereas llvm-libraries only
includes targets added via add_llvm_library that didn't use the MODULE
or BUILDTREE_ONLY arguments. add_clang_library doesn't appear to have
any equivalents of those arguments, so the conditions don't apply.

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

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

5 years ago[clang] Create install targets for non-shared libraries
Shoaib Meenai [Fri, 15 Feb 2019 15:59:02 +0000 (15:59 +0000)]
[clang] Create install targets for non-shared libraries

I don't see a reason for these to not have install targets created,
which in turn allows them to be bundled in distributions. This doesn't
affect the "install" target, since that just runs all CMake install
rules (and we were already creating install rules for these).

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

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

5 years agoExteded test of .
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:10 +0000 (14:43 +0000)]
Exteded test of .

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

5 years agoRemove unnecessary expectation.
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:08 +0000 (14:43 +0000)]
Remove unnecessary expectation.

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

5 years agoAdded test for matcher On.
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:06 +0000 (14:43 +0000)]
Added test for matcher On.

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

5 years agoAdd tests for assorted `CXXMemberCallExpr` matchers.
Yitzhak Mandelbaum [Fri, 15 Feb 2019 14:43:03 +0000 (14:43 +0000)]
Add tests for assorted `CXXMemberCallExpr` matchers.

Summary: Add tests for matchers `on`, `onImplicitObjectArgument` and `hasObjectExpression`.

Reviewers: alexfh, steveire, aaron.ballman

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

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

5 years ago[Analyzer] Fix for test file of bug 40625
Adam Balogh [Fri, 15 Feb 2019 12:33:42 +0000 (12:33 +0000)]
[Analyzer] Fix for test file of bug 40625

Test fixed and changed to true positive, FIXME about false positive removed.

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

5 years ago[OpenCL][PR40707] Allow OpenCL C types in C++ mode.
Anastasia Stulova [Fri, 15 Feb 2019 12:07:57 +0000 (12:07 +0000)]
[OpenCL][PR40707] Allow OpenCL C types in C++ mode.

Allow all OpenCL types to be parsed in C++ mode.

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

5 years ago[ASTImporter] Import every Decl in lambda record
Gabor Marton [Fri, 15 Feb 2019 12:04:05 +0000 (12:04 +0000)]
[ASTImporter] Import every Decl in lambda record

Summary:
Previously only the fields were imported. Now every Decl is imported.
This way the destructor decl is not missing after import.

Patch by balazske (Balázs Kéri)

Reviewers: a.sidorin, shafik

Reviewed By: shafik

Subscribers: balazske, cfe-commits, Szelethus, martong, dkrupp

Tags: #clang

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

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

5 years agoRevert "[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach...
Sam McCall [Fri, 15 Feb 2019 09:18:49 +0000 (09:18 +0000)]
Revert "[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop"

This reverts commit r354102.

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

5 years ago[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop
Sam McCall [Fri, 15 Feb 2019 07:16:11 +0000 (07:16 +0000)]
[Analysis] -Wunreachable-code shouldn't fire on the increment of a foreach loop

Summary:
The idea is that the code here isn't written, so doesn't indicate a bug.
Similar to code expanded from macros.

This means the warning no longer fires on this code:
  for (auto C : collection) {
    process(C);
    return;
  }
  handleEmptyCollection();
Unclear whether this is more often a bug or not in practice, I think it's a
reasonable idiom in some cases.
Either way, if we want to warn on "loop that doesn't loop", I think it should be
a separate warning, and catch `while(1) break;`

Reviewers: ilya-biryukov, ioeric

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoRevert "Fix implementation of [temp.local]p4."
Francis Visoiu Mistrih [Fri, 15 Feb 2019 03:06:15 +0000 (03:06 +0000)]
Revert "Fix implementation of [temp.local]p4."

This reverts commit 40bd10b770813bd1471d46f514545437516aa4ba.

This seems to now emit an error when building the sanitizer tests:
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/53965/consoleFull.

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

5 years agoFix implementation of [temp.local]p4.
Richard Smith [Fri, 15 Feb 2019 00:29:04 +0000 (00:29 +0000)]
Fix implementation of [temp.local]p4.

When a template-name is looked up, we need to give injected-class-name
declarations of class templates special treatment, as they denote a
template rather than a type.

Previously we achieved this by applying a filter to the lookup results
after completing name lookup, but that is incorrect in various ways, not
least of which is that it lost all information about access and how
members were named, and the filtering caused us to generally lose
all ambiguity errors between templates and non-templates.

We now preserve the lookup results exactly, and the few places that need
to map from a declaration found by name lookup into a declaration of a
template do so explicitly. Deduplication of repeated lookup results of
the same injected-class-name declaration is done by name lookup instead
of after the fact.

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

5 years agoPR40642: Fix determination of whether the final statement of a statement
Richard Smith [Fri, 15 Feb 2019 00:27:53 +0000 (00:27 +0000)]
PR40642: Fix determination of whether the final statement of a statement
expression is a discarded-value expression.

Summary:
We used to get this wrong in three ways:

1) During parsing, an expression-statement followed by the }) ending a
   statement expression was always treated as producing the value of the
   statement expression. That's wrong for ({ if (1) expr; })
2) During template instantiation, various kinds of statement (most
   statements not appearing directly in a compound-statement) were not
   treated as discarded-value expressions, resulting in missing volatile
   loads (etc).
3) In all contexts, an expression-statement with attributes was not
   treated as producing the value of the statement expression, eg
   ({ [[attr]] expr; }).

Also fix incorrect enforcement of OpenMP rule that directives can "only
be placed in the program at a position where ignoring or deleting the
directive would result in a program with correct syntax". In particular,
a label (be it goto, case, or default) should not affect whether
directives are permitted.

Reviewers: aaron.ballman, rjmccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoFixed failure on Darwin due to r354064
Ana Pazos [Fri, 15 Feb 2019 00:19:45 +0000 (00:19 +0000)]
Fixed failure on Darwin due to r354064

Summary:
instrprof-darwin-exports.c test fails on Darwin due  to r354064.

Updated clang list of exported symbols to fix the issue.

Reviewers: vsk

Reviewed By: vsk

Subscribers: davidxl, efriedma

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

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

5 years ago[Driver][Darwin] Emit an error when using -pg on OS without support for it.
Volodymyr Sapsai [Thu, 14 Feb 2019 23:50:44 +0000 (23:50 +0000)]
[Driver][Darwin] Emit an error when using -pg on OS without support for it.

Instead of letting a program fail at runtime, emit an error during
compilation.

rdar://problem/12206955

Reviewers: dexonsmith, bob.wilson, steven_wu

Reviewed By: steven_wu

Subscribers: jkorous, cfe-commits

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

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

5 years ago[clang][FileManager] fillRealPathName even if we aren't opening the file
Jan Korous [Thu, 14 Feb 2019 23:02:35 +0000 (23:02 +0000)]
[clang][FileManager] fillRealPathName even if we aren't opening the file

The pathname wasn't previously filled when the getFile() method was called with openFile = false.
We are caching FileEntry-s in ParsedAST::Includes in clangd and this caused the problem.

This fixes an internal test failure in clangd - ClangdTests.GoToInclude.All

rdar://47536127

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

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

5 years ago[Sema] Fix-up a -Wfloat-conversion diagnostic
Erik Pilkington [Thu, 14 Feb 2019 22:48:01 +0000 (22:48 +0000)]
[Sema] Fix-up a -Wfloat-conversion diagnostic

We were warning on valid ObjC property reference exprs, and passing
in the wrong arguments to DiagnoseFloatingImpCast (leading to a badly
worded diagnostic).

rdar://47644670

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

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

5 years agoFurther relax restriction in tests to include where "-E" and "-S" must appear.
Douglas Yung [Thu, 14 Feb 2019 21:37:19 +0000 (21:37 +0000)]
Further relax restriction in tests to include where "-E" and "-S" must appear.

Also updated a few instances of "-emit-llvm-bc" and "-emit-obj" that were missed in the previous change.

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

5 years ago[CodeGenObjC] Emit [[X alloc] init] as objc_alloc_init(X) when available
Erik Pilkington [Thu, 14 Feb 2019 19:58:37 +0000 (19:58 +0000)]
[CodeGenObjC] Emit [[X alloc] init] as objc_alloc_init(X) when available

This provides a code size win on the caller side, since the init
message send is done in the runtime function.

rdar://44987038

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

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

5 years ago[X86] Add clang support for X86 flag output parameters.
Nirav Dave [Thu, 14 Feb 2019 19:27:25 +0000 (19:27 +0000)]
[X86] Add clang support for X86 flag output parameters.

Summary:
Add frontend support and expected flags for X86 inline assembly flag
parameters.

Reviewers: craig.topper, rnk, echristo

Subscribers: eraman, nickdesaulniers, void, llvm-commits

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

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

5 years ago[Sema] Fix a regression introduced in "[AST][Sema] Remove CallExpr::setNumArgs"
Bruno Ricci [Thu, 14 Feb 2019 15:43:17 +0000 (15:43 +0000)]
[Sema] Fix a regression introduced in "[AST][Sema] Remove CallExpr::setNumArgs"

D54902 removed CallExpr::setNumArgs in preparation of tail-allocating the
arguments of CallExpr. It did this by allocating storage for
max(number of arguments, number of parameters in the prototype). The
temporarily nulled arguments however causes issues in BuildResolvedCallExpr
when typo correction is done just after the creation of the call expression.

This was unfortunately missed by the tests /:

To fix this, delay setting the number of arguments to
max(number of arguments, number of parameters in the prototype) until we are
ready for it. It would be nice to have this encapsulated in CallExpr but this
is the best I can come up with under the constraint that we cannot add
anything the CallExpr.

Fixes PR40286.

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

Reviewed By: aaron.ballman

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

5 years ago[ASTImporter] Check visibility/linkage of functions and variables
Gabor Marton [Thu, 14 Feb 2019 13:07:03 +0000 (13:07 +0000)]
[ASTImporter] Check visibility/linkage of functions and variables

Summary:
During import of a global variable with external visibility the lookup
will find variables (with the same name) but with static visibility.
Clearly, we cannot put them into the same redecl chain.  The same is
true in case of functions.  In this fix we filter the lookup results and
consider only those which have the same visibility as the decl we
currently import.

We consider two decls in two anonymous namsepaces to have the same
visibility only if they are imported from the very same translation
unit.

Reviewers: a_sidorin, shafik, a.sidorin

Reviewed By: shafik

Subscribers: jdoerfert, balazske, rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

Tags: #clang

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

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

5 years ago[Builtins] Treat `bcmp` as a builtin.
Clement Courbet [Thu, 14 Feb 2019 12:00:34 +0000 (12:00 +0000)]
[Builtins] Treat `bcmp` as a builtin.

Summary:
This makes it consistent with `memcmp` and `__builtin_bcmp`.

Also see the discussion in https://reviews.llvm.org/D56593.

Reviewers: jyknight

Subscribers: kristina, cfe-commits

Tags: #clang

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

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

5 years agoPrint a note to the called macro when diagnosing err_embedded_directive
Nico Weber [Thu, 14 Feb 2019 04:13:17 +0000 (04:13 +0000)]
Print a note to the called macro when diagnosing err_embedded_directive

Fixes PR40713, see there for the motivation for this.

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

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

5 years ago[NewPM] Add explicit triple to test
Francis Visoiu Mistrih [Thu, 14 Feb 2019 04:13:00 +0000 (04:13 +0000)]
[NewPM] Add explicit triple to test

This prevents warnings like:

> warning: overriding the module target triple with x86_64-apple-darwin

on macOS.

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

5 years ago[CUDA][HIP] Use device side kernel and variable names when registering them
Yaxun Liu [Thu, 14 Feb 2019 02:00:09 +0000 (02:00 +0000)]
[CUDA][HIP] Use device side kernel and variable names when registering them

__hipRegisterFunction and __hipRegisterVar need to accept device side kernel and variable names
so that HIP runtime can associate kernel stub functions in host code with kernel symbols in fat binaries,
and associate shadow variables in host code with device variables in fat binaries.

Currently, clang assumes kernel functions and device variables have the same name as the kernel
stub functions and shadow variables. However, when host is compiled in windows with MSVC C++
ABI and device is compiled with Itanium C++ ABI (e.g. AMDGPU), kernels and device symbols in fat
binary are mangled differently than host.

This patch gets the device side kernel and variable name by mangling them in the mangle context
of aux target.

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

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

5 years agoRelax restriction in tests to where "-emit-llvm-bc" and "-emit-obj" must appear.
Douglas Yung [Thu, 14 Feb 2019 01:11:32 +0000 (01:11 +0000)]
Relax restriction in tests to where "-emit-llvm-bc" and "-emit-obj" must appear.

The CHECK lines as structured were requiring them to appear only in a certain
position while all that is really needed is to check that they are present.

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

5 years agoFix for asan bots
Leonard Chan [Thu, 14 Feb 2019 01:07:47 +0000 (01:07 +0000)]
Fix for asan bots

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

5 years ago[HWASAN] Updated HWASAN design document to better portray the chance of missing a...
Mitch Phillips [Wed, 13 Feb 2019 23:14:54 +0000 (23:14 +0000)]
[HWASAN] Updated HWASAN design document to better portray the chance of missing a bug.

Summary: Provided rule of thumb percentage chances of miss for 4 and 8 bit tag sizes.

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[NewPM] Second attempt at porting ASan
Leonard Chan [Wed, 13 Feb 2019 22:22:48 +0000 (22:22 +0000)]
[NewPM] Second attempt at porting ASan

This is the second attempt to port ASan to new PM after D52739. This takes the
initialization requried by ASan from the Module by moving it into a separate
class with it's own analysis that the new PM ASan can use.

Changes:
- Split AddressSanitizer into 2 passes: 1 for the instrumentation on the
  function, and 1 for the pass itself which creates an instance of the first
  during it's run. The same is done for AddressSanitizerModule.
- Add new PM AddressSanitizer and AddressSanitizerModule.
- Add legacy and new PM analyses for reading data needed to initialize ASan with.
- Removed DominatorTree dependency from ASan since it was unused.
- Move GlobalsMetadata and ShadowMapping out of anonymous namespace since the
  new PM analysis holds these 2 classes and will need to expose them.

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

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

5 years agoRestore Check for Unreachable Exit Block in -Winfinite-recursion
Robert Widmann [Wed, 13 Feb 2019 22:22:23 +0000 (22:22 +0000)]
Restore Check for Unreachable Exit Block in -Winfinite-recursion

Summary:
When this was rewritten in D43737, the logic changed to better explore infinite loops. The check for a reachable exit block was deleted which accidentally introduced false positives in case the exit node was unreachable.

We were testing for cases like this, but @steven_wu provided an additional test case that I've included in the regression tests for this patch.

Reviewers: steven_wu, rtrieu

Reviewed By: steven_wu, rtrieu

Subscribers: cfe-commits, steven_wu

Tags: #clang

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

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

5 years ago[WebAssembly] Bulk memory intrinsics and builtins
Thomas Lively [Wed, 13 Feb 2019 22:11:16 +0000 (22:11 +0000)]
[WebAssembly] Bulk memory intrinsics and builtins

Summary:
implements llvm intrinsics and clang intrinsics for
memory.init and data.drop.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits

Tags: #clang

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

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

5 years ago[Sema] Delay checking whether objc_designated_initializer is being applied to an...
Erik Pilkington [Wed, 13 Feb 2019 20:32:37 +0000 (20:32 +0000)]
[Sema] Delay checking whether objc_designated_initializer is being applied to an init method

This fixes a regression that was caused by r335084, which reversed
the order that attributes are applied. objc_method_family can change
whether a method is an init method, so the order that these
attributes are applied matters. The commit fixes this by delaying the
init check until after all attributes have been applied.

rdar://47829358

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

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

5 years ago[PowerPC] Stop defining _ARCH_PWR6X on POWER7 and up
Hubert Tong [Wed, 13 Feb 2019 20:17:13 +0000 (20:17 +0000)]
[PowerPC] Stop defining _ARCH_PWR6X on POWER7 and up

Summary:
The predefined macro `_ARCH_PWR6X` is associated with GCC's
`-mcpu=power6x` option, which enables generation of P6 "raw mode"
instructions such as `mftgpr`.

Later POWER processors build upon the "architected mode", not the raw
one. `_ARCH_PWR6X` should not be defined for these later processors.

Fixes PR#40236.

Reviewers: echristo, hfinkel, kbarton, nemanjai, wschmidt

Reviewed By: hfinkel

Subscribers: jsji, cfe-commits

Tags: #clang

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

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

5 years ago[clang] Make sure C99/C11 features in <float.h> are provided in C++11
Louis Dionne [Wed, 13 Feb 2019 19:08:01 +0000 (19:08 +0000)]
[clang] Make sure C99/C11 features in <float.h> are provided in C++11

Summary:
Previously, those #defines were only provided in C or when GNU extensions were
enabled. We need those #defines in C++11 and above, too.

Reviewers: jfb, eli.friedman

Subscribers: jkorous, dexonsmith, cfe-commits

Tags: #clang

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

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

5 years agoRe-enable the test disabled in r353836 and hopefully make it pass in gcc builds
Nico Weber [Wed, 13 Feb 2019 19:04:26 +0000 (19:04 +0000)]
Re-enable the test disabled in r353836 and hopefully make it pass in gcc builds

Argument evaluation order is different between gcc and clang, so pull out
the Builder calls to make the generated IR independent of the host compiler's
argument evaluation order.  Thanks to rnk for reminding me of this clang/gcc
difference.

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

5 years ago[Headers][mips] Add `__attribute__((__mode__(__unwind_word__)))` to the _Unwind_Word...
Simon Atanasyan [Wed, 13 Feb 2019 18:27:09 +0000 (18:27 +0000)]
[Headers][mips] Add `__attribute__((__mode__(__unwind_word__)))` to the _Unwind_Word / _Unwind_SWord definitions

The rationale of this change is to fix _Unwind_Word / _Unwind_SWord
definitions for MIPS N32 ABI. This ABI uses 32-bit pointers,
but _Unwind_Word and _Unwind_SWord types are eight bytes long.

 # The __attribute__((__mode__(__unwind_word__))) is added to the type
   definitions. It makes them equal to the corresponding definitions used
   by GCC and allows to override types using `getUnwindWordWidth` function.
 # The `getUnwindWordWidth` virtual function override in the `MipsTargetInfo`
   class and provides correct type size values.

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

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

5 years ago[Driver] Pass +reserve-x25 to backend if -ffixed-x25 is specified
Petr Hosek [Wed, 13 Feb 2019 18:01:23 +0000 (18:01 +0000)]
[Driver] Pass +reserve-x25 to backend if -ffixed-x25 is specified

This was accidentally omitted in r353957 breaking the Clang test.

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

5 years ago[AArch64] Support reserving arbitrary general purpose registers
Petr Hosek [Wed, 13 Feb 2019 17:28:47 +0000 (17:28 +0000)]
[AArch64] Support reserving arbitrary general purpose registers

This is a follow up to D48580 and D48581 which allows reserving
arbitrary general purpose registers with the exception of registers
with special purpose (X8, X16-X18, X29, X30) and registers used by LLVM
(X0, X19). This change also generalizes some of the existing logic to
rely entirely on values generated from tablegen.

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

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

5 years ago[HIP] Handle compile -m options and propagate into LLC
Aaron Enye Shi [Wed, 13 Feb 2019 16:12:16 +0000 (16:12 +0000)]
[HIP] Handle compile -m options and propagate into LLC

Allow the compile options for -m such as -mxnack/-mno-xnack, -msram-ecc/-mno-sram-ecc, -mcode-object-v3/-mno-code-object-v3 to propagate into LLC args. Fix an issue where -mattr was pushed even when it was empty.

Also add lit tests to verify features are properly passed.

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

Reviewers: yaxunl, kzhuravl

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

5 years ago[test] Tweak driver test from r353917 and r353922 to pass with a nondefault CLANG_DEF...
Martin Storsjo [Wed, 13 Feb 2019 13:13:45 +0000 (13:13 +0000)]
[test] Tweak driver test from r353917 and r353922 to pass with a nondefault CLANG_DEFAULT_LINKER

Force -fuse-ld=ld, as some other tests in the same file do.

Loosen the regex matching the linker tool name as well, as this
can end up being <triple>-ld in case such a named tool exists.

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

5 years ago[Analyzer] Crash fix for FindLastStoreBRVisitor
Adam Balogh [Wed, 13 Feb 2019 12:25:47 +0000 (12:25 +0000)]
[Analyzer] Crash fix for FindLastStoreBRVisitor

FindLastStoreBRVisitor tries to find the first node in the exploded graph where
the current value was assigned to a region. This node is called the "store
site". It is identified by a pair of Pred and Succ nodes where Succ already has
the binding for the value while Pred does not have it. However the visitor
mistakenly identifies a node pair as the store site where the value is a
`LazyCompoundVal` and `Pred` does not have a store yet but `Succ` has it. In
this case the `LazyCompoundVal` is different in the `Pred` node because it also
contains the store which is different in the two nodes. This error may lead to
crashes (a declaration is cast to a parameter declaration without check) or
misleading bug path notes.

In this patch we fix this problem by checking for unequal `LazyCompoundVals`: if
their region is equal, and their store is the same as the store of their nodes
we consider them as equal when looking for the "store site". This is an
approximation because we do not check for differences of the subvalues
(structure members or array elements) in the stores.

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

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

5 years agoLook through typedefs in getFunctionTypeWithExceptionSpec
Stephan Bergmann [Wed, 13 Feb 2019 09:39:17 +0000 (09:39 +0000)]
Look through typedefs in getFunctionTypeWithExceptionSpec

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

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

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

5 years ago[test] Fix the test from SVN r353917 when running without lld available
Martin Storsjo [Wed, 13 Feb 2019 07:50:21 +0000 (07:50 +0000)]
[test] Fix the test from SVN r353917 when running without lld available

These tests still relies on the default linker not to be overridden
via e.g. CLANG_DEFAULT_LINKER in cmake.

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

5 years ago[MinGW] Add the profiling library when necessary
Martin Storsjo [Wed, 13 Feb 2019 07:26:54 +0000 (07:26 +0000)]
[MinGW] Add the profiling library when necessary

Profiling still doesn't seem to work properly, but this at least
hooks up the library and eases completing whatever is missing.

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

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

5 years agoRevert r353880 "[HIP] Handle compile -m options and propagate into LLC"
Reid Kleckner [Tue, 12 Feb 2019 22:51:54 +0000 (22:51 +0000)]
Revert r353880 "[HIP] Handle compile -m options and propagate into LLC"

This was still causing test failures in the clang test suite.

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

5 years agodocs: Update the ShadowCallStack documentation.
Peter Collingbourne [Tue, 12 Feb 2019 22:45:23 +0000 (22:45 +0000)]
docs: Update the ShadowCallStack documentation.

- Remove most of the discussion of the x86_64 implementation;
  link to an older version of the documentation for details of
  that implementation.
- Add description of the compatibility and security issues discovered
  during the development of the aarch64 implementation for Android.

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

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

5 years ago[X86] Follow up to r353878, add MSVC compatibility command lines to other intrinsic...
Craig Topper [Tue, 12 Feb 2019 22:12:19 +0000 (22:12 +0000)]
[X86] Follow up to r353878, add MSVC compatibility command lines to other intrinsic tests that uses packed structs to control alignment.

r353878 fixed a bug in _mm_loadu_ps and added a command line to catch it. Adding additional command lines to prevent breaking other intrinsics in the future.

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

5 years ago[HIP] Fix hip-toolchain-rdc tests
Aaron Enye Shi [Tue, 12 Feb 2019 22:01:19 +0000 (22:01 +0000)]
[HIP] Fix hip-toolchain-rdc tests

Since we removed changed the way HIP Toolchain will propagate -m options into LLC, we need to remove from these older tests.

This is related to rC353880.

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

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

5 years agoMake ModuleDependencyCollector's method virtual (NFC)
Jonas Devlieghere [Tue, 12 Feb 2019 21:45:14 +0000 (21:45 +0000)]
Make ModuleDependencyCollector's method virtual (NFC)

For reproducers in LLDB we want to hook up into the existing clang
infrastructure. To make that happen we need to be able to override the
ModuleDependencyCollector's methods.

The alternative was to inherit from the DependencyCollector directly,
but that would mean re-implementing the ModuleDependencyListener and the
ModuleDependencyPPCallbacks and ModuleDependencyMMCallbacks.

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

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

5 years ago[HIP] Handle compile -m options and propagate into LLC
Aaron Enye Shi [Tue, 12 Feb 2019 21:21:06 +0000 (21:21 +0000)]
[HIP] Handle compile -m options and propagate into LLC

Allow the compile options for -m such as -mxnack/-mno-xnack, -msram-ecc/-mno-sram-ecc, -mcode-object-v3/-mno-code-object-v3 to propagate into LLC args.

Also add lit tests to verify features are properly passed.

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

Reviewers: yaxunl, kzhuravl

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

5 years ago[X86] Use __m128_u for _mm_loadu_ps after r353555
Reid Kleckner [Tue, 12 Feb 2019 21:04:21 +0000 (21:04 +0000)]
[X86] Use __m128_u for _mm_loadu_ps after r353555

Add secondary triple to existing SSE test for it.  I audited other uses
of __attribute__((__packed__)) in the intrinsic headers, and this seemed
to be the only missing one.

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

5 years agoDisable PIC/PIE for MSP430 target
Anton Korobeynikov [Tue, 12 Feb 2019 20:46:00 +0000 (20:46 +0000)]
Disable PIC/PIE for MSP430 target

Relocatable code generation is meaningless on MSP430, as the platform is too small to use shared libraries.

Patch by Dmitry Mikushev!

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

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

5 years ago[NFC] typo
JF Bastien [Tue, 12 Feb 2019 20:19:16 +0000 (20:19 +0000)]
[NFC] typo

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

5 years ago[AMDGPU] Require at least protected visibility for certain symbols
Scott Linder [Tue, 12 Feb 2019 18:30:38 +0000 (18:30 +0000)]
[AMDGPU] Require at least protected visibility for certain symbols

This allows the global visibility controls to be restrictive while still
populating the dynamic symbol table where required.

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

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

5 years ago[CMake][Fuchsia] Pass -ldl -lpthread LDFLAGS to second stage
Petr Hosek [Tue, 12 Feb 2019 16:24:46 +0000 (16:24 +0000)]
[CMake][Fuchsia] Pass -ldl -lpthread LDFLAGS to second stage

We're using static libc++ for the second stage which requires explicitly
linking -ldl and -lpthread.

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

5 years ago[Sema] Fix a crash in access checking for deduction guides
Ilya Biryukov [Tue, 12 Feb 2019 14:21:44 +0000 (14:21 +0000)]
[Sema] Fix a crash in access checking for deduction guides

Summary: See the added test for a repro.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoRenaming yet another diagnostic to not conflict; NFC.
Aaron Ballman [Tue, 12 Feb 2019 13:19:02 +0000 (13:19 +0000)]
Renaming yet another diagnostic to not conflict; NFC.

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

5 years agoRenaming this diagnostic to not conflict with another; NFC.
Aaron Ballman [Tue, 12 Feb 2019 13:13:35 +0000 (13:13 +0000)]
Renaming this diagnostic to not conflict with another; NFC.

Amends r353837 which renamed the diagnostics to conflict.

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

5 years agoFixing a typo; NFC.
Aaron Ballman [Tue, 12 Feb 2019 13:04:11 +0000 (13:04 +0000)]
Fixing a typo; NFC.

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

5 years agoDisable test after r353718, r353725, r353729 while I investigate
Nico Weber [Tue, 12 Feb 2019 12:40:56 +0000 (12:40 +0000)]
Disable test after r353718, r353725, r353729 while I investigate

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

5 years ago[X86] Use the new unaligned vector typedefs for the loadu/storeu intrinsics pointer...
Craig Topper [Tue, 12 Feb 2019 07:44:40 +0000 (07:44 +0000)]
[X86] Use the new unaligned vector typedefs for the loadu/storeu intrinsics pointer arguments.

This matches what gcc does and what was suggested by rnk in PR20670.

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

5 years agoFix VS2015 build problem introduced by r353370.
Douglas Yung [Tue, 12 Feb 2019 02:17:51 +0000 (02:17 +0000)]
Fix VS2015 build problem introduced by r353370.

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

5 years agoAdd a new attribute, fortify_stdlib
Erik Pilkington [Mon, 11 Feb 2019 23:21:39 +0000 (23:21 +0000)]
Add a new attribute, fortify_stdlib

This attribute applies to declarations of C stdlib functions
(sprintf, memcpy...) that have known fortified variants
(__sprintf_chk, __memcpy_chk, ...). When applied, clang will emit
calls to the fortified variant functions instead of calls to the
defaults.

In GCC, this is done by adding gnu_inline-style wrapper functions,
but that doesn't work for us for variadic functions because we don't
support __builtin_va_arg_pack (and have no intention to).

This attribute takes two arguments, the first is 'type' argument
passed through to __builtin_object_size, and the second is a flag
argument that gets passed through to the variadic checking variants.

rdar://47905754

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

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

5 years ago[Sema] Mark GNU compound literal array init as an rvalue.
Eli Friedman [Mon, 11 Feb 2019 22:54:27 +0000 (22:54 +0000)]
[Sema] Mark GNU compound literal array init as an rvalue.

Basically the same issue as string init, except it didn't really have
any visible consequences before I removed the implicit lvalue-to-rvalue
conversion from CodeGen.

While I'm here, a couple minor drive-by cleanups: IgnoreParens never
returns a ConstantExpr, and there was a potential crash with string init
involving a ChooseExpr.

The analyzer test change maybe indicates we could simplify the analyzer
code a little with this fix?  Apparently a hack was added to support
lvalues in initializers in r315750, but I'm not really familiar with the
relevant code.

Fixes regression reported in the kernel build at
https://bugs.llvm.org/show_bug.cgi?id=40430#c6 .

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

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

5 years ago[WebAssembly] Make thread-related options consistent
Heejin Ahn [Mon, 11 Feb 2019 22:47:50 +0000 (22:47 +0000)]
[WebAssembly] Make thread-related options consistent

Summary:
There have been three options related to threads and users had to set
all three of them separately to get the correct compilation results.
This makes sure the relationship between the options makes sense and
sets necessary options for users if only part of the necessary options
are specified. This does:

- Remove `-matomics`; this option alone does not enable anything, so
  removed it to not confuse users.
- `-mthread-model posix` sets `-target-feature +atomics`
- `-pthread` sets both `-target-feature +atomics` and
  `-mthread-model posix`
Also errors out when explicitly given options don't match, such as
`-pthread` is given with `-mthread-model single`.

Reviewers: dschuff, sbc100, tlively, sunfish

Subscribers: jgravelle-google, jfb, cfe-commits

Tags: #clang

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

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

5 years agoFix a few tests that were missing ':' on CHECK lines and weren't testing anything.
Nico Weber [Mon, 11 Feb 2019 20:33:22 +0000 (20:33 +0000)]
Fix a few tests that were missing ':' on CHECK lines and weren't testing anything.

Found by `git grep '\/\/ CHECK-[^: ]* ' clang/test/ | grep -v RUN:`.

Also tweak CodeGenCXX/arm-swiftcall.cpp to still pass now that it checks more.

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

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

5 years ago[CodeGen] Set construction vtable visibility after creating initializer
Petr Hosek [Mon, 11 Feb 2019 20:13:42 +0000 (20:13 +0000)]
[CodeGen] Set construction vtable visibility after creating initializer

We must only set the construction vtable visibility after we create the
vtable initializer, otherwise the global value will be treated as
declaration rather than definition and the visibility won't be set.

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

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

5 years ago[COFF, ARM64] Remove definitions for _byteswap library functions
Tom Tan [Mon, 11 Feb 2019 20:04:02 +0000 (20:04 +0000)]
[COFF, ARM64] Remove definitions for _byteswap library functions

_byteswap_* functions are are implemented in below file as normal function
from libucrt.lib and declared in stdlib.h. Define them in intrin.h triggers
lld error "conflicting comdat type" and "duplicate symbols" which was just
added to LLD (https://reviews.llvm.org/D57324).

C:\Program Files (x86)\Windows Kits\10\Source\10.0.17763.0\ucrt\stdlib\byteswap.cpp

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

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