Commit Graph

76348 Commits

Author SHA1 Message Date
Stephen Kelly e8e4f09add Fix whitespace
llvm-svn: 348094
2018-12-02 16:42:34 +00:00
Stephen Kelly 765e1a4472 Add dump tests for ArrayInitLoopExpr and ArrayInitIndexExpr
llvm-svn: 348093
2018-12-02 16:36:23 +00:00
Matt Arsenault 0ff50d49d1 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

llvm-svn: 348084
2018-12-01 22:16:27 +00:00
Matt Arsenault af07de4059 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.

llvm-svn: 348083
2018-12-01 21:56:10 +00:00
Bill Wendling 958b94d679 Correct indentation.
llvm-svn: 348071
2018-12-01 09:06:26 +00:00
Bill Wendling 2a81f6670d Specify constant context in constant emitter
The constant emitter may need to evaluate the expression in a constant context.
For exasmple, global initializer lists.

llvm-svn: 348070
2018-12-01 08:29:36 +00:00
Fangrui Song 2f55320741 [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

llvm-svn: 348065
2018-12-01 01:43:05 +00:00
Adrian Prantl 33f0af35df Relax test to also work on Windows.
llvm-svn: 348062
2018-12-01 01:30:00 +00:00
Adrian Prantl bef4f92a3b 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

llvm-svn: 348060
2018-12-01 00:24:27 +00:00
Fangrui Song 407659ab0a 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

llvm-svn: 348053
2018-11-30 23:41:18 +00:00
Kristof Umann f110a357ac [analyzer] Deleting unnecessary test file
That I really should've done in rC348031.

llvm-svn: 348044
2018-11-30 22:32:17 +00:00
Brad Smith 0b32e44eff Add myself as code owner for OpenBSD driver
llvm-svn: 348041
2018-11-30 21:42:34 +00:00
Fangrui Song f5d3335d75 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)};

llvm-svn: 348039
2018-11-30 21:26:09 +00:00
Kristof Umann d1a4b06c20 [analyzer] Emit an error for invalid -analyzer-config inputs
Differential Revision: https://reviews.llvm.org/D53280

llvm-svn: 348038
2018-11-30 21:24:31 +00:00
Fangrui Song 81a1a8e181 [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)};

llvm-svn: 348037
2018-11-30 21:15:41 +00:00
Aaron Ballman 3b6fb6e846 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'.

llvm-svn: 348033
2018-11-30 20:55:26 +00:00
Bill Wendling 90a0563118 Revert r348029. I was git-ing and jumped the gun.
llvm-svn: 348032
2018-11-30 20:44:11 +00:00
Kristof Umann 549f9cd46f [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

llvm-svn: 348031
2018-11-30 20:44:00 +00:00
George Karpenkov be3f4bd36b Revert "Reverting r347949-r347951 because they broke the test bots."
This reverts commit 5bad6129c012fbf186eb055be49344e790448ecc.

Hopefully fixing the issue which was breaking the bots.

llvm-svn: 348030
2018-11-30 20:43:42 +00:00
Bill Wendling e64fe2abae We're in a constant context in the ConstantEmitter.
llvm-svn: 348029
2018-11-30 20:40:06 +00:00
Matthew Voss 601d311326 Expect mixed path separators in FileManagerTest when resolving paths on Win32
llvm-svn: 348028
2018-11-30 19:52:50 +00:00
Aaron Ballman 971a89ce4c Revert an inadvertent change from r348020.
llvm-svn: 348026
2018-11-30 19:32:35 +00:00
Kristof Umann 5f9981f8a5 [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

llvm-svn: 348025
2018-11-30 19:21:35 +00:00
Aaron Ballman e024c8b212 Updating this test, which changed after the reverts from r348020.
llvm-svn: 348023
2018-11-30 19:15:07 +00:00
Aaron Ballman cd5115b74d 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

llvm-svn: 348020
2018-11-30 18:52:51 +00:00
Aaron Ballman 4b5b0c0025 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.

llvm-svn: 348017
2018-11-30 18:43:02 +00:00
Kadir Cetinkaya 853ec89249 [clang] Fix rL348006 for windows
llvm-svn: 348015
2018-11-30 18:36:31 +00:00
Aaron Ballman e47b366900 Adding tests for -ast-dump; NFC.
This adds tests for GenericSelectionExpr; note that it points out a minor whitespace bug for selection expression cases.

llvm-svn: 348008
2018-11-30 17:19:06 +00:00
Kadir Cetinkaya e9870c0c91 [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

llvm-svn: 348006
2018-11-30 17:10:11 +00:00
Aaron Ballman 7213cd14f5 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.

llvm-svn: 347996
2018-11-30 15:11:16 +00:00
Aaron Ballman 7278cc7d73 Adding tests for -ast-dump; NFC.
This adds tests for the majority of the functionality around FunctionDecl and CXXMethodDecl.

llvm-svn: 347994
2018-11-30 14:43:21 +00:00
Mikael Holmen ebf787b138 Fix warning about unused variable [NFC]
llvm-svn: 347987
2018-11-30 13:38:33 +00:00
Adam Balogh 471d0864df 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

llvm-svn: 347981
2018-11-30 10:37:44 +00:00
Haojian Wu ceff730fef Fix a use-after-scope bug.
llvm-svn: 347970
2018-11-30 09:23:01 +00:00
Artem Dergachev c076907384 Revert r344580 "[analyzer] Nullability: Don't detect post factum violation..."
Fails under ASan!

llvm-svn: 347956
2018-11-30 04:26:17 +00:00
Artem Dergachev e2b5438a73 [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

llvm-svn: 347955
2018-11-30 03:52:42 +00:00
Artem Dergachev 34d3576736 [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

llvm-svn: 347954
2018-11-30 03:39:58 +00:00
Artem Dergachev bbc6d68297 [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

llvm-svn: 347953
2018-11-30 03:27:50 +00:00
George Karpenkov 4908f9c0d0 [analyzer] Fixes after rebase.
llvm-svn: 347951
2018-11-30 02:19:29 +00:00
George Karpenkov 2620c60545 [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

llvm-svn: 347950
2018-11-30 02:19:16 +00:00
George Karpenkov 2bd644ebbd [analyzer] RetainCountChecker: recognize that OSObject can be created directly using an operator "new"
Differential Revision: https://reviews.llvm.org/D55076

llvm-svn: 347949
2018-11-30 02:19:03 +00:00
George Karpenkov b43772d85c [analyzer] Switch retain count checker for OSObject to use OS_* attributes
Instead of generalized reference counting annotations.

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

llvm-svn: 347948
2018-11-30 02:18:50 +00:00
George Karpenkov 1657f36c7f [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

llvm-svn: 347947
2018-11-30 02:18:37 +00:00
George Karpenkov 62db886062 [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

llvm-svn: 347946
2018-11-30 02:18:23 +00:00
George Karpenkov 3bdbeb155b [analyzer] For OSObject, trust that functions starting with Get
(uppercase) are also getters.

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

llvm-svn: 347945
2018-11-30 02:18:10 +00:00
George Karpenkov e2f09542a5 [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

llvm-svn: 347944
2018-11-30 02:17:57 +00:00
George Karpenkov f893ea1592 [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

llvm-svn: 347943
2018-11-30 02:17:44 +00:00
George Karpenkov a1c3bb88ee [analyzer] Reference leaked object by name, even if it was created in an inlined function.
rdar://45532181

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

llvm-svn: 347942
2018-11-30 02:17:31 +00:00
George Karpenkov 58c3837ee3 [analyzer] [NFC] Test dumping trimmed graph
Differential Revision: https://reviews.llvm.org/D54972

llvm-svn: 347941
2018-11-30 02:17:18 +00:00
George Karpenkov b3303d7c1d [analyzer] [NFC] Some miscellaneous clean ups and documentation fixes.
Differential Revision: https://reviews.llvm.org/D54971

llvm-svn: 347940
2018-11-30 02:17:05 +00:00
Adrian Prantl 55fcb4e90e [-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

llvm-svn: 347926
2018-11-29 22:33:09 +00:00
Alexey Bataev 3ce5d827fc [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.

llvm-svn: 347919
2018-11-29 21:21:32 +00:00
Gheorghe-Teodor Bercea 2b40470c61 [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

llvm-svn: 347915
2018-11-29 20:53:49 +00:00
Stephen Kelly d6248978fb Revert "NFC: Fix case of CommentVisitor::Visit methods"
This reverts commit 0859c80137ac5fb3c86e7802cb8c5ef56f921cce.

llvm-svn: 347905
2018-11-29 19:50:10 +00:00
Stephen Kelly 57cf0c5b4c NFC: Fix case of CommentVisitor::Visit methods
This difference is very visible because it is used with other Visitor
classes together.

llvm-svn: 347901
2018-11-29 19:31:32 +00:00
Stephen Kelly 27e948c639 NFC: Move ColorScope to global scope
llvm-svn: 347900
2018-11-29 19:30:37 +00:00
Stephen Kelly e66308b0da NFC: Constify ShowColors
llvm-svn: 347899
2018-11-29 19:30:08 +00:00
Zhizhou Yang 514a647433 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

llvm-svn: 347897
2018-11-29 18:52:22 +00:00
Fangrui Song b74d636897 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

llvm-svn: 347895
2018-11-29 18:26:39 +00:00
Teresa Johnson e849e59c9d Add missing REQUIRES to new test
Test added in r347887 requires an x86 target.

llvm-svn: 347892
2018-11-29 18:02:31 +00:00
Kristof Umann 8de6062010 [analyzer][PlistMacroExpansion] Part 4.: Support for __VA_ARGS__
Differential Revision: https://reviews.llvm.org/D52986

llvm-svn: 347888
2018-11-29 17:09:41 +00:00
Teresa Johnson 5ed8b00d14 [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

llvm-svn: 347887
2018-11-29 17:02:59 +00:00
Matt Arsenault 4fb02effcc 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.

llvm-svn: 347873
2018-11-29 15:45:05 +00:00
David Callahan 63c77fd46e 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

llvm-svn: 347870
2018-11-29 14:57:14 +00:00
Anastasia Stulova 6a4c34689e [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

llvm-svn: 347865
2018-11-29 14:11:15 +00:00
Raphael Isemann ddedf0f9bb 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

llvm-svn: 347863
2018-11-29 13:50:30 +00:00
Kristina Brooks 77a4adc4f9 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

llvm-svn: 347833
2018-11-29 03:49:14 +00:00
Erich Keane a3e7a167c4 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
llvm-svn: 347812
2018-11-28 21:54:04 +00:00
Adrian Prantl c9f2473b43 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.

llvm-svn: 347810
2018-11-28 21:44:06 +00:00
Paul Robinson 416b12f776 [DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags.
Differential Revision: https://reviews.llvm.org/D54756

llvm-svn: 347807
2018-11-28 21:18:07 +00:00
Erich Keane 7304f0a66e 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
llvm-svn: 347805
2018-11-28 20:58:43 +00:00
Vedant Kumar 83db1d219e [Coverage] Specify the Itanium ABI triple for a C++ test
llvm-svn: 347804
2018-11-28 20:51:09 +00:00
Vedant Kumar 7225a26176 [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.

llvm-svn: 347803
2018-11-28 20:48:07 +00:00
Davide Italiano faee83d102 Revert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."
This broke the lldb bots.

llvm-svn: 347794
2018-11-28 19:15:23 +00:00
Alexey Bataev 719713ab7d [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.

llvm-svn: 347793
2018-11-28 19:00:07 +00:00
Erich Keane 5c0d1925e3 [NFC] Move MultIversioning::Type into Decl so that it can be used in
CodeGen

Change-Id: I32b14edca3501277e0e65672eafe3eea38c6f9ae
llvm-svn: 347791
2018-11-28 18:34:14 +00:00
Mikhail R. Gadelha ad320ae3e2 [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

llvm-svn: 347777
2018-11-28 17:22:49 +00:00
Hans Wennborg 48ee4ad325 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.

llvm-svn: 347756
2018-11-28 14:04:12 +00:00
Balazs Keri deaf7ab810 [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

llvm-svn: 347752
2018-11-28 13:21:26 +00:00
Richard Smith dab73ce1dc PR39809: (const void*)0 is not a null pointer constant in C.
llvm-svn: 347730
2018-11-28 06:25:06 +00:00
Richard Smith 02a84c8d0c PR12884: Add test (bug is already fixed).
llvm-svn: 347729
2018-11-28 05:15:46 +00:00
Richard Trieu 0614cff40d 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.

llvm-svn: 347728
2018-11-28 04:36:31 +00:00
Richard Trieu 994b8bef4d [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.

llvm-svn: 347727
2018-11-28 04:14:29 +00:00
Richard Trieu 8e0e80fc9f [diagtool] Remove unneeded header includes.
llvm-svn: 347726
2018-11-28 03:59:35 +00:00
Kelvin Li a8d2217ac7 [OPENMP] remove redundant ColonExpected flag in ParseOpenMP.cpp (NFC)
The flag ColonExpected is not changed after being initialized to 
false at declaration.

Patch by Ahsan Saghir

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

llvm-svn: 347723
2018-11-28 00:51:08 +00:00
Mandeep Singh Grang c77dd514ad [RISCV] Mark unit tests as "requires: riscv-registered-target"
Some of these tests break if the RISCV backend has not been built.

Reland D54816.

llvm-svn: 347720
2018-11-27 22:53:57 +00:00
Tatyana Krasnukha 0b96fda9f5 Fix typo in "[clang][ARC] Fix test for commit r347699"
llvm-svn: 347718
2018-11-27 22:22:33 +00:00
Alexey Bataev a116602475 [OPENMP][NVPTX]Basic support for reductions across the teams.
Added basic codegen support for the reductions across the teams.

llvm-svn: 347715
2018-11-27 21:24:54 +00:00
Reid Kleckner 229eee49fc [MS] Push outermost class DeclContexts only in -fdelayed-template-parsing
This is more or less a complete rewrite of r347627, and it fixes PR38460
I added a reduced test case to DelayedTemplateParsing.cpp.

llvm-svn: 347713
2018-11-27 21:20:42 +00:00
Tatyana Krasnukha a82303352a [clang][ARC] Fix test for commit r347699
llvm-svn: 347705
2018-11-27 20:56:30 +00:00
Zola Bridges cbac3ad122 [clang][slh] add attribute for speculative load hardening
Summary:
Resubmit this with no changes because I think the build was broken
by a different diff.
-----
The prior diff had to be reverted because there were two tests
that failed. I updated the two tests in this diff

clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaCXX/attr-speculative-load-hardening.cpp

----- Summary from Previous Diff (Still Accurate) -----

LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function basis.

This can be applied to functions and Objective C methods.

Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

Subscribers: llvm-commits

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

llvm-svn: 347701
2018-11-27 19:56:46 +00:00
Tatyana Krasnukha f8c264e02e [clang][ARC] Add ARCTargetInfo
Based-on-patch-by: Pete Couperus <petecoup@synopsys.com>

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

llvm-svn: 347699
2018-11-27 19:52:10 +00:00
Richard Smith c195c25b22 Don't speculatively emit VTTs for classes unless we are able to correctly emit references to all the functions they will (directly or indirectly) reference.
Summary:
This fixes a miscompile where we'd emit a VTT for a class that ends up
referencing an inline virtual member function that we can't actually
emit a body for (because we never instantiated it in the current TU),
which in a corner case of a corner case can lead to link errors.

Reviewers: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 347692
2018-11-27 19:33:49 +00:00
Mandeep Singh Grang 02d3ca89bd Revert "[RISCV] Mark unit tests as "requires: riscv-registered-target""
This reverts commit 1a6a0c9ea2716378d55858c11adf5941608531f8.

llvm-svn: 347689
2018-11-27 19:13:52 +00:00
Mandeep Singh Grang bca7192462 [RISCV] Mark unit tests as "requires: riscv-registered-target"
Summary: Some of these tests break if the RISCV backend has not been built.

Reviewers: asb, apazos, sabuasal

Reviewed By: sabuasal

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, cfe-commits

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

llvm-svn: 347688
2018-11-27 19:13:13 +00:00
Balazs Keri 4a3d758ae4 [ASTImporter] Added Import functions for transition to new API.
Summary:
These Import_New functions should be used in the ASTImporter,
and the old Import functions should not be used. Later the
Import_New should be renamed to Import again and the old Import
functions must be removed. But this can happen only after LLDB
was updated to use the new Import interface.

This commit is only about introducing the new Import_New
functions. These are not implemented now, only calling the old
Import ones.

Reviewers: shafik, rsmith, a_sidorin, a.sidorin

Reviewed By: a_sidorin

Subscribers: spyffe, a_sidorin, gamesh411, shafik, rsmith, dkrupp, martong, Szelethus, cfe-commits

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

llvm-svn: 347685
2018-11-27 18:36:31 +00:00
Craig Topper 5bb1bf6ff5 [X86] Add -march=cascadelake support in clang.
This is skylake-avx512 with the addition of avx512vnni ISA.

Patch by Jianping Chen

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

llvm-svn: 347682
2018-11-27 18:05:14 +00:00
Marco Castelluccio 9123bfddd7 Fix linker option for -fprofile-arcs -ftest-coverage
Summary:
Linux toolchain accidentally added "-u__llvm_runtime_variable" when "-fprofile-arcs -ftest-coverage", this is not added when "--coverage" option is used.
Using "-u__llvm_runtime_variable" generates an empty default.profraw file while an application built with  "-fprofile-arcs -ftest-coverage" is running. 

Reviewers: calixte, marco-c, sylvestre.ledru

Reviewed By: marco-c

Subscribers: vsk, cfe-commits

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

llvm-svn: 347677
2018-11-27 17:31:08 +00:00
Jonas Toth 1b2ead17d6 Revert "[clang] - Simplify tools::SplitDebugName."
This reverts commit r347035 as it introduced assertion failures under
certain conditions. More information can be found here:
https://reviews.llvm.org/rL347035

llvm-svn: 347676
2018-11-27 17:28:38 +00:00
Marco Antognini 06d9d070c7 Derive builtin return type from its definition
Summary:
Prior to this patch, OpenCL code such as the following would attempt to create
a BranchInst with a non-bool argument:

    if (enqueue_kernel(get_default_queue(), 0, nd, ^(void){})) /* ... */

This patch is a follow up on a similar issue with pipe builtin
operations. See commit r280800 and https://bugs.llvm.org/show_bug.cgi?id=30219.

This change, while being conservative on non-builtin functions,
should set the type of expressions invoking builtins to the
proper type, instead of defaulting to `bool` and requiring
manual overrides in Sema::CheckBuiltinFunctionCall.

In addition to tests for enqueue_kernel, the tests are extended to
check other OpenCL builtins.

Reviewers: Anastasia, spatel, rsmith

Reviewed By: Anastasia

Subscribers: kristina, cfe-commits, svenvh

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

llvm-svn: 347658
2018-11-27 14:54:58 +00:00
Hans Wennborg 8c79706e89 Revert r347417 "Re-Reinstate 347294 with a fix for the failures."
This caused a miscompile in Chrome (see crbug.com/908372) that's
illustrated by this small reduction:

  static bool f(int *a, int *b) {
    return !__builtin_constant_p(b - a) || (!(b - a));
  }

  int arr[] = {1,2,3};

  bool g() {
    return f(arr, arr + 3);
  }

  $ clang -O2 -S -emit-llvm a.cc -o -

g() should return true, but after r347417 it became false for some reason.

This also reverts the follow-up commits.

r347417:
> Re-Reinstate 347294 with a fix for the failures.
>
> Don't try to emit a scalar expression for a non-scalar argument to
> __builtin_constant_p().
>
> Third time's a charm!

r347446:
> The result of is.constant() is unsigned.

r347480:
> A __builtin_constant_p() returns 0 with a function type.

r347512:
> isEvaluatable() implies a constant context.
>
> Assume that we're in a constant context if we're asking if the expression can
> be compiled into a constant initializer. This fixes the issue where a
> __builtin_constant_p() in a compound literal was diagnosed as not being
> constant, even though it's always possible to convert the builtin into a
> constant.

r347531:
> A "constexpr" is evaluated in a constant context. Make sure this is reflected
> if a __builtin_constant_p() is a part of a constexpr.

llvm-svn: 347656
2018-11-27 14:01:40 +00:00
Ivan Donchevskii 60b7103ce8 [libclang] Fix clang_Cursor_getNumArguments and clang_Cursor_getArgument for CXXConstructExpr
Constructors have the same methods for arguments as call expressions.
Let's provide a way to get their arguments the same way.

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

llvm-svn: 347654
2018-11-27 12:02:39 +00:00
Gabor Marton b93baf65c0 [ASTImporter] Typedef import brings in the complete type
Summary:
When we already have an incomplete underlying type of a typedef in the
"To" context, and the "From" context has the same typedef, but the
underlying type is complete, then the imported type should be complete.

Fixes an assertion in CTU analysis of Xerces:
Assertion `DD && "queried property of class with no definition"' failed.
This assert is happening in the analyzer engine, because that attempts
to query an underlying type of a typedef, which happens to be
incomplete.

Reviewers: a_sidorin, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

llvm-svn: 347648
2018-11-27 09:51:36 +00:00
Reid Kleckner 0bbbc55182 [docs] UBSan and ASan are supported on Windows
Also fix a bullet list.

Fixes PR39775

llvm-svn: 347633
2018-11-27 03:55:15 +00:00
Reid Kleckner 0ef5843dcc Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing"
It broke the Windows self-host:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1799/steps/stage%202%20build/logs/stdio

I can build
lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/MachinePostDominators.cpp.obj to
repro.

llvm-svn: 347630
2018-11-27 02:54:17 +00:00
Kristof Umann 08d92e4a10 [analyzer][PlistMacroExpansion] Part 3.: Macro arguments are expanded
This part focuses on expanding macro arguments.

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

llvm-svn: 347629
2018-11-27 02:28:23 +00:00
Zola Bridges 0b35afd79d Revert "[clang][slh] add attribute for speculative load hardening"
until I figure out why the build is failing or timing out

***************************

Summary:
The prior diff had to be reverted because there were two tests
that failed. I updated the two tests in this diff

clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaCXX/attr-speculative-load-hardening.cpp

LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function
basis.

This can be applied to functions and Objective C methods.

Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

Subscribers: llvm-commits

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

This reverts commit a5b3c232d1e3613f23efbc3960f8e23ea70f2a79.
(r347617)

llvm-svn: 347628
2018-11-27 02:22:00 +00:00
Reid Kleckner 5cec19dc1a [MS] Push fewer DeclContexts for delayed template parsing
Only push the outermost record as a DeclContext when parsing a function
body. See the comments in Sema::getContainingDC about the way the parser
pushes contexts. This is intended to match the behavior the parser
normally displays where it parses all method bodies from all nested
classes at the end of the outermost class, when all nested classes are
complete.

Fixes PR38460.

llvm-svn: 347627
2018-11-27 02:21:51 +00:00
Zola Bridges 3b47649fa8 [clang][slh] add attribute for speculative load hardening
Summary:
The prior diff had to be reverted because there were two tests
that failed. I updated the two tests in this diff

clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaCXX/attr-speculative-load-hardening.cpp

----- Summary from Previous Diff (Still Accurate) -----

LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function basis.

This can be applied to functions and Objective C methods.

Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

Subscribers: llvm-commits

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

llvm-svn: 347617
2018-11-27 00:03:44 +00:00
Zola Bridges e8e8c5cf4d Revert "[clang][slh] add attribute for speculative load hardening"
This reverts commit 801eaf91221ba6dd6996b29ff82659ad6359e885.

llvm-svn: 347588
2018-11-26 20:11:18 +00:00
Zola Bridges b0fd2db8fc [clang][slh] add attribute for speculative load hardening
Summary:
LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function basis.

This can be applied to functions and Objective C methods.

Reviewers: chandlerc, echristo

Subscribers: llvm-commits

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

llvm-svn: 347586
2018-11-26 19:41:14 +00:00
Alexey Bataev e8ad4b7124 [OPENMP][NVPTX]Emit default locations with the correct Exec|Runtime
modes.

If the region is inside target|teams|distribute region, we can emit the
locations with the correct info for execution mode and runtime mode.
Patch adds this ability to the NVPTX codegen to help the optimizer to
produce better code.

llvm-svn: 347583
2018-11-26 18:37:09 +00:00
Zola Bridges c866679a9b [clang][slh] Forward mSLH only to Clang CC1
Summary:
-mno-speculative-load-hardening isn't a cc1 option, therefore,
before this change:

clang -mno-speculative-load-hardening hello.cpp

would have the following error:

error: unknown argument: '-mno-speculative-load-hardening'

This change will only ever forward -mspeculative-load-hardening
which is a CC1 option based on which flag was passed to clang.

Also added a test that uses this option that fails if an error like the
above is ever thrown.

Thank you ericwf for help debugging and fixing this error.

Reviewers: chandlerc, EricWF

Subscribers: llvm-commits

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

llvm-svn: 347582
2018-11-26 18:13:31 +00:00
Sam Parker 000fbab01c [NFC] Replace magic numbers with CodeGenOpt enums
Use enum values from llvm/Support/CodeGen.h for the optimisation
levels in CompilerInvocation.

llvm-svn: 347577
2018-11-26 17:26:49 +00:00
Sander de Smalen 44a2253a54 [AArch64] Add aarch64_vector_pcs function attribute to Clang
This is the Clang patch to complement the following LLVM patches:
  https://reviews.llvm.org/D51477
  https://reviews.llvm.org/D51479

More information describing the vector ABI and procedure call standard
can be found here:

https://developer.arm.com/products/software-development-tools/\
                          hpc/arm-compiler-for-hpc/vector-function-abi

Patch by Kerry McLaughlin.

Reviewed By: rjmccall

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

llvm-svn: 347571
2018-11-26 16:38:37 +00:00
Gabor Marton 17d39677e0 [ASTImporter][Structural Eq] Check for isBeingDefined
Summary:
If one definition is currently being defined, we do not compare for
equality and we assume that the decls are equal.

Reviewers: a_sidorin, a.sidorin, shafik

Reviewed By: a_sidorin

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

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

llvm-svn: 347564
2018-11-26 15:54:08 +00:00
Ilya Biryukov a622484fa6 [Index] Expose USR generation for types
Summary: Used in clangd.

Reviewers: sammccall, ioeric

Reviewed By: sammccall

Subscribers: kadircet, cfe-commits

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

llvm-svn: 347558
2018-11-26 15:24:48 +00:00
Nemanja Ivanovic 2447baff84 [PowerPC] Vector load/store builtins overstate alignment of pointers
A number of builtins in altivec.h load/store vectors from pointers to scalar
types. Currently they just cast the pointer to a vector pointer, but expressions
like that have the alignment of the target type. Of course, the input pointer
did not have that alignment so this triggers UBSan (and rightly so).

This resolves https://bugs.llvm.org/show_bug.cgi?id=39704

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

llvm-svn: 347556
2018-11-26 14:35:38 +00:00
Sylvestre Ledru 72c5fcf088 Create a diagnostic group for warn_call_to_pure_virtual_member_function_from_ctor_dtor, so it can be turned into an error using Werror
Summary: Patch by Arnaud Bienner

Reviewers: davide, rsmith, jkorous

Reviewed By: jkorous

Subscribers: jkorous, sylvestre.ledru, cfe-commits

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

llvm-svn: 347555
2018-11-26 14:29:48 +00:00
Bill Wendling 372b1e796b A "constexpr" is evaluated in a constant context. Make sure this is reflected
if a __builtin_constant_p() is a part of a constexpr.

llvm-svn: 347531
2018-11-26 02:10:53 +00:00
Fangrui Song de314b39cf [CodeComplete] Simplify CodeCompleteConsumer.cpp, NFC
Use range-based for loops
Use XStr.compare(YStr) < 0
Format misaligned code

llvm-svn: 347529
2018-11-25 20:57:05 +00:00
Sanjay Patel c6fa5bc7c7 [CodeGen] translate MS rotate builtins to LLVM funnel-shift intrinsics
This was originally part of:
D50924

and should resolve PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387

...but it was reverted because some bots using a gcc host compiler 
would crash for unknown reasons with this included in the patch. 
Trying again now to see if that's still a problem.

llvm-svn: 347527
2018-11-25 17:53:16 +00:00
Kristof Umann e0466f570e [analyzer] INT50-CPP. Do not cast to an out-of-range enumeration checker
This checker implements a solution to the "INT50-CPP. Do not cast to an
out-of-range enumeration value" rule [1].
It lands in alpha for now, and a number of followup patches are planned in order
to enable it by default.

[1] https://www.securecoding.cert.org/confluence/display/cplusplus/INT50-CPP.+Do+not+cast+to+an+out-of-range+enumeration+value

Patch by: Endre Fülöp and Alexander Zaitsev!

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

llvm-svn: 347513
2018-11-24 12:24:27 +00:00
Bill Wendling 1af8dd6a1e isEvaluatable() implies a constant context.
Assume that we're in a constant context if we're asking if the expression can
be compiled into a constant initializer. This fixes the issue where a
__builtin_constant_p() in a compound literal was diagnosed as not being
constant, even though it's always possible to convert the builtin into a
constant.

llvm-svn: 347512
2018-11-24 10:45:55 +00:00
Fangrui Song 0b9d1b7433 [CodeComplete] Delete unused variable in rC342449
llvm-svn: 347508
2018-11-24 00:41:13 +00:00
Fangrui Song 050229df09 [CodeComplete] Format SemaCodeComplete.cpp and improve code consistency
There are some mis-indented places and missing spaces here and there. Just format the whole file.

Also, newer code (from 2014 onwards) in this file prefers const auto *X = dyn_cast to not repeat the Decl type name. Make other occurrences consistent.
Remove two anonymous namespaces that are not very necessary: 1) a typedef 2) a local function (should use static)

llvm-svn: 347507
2018-11-24 00:14:31 +00:00
Benjamin Kramer da113f3202 Remove the optional dependency from libclang to clang-tidy/include-fixer
clangd does a better job on both of these, so don't slow down everyone's build
for a poorly working libclang feature.

llvm-svn: 347496
2018-11-23 15:02:33 +00:00
Bill Wendling 46acc72cf4 A __builtin_constant_p() returns 0 with a function type.
llvm-svn: 347480
2018-11-22 22:58:06 +00:00
Krasimir Georgiev 56904bf8a7 [clang-format] Do not treat asm clobber [ as ObjCExpr, refined
Summary:
r346756 refined clang-format to not treat the `[` in `asm (...: [] ..)` as an
ObjCExpr. However that's not enough, as we might have a comma-separated list of
such clobbers as in the newly added test.
This updates the detection to instead look at the Line's first token being `asm`
and not mark `[`-s as ObjCExprs in this case.

Reviewers: djasper, benhamilton

Reviewed By: djasper, benhamilton

Subscribers: benhamilton, cfe-commits

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

llvm-svn: 347465
2018-11-22 14:49:55 +00:00
Clement Courbet a6144db15f Revert rL347462 "[ASTMatchers] Add hasSideEffect() matcher."
Breaks some buildbots.

llvm-svn: 347463
2018-11-22 14:26:33 +00:00
Clement Courbet c022c51f89 [ASTMatchers] Add hasSideEffect() matcher.
Summary: Exposes Expr::HasSideEffects.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 347462
2018-11-22 14:00:56 +00:00
Clement Courbet 314cfb539b [ASTMatchers] Re-generate ast matchers doc after rL346455.
llvm-svn: 347453
2018-11-22 10:44:36 +00:00
Bill Wendling 2a6c59ea2a The result of is.constant() is unsigned.
llvm-svn: 347446
2018-11-22 09:31:08 +00:00
Petr Hosek da91431842 [Driver] Support XRay on Fuchsia
This enables support for XRay in Fuchsia Clang driver.

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

llvm-svn: 347444
2018-11-22 02:36:47 +00:00
Petr Hosek fd6a8abd08 Revert "[Driver] Use --push/pop-state with Sanitizer link deps"
This reverts commit r347413: older versions of ld.gold that are used
by Android don't support --push/pop-state which broke sanitizer bots.

llvm-svn: 347430
2018-11-21 21:59:39 +00:00
Alexey Bataev ceeaa48052 [OPENMP][NVPTX]Emit default locations as constant with undefined mode.
For the NVPTX target default locations should be emitted as constants +
additional info must be emitted in the reserved_2 field of the ident_t
structure. The 1st bit controls the execution mode and the 2nd bit
controls use of the lightweight runtime. The combination of the bits for
Non-SPMD mode + lightweight runtime represents special undefined mode,
used outside of the target regions for orphaned directives or functions.
Should allow and additional optimization inside of the target regions.

llvm-svn: 347425
2018-11-21 21:04:34 +00:00
Bill Wendling 6ff1751f7d Re-Reinstate 347294 with a fix for the failures.
Don't try to emit a scalar expression for a non-scalar argument to
__builtin_constant_p().

Third time's a charm!

llvm-svn: 347417
2018-11-21 20:44:18 +00:00
Petr Hosek 584d935351 [Driver] Use --push/pop-state with Sanitizer link deps
Sanitizer runtime link deps handling passes --no-as-needed because of
PR15823, but it never undoes it and this flag may affect other libraries
that come later on the link line. To avoid this, wrap Sanitizer link
deps in --push/pop-state.

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

llvm-svn: 347413
2018-11-21 20:33:12 +00:00
Kelvin Li e050275afb [OPENMP] Refactor code for parsing omp declare target directive and its clauses (NFC)
This patch refactor the code for parsing omp declare target directive and
its clauses.

Patch by pjeeva01 (Jeeva P.)
    
Differential Revision: https://reviews.llvm.org/D54708

llvm-svn: 347411
2018-11-21 20:15:57 +00:00
Alexey Bataev 92b33652f6 [OPENMP]Fix handling of the LCVs in loop-based directives.
Loop-control variables with the default data-sharing attributes should
not be captured in the OpenMP region as they are private by default.
Also, default attributes should be emitted for such variables in the
inner OpenMP regions for the correct data sharing during codegen.

llvm-svn: 347409
2018-11-21 19:41:10 +00:00
Kelvin Li da6bc702d0 [OPENMP] remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp (NFC)
Whether the map type modifier is specified or not, the flag 
MapTypeModifierSpecified is always set to true.

Patch by Ahsan Saghir
    
Differential Revision: https://reviews.llvm.org/D54638

llvm-svn: 347408
2018-11-21 19:38:53 +00:00
Kelvin Li efbe4afbda [OPENMP] Support relational-op != (not-equal) as one of the canonical
forms of random access iterator
    
In OpenMP 4.5, only 4 relational operators are supported: <, <=, >, 
and >=.  This work is to enable support for relational operator 
!= (not-equal) as one of the canonical forms.

Patch by Anh Tuyen Tran
    
Differential Revision: https://reviews.llvm.org/D54441

llvm-svn: 347405
2018-11-21 19:10:48 +00:00
Jorge Gorbe Moya 59974412a4 Mark lambda decl as invalid if a captured variable has an invalid type.
This causes the compiler to crash when trying to compute a layout for
the lambda closure type (see included test).

llvm-svn: 347402
2018-11-21 17:49:37 +00:00
Nico Weber 9f0246d473 Revert r347364 again, the fix was incomplete.
llvm-svn: 347389
2018-11-21 12:47:43 +00:00
Petr Hosek a676d7ee95 [Driver] Link sanitizer runtime deps on Fuchsia when needed
Even though these deps weren't needed, this makes Fuchsia driver
better match other drivers, and it may be necessary when trying to
use different C libraries on Fuchsia.

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

llvm-svn: 347378
2018-11-21 04:33:44 +00:00
Alexander Kornienko b2ac7eec42 clang::tooling::Diagnostic: Don't store offset in the scratch space.
These offsets are useless (and even harmful in certain cases) in exported
diagnostics. The test will be added to clang-tidy, since it's the main user of
the clang::tooling::Diagnostic class.

llvm-svn: 347372
2018-11-21 01:08:46 +00:00
Alexander Kornienko af17a3866b Implement YAML serialization of notes in clang::tooling::Diagnostic.
llvm-svn: 347371
2018-11-21 01:06:32 +00:00
Bill Wendling 91549ed15f Reinstate 347294 with a fix for the failures.
EvaluateAsInt() is sometimes called in a constant context. When that's the
case, we need to specify it as so.

llvm-svn: 347364
2018-11-20 23:24:16 +00:00
Sam McCall 8e9baa3f17 [CodeComplete] Penalize inherited ObjC properties for auto-completion
Summary:
Similar to auto-completion for ObjC methods, inherited properties
should be penalized / direct class and category properties should
be prioritized.

Note that currently, the penalty for using a result from a base class
(CCD_InBaseClass) is equal to the penalty for using a method as a
property (CCD_MethodAsProperty).

Reviewers: jkorous, sammccall, akyrtzi, arphaman, benlangmuir

Reviewed By: sammccall, akyrtzi

Subscribers: arphaman, cfe-commits

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

llvm-svn: 347352
2018-11-20 22:06:54 +00:00
Joel E. Denny 435c739fbe [OpenMP] Update CHECK-DAG usage in target_parallel_codegen.cpp
This patch adjusts a test not to depend on deprecated FileCheck
behavior that permits overlapping matches within a block of CHECK-DAG
directives.  Thus, this patch also removes uses of FileCheck's
-allow-deprecated-dag-overlap command-line option.

There were two issues in this test:

1. There were sets of patterns for store instructions in which a
pattern X could match a superset of a pattern Y.  While X appeared
before Y, Y's intended match appeared before X's intended match.  The
result was that X matched Y's intended match.  Under the old
overlapping behavior, Y also matched Y's intended match.  Under the
new non-overlapping behavior, Y had nothing left to match.  This patch
fixes this by gathering these sets in one place and putting the most
specific patterns (Y) before the more general patterns (X).

2. The CHECK-DAG patterns involving the variables CBPADDR3 and
CBPADDR4 were the same, but there was only one match in the text, so
CBPADDR4 patterns had nothing to match under the new non-overlapping
behavior.  Moreover, a preceding related series of directives had
variables (SADDR0, BPADDR0, etc.) numbered only 0 through 4, but this
series had variables numbered 0 through 5.  Assuming CBPADDR4's
directives were not intended, this patch removes them.

Reviewed By: ABataev

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

llvm-svn: 347351
2018-11-20 22:05:23 +00:00