]> granicus.if.org Git - clang/log
clang
5 years ago[AArch64] Add command-line option for SSBS
Pablo Barrio [Mon, 3 Dec 2018 14:40:37 +0000 (14:40 +0000)]
[AArch64] Add command-line option for SSBS

Summary:
SSBS (Speculative Store Bypass Safe) is only mandatory from 8.5
onwards but is optional from Armv8.0-A. This patch adds testing for
the ssbs command line option, added to allow enabling the feature
in previous Armv8-A architectures to 8.5.

Reviewers: olista01, samparker, aemerson

Reviewed By: samparker

Subscribers: javed.absar, kristof.beyls, cfe-commits

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

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

5 years ago[OpenCL][Sema] Improving formatting
Marco Antognini [Mon, 3 Dec 2018 14:03:49 +0000 (14:03 +0000)]
[OpenCL][Sema] Improving formatting

Reformat comment added in r348120 following
review https://reviews.llvm.org/D55136.

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

5 years ago[CodeComplete] Cleanup access checking in code completion
Ilya Biryukov [Mon, 3 Dec 2018 13:29:17 +0000 (13:29 +0000)]
[CodeComplete] Cleanup access checking in code completion

Summary: Also fixes a crash (see the added 'accessibility-crash.cpp' test).

Reviewers: ioeric, kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

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

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

5 years ago[Sema] Avoid CallExpr::setNumArgs in Sema::BuildCallToObjectOfClassType
Bruno Ricci [Mon, 3 Dec 2018 13:23:56 +0000 (13:23 +0000)]
[Sema] Avoid CallExpr::setNumArgs in Sema::BuildCallToObjectOfClassType

CallExpr::setNumArgs is the only thing that prevents storing the arguments
of a call expression in a trailing array since it might resize the argument
array. setNumArgs is only called in 3 places in Sema, and for all of them it
is possible to avoid it.

This deals with the call to setNumArgs in BuildCallToObjectOfClassType.
Instead of constructing the CXXOperatorCallExpr first and later calling
setNumArgs if we have default arguments, we first construct a large
enough SmallVector, do the promotion/check of the arguments, and
then construct the CXXOperatorCallExpr.

Incidentally this also avoid reallocating the arguments when the
call operator has default arguments but this is not the primary goal.

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

Reviewed By: aaron.ballman

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

5 years ago[AST] Fix an uninitialized bug in the bits of FunctionDecl
Bruno Ricci [Mon, 3 Dec 2018 13:04:10 +0000 (13:04 +0000)]
[AST] Fix an uninitialized bug in the bits of FunctionDecl

FunctionDeclBits.IsCopyDeductionCandidate was not initialized.
This caused a warning with valgrind.

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

5 years agoPortable Python script across Python version
Serge Guelton [Mon, 3 Dec 2018 12:41:35 +0000 (12:41 +0000)]
Portable Python script across Python version

Python3 does not support type destructuring in function parameters.

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

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

5 years ago[AST][NFC] Pack CXXDeleteExpr
Bruno Ricci [Mon, 3 Dec 2018 12:32:32 +0000 (12:32 +0000)]
[AST][NFC] Pack CXXDeleteExpr

Use the newly available space in the bit-fields of Stmt.
This saves 8 bytes per CXXDeleteExpr. NFC.

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

5 years agoPortable Python script across version
Serge Guelton [Mon, 3 Dec 2018 12:12:48 +0000 (12:12 +0000)]
Portable Python script across version

Have all classes derive from object: that's implicitly the default in Python3,
it needs to be done explicilty in Python2.

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

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

5 years agoPortable Python script across Python version
Serge Guelton [Mon, 3 Dec 2018 12:11:21 +0000 (12:11 +0000)]
Portable Python script across Python version

Python2 supports the two following equivalent construct

raise ExceptionType, exception_value
and
raise ExceptionType(exception_value)

Only the later is supported by Python3.

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

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

5 years ago[Analyzer] Actually check for -model-path being a directory
Ilya Biryukov [Mon, 3 Dec 2018 11:34:08 +0000 (11:34 +0000)]
[Analyzer] Actually check for -model-path being a directory

The original patch (r348038) clearly contained a typo and checked
for '-ctu-dir' twice.

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

5 years ago[Analysis] Properly prepare test env in test/Analysis/undef-call.c
Ilya Biryukov [Mon, 3 Dec 2018 11:28:17 +0000 (11:28 +0000)]
[Analysis] Properly prepare test env in test/Analysis/undef-call.c

The test expectes the '%T/ctudir' to be present, but does not create it.

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

5 years ago[clang] Do not read from 'test/SemaCXX/Inputs' inside 'test/AST'
Ilya Biryukov [Mon, 3 Dec 2018 11:26:35 +0000 (11:26 +0000)]
[clang] Do not read from 'test/SemaCXX/Inputs' inside 'test/AST'

Our integrate relies on test inputs being taken from the same diretory as the
test itself.

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

5 years ago[OpenCL][Sema] Improve BuildResolvedCallExpr handling of builtins
Marco Antognini [Mon, 3 Dec 2018 10:58:56 +0000 (10:58 +0000)]
[OpenCL][Sema] Improve BuildResolvedCallExpr handling of builtins

Summary:
This is a follow-up on https://reviews.llvm.org/D52879, addressing a few issues.

This:
 - adds a FIXME for later improvement for specific builtins: I previously have only checked OpenCL ones and ensured tests cover those.
 - fixed the CallExpr type.

Reviewers: riccibruno

Reviewed By: riccibruno

Subscribers: yaxunl, Anastasia, kristina, svenvh, cfe-commits

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

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

5 years ago[CMake] Store path to vendor-specific headers in clang-headers target property
Stefan Granitz [Mon, 3 Dec 2018 10:34:25 +0000 (10:34 +0000)]
[CMake] Store path to vendor-specific headers in clang-headers target property

Summary:
LLDB.framework wants a copy these headers. With this change LLDB can easily glob for the list of files:
```
get_target_property(clang_include_dir clang-headers RUNTIME_OUTPUT_DIRECTORY)
file(GLOB_RECURSE clang_vendor_headers RELATIVE ${clang_include_dir} "${clang_include_dir}/*")
```

By default `RUNTIME_OUTPUT_DIRECTORY` is unset for custom targets like `clang-headers`.

Reviewers: aprantl, JDevlieghere, davide, friss, dexonsmith

Reviewed By: JDevlieghere

Subscribers: mgorny, #lldb, cfe-commits, llvm-commits

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

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

5 years agoReplace FullComment member being visited with parameter
Stephen Kelly [Sun, 2 Dec 2018 17:30:40 +0000 (17:30 +0000)]
Replace FullComment member being visited with parameter

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoExtend the CommentVisitor with parameter types
Stephen Kelly [Sun, 2 Dec 2018 17:30:34 +0000 (17:30 +0000)]
Extend the CommentVisitor with parameter types

Summary:
This has precedent in the StmtVisitor.  This change will make it
possible to clean up the comment handling in ASTDumper.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoRemove unecessary methods
Stephen Kelly [Sun, 2 Dec 2018 17:30:26 +0000 (17:30 +0000)]
Remove unecessary methods

The base class calls VisitExpr

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

5 years agoFix whitespace
Stephen Kelly [Sun, 2 Dec 2018 16:42:34 +0000 (16:42 +0000)]
Fix whitespace

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

5 years agoAdd dump tests for ArrayInitLoopExpr and ArrayInitIndexExpr
Stephen Kelly [Sun, 2 Dec 2018 16:36:23 +0000 (16:36 +0000)]
Add dump tests for ArrayInitLoopExpr and ArrayInitIndexExpr

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

5 years agoOpenCL: Improve vector printf warnings
Matt Arsenault [Sat, 1 Dec 2018 22:16:27 +0000 (22:16 +0000)]
OpenCL: Improve vector printf warnings

The vector modifier is considered separate, so
don't treat it as a conversion specifier.

This is still not warning on some cases, like
using a type that isn't a valid vector element.

Fixes bug 39652

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

5 years agoOpenCL: Extend argument promotion rules to vector types
Matt Arsenault [Sat, 1 Dec 2018 21:56:10 +0000 (21:56 +0000)]
OpenCL: Extend argument promotion rules to vector types

The spec is ambiguous on whether vector types are allowed to be
implicitly converted. The only legal context I think this can
be used for OpenCL is printf, where it seems necessary.

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

5 years agoCorrect indentation.
Bill Wendling [Sat, 1 Dec 2018 09:06:26 +0000 (09:06 +0000)]
Correct indentation.

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

5 years agoSpecify constant context in constant emitter
Bill Wendling [Sat, 1 Dec 2018 08:29:36 +0000 (08:29 +0000)]
Specify constant context in constant emitter

The constant emitter may need to evaluate the expression in a constant context.
For exasmple, global initializer lists.

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

5 years ago[Basic] Move DiagnosticsEngine::dump from .h to .cpp
Fangrui Song [Sat, 1 Dec 2018 01:43:05 +0000 (01:43 +0000)]
[Basic] Move DiagnosticsEngine::dump from .h to .cpp

The two LLVM_DUMP_METHOD methods have a undefined reference on clang::DiagnosticsEngine::DiagStateMap::dump.

tools/clang/tools/extra/clangd/benchmarks/IndexBenchmark links in
clangDaemon but does not link in clangBasic explicitly, which causes a
linker error "undefined symbol" in !NDEBUG + -DBUILD_SHARED_LIBS=on builds.

Move LLVM_DUMP_METHOD methods to .cpp to fix IndexBenchmark. They should
be unconditionally defined as they are also used by non-dump-method #pragma clang __debug diag_mapping

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

5 years agoRelax test to also work on Windows.
Adrian Prantl [Sat, 1 Dec 2018 01:30:00 +0000 (01:30 +0000)]
Relax test to also work on Windows.

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

5 years agoHonor -fdebug-prefix-map when creating function names for the debug info.
Adrian Prantl [Sat, 1 Dec 2018 00:24:27 +0000 (00:24 +0000)]
Honor -fdebug-prefix-map when creating function names for the debug info.

This adds a callback to PrintingPolicy to allow CGDebugInfo to remap
file paths according to -fdebug-prefix-map. Otherwise the debug info
(particularly function names for C++ lambdas) may contain paths that
should have been remapped in the debug info.

<rdar://problem/46128056>

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

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

5 years agoRevert "Revert r347417 "Re-Reinstate 347294 with a fix for the failures.""
Fangrui Song [Fri, 30 Nov 2018 23:41:18 +0000 (23:41 +0000)]
Revert "Revert r347417 "Re-Reinstate 347294 with a fix for the failures.""

It seems the two failing tests can be simply fixed after r348037

Fix 3 cases in Analysis/builtin-functions.cpp
Delete the bad CodeGen/builtin-constant-p.c for now

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

5 years ago[analyzer] Deleting unnecessary test file
Kristof Umann [Fri, 30 Nov 2018 22:32:17 +0000 (22:32 +0000)]
[analyzer] Deleting unnecessary test file

That I really should've done in rC348031.

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

5 years agoAdd myself as code owner for OpenBSD driver
Brad Smith [Fri, 30 Nov 2018 21:42:34 +0000 (21:42 +0000)]
Add myself as code owner for OpenBSD driver

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

5 years agoRevert r347417 "Re-Reinstate 347294 with a fix for the failures."
Fangrui Song [Fri, 30 Nov 2018 21:26:09 +0000 (21:26 +0000)]
Revert r347417 "Re-Reinstate 347294 with a fix for the failures."

Kept the "indirect_builtin_constant_p" test case in test/SemaCXX/constant-expression-cxx1y.cpp
while we are investigating why the following snippet fails:

  extern char extern_var;
  struct { int a; } a = {__builtin_constant_p(extern_var)};

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

5 years ago[analyzer] Emit an error for invalid -analyzer-config inputs
Kristof Umann [Fri, 30 Nov 2018 21:24:31 +0000 (21:24 +0000)]
[analyzer] Emit an error for invalid -analyzer-config inputs

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

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

5 years ago[ExprConstant] Try fixing __builtin_constant_p after D54355 (rC347417)
Fangrui Song [Fri, 30 Nov 2018 21:15:41 +0000 (21:15 +0000)]
[ExprConstant] Try fixing __builtin_constant_p after D54355 (rC347417)

Summary:
Reinstate the original behavior (Success(false, E)) before D54355 when this branch is
taken. This fixes spurious error of the following snippet:

  extern char extern_var;
  struct { int a; } a = {__builtin_constant_p(extern_var)};

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

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Fri, 30 Nov 2018 20:55:26 +0000 (20:55 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for struct and union declarations in C. It also points out a bug when dumping anonymous record types -- they are sometimes reported as being contained by something of the wrong tag type. e.g., an anonymous struct inside of a union named X reports the anonymous struct as being inside of 'struct X' rather than 'union X'.

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

5 years agoRevert r348029. I was git-ing and jumped the gun.
Bill Wendling [Fri, 30 Nov 2018 20:44:11 +0000 (20:44 +0000)]
Revert r348029. I was git-ing and jumped the gun.

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

5 years ago[analyzer] Evaluate all non-checker config options before analysis
Kristof Umann [Fri, 30 Nov 2018 20:44:00 +0000 (20:44 +0000)]
[analyzer] Evaluate all non-checker config options before analysis

In earlier patches regarding AnalyzerOptions, a lot of effort went into
gathering all config options, and changing the interface so that potential
misuse can be eliminited.

Up until this point, AnalyzerOptions only evaluated an option when it was
querried. For example, if we had a "-no-false-positives" flag, AnalyzerOptions
would store an Optional field for it that would be None up until somewhere in
the code until the flag's getter function is called.

However, now that we're confident that we've gathered all configs, we can
evaluate off of them before analysis, so we can emit a error on invalid input
even if that prticular flag will not matter in that particular run of the
analyzer. Another very big benefit of this is that debug.ConfigDumper will now
show the value of all configs every single time.

Also, almost all options related class have a similar interface, so uniformity
is also a benefit.

The implementation for errors on invalid input will be commited shorty.

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

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

5 years agoRevert "Reverting r347949-r347951 because they broke the test bots."
George Karpenkov [Fri, 30 Nov 2018 20:43:42 +0000 (20:43 +0000)]
Revert "Reverting r347949-r347951 because they broke the test bots."

This reverts commit 5bad6129c012fbf186eb055be49344e790448ecc.

Hopefully fixing the issue which was breaking the bots.

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

5 years agoWe're in a constant context in the ConstantEmitter.
Bill Wendling [Fri, 30 Nov 2018 20:40:06 +0000 (20:40 +0000)]
We're in a constant context in the ConstantEmitter.

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

5 years agoExpect mixed path separators in FileManagerTest when resolving paths on Win32
Matthew Voss [Fri, 30 Nov 2018 19:52:50 +0000 (19:52 +0000)]
Expect mixed path separators in FileManagerTest when resolving paths on Win32

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

5 years agoRevert an inadvertent change from r348020.
Aaron Ballman [Fri, 30 Nov 2018 19:32:35 +0000 (19:32 +0000)]
Revert an inadvertent change from r348020.

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

5 years ago[analyzer][PlistMacroExpansion] Part 5.: Support for # and ##
Kristof Umann [Fri, 30 Nov 2018 19:21:35 +0000 (19:21 +0000)]
[analyzer][PlistMacroExpansion] Part 5.: Support for # and ##

From what I can see, this should be the last patch needed to replicate macro
argument expansions.

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

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

5 years agoUpdating this test, which changed after the reverts from r348020.
Aaron Ballman [Fri, 30 Nov 2018 19:15:07 +0000 (19:15 +0000)]
Updating this test, which changed after the reverts from r348020.

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

5 years agoReverting r347949-r347951 because they broke the test bots.
Aaron Ballman [Fri, 30 Nov 2018 18:52:51 +0000 (18:52 +0000)]
Reverting r347949-r347951 because they broke the test bots.

http://lab.llvm.org:8011/builders/clang-cmake-armv8-lld/builds/440/steps/ninja%20check%202/logs/FAIL%3A%20Clang%3A%3Aosobject-retain-release.cpp

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

5 years agoMove AST tests into their own test directory; NFC.
Aaron Ballman [Fri, 30 Nov 2018 18:43:02 +0000 (18:43 +0000)]
Move AST tests into their own test directory; NFC.

This moves everything primarily testing the functionality of -ast-dump and -ast-print into their own directory, rather than leaving the tests spread around the testing directory.

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

5 years ago[clang] Fix rL348006 for windows
Kadir Cetinkaya [Fri, 30 Nov 2018 18:36:31 +0000 (18:36 +0000)]
[clang] Fix rL348006 for windows

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

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Fri, 30 Nov 2018 17:19:06 +0000 (17:19 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for GenericSelectionExpr; note that it points out a minor whitespace bug for selection expression cases.

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

5 years ago[clang] Fill RealPathName for virtual files.
Kadir Cetinkaya [Fri, 30 Nov 2018 17:10:11 +0000 (17:10 +0000)]
[clang] Fill RealPathName for virtual files.

Summary:
Absolute path information for virtual files were missing even if we
have already stat'd the files. This patch puts that information for virtual
files that can succesffully be stat'd.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

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

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Fri, 30 Nov 2018 15:11:16 +0000 (15:11 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for DeclStmt and demonstrates that we don't create such an AST node for global declarations currently.

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

5 years agoAdding tests for -ast-dump; NFC.
Aaron Ballman [Fri, 30 Nov 2018 14:43:21 +0000 (14:43 +0000)]
Adding tests for -ast-dump; NFC.

This adds tests for the majority of the functionality around FunctionDecl and CXXMethodDecl.

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

5 years agoFix warning about unused variable [NFC]
Mikael Holmen [Fri, 30 Nov 2018 13:38:33 +0000 (13:38 +0000)]
Fix warning about unused variable [NFC]

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

5 years agolyzer] [HOTFIX!] SValBuilder crash when `aggressive-binary-operation-simplification...
Adam Balogh [Fri, 30 Nov 2018 10:37:44 +0000 (10:37 +0000)]
lyzer] [HOTFIX!] SValBuilder crash when `aggressive-binary-operation-simplification` enabled

During the review of D41938 a condition check with an early exit accidentally
slipped into a branch, leaving the other branch unprotected. This may result in
an assertion later on. This hotfix moves this contition check outside of the
branch.

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

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

5 years agoFix a use-after-scope bug.
Haojian Wu [Fri, 30 Nov 2018 09:23:01 +0000 (09:23 +0000)]
Fix a use-after-scope bug.

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

5 years agoRevert r344580 "[analyzer] Nullability: Don't detect post factum violation..."
Artem Dergachev [Fri, 30 Nov 2018 04:26:17 +0000 (04:26 +0000)]
Revert r344580 "[analyzer] Nullability: Don't detect post factum violation..."

Fails under ASan!

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

5 years ago[analyzer] MallocChecker: Avoid redundant transitions.
Artem Dergachev [Fri, 30 Nov 2018 03:52:42 +0000 (03:52 +0000)]
[analyzer] MallocChecker: Avoid redundant transitions.

Don't generate a checker-tagged node unconditionally on the first
checkDeadSymbols callback when no pointers are tracked.

This is a tiny performance optimization; it may change the behavior slightly
by making Static Analyzer bail out on max-nodes one node later (which is good)
but any test would either break for no good reason or become useless
every time someone sneezes.

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

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

5 years ago[analyzer] Nullability: Don't detect post factum violation on concrete values.
Artem Dergachev [Fri, 30 Nov 2018 03:39:58 +0000 (03:39 +0000)]
[analyzer] Nullability: Don't detect post factum violation on concrete values.

The checker suppresses warnings on paths on which a nonnull value is assumed
to be nullable. This probably deserves a warning, but it's a separate story.

Now, because dead symbol collection fires in pretty random moments,
there sometimes was a situation when dead symbol collection fired after
computing a parameter but before actually evaluating call enter into the
function, which triggered the suppression when the argument was null
in the first place earlier than the obvious warning for null-to-nonnull
was emitted, causing false negatives.

Only trigger the suppression for symbols, not for concrete values.

It is impossible to constrain a concrete value post-factum because
it is impossible to constrain a concrete value at all.

This covers all the necessary cases because by the time we reach the call,
symbolic values should be either not constrained to null, or already collapsed
into concrete null values. Which in turn happens because they are passed through
the Store, and the respective collapse is implemented as part of getSVal(),
which is also weird.

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

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

5 years ago[analyzer] Fix the "Zombie Symbols" bug.
Artem Dergachev [Fri, 30 Nov 2018 03:27:50 +0000 (03:27 +0000)]
[analyzer] Fix the "Zombie Symbols" bug.

It's an old bug that consists in stale references to symbols remaining in the
GDM if they disappear from other program state sections as a result of any
operation that isn't the actual dead symbol collection. The most common example
here is:

   FILE *fp = fopen("myfile.txt", "w");
   fp = 0; // leak of file descriptor

In this example the leak were not detected previously because the symbol
disappears from the public part of the program state due to evaluating
the assignment. For that reason the checker never receives a notification
that the symbol is dead, and never reports a leak.

This patch not only causes leak false negatives, but also a number of other
problems, including false positives on some checkers.

What's worse, even though the program state contains a finite number of symbols,
the set of symbols that dies is potentially infinite. This means that is
impossible to compute the set of all dead symbols to pass off to the checkers
for cleaning up their part of the GDM.

No longer compute the dead set at all. Disallow iterating over dead symbols.
Disallow querying if any symbols are dead. Remove the API for marking symbols
as dead, as it is no longer necessary. Update checkers accordingly.

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

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

5 years ago[analyzer] Fixes after rebase.
George Karpenkov [Fri, 30 Nov 2018 02:19:29 +0000 (02:19 +0000)]
[analyzer] Fixes after rebase.

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

5 years ago[analyzer] RetainCountChecker for OSObject model the "free" call
George Karpenkov [Fri, 30 Nov 2018 02:19:16 +0000 (02:19 +0000)]
[analyzer] RetainCountChecker for OSObject model the "free" call

The "free" call frees the object immediately, ignoring the reference count.
Sadly, it is actually used in a few places, so we need to model it.

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

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

5 years ago[analyzer] RetainCountChecker: recognize that OSObject can be created directly using...
George Karpenkov [Fri, 30 Nov 2018 02:19:03 +0000 (02:19 +0000)]
[analyzer] RetainCountChecker: recognize that OSObject can be created directly using an operator "new"

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

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

5 years ago[analyzer] Switch retain count checker for OSObject to use OS_* attributes
George Karpenkov [Fri, 30 Nov 2018 02:18:50 +0000 (02:18 +0000)]
[analyzer] Switch retain count checker for OSObject to use OS_* attributes

Instead of generalized reference counting annotations.

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

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

5 years ago[attributes] Add a family of OS_CONSUMED, OS_RETURNS and OS_RETURNS_RETAINED attributes
George Karpenkov [Fri, 30 Nov 2018 02:18:37 +0000 (02:18 +0000)]
[attributes] Add a family of OS_CONSUMED, OS_RETURNS and OS_RETURNS_RETAINED attributes

The addition adds three attributes for communicating ownership,
analogous to existing NS_ and CF_ attributes.
The attributes are meant to be used for communicating ownership of all
objects in XNU (Darwin kernel) and all of the kernel modules.
The ownership model there is very similar, but still different from the
Foundation model, so we think that introducing a new family of
attributes is appropriate.

The addition required a sizeable refactoring of the existing code for
CF_ and NS_ ownership attributes, due to tight coupling and the fact
that differentiating between the types was previously done using a
boolean.

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

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

5 years ago[analyzer] [NFC] Minor refactoring of RetainCountDiagnostics
George Karpenkov [Fri, 30 Nov 2018 02:18:23 +0000 (02:18 +0000)]
[analyzer] [NFC] Minor refactoring of RetainCountDiagnostics

Move visitors to the implementation file, move a complicated logic into
a function.

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

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

5 years ago[analyzer] For OSObject, trust that functions starting with Get
George Karpenkov [Fri, 30 Nov 2018 02:18:10 +0000 (02:18 +0000)]
[analyzer] For OSObject, trust that functions starting with Get

(uppercase) are also getters.

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

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

5 years ago[analyzer] Print a fully qualified name for functions in RetainCountChecker diagnostics
George Karpenkov [Fri, 30 Nov 2018 02:17:57 +0000 (02:17 +0000)]
[analyzer] Print a fully qualified name for functions in RetainCountChecker diagnostics

Attempt to get a fully qualified name from AST if an SVal corresponding
to the object is not available.

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

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

5 years ago[analyzer] Add the type of the leaked object to the diagnostic message
George Karpenkov [Fri, 30 Nov 2018 02:17:44 +0000 (02:17 +0000)]
[analyzer] Add the type of the leaked object to the diagnostic message

If the object is a temporary, and there is no variable it binds to,
let's at least print out the object name in order to help differentiate
it from other temporaries.

rdar://45175098

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

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

5 years ago[analyzer] Reference leaked object by name, even if it was created in an inlined...
George Karpenkov [Fri, 30 Nov 2018 02:17:31 +0000 (02:17 +0000)]
[analyzer] Reference leaked object by name, even if it was created in an inlined function.

rdar://45532181

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

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

5 years ago[analyzer] [NFC] Test dumping trimmed graph
George Karpenkov [Fri, 30 Nov 2018 02:17:18 +0000 (02:17 +0000)]
[analyzer] [NFC] Test dumping trimmed graph

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

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

5 years ago[analyzer] [NFC] Some miscellaneous clean ups and documentation fixes.
George Karpenkov [Fri, 30 Nov 2018 02:17:05 +0000 (02:17 +0000)]
[analyzer] [NFC] Some miscellaneous clean ups and documentation fixes.

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

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

5 years ago[-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs.
Adrian Prantl [Thu, 29 Nov 2018 22:33:09 +0000 (22:33 +0000)]
[-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs.

This patch passes -fdebug-prefix-map (a feature for renaming source
paths in the debug info) through to the per-module codegen options and
adds the debug prefix map to the module hash.

<rdar://problem/46045865>

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

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

5 years ago[OPENMP][NVPTX]Call get __kmpc_global_thread_num in worker after
Alexey Bataev [Thu, 29 Nov 2018 21:21:32 +0000 (21:21 +0000)]
[OPENMP][NVPTX]Call get __kmpc_global_thread_num in worker after
initialization.

Function __kmpc_global_thread_num  should be called only after
initialization, not earlier.

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

5 years ago[OpenMP] Add a new version of the SPMD deinit kernel function
Gheorghe-Teodor Bercea [Thu, 29 Nov 2018 20:53:49 +0000 (20:53 +0000)]
[OpenMP] Add a new version of the SPMD deinit kernel function

Summary: This patch adds a new runtime for the SPMD deinit kernel function which replaces the previous function. The new function takes as argument the flag which signals whether the runtime is required or not. This enables the compiler to optimize out the part of the deinit function which are not needed.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

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

5 years agoRevert "NFC: Fix case of CommentVisitor::Visit methods"
Stephen Kelly [Thu, 29 Nov 2018 19:50:10 +0000 (19:50 +0000)]
Revert "NFC: Fix case of CommentVisitor::Visit methods"

This reverts commit 0859c80137ac5fb3c86e7802cb8c5ef56f921cce.

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

5 years agoNFC: Fix case of CommentVisitor::Visit methods
Stephen Kelly [Thu, 29 Nov 2018 19:31:32 +0000 (19:31 +0000)]
NFC: Fix case of CommentVisitor::Visit methods

This difference is very visible because it is used with other Visitor
classes together.

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

5 years agoNFC: Move ColorScope to global scope
Stephen Kelly [Thu, 29 Nov 2018 19:30:37 +0000 (19:30 +0000)]
NFC: Move ColorScope to global scope

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

5 years agoNFC: Constify ShowColors
Stephen Kelly [Thu, 29 Nov 2018 19:30:08 +0000 (19:30 +0000)]
NFC: Constify ShowColors

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

5 years agoset default max-page-size to 4KB in lld for Android Aarch64
Zhizhou Yang [Thu, 29 Nov 2018 18:52:22 +0000 (18:52 +0000)]
set default max-page-size to 4KB in lld for Android Aarch64

Summary:
This patch passes an option '-z max-page-size=4096' to lld through clang driver.

This is for Android on Aarch64 target.

The lld default page size is too large for Aarch64, which produces larger .so files and images for arm64 device targets.
In this patch we set default page size to 4KB for Android Aarch64 targets instead.

Reviewers: srhines, danalbert, ruiu, chh, peter.smith

Reviewed By: srhines

Subscribers: javed.absar, kristof.beyls, cfe-commits, george.burgess.iv, llozano

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

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

5 years agoSimplify the __builtin_constant_p test that was used to catch rC347417 failure
Fangrui Song [Thu, 29 Nov 2018 18:26:39 +0000 (18:26 +0000)]
Simplify the __builtin_constant_p test that was used to catch rC347417 failure

Reviewers: rsmith, void, shafik

Reviewed By: void

Subscribers: kristina, cfe-commits

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

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

5 years agoAdd missing REQUIRES to new test
Teresa Johnson [Thu, 29 Nov 2018 18:02:31 +0000 (18:02 +0000)]
Add missing REQUIRES to new test

Test added in r347887 requires an x86 target.

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

5 years ago[analyzer][PlistMacroExpansion] Part 4.: Support for __VA_ARGS__
Kristof Umann [Thu, 29 Nov 2018 17:09:41 +0000 (17:09 +0000)]
[analyzer][PlistMacroExpansion] Part 4.: Support for __VA_ARGS__

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

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

5 years ago[ThinLTO] Allow importing of multiple symbols with same GUID
Teresa Johnson [Thu, 29 Nov 2018 17:02:59 +0000 (17:02 +0000)]
[ThinLTO] Allow importing of multiple symbols with same GUID

Summary:
The is the clang side of the fix in D55047, to handle the case where
two different modules have local variables with the same GUID because
they had the same source file name at compilation time. Allow multiple
symbols with the same GUID to be imported, and test that this case works
with the distributed backend path.

Depends on D55047.

Reviewers: evgeny777

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, cfe-commits

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

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

5 years agoMark __builtin_shufflevector as using custom type checking
Matt Arsenault [Thu, 29 Nov 2018 15:45:05 +0000 (15:45 +0000)]
Mark __builtin_shufflevector as using custom type checking

The custom handling seems to all be implemented already.
This avoids regressions in a future patch when float vectors
are ordinarily promoted to double vectors in variadic calls.

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

5 years agoinhereit LLVM_ENABLE_LIBXML2
David Callahan [Thu, 29 Nov 2018 14:57:14 +0000 (14:57 +0000)]
inhereit LLVM_ENABLE_LIBXML2

Summary: When building in an LLVM context, we should respect its LLVM_ENABLE_LIBXML2 option.

Reviewers: vitalybuka, mspertus, modocache

Reviewed By: modocache

Subscribers: mgorny, cfe-commits

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

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

5 years ago[OpenCL] Improve diags for addr spaces in templates
Anastasia Stulova [Thu, 29 Nov 2018 14:11:15 +0000 (14:11 +0000)]
[OpenCL] Improve diags for addr spaces in templates

Fix ICEs on template instantiations that were leading to
the creation of invalid code patterns with address spaces.

Incorrect cases are now diagnosed properly.

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

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

5 years agoSet MustBuildLookupTable on PrimaryContext in ExternalASTMerger
Raphael Isemann [Thu, 29 Nov 2018 13:50:30 +0000 (13:50 +0000)]
Set MustBuildLookupTable on PrimaryContext in ExternalASTMerger

Summary:
`MustBuildLookupTable` must always be called on a primary context as we otherwise
trigger an assert, but we don't ensure that this will always happen in our code right now.

This patch explicitly requests the primary context when doing this call as this shouldn't break
anything (as calling `getPrimaryContext` on a context which is its own primary context is a no-op)
but will catch these rare cases where we somehow operate on a declaration context that is
not its own primary context.

See also D54863.

Reviewers: martong, a.sidorin, shafik

Reviewed By: martong

Subscribers: davide, rnkovacs, cfe-commits

Tags: #lldb

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

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

5 years agoAdd Hurd target to Clang driver (2/2)
Kristina Brooks [Thu, 29 Nov 2018 03:49:14 +0000 (03:49 +0000)]
Add Hurd target to Clang driver (2/2)

This adds Hurd toolchain support to Clang's driver in addition
to handling translating the triple from Hurd-compatible form to
the actual triple registered in LLVM.

(Phabricator was stripping the empty files from the patch so I
manually created them)

Patch by sthibaul (Samuel Thibault)

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

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

5 years agoAllow cpu-dispatch forward declarations.
Erich Keane [Wed, 28 Nov 2018 21:54:04 +0000 (21:54 +0000)]
Allow cpu-dispatch forward declarations.

As a followup to r347805, allow forward declarations of cpu-dispatch and
cpu-specific for the same reasons.

Change-Id: Ic1bde9be369b1f8f1d47d58e6fbdc2f9dfcdd785

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

5 years agoEnsure sanitizer check function calls have a !dbg location
Adrian Prantl [Wed, 28 Nov 2018 21:44:06 +0000 (21:44 +0000)]
Ensure sanitizer check function calls have a !dbg location

Function calls without a !dbg location inside a function that has a
DISubprogram make it impossible to construct inline information and
are rejected by the verifier. This patch ensures that sanitizer check
function calls have a !dbg location, by carrying forward the location
of the preceding instruction or by inserting an artificial location if
necessary.

This fixes a crash when compiling the attached testcase with -Os.

rdar://problem/45311226

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

Note: This reapllies r344915, modified to reuse the IRBuilder's
DebugLoc if one exists instead of picking the one from CGDebugInfo
since the latter may get reset when emitting thunks such as block
helpers in the middle of emitting another function.

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

5 years ago[DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags.
Paul Robinson [Wed, 28 Nov 2018 21:18:07 +0000 (21:18 +0000)]
[DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags.

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

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

5 years agoCorrect 'target' default behavior on redecl, allow forward declaration.
Erich Keane [Wed, 28 Nov 2018 20:58:43 +0000 (20:58 +0000)]
Correct 'target' default behavior on redecl, allow forward declaration.

Declarations without the attribute were disallowed because it would be
ambiguous which 'target' it was supposed to be on.  For example:

void ___attribute__((target("v1"))) foo();
void foo(); // Redecl of above, or fwd decl of below?
void ___attribute__((target("v2"))) foo();

However, a first declaration doesn't have that problem, and erroring
prevents it from working in cases where the forward declaration is
useful.

Additionally, a forward declaration of target==default wouldn't properly
cause multiversioning, so this patch fixes that.

The patch was not split since the 'default' fix would require
implementing the same check for that case, followed by undoing the same
change for the fwd-decl implementation.

Change-Id: I66f2c5bc2477bcd3f7544b9c16c83ece257077b0

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

5 years ago[Coverage] Specify the Itanium ABI triple for a C++ test
Vedant Kumar [Wed, 28 Nov 2018 20:51:09 +0000 (20:51 +0000)]
[Coverage] Specify the Itanium ABI triple for a C++ test

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

5 years ago[Coverage] Do not visit artificial stmts in defaulted methods (PR39822)
Vedant Kumar [Wed, 28 Nov 2018 20:48:07 +0000 (20:48 +0000)]
[Coverage] Do not visit artificial stmts in defaulted methods (PR39822)

There is no reason to emit coverage mappings for artificial statements
contained within defaulted methods, as these statements are not visible
to users.

Only emit a mapping for the body of the defaulted method (clang treats
the text of the "default" keyword as the body when reporting locations).
This allows users to see how often the default method is called, but
trims down the coverage mapping by skipping visitation of the children
of the method.

The immediate motivation for this change is that the lexer's
getPreciseTokenLocEnd API cannot return the correct location when given
an artificial statement (with a somewhat made-up location) as an input.

Test by Orivej Desh!

Fixes llvm.org/PR39822.

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

5 years agoRevert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."
Davide Italiano [Wed, 28 Nov 2018 19:15:23 +0000 (19:15 +0000)]
Revert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."

This broke the lldb bots.

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

5 years ago[OPENMP]Fix emission of the target regions in virtual functions.
Alexey Bataev [Wed, 28 Nov 2018 19:00:07 +0000 (19:00 +0000)]
[OPENMP]Fix emission of the target regions in virtual functions.

Fixed emission of the target regions found in the virtual functions.
Previously we may end up with the situation when those regions could be
skipped.

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

5 years ago[NFC] Move MultIversioning::Type into Decl so that it can be used in
Erich Keane [Wed, 28 Nov 2018 18:34:14 +0000 (18:34 +0000)]
[NFC] Move MultIversioning::Type into Decl so that it can be used in
CodeGen

Change-Id: I32b14edca3501277e0e65672eafe3eea38c6f9ae

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

5 years ago[analyzer] Cleanup constructors in the Z3 backend
Mikhail R. Gadelha [Wed, 28 Nov 2018 17:22:49 +0000 (17:22 +0000)]
[analyzer] Cleanup constructors in the Z3 backend

Summary: Left only the constructors that are actually required, and marked the move constructors as deleted. They are not used anymore and we were never sure they've actually worked correctly.

Reviewers: george.karpenkov, NoQ

Reviewed By: george.karpenkov

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, Szelethus, donat.nagy, dkrupp

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

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

5 years agoRe-commit r347417 "Re-Reinstate 347294 with a fix for the failures."
Hans Wennborg [Wed, 28 Nov 2018 14:04:12 +0000 (14:04 +0000)]
Re-commit r347417 "Re-Reinstate 347294 with a fix for the failures."

This was reverted in r347656 due to me thinking it caused a miscompile of
Chromium. Turns out it was the Chromium code that was broken.

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

5 years ago[ASTImporter] Changed use of Import to Import_New in ASTImporter.
Balazs Keri [Wed, 28 Nov 2018 13:21:26 +0000 (13:21 +0000)]
[ASTImporter] Changed use of Import to Import_New in ASTImporter.

Reviewers: a.sidorin, shafik, a_sidorin

Reviewed By: a_sidorin

Subscribers: gamesh411, a_sidorin, dkrupp, martong, Szelethus, cfe-commits

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

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

5 years agoPR39809: (const void*)0 is not a null pointer constant in C.
Richard Smith [Wed, 28 Nov 2018 06:25:06 +0000 (06:25 +0000)]
PR39809: (const void*)0 is not a null pointer constant in C.

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

5 years agoPR12884: Add test (bug is already fixed).
Richard Smith [Wed, 28 Nov 2018 05:15:46 +0000 (05:15 +0000)]
PR12884: Add test (bug is already fixed).

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

5 years agoMove LoopHint.h from Sema to Parse
Richard Trieu [Wed, 28 Nov 2018 04:36:31 +0000 (04:36 +0000)]
Move LoopHint.h from Sema to Parse

struct LoopHint was only used within Parse and not in any of the Sema or
Codegen files.  In the non-Parse files where it was included, it either wasn't
used or LoopHintAttr was used, so its inclusion did nothing.

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

5 years ago[CodeGen] Fix included headers.
Richard Trieu [Wed, 28 Nov 2018 04:14:29 +0000 (04:14 +0000)]
[CodeGen] Fix included headers.

Remove the included Parse header because CodeGen should not depend on Parse.
Instead, include the Lex headers that it needs instead.

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