]> granicus.if.org Git - clang/log
clang
6 years agoRemove debugging code I accidentally committed in r326530.
Akira Hatanaka [Fri, 2 Mar 2018 02:03:21 +0000 (02:03 +0000)]
Remove debugging code I accidentally committed in r326530.

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

6 years agoAdd an option to disable tail-call optimization for escaping blocks.
Akira Hatanaka [Fri, 2 Mar 2018 01:53:15 +0000 (01:53 +0000)]
Add an option to disable tail-call optimization for escaping blocks.

This makes it easier to debug crashes and hangs in block functions since
users can easily find out where the block is called from. The option
doesn't disable tail-calls from non-escaping blocks since non-escaping
blocks are not as hard to debug as escaping blocks.

rdar://problem/35758207

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

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

6 years ago[analyzer] [tests] Again, make tests more resilient to changes in exploration strategy
George Karpenkov [Fri, 2 Mar 2018 01:41:19 +0000 (01:41 +0000)]
[analyzer] [tests] Again, make tests more resilient to changes in exploration strategy

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

6 years agoAlways set dso_local in CodeGenModule::setDSOLocal.
Rafael Espindola [Fri, 2 Mar 2018 01:29:51 +0000 (01:29 +0000)]
Always set dso_local in CodeGenModule::setDSOLocal.

This shouldn't change any results for now, but is more consistent with
how we set dllimport/dllexport and will make future changes easier.

Since clang produces IR as it parses, it can find out mid file that
something is dllimport. When that happens we have to drop
dso_local. This is not a problem right now because
CodeGenModule::setDSOLocal is called from relatively few places at
the moment.

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

6 years ago[analyzer] Prevent crashing in NonNullParamChecker
George Karpenkov [Fri, 2 Mar 2018 00:55:59 +0000 (00:55 +0000)]
[analyzer] Prevent crashing in NonNullParamChecker

https://bugs.llvm.org/show_bug.cgi?id=36381
rdar://37543426

Turns out, the type passed for the lambda capture was incorrect.
One more argument to abandon the getSVal overload which does not require the
type information.

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

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

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Fri, 2 Mar 2018 00:54:51 +0000 (00:54 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[analyzer] [NFC] [tests] Make test more resilient to changes in exploration strategy
George Karpenkov [Fri, 2 Mar 2018 00:54:05 +0000 (00:54 +0000)]
[analyzer] [NFC] [tests] Make test more resilient to changes in exploration strategy

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

6 years ago[WebAssembly] Add exception handling option
Heejin Ahn [Fri, 2 Mar 2018 00:39:16 +0000 (00:39 +0000)]
[WebAssembly] Add exception handling option

Summary: Add exception handling option to clang.

Reviewers: dschuff

Subscribers: jfb, sbc100, jgravelle-google, sunfish, cfe-commits

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

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

6 years ago[NFC] Move CommentOpts checks to the call sites that depend on it. (Re-applying r326501.)
David L. Jones [Fri, 2 Mar 2018 00:07:45 +0000 (00:07 +0000)]
[NFC] Move CommentOpts checks to the call sites that depend on it. (Re-applying r326501.)

When parsing comments, for example, for -Wdocumentation, slightly different
behaviour occurs when -fparse-all-comments is specified. However, these
differences are subtle:

1. All comments are saved during parsing, regardless of whether they are doc
   comments or not.
2. "Maybe-doc" comments, like <, !, etc, are saved as such, instead of marking
   them as ordinary comments. The maybe-doc type of comment is never saved
   otherwise. (Warning on these is the impetus of -Wdocumentation.)
3. All comments are treated as doc comments in ASTContext, even if they are ordinary.

This change moves the logic for checking CommentOptions.ParseAllComments closer
to where it has an effect. The overall logic is unchanged, but checks of the
ParseAllComments flag are now done where the effect will be clearer.

Subscribers: cfe-commits

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

6 years agoRevert r326501 due to buildbot breakage.
David L. Jones [Thu, 1 Mar 2018 23:14:00 +0000 (23:14 +0000)]
Revert r326501 due to buildbot breakage.

Original change:

[NFC] Move CommentOpts checks to the call sites that depend on it.

When parsing comments, for example, for -Wdocumentation, slightly different
behaviour occurs when -fparse-all-comments is specified. However, these
differences are subtle:

1. All comments are saved during parsing, regardless of whether they are doc comments or not.
2. "Maybe-doc" comments, like //<, //!, etc, are saved as such, instead of marking them as ordinary comments. The maybe-doc type of comment is never saved otherwise. (Warning on these is the impetus of -Wdocumentation.)
3. All comments are treated as doc comments in ASTContext, even if they are ordinary.

This change moves the logic for checking CommentOptions.ParseAllComments closer
to where it has an effect. The overall logic is unchanged, but checks of the
ParseAllComments flag are now done where the effect will be clearer.

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

6 years ago[NFC] Move CommentOpts checks to the call sites that depend on it.
David L. Jones [Thu, 1 Mar 2018 22:41:53 +0000 (22:41 +0000)]
[NFC] Move CommentOpts checks to the call sites that depend on it.

When parsing comments, for example, for -Wdocumentation, slightly different
behaviour occurs when -fparse-all-comments is specified. However, these
differences are subtle:

 1. All comments are saved during parsing, regardless of whether they are doc
    comments or not.
 2. "Maybe-doc" comments, like //<, //!, etc, are saved as such, instead of
    marking them as ordinary comments. The maybe-doc type of comment is never
    saved otherwise. (Warning on these is the impetus of -Wdocumentation.)
 3. All comments are treated as doc comments in ASTContext, even if they are
    ordinary.

This change moves the logic for checking CommentOptions.ParseAllComments closer
to where it has an effect. The overall logic is unchanged, but checks of the
ParseAllComments flag are now done where the effect will be clearer.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

6 years ago[Driver] Pass -f[no-]emulated-tls and set up ExplicitEmulatedTLS
Chih-Hung Hsieh [Thu, 1 Mar 2018 22:26:19 +0000 (22:26 +0000)]
[Driver] Pass -f[no-]emulated-tls and set up ExplicitEmulatedTLS

Since LLVM r326341, default EmulatedTLS mode is decided in backend
according to target triple. Any front-end should pass -f[no]-emulated-tls
to backend and set up ExplicitEmulatedTLS only when the flags are used.

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

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

6 years ago[modules] Don't diagnose "redefinition" of a friend with a pending definition
Richard Smith [Thu, 1 Mar 2018 22:20:13 +0000 (22:20 +0000)]
[modules] Don't diagnose "redefinition" of a friend with a pending definition
if the other definition is a merged copy of the same function.

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

6 years ago[www] Capitalize "Clang" when referring to the project, and generalize the
Richard Smith [Thu, 1 Mar 2018 22:01:06 +0000 (22:01 +0000)]
[www] Capitalize "Clang" when referring to the project, and generalize the
introduction on the front page page.

We still use the lowercase "clang" spelling when referring to the driver binary.

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

6 years ago[RecordLayout] Only assert that fundamental type sizes are power of two on MSVC
Martin Storsjo [Thu, 1 Mar 2018 20:22:57 +0000 (20:22 +0000)]
[RecordLayout] Only assert that fundamental type sizes are power of two on MSVC

Make types with sizes that aren't a power of two an error (that can
be disabled) in structs with ms_struct layout, except on mingw where
the situation is quite likely to occur and GCC handles it silently.

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

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

6 years agoDriver: hoist `-fno-rtti-data` to a driver flag
Saleem Abdulrasool [Thu, 1 Mar 2018 19:13:43 +0000 (19:13 +0000)]
Driver: hoist `-fno-rtti-data` to a driver flag

This is needed for building with the GNU driver (`clang++`) when
targeting Windows and using msvcprt.  This flag is the equivalent of
`/GR-`.

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

6 years ago[analyzer] Enable cfg-temporary-dtors by default.
Artem Dergachev [Thu, 1 Mar 2018 18:53:13 +0000 (18:53 +0000)]
[analyzer] Enable cfg-temporary-dtors by default.

Don't enable c++-temp-dtor-inlining by default yet, due to this reference
counting pointe problem.

Otherwise the new mode seems stable and allows us to incrementally fix C++
problems in much less hacky ways.

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

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

6 years agoResubmit [analyzer] Support for naive cross translation unit analysis
Ilya Biryukov [Thu, 1 Mar 2018 14:54:16 +0000 (14:54 +0000)]
Resubmit [analyzer] Support for naive cross translation unit analysis

Originally submitted as r326323 and r326324.
Reverted in r326432.

Reverting the commit was a mistake.
The breakage was due to invalid build files in our internal buildsystem,
CMakeLists did not have any cyclic dependencies.

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

6 years agoUsersManual: improve the clang-cl text some more
Hans Wennborg [Thu, 1 Mar 2018 14:48:19 +0000 (14:48 +0000)]
UsersManual: improve the clang-cl text some more

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

6 years agoUsersManual: beef up the clang-cl text a little
Hans Wennborg [Thu, 1 Mar 2018 14:00:19 +0000 (14:00 +0000)]
UsersManual: beef up the clang-cl text a little

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

6 years agoRevert "[analyzer] Support for naive cross translation unit analysis"
Ilya Biryukov [Thu, 1 Mar 2018 12:43:39 +0000 (12:43 +0000)]
Revert "[analyzer] Support for naive cross translation unit analysis"

Also revert "[analyzer] Fix a compiler warning"
This reverts commits r326323 and r326324.

Reason: the commits introduced a cyclic dependency in the build graph.
This happens to work with cmake, but breaks out internal integrate.

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

6 years ago[clang-format] Add SpaceBeforeColon option
Francois Ferrand [Thu, 1 Mar 2018 10:09:13 +0000 (10:09 +0000)]
[clang-format] Add SpaceBeforeColon option

Summary:
When disabled, this option allows removing the space before colon,
making it act more like the semi-colon. When enabled (default), the
current behavior is not affected.

This mostly affects C++11 loop, initializer list, inheritance list and
container literals:

  class Foo: Bar {}
  Foo::Foo(): a(a) {}
  for (auto i: myList) {}
  f({a: 1, b: 2, c: 3});

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: xvallspl, teemperor, karies, cfe-commits, klimek

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

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

6 years agoFunction definition may have uninstantiated body
Serge Pavlov [Thu, 1 Mar 2018 07:04:11 +0000 (07:04 +0000)]
Function definition may have uninstantiated body

Current implementation of `FunctionDecl::isDefined` does not take into
account redeclarations that do not have bodies, but the bodies can be
instantiated from corresponding templated definition. This behavior does
not allow to detect function redefinition in the cases where friend
functions is defined in class templates. For instance, the code:
```
    template<typename T> struct X { friend void f() {} };
    X<int> xi;
    void f() {}
```
compiles successfully but must fail due to redefinition of `f`. The
declaration of the friend `f` is created when the containing template
`X` is instantiated, but it does not have a body as per 14.5.4p4
because `f` is not odr-used.

With this change the function `Sema::CheckForFunctionRedefinition`
considers functions with uninstantiated bodies as definitions.

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

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

6 years agoRemove redundant casts. NFC
George Burgess IV [Thu, 1 Mar 2018 05:43:23 +0000 (05:43 +0000)]
Remove redundant casts. NFC

So I wrote a clang-tidy check to lint out redundant `isa`, `cast`, and
`dyn_cast`s for fun. This is a portion of what it found for clang; I
plan to do similar cleanups in LLVM and other subprojects when I find
time.

Because of the volume of changes, I explicitly avoided making any change
that wasn't highly local and obviously correct to me (e.g. we still have
a number of foo(cast<Bar>(baz)) that I didn't touch, since overloading
is a thing and the cast<Bar> did actually change the type -- just up the
class hierarchy).

I also tried to leave the types we were cast<>ing to somewhere nearby,
in cases where it wasn't locally obvious what we were dealing with
before.

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

6 years ago[analyzer] [tests] Create a directory for the log file
George Karpenkov [Thu, 1 Mar 2018 02:18:54 +0000 (02:18 +0000)]
[analyzer] [tests] Create a directory for the log file

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

6 years ago[analyzer] Add a checker for mmap()s which are both writable and executable.
Artem Dergachev [Thu, 1 Mar 2018 01:27:46 +0000 (01:27 +0000)]
[analyzer] Add a checker for mmap()s which are both writable and executable.

This is a security check that warns when both PROT_WRITE and PROT_EXEC are
set during mmap(). If mmap()ed memory is both writable and executable, it makes
it easier for the attacker to execute arbitrary code when contents of this
memory are compromised. Some applications require such mmap()s though, such as
different sorts of JIT.

Re-applied after a revert in r324167.

Temporarily stays in the alpha package because it needs a better way of
determining macro values that are not immediately available in the AST.

Patch by David Carlier!

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

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

6 years ago[CFG] [analyzer] Recall that we only skip NoOp casts in construction contexts.
Artem Dergachev [Thu, 1 Mar 2018 01:09:24 +0000 (01:09 +0000)]
[CFG] [analyzer] Recall that we only skip NoOp casts in construction contexts.

For now. We should also add support for ConstructorConversion casts as presented
in the attached test case, but this requires more changes because AST around
them seems different.

The check was originally present but was accidentally lost during r326021.

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

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

6 years agoStart setting dllimport/dllexport in setGVProperties.
Rafael Espindola [Thu, 1 Mar 2018 00:35:47 +0000 (00:35 +0000)]
Start setting dllimport/dllexport in setGVProperties.

This is the next step in setting dso_local for COFF.

The patches changes setGVProperties to first set dllimport/dllexport
and changes a few cases that were setting dllimport/dllexport
manually. With this a few more GVs are marked dso_local.

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

6 years agoPass a GlobalDecl to SetCommonAttributes. NFC.
Rafael Espindola [Thu, 1 Mar 2018 00:06:55 +0000 (00:06 +0000)]
Pass a GlobalDecl to SetCommonAttributes. NFC.

Part of D43900.

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

6 years agoInline a trivial function. NFC.
Rafael Espindola [Thu, 1 Mar 2018 00:00:02 +0000 (00:00 +0000)]
Inline a trivial function. NFC.

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

6 years agoPass a GlobalDecl to setNonAliasAttributes. NFC.
Rafael Espindola [Wed, 28 Feb 2018 23:54:23 +0000 (23:54 +0000)]
Pass a GlobalDecl to setNonAliasAttributes. NFC.

Also part of D43900.

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

6 years agoPass a GlobalDecl to SetInternalFunctionAttributes. NFC.
Rafael Espindola [Wed, 28 Feb 2018 23:46:35 +0000 (23:46 +0000)]
Pass a GlobalDecl to SetInternalFunctionAttributes. NFC.

This just reduces the noise in a followup patch.

Part of D43900.

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

6 years ago[hwasan] update the asm snippet in the docs to match the current default behaviour
Kostya Serebryany [Wed, 28 Feb 2018 21:58:19 +0000 (21:58 +0000)]
[hwasan] update the asm snippet in the docs to match the current default behaviour

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

6 years agoAttempt to fix cl-include.c on Windows.
Nico Weber [Wed, 28 Feb 2018 20:58:06 +0000 (20:58 +0000)]
Attempt to fix cl-include.c on Windows.

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

6 years ago[OpenMP] Extend NVPTX SPMD implementation of combined constructs
Carlo Bertolli [Wed, 28 Feb 2018 20:48:35 +0000 (20:48 +0000)]
[OpenMP] Extend NVPTX SPMD implementation of combined constructs

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

This patch extends the SPMD implementation to all target constructs and guards this implementation under a new flag.

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

6 years ago[Hexagon] Add -ffixed-r19 driver option and translate it to +reserved-r19
Krzysztof Parzyszek [Wed, 28 Feb 2018 20:31:55 +0000 (20:31 +0000)]
[Hexagon] Add -ffixed-r19 driver option and translate it to +reserved-r19

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

6 years agoCodeGenObjCXX: handle inalloca appropriately for msgSend variant
Saleem Abdulrasool [Wed, 28 Feb 2018 20:16:12 +0000 (20:16 +0000)]
CodeGenObjCXX: handle inalloca appropriately for msgSend variant

objc_msgSend_stret takes a hidden parameter for the returned structure's
address for the construction.  When the function signature is rewritten
for the inalloca passing, the return type is no longer marked as
indirect but rather inalloca stret.  This enhances the test for the
indirect return to check for that case as well.  This fixes the
incorrect return classification for Windows x86.

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

6 years ago[clang-cl] Implement /X
Nico Weber [Wed, 28 Feb 2018 19:49:07 +0000 (19:49 +0000)]
[clang-cl] Implement /X

/X makes cl stop looking in %INCLUDE%. Implement this for clang-cl.

As it turns out, the return in ToolChains/MSVC.cpp, AddClangSystemIncludeArgs()
for -nostdlibinc is already in the right place (but -nostdlibinc isn't exposed
by clang-cl), so just alias /X to that.

https://reviews.llvm.org/D43888

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

6 years agoFix gcc -Wreturn-type warnings after r326307.
Nico Weber [Wed, 28 Feb 2018 19:28:47 +0000 (19:28 +0000)]
Fix gcc -Wreturn-type warnings after r326307.

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

6 years ago[CUDA] Include single GPU binary, NFCI.
Jonas Hahnfeld [Wed, 28 Feb 2018 17:53:46 +0000 (17:53 +0000)]
[CUDA] Include single GPU binary, NFCI.

Binaries for multiple architectures are combined by fatbinary,
so the current code was effectively not needed.

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

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

6 years agoTest commit access: apply clang-format suggestion
Joel E. Denny [Wed, 28 Feb 2018 16:57:33 +0000 (16:57 +0000)]
Test commit access: apply clang-format suggestion

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

6 years ago[analyzer] Fix a compiler warning
Gabor Horvath [Wed, 28 Feb 2018 14:01:48 +0000 (14:01 +0000)]
[analyzer] Fix a compiler warning

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

6 years ago[analyzer] Support for naive cross translation unit analysis
Gabor Horvath [Wed, 28 Feb 2018 13:23:10 +0000 (13:23 +0000)]
[analyzer] Support for naive cross translation unit analysis

The aim of this patch is to be minimal to enable incremental development of
the feature on the top of the tree. This patch should be an NFC when the
feature is turned off. It is turned off by default and still considered as
experimental.

Technical details are available in the EuroLLVM Talk:
http://llvm.org/devmtg/2017-03//2017/02/20/accepted-sessions.html#7

Note that the initial prototype was done by A. Sidorin et al.: http://lists.llvm.org/pipermail/cfe-dev/2015-October/045730.html

Contributions to the measurements and the new version of the code: Peter Szecsi, Zoltan Gera, Daniel Krupp, Kareem Khazem.

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

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

6 years ago[ObjC] Allow declaring __strong pointer fields in structs in Objective-C
Akira Hatanaka [Wed, 28 Feb 2018 07:15:55 +0000 (07:15 +0000)]
[ObjC] Allow declaring __strong pointer fields in structs in Objective-C
ARC mode.

Declaring __strong pointer fields in structs was not allowed in
Objective-C ARC until now because that would make the struct non-trivial
to default-initialize, copy/move, and destroy, which is not something C
was designed to do. This patch lifts that restriction.

Special functions for non-trivial C structs are synthesized that are
needed to default-initialize, copy/move, and destroy the structs and
manage the ownership of the objects the __strong pointer fields point
to. Non-trivial structs passed to functions are destructed in the callee
function.

rdar://problem/33599681

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

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

6 years agoFix a couple of cases where we would fail to correctly parse deduced class template...
Richard Smith [Wed, 28 Feb 2018 03:02:23 +0000 (03:02 +0000)]
Fix a couple of cases where we would fail to correctly parse deduced class template specialization types.

Specifically, we would not properly parse these types within template arguments
(for non-type template parameters), and in tentative parses. Fixing both of
these essentially requires that we parse deduced template specialization types
as types in all contexts, even in template argument lists -- in particular,
tentative parsing may look ahead and annotate a deduced template specialization
type before we figure out that we're actually supposed to treat the tokens as a
template-name. We deal with this by simply permitting deduced template
specialization types when parsing template arguments, and converting them to
template template arguments.

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

6 years agoUpdate cxx_status to mark "SVN" items as "Clang 6" instead.
Richard Smith [Wed, 28 Feb 2018 03:02:07 +0000 (03:02 +0000)]
Update cxx_status to mark "SVN" items as "Clang 6" instead.

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

6 years ago[analyzer] [tests] Write to logfile instead of stdout while updating
George Karpenkov [Wed, 28 Feb 2018 01:55:23 +0000 (01:55 +0000)]
[analyzer] [tests] Write to logfile instead of stdout while updating

reference results

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

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Wed, 28 Feb 2018 01:10:04 +0000 (01:10 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoAMDGPU: Move run and check lines around to match processor order in AMDGPU.h
Konstantin Zhuravlyov [Wed, 28 Feb 2018 00:27:00 +0000 (00:27 +0000)]
AMDGPU: Move run and check lines around to match processor order in AMDGPU.h

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

6 years agoInline trivial function. NFC.
Rafael Espindola [Wed, 28 Feb 2018 00:14:18 +0000 (00:14 +0000)]
Inline trivial function. NFC.

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

6 years agoPass a GlobalDecl to setAliasAttributes. NFC.
Rafael Espindola [Wed, 28 Feb 2018 00:06:01 +0000 (00:06 +0000)]
Pass a GlobalDecl to setAliasAttributes. NFC.

This just makes a followup change easier to read.

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

6 years agoImprove the way attribute argument printing happens for omitted optional arguments...
Aaron Ballman [Tue, 27 Feb 2018 23:49:28 +0000 (23:49 +0000)]
Improve the way attribute argument printing happens for omitted optional arguments when pretty printing.

Patch by Joel Denny.

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

6 years agoPass a GlobalDecl to setFunctionDefinitionAttributes. NFC.
Rafael Espindola [Tue, 27 Feb 2018 23:44:36 +0000 (23:44 +0000)]
Pass a GlobalDecl to setFunctionDefinitionAttributes. NFC.

This just makes a followup patch easier to read.

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

6 years ago[analyzer] UndefinedAssignmentChecker: Better warning message in implicit ctors.
Artem Dergachev [Tue, 27 Feb 2018 22:05:55 +0000 (22:05 +0000)]
[analyzer] UndefinedAssignmentChecker: Better warning message in implicit ctors.

When a class forgets to initialize a field in the constructor, and then gets
copied around, a warning is emitted that the value assigned to a specific field
is undefined.

When the copy/move constructor is implicit (not written out in the code) but not
trivial (is not a trivial memory copy, eg. because members have an explicit copy
constructor), the body of such constructor is auto-generated in the AST.
In this case the checker's warning message is squeezed at the top of
the class declaration, and it gets hard to guess which field is at fault.

Fix the warning message to include the name of the field.

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

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

6 years agoAMDGPU: Define FP_FAST_FMA{F} macros for amdgcn
Konstantin Zhuravlyov [Tue, 27 Feb 2018 21:48:05 +0000 (21:48 +0000)]
AMDGPU: Define FP_FAST_FMA{F} macros for amdgcn

- Expand GK_*s (i.e. GFX6 -> GFX600, GFX601, etc.)
  - This allows us to choose features correctly in some cases (for example, fast fmaf is available on gfx600, but not gfx601)
- Move HasFMAF, HasFP64, HasLDEXPF to GPUInfo tables
- Add HasFastFMA, HasFastFMAF to GPUInfo tables
- Add missing tests

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

6 years ago[OPENMP] Emit warning for non-trivial types in map clauses.
Alexey Bataev [Tue, 27 Feb 2018 21:31:11 +0000 (21:31 +0000)]
[OPENMP] Emit warning for non-trivial types in map clauses.

If the mapped type is non-trivial, the warning message is emitted for
better user experience.

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

6 years ago[analyzer] MallocChecker: Suppress false positives in shared pointers.
Artem Dergachev [Tue, 27 Feb 2018 21:19:33 +0000 (21:19 +0000)]
[analyzer] MallocChecker: Suppress false positives in shared pointers.

Throw away MallocChecker warnings that occur after releasing a pointer within a
destructor (or its callees) after performing C11 atomic fetch_add or fetch_sub
within that destructor (or its callees).

This is an indication that the destructor's class is likely a
reference-counting pointer. The analyzer is not able to understand that the
original reference count is usually large enough to avoid most use-after-frees.

Even when the smart pointer is a local variable, we still have these false
positives that this patch suppresses, because the analyzer doesn't currently
support atomics well enough.

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

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

6 years ago[analyzer] Fix trivial copy for empty objects.
Artem Dergachev [Tue, 27 Feb 2018 21:10:08 +0000 (21:10 +0000)]
[analyzer] Fix trivial copy for empty objects.

The SVal for any empty C++ object is an UnknownVal. Because RegionStore does
not have binding extents, binding an empty object to an UnknownVal may
potentially overwrite existing bindings at the same offset.

Therefore, when performing a trivial copy of an empty object, don't try to
take the value of the object and bind it to the copy. Doing nothing is accurate
enough, and it doesn't screw any existing bindings.

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

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

6 years ago[analyzer] Track temporaries without construction contexts for destruction.
Artem Dergachev [Tue, 27 Feb 2018 21:02:58 +0000 (21:02 +0000)]
[analyzer] Track temporaries without construction contexts for destruction.

Sometimes it is not known at compile time which temporary objects will be
constructed, eg. 'x ? A() : B()' or 'C() || D()'. In this case we track which
temporary was constructed to know how to properly call the destructor.

Once the construction context for temporaries was introduced, we moved the
tracking code to the code that investigates the construction context.

Bring back the old mechanism because construction contexts are not always
available yet - eg. in the case where a temporary is constructed without a
constructor expression, eg. returned from a function by value. The mechanism
should still go away eventually.

Additionally, fix a bug in the temporary cleanup code for the case when
construction contexts are not available, which could lead to temporaries
staying in the program state and increasing memory consumption.

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

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

6 years ago[analyzer] Don't crash when dynamic type of a variable is set via placement new.
Artem Dergachev [Tue, 27 Feb 2018 20:54:40 +0000 (20:54 +0000)]
[analyzer] Don't crash when dynamic type of a variable is set via placement new.

If a variable or an otherwise a concrete typed-value region is being
placement-new'ed into, its dynamic type may change in arbitrary manners. And
when the region is used, there may be a third type that's different from both
the static and the dynamic type. It cannot be *completely* different from the
dynamic type, but it may be a base class of the dynamic type - and in this case
there isn't (and shouldn't be) any indication anywhere in the AST that there is
a derived-to-base cast from the dynamic type to the third type.

Perform a generic cast (evalCast()) from the third type to the dynamic type
in this case. From the point of view of the SVal hierarchy, this would have
produced non-canonical SVals if we used such generic cast in the normal case,
but in this case there doesn't seem to be a better option.

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

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

6 years ago[analyzer] Disable constructor inlining when lifetime extending through a field.
Artem Dergachev [Tue, 27 Feb 2018 20:14:06 +0000 (20:14 +0000)]
[analyzer] Disable constructor inlining when lifetime extending through a field.

Automatic destructors are missing in the CFG in situations like

  const int &x = C().x;

For now it's better to disable construction inlining, because inlining
constructors while doing nothing on destructors is very bad.

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

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

6 years ago[analyzer] Self-debug: Dump dynamic type info and taint with the program state.
Artem Dergachev [Tue, 27 Feb 2018 20:06:20 +0000 (20:06 +0000)]
[analyzer] Self-debug: Dump dynamic type info and taint with the program state.

Useful for debugging problems with dynamic type info and taint.

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

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

6 years ago[CFG] NFC: Refactor ConstructionContext into a finite set of cases.
Artem Dergachev [Tue, 27 Feb 2018 20:03:35 +0000 (20:03 +0000)]
[CFG] NFC: Refactor ConstructionContext into a finite set of cases.

ConstructionContext is moved into a separate translation unit and is separated
into multiple classes. The "old" "raw" ConstructionContext is renamed into
ConstructionContextLayer - which corresponds to the idea of building the context
gradually layer-by-layer, but it isn't easy to use in the clients. Once
CXXConstructExpr is reached, layers that we've gathered so far are transformed
into the actual, "new-style" "flat" ConstructionContext, which is put into the
CFGConstructor element and has no layers whatsoever (until it actually needs
them, eg. aggregate initialization). The new-style ConstructionContext is
instead presented as a variety of sub-classes that enumerate different ways of
constructing an object in C++. There are 5 of these supported for now,
which is around a half of what needs to be supported.

The layer-by-layer buildup process is still a little bit weird, but it hides
all the weirdness in one place, that sounds like a good thing.

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

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

6 years ago[analyzer] Introduce correct lifetime extension behavior in simple cases.
Artem Dergachev [Tue, 27 Feb 2018 19:47:49 +0000 (19:47 +0000)]
[analyzer] Introduce correct lifetime extension behavior in simple cases.

This patch uses the reference to MaterializeTemporaryExpr stored in the
construction context since r326014 in order to model that expression correctly.

When modeling MaterializeTemporaryExpr, instead of copying the raw memory
contents from the sub-expression's rvalue to a completely new temporary region,
that we conjure up for the lack of better options, we now have the better
option to recall the region into which the object was originally constructed
and declare that region to be the value of the expression, which is semantically
correct.

This only works when the construction context is available, which is worked on
independently.

The temporary region's liveness (in the sense of removeDeadBindings) is extended
until the MaterializeTemporaryExpr is resolved, in order to keep the store
bindings around, because it wouldn't be referenced from anywhere else in the
program state.

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

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

6 years ago[MinGW, CrossWindows] Allow passing -static together with -shared
Martin Storsjo [Tue, 27 Feb 2018 19:42:19 +0000 (19:42 +0000)]
[MinGW, CrossWindows] Allow passing -static together with -shared

In these combinations, link a DLL as usual, but pass -Bstatic instead
of -Bdynamic to indicate prefering static libraries.

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

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

6 years ago[analyzer] Remove redundant check
George Karpenkov [Tue, 27 Feb 2018 19:28:52 +0000 (19:28 +0000)]
[analyzer] Remove redundant check

There is no point in assigning void just to crash on it in the next line

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

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

6 years ago[analyzer] Only attempt to get the value of locations of known type
George Karpenkov [Tue, 27 Feb 2018 19:28:52 +0000 (19:28 +0000)]
[analyzer] Only attempt to get the value of locations of known type

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

In general, getSVal API should be changed so that it does not crash on
some non-obvious conditions.
It should either be updated to require a type, or to return Optional<SVal>.

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

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

6 years ago[analyzer] Quickfix: don't crash when runtime definition is not available.
George Karpenkov [Tue, 27 Feb 2018 19:19:49 +0000 (19:19 +0000)]
[analyzer] Quickfix: don't crash when runtime definition is not available.

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

6 years ago[analyzer] Logging test quickfix #2.
George Karpenkov [Tue, 27 Feb 2018 19:19:43 +0000 (19:19 +0000)]
[analyzer] Logging test quickfix #2.

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

6 years ago[clang-format] Format operator key in protos
Krasimir Georgiev [Tue, 27 Feb 2018 19:07:47 +0000 (19:07 +0000)]
[clang-format] Format operator key in protos

Summary: This fixes a glitch where ``operator: value`` in a text proto would mess up the underlying formatting since it gets parsed as a kw_operator instead of an identifier.

Subscribers: klimek, cfe-commits

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

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

6 years agoHandle the NetBSD case in ToolChain::getOSLibName()
Kamil Rytarowski [Tue, 27 Feb 2018 18:16:47 +0000 (18:16 +0000)]
Handle the NetBSD case in ToolChain::getOSLibName()

Return a new CompilerRT Path on NetBSD: "netbsd", instead of
getOS(), which returns a string like "netbsd8.9.12".

Sponsored by <The NetBSD Foundation>

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

6 years ago[OPENMP] Allow multiple mappings for member expressions for pointers.
Alexey Bataev [Tue, 27 Feb 2018 17:42:00 +0000 (17:42 +0000)]
[OPENMP] Allow multiple mappings for member expressions for pointers.

If several member expressions are mapped and they reference the same
address as a base, but access different members, this must be allowed.

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

6 years ago[clang-format] Tidy up new API guessLanguage()
Ben Hamilton [Tue, 27 Feb 2018 15:56:40 +0000 (15:56 +0000)]
[clang-format] Tidy up new API guessLanguage()

Summary:
This fixes a few issues djasper@ brought up in his review of D43522.

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

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years agoRevert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::uniqu...
Roman Lebedev [Tue, 27 Feb 2018 15:54:55 +0000 (15:54 +0000)]
Revert "[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>"

This reverts commit rL326201

This broke gcc4.8 builds, compiler just segfaults:¬
http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/14909¬
http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/22673¬

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

6 years ago[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>
Roman Lebedev [Tue, 27 Feb 2018 15:19:20 +0000 (15:19 +0000)]
[Tooling] [0/1] Refactor FrontendActionFactory::create() to return std::unique_ptr<>

Summary:
Noticed during review of D41102.

I'm not sure whether there are any principal reasons why it returns raw owning pointer,
or it is just a old code that was not updated post-C++11.

I'm not too sure what testing i should do, because `check-all` is not error clean here for some reason,
but it does not //appear// asif those failures are related to these changes.

This is clang part.
Clang-tools-extra part is D43780.

Reviewers: klimek, bkramer, alexfh, pcc

Reviewed By: alexfh

Subscribers: cfe-commits

Tags: #clang

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

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

6 years agoAttrDocs.td: fix some bad code-blocks
Hans Wennborg [Tue, 27 Feb 2018 13:48:50 +0000 (13:48 +0000)]
AttrDocs.td: fix some bad code-blocks

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

6 years agoAttrDocs.td: fix bad bullet list
Hans Wennborg [Tue, 27 Feb 2018 13:48:47 +0000 (13:48 +0000)]
AttrDocs.td: fix bad bullet list

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

6 years agoAttrDocs.td: fix bad indent and code block
Hans Wennborg [Tue, 27 Feb 2018 13:48:41 +0000 (13:48 +0000)]
AttrDocs.td: fix bad indent and code block

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

6 years agoclang-format: use AfterControlStatement to format ObjC control blocks
Francois Ferrand [Tue, 27 Feb 2018 13:48:27 +0000 (13:48 +0000)]
clang-format: use AfterControlStatement to format ObjC control blocks

ObjC defines `@autoreleasepool` and `@synchronized` control blocks. These
used to be formatted according to the `AfterObjCDeclaration` brace-
wrapping flag, which is not very consistent.

This patch changes the behavior to use the `AfterControlStatement` flag
instead. This should not affect the behavior unless a custom brace
wrapping mode is used.

Reviewers: krasimir, djasper, klimek, benhamilton

Subscribers: cfe-commits

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

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

6 years agoclang-format: fix formatting of ObjC @synchronized blocks
Francois Ferrand [Tue, 27 Feb 2018 13:48:21 +0000 (13:48 +0000)]
clang-format: fix formatting of ObjC @synchronized blocks

Summary:
The blocks used to be formatted using the "default" behavior, and would
thus be mistaken for function calls followed by blocks: this could lead
to unexpected inlining of the block and extra line-break before the
opening brace.

They are now formatted similarly to `@autoreleasepool` blocks, as
expected:

  @synchronized(self) {
      f();
  }

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

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

6 years ago[test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC.
Martin Storsjo [Tue, 27 Feb 2018 08:35:35 +0000 (08:35 +0000)]
[test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC.

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

6 years ago[RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields
Martin Storsjo [Tue, 27 Feb 2018 06:27:06 +0000 (06:27 +0000)]
[RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields

When targeting GNU/MinGW for i386, the size of the "long double" data
type is 12 bytes (while it is 8 bytes in MSVC). When building
with -mms-bitfields to have struct layouts match MSVC, data types
are laid out in a struct with alignment according to their size.
However, this doesn't make sense for the long double type, since
it doesn't match MSVC at all, and aligning to a non-power-of-2
size triggers other asserts later.

This matches what GCC does, aligning a long double to 4 bytes
in structs on i386 even when -mms-bitfields is specified.

This fixes asserts when using the max_align_t data type when
building for MinGW/i386 with the -mms-bitfields flag.

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

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

6 years ago[Driver] Fix codeview-column-info on macOS
Shoaib Meenai [Tue, 27 Feb 2018 06:04:23 +0000 (06:04 +0000)]
[Driver] Fix codeview-column-info on macOS

macOS home directory paths begin with /Users, and clang-cl interprets
the /U portion as a macro undefine rather than a path, causing test
failures on macOS. Use a -- to explicitly treat the input file as a path
and fix the test.

This effectively reverts r326168 and adds an alternative fix.

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

6 years agoAttempt to fix greendragon bot after r326141
Adam Nemet [Tue, 27 Feb 2018 04:49:26 +0000 (04:49 +0000)]
Attempt to fix greendragon bot after r326141

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

6 years ago[analyzer] Fix an uninitialized field.
Artem Dergachev [Tue, 27 Feb 2018 02:53:30 +0000 (02:53 +0000)]
[analyzer] Fix an uninitialized field.

Found by the analyzer!

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

6 years ago[Driver] Allow using a canonical form of '-fuse-ld=' when cross-compiling on Windows.
Igor Kudrin [Tue, 27 Feb 2018 02:51:30 +0000 (02:51 +0000)]
[Driver] Allow using a canonical form of '-fuse-ld=' when cross-compiling on Windows.

clang used to require adding an ".exe" suffix when targeting ELF systems on Windows.

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

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

6 years ago[analyzer] Switch the default exploration strategy to priority queue based on coverage
George Karpenkov [Tue, 27 Feb 2018 01:31:56 +0000 (01:31 +0000)]
[analyzer] Switch the default exploration strategy to priority queue based on coverage

After the investigation it seems safe to flip the switch.

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

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

6 years ago[analyzer] Logging test typo quickfix.
George Karpenkov [Tue, 27 Feb 2018 01:31:06 +0000 (01:31 +0000)]
[analyzer] Logging test typo quickfix.

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

6 years ago[analyzer] Logging test quickfix.
George Karpenkov [Tue, 27 Feb 2018 01:13:28 +0000 (01:13 +0000)]
[analyzer] Logging test quickfix.

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

6 years agoRevert "Revert "[analyzer] Quickfix: do not overflow in calculating offset in RegionM...
George Karpenkov [Tue, 27 Feb 2018 00:05:04 +0000 (00:05 +0000)]
Revert "Revert "[analyzer] Quickfix: do not overflow in calculating offset in RegionManager""

This reverts commit c4cc41166d93178a3ddd4b2b5a685cf74a459247.

Revert and fix uninitialized read.

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

6 years ago[Driver] Add SafeStack to a map of incompatible sanitizers
Petr Hosek [Tue, 27 Feb 2018 00:01:26 +0000 (00:01 +0000)]
[Driver] Add SafeStack to a map of incompatible sanitizers

This allows reporting an error when user tries to use SafeStack with
incompatible sanitizers.

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

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

6 years ago[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings...
Eugene Zelenko [Mon, 26 Feb 2018 23:15:52 +0000 (23:15 +0000)]
[StaticAnalyzer] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoFix which Darwin versions have ObjC runtime with full subscripting support.
Volodymyr Sapsai [Mon, 26 Feb 2018 23:10:23 +0000 (23:10 +0000)]
Fix which Darwin versions have ObjC runtime with full subscripting support.

Update min deployment target in some tests so that they don't try
to link against libarclite and don't fail when it's not available.

rdar://problem/29253617

Reviewers: vsk, kubamracek

Reviewed By: vsk

Subscribers: jkorous-apple, cfe-commits

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

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

6 years agoFix codeview-column-info.c test with a triple
Reid Kleckner [Mon, 26 Feb 2018 23:06:40 +0000 (23:06 +0000)]
Fix codeview-column-info.c test with a triple

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

6 years agoRe-land "Emit proper CodeView when -gcodeview is passed without the cl driver."
Reid Kleckner [Mon, 26 Feb 2018 22:55:33 +0000 (22:55 +0000)]
Re-land "Emit proper CodeView when -gcodeview is passed without the cl driver."

Reverts r326116 and re-lands r326113 with a fix to ASan so that it
enables column info in its test suite.

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

6 years ago[analyzer] Exploration strategy prioritizing unexplored nodes first
George Karpenkov [Mon, 26 Feb 2018 22:14:18 +0000 (22:14 +0000)]
[analyzer] Exploration strategy prioritizing unexplored nodes first

See D42775 for discussion.  Turns out, just exploring nodes which
weren't explored first is not quite enough, as e.g. the first quick
traversal resulting in a report can mark everything as "visited", and
then subsequent traversals of the same region will get all the pitfalls
of DFS.
Priority queue-based approach in comparison shows much greater
increase in coverage and even performance, without sacrificing memory.

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

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

6 years ago[analyzer] Do not analyze bison-generated files
George Karpenkov [Mon, 26 Feb 2018 22:14:16 +0000 (22:14 +0000)]
[analyzer] Do not analyze bison-generated files

Bison/YACC generated files result in a very large number of (presumably)
false positives from the analyzer.
These false positives are "true" in a sense of the information analyzer
sees: assuming that the lexer can return any token at any point a number
of uninitialized reads does occur.
(naturally, the analyzer can not capture a complex invariant that
certain tokens can only occur under certain conditions).

Current fix simply stops analysis on those files.
I have examined a very large number of such auto-generated files, and
they do all start with such a comment.
Conversely, user code is very unlikely to contain such a comment.

rdar://33608161

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

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

6 years agoRevert "[analyzer] Quickfix: do not overflow in calculating offset in RegionManager"
George Karpenkov [Mon, 26 Feb 2018 21:32:57 +0000 (21:32 +0000)]
Revert "[analyzer] Quickfix: do not overflow in calculating offset in RegionManager"

This reverts commit df306c4c5ab4a6b8d3c47432346d1f9b90c328b4.

Reverting until I can figured out the reasons for failures.

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

6 years ago[analyzer] Quickfix: do not overflow in calculating offset in RegionManager
George Karpenkov [Mon, 26 Feb 2018 21:03:06 +0000 (21:03 +0000)]
[analyzer] Quickfix: do not overflow in calculating offset in RegionManager

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

rdar://37159026

A proper fix would be much harder, and would involve changing the
appropriate code in ExprEngine to be aware of the size limitations of
the type used for addressing.

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

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

6 years agoRevert "Emit proper CodeView when -gcodeview is passed without the cl driver."
Zachary Turner [Mon, 26 Feb 2018 19:51:29 +0000 (19:51 +0000)]
Revert "Emit proper CodeView when -gcodeview is passed without the cl driver."

This reverts commit e17911006548518634fad66bb8648bcad49a1d64.

This is failing on ASAN bots because asan expects column info,
and it's also failing on some linux bots for unknown reasons which
i need to investigate.

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