Commit Graph

71138 Commits

Author SHA1 Message Date
Alex Lorenz bbe51d86ec [ObjC++] Don't warn about pessimizing move for __block variables
rdar://33316951

llvm-svn: 317620
2017-11-07 21:40:11 +00:00
Mitch Phillips 512fa40b3e Update SanitizerSpecialCaseList to use renamed functions in base class.
Note: This change has a cyclical dependency on D39485. Both these changes must be submitted at the same time to avoid a build breakage.

Reviewers: vlad.tsyrklevich

Subscribers: llvm-commits

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

llvm-svn: 317616
2017-11-07 21:16:37 +00:00
Sriraman Tallam 5c65148565 New clang option -fno-plt which avoids the PLT and lazy binding while making external calls.
Differential Revision: https://reviews.llvm.org/D39079

llvm-svn: 317605
2017-11-07 19:37:51 +00:00
Alex Lorenz f4bf4227b7 [refactor] rename field references in __builtin_offsetof
rdar://33875453

llvm-svn: 317599
2017-11-07 18:30:23 +00:00
George Rokos 065755d23d Clang/libomptarget map interface flag renaming - NFC patch
This patch renames some of the flag names of the clang/libomptarget map interface. The old names are slightly misleading, whereas the new ones describe in a better way what each flag is about.

Only the macros within the enumeration are renamed, there is no change in functionality therefore there are no updated regression tests.

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

llvm-svn: 317598
2017-11-07 18:27:04 +00:00
Alex Lorenz 1c628e3c3e [index] __builtin_offset's field reference is located at the end location
The starting location is the location of the '.'

llvm-svn: 317596
2017-11-07 18:25:36 +00:00
Alex Lorenz 7b760095cb [index] index field references in __builtin_offset
rdar://35109556

llvm-svn: 317593
2017-11-07 17:29:11 +00:00
Arnold Schwaighofer 612d693c64 SystemZ Swift TargetInfo: swifterror support in the backend is broken
Return false for swifterror support until the backend is fixed.

llvm-svn: 317589
2017-11-07 16:40:51 +00:00
Sanjay Patel 040fbe3027 [CodeGen] split math and complex tests into separate files; NFCI
The files are already large, and we may need to add even more RUNs to 
distinguish differences based on OS, environment, or other platform things.

llvm-svn: 317583
2017-11-07 15:13:22 +00:00
Eric Liu c47fd014ae [clang-refactor] Use ClangTool more explicitly by making refaroing actions AST frontend actions.
Summary: This is a refactoring change. NFC

Reviewers: arphaman, hokein

Reviewed By: arphaman, hokein

Subscribers: cfe-commits

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

llvm-svn: 317577
2017-11-07 14:35:03 +00:00
Artem Dergachev 0b5b1f14fd [analyzer] pr34779: CStringChecker: Accept non-standard headers.
Do not crash when trying to define and call a non-standard
strcpy(unsigned char *, unsigned char *) during analysis.

At the same time, do not try to actually evaluate the call.

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

llvm-svn: 317565
2017-11-07 10:51:15 +00:00
Sjoerd Meijer 167f2e34d5 [docs] Add section 'Half-Precision Floating Point'
This documents the differences/interactions between _Float16 and __fp16
and is a companion change for the _Float16 type implementation (r312794).

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

llvm-svn: 317558
2017-11-07 10:09:45 +00:00
George Karpenkov 166548c0dc [analyzer] [NFC] Remove unused typedef from SVals.h
Differential Revision: https://reviews.llvm.org/D39620

llvm-svn: 317537
2017-11-07 02:02:10 +00:00
Alex Lorenz 4e30b96834 Clarify the error message for unsupported aliases on Darwin
rdar://35109556

llvm-svn: 317532
2017-11-07 00:31:19 +00:00
Devin Coughlin 046833e5fb [analyzer] Model correct dispatch_once() 'done' value in BodyFarm
The analyzer's BodyFarm models dispatch_once() by comparing the passed-in
predicate against a known 'done' value. If the predicate does not have that
value, the model updates the predicate to have that value and executes the
passed in block.

Unfortunately, the current model uses the wrong 'done' value: 1 instead of ~0.
This interferes with libdispatch's static inline function _dispatch_once(),
which enables a fast path if the block has already been executed. That function
uses __builtin_assume() to tell the compiler that the done flag is set to ~0 on
exit. When r302880 added modeling of __builtin_assume(), this caused the
analyzer to assume 1 == ~0. This in turn caused the analyzer to never explore any code after a call to dispatch_once().

This patch regains the missing coverage by updating BodyFarm to use the correct
'done' value.

rdar://problem/34413048

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

llvm-svn: 317516
2017-11-06 22:12:19 +00:00
Dave Lee f96bedfce3 Vary Windows toolchain selection by -fuse-ld
Summary:
This change allows binutils to be used for linking with MSVC. Currently, when
using an MSVC target and `-fuse-ld=bfd`, the driver produces an invalid linker
invocation.

Reviewers: rnk, compnerd

Reviewed By: compnerd

Subscribers: smeenai, cfe-commits

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

llvm-svn: 317511
2017-11-06 21:18:05 +00:00
Craig Topper 57f96ac6dc [X86] Replace the mask cmpeq/cmple/cmplt/cmpgt/cmpge/cmpneq intrinsics with macros that just pass the right comparison predicate value to the regular cmp intrinsic. Remove mask cmpeq/cmpgt builtins that are now unused.
This shortens the intrinsic headers a little and allows us to get rid of the cmpeq and cmpgt handling from CGBuiltin.cpp.

llvm-svn: 317506
2017-11-06 21:00:49 +00:00
Martin Storsjo b438ea3f1c [X86] Add 3dnow and 3dnowa to the list of valid target features
These were missed in SVN r316783, which broke compiling mingw-w64 CRT.

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

llvm-svn: 317504
2017-11-06 20:33:13 +00:00
Jan Korous 06aa2aff7b [Parser] Fix TryParseLambdaIntroducer() error handling
rdar://35066196

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

llvm-svn: 317493
2017-11-06 17:42:17 +00:00
Sanjay Patel 401aaee300 [CodeGen] match new fast-math-flag method: isFast()
This corresponds to LLVM commiti r317488:

If that commit is reverted, this commit will also need to be reverted.

llvm-svn: 317489
2017-11-06 16:27:36 +00:00
Daniel Jasper bbf5f4ecbc [clang-format] Handle unary operator overload with arguments and specifiers
Before:
  int operator++(int)noexcept;

After:
  int operator++(int) noexcept;

Patch by Igor Sugak. Thank you!

llvm-svn: 317473
2017-11-06 12:11:51 +00:00
Eric Liu 190afe955c [Tooling] Test internal::createExecutorFromCommandLineArgsImpl instead of the wrapper.
llvm-svn: 317466
2017-11-06 09:29:09 +00:00
Jina Nahias 48e298b8c4 lowering broadcastm
Change-Id: I0661abea3e3742860e0a03ff9e4fcdc367eff7db
llvm-svn: 317456
2017-11-06 07:04:12 +00:00
Adrian Prantl 131ab94008 Remove \brief from doxygen comments in PrettyPrinter.h
Patch by @xsga!

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

llvm-svn: 317443
2017-11-05 21:52:36 +00:00
Johannes Altmanninger a584beb9d7 [clang-diff] NFC: format
llvm-svn: 317434
2017-11-05 11:53:18 +00:00
Roman Lebedev d9af8e1f98 [Sema] Document+test the -Wsign-conversion change for enums in C code [NFC]
Basically a regression after r316268.
However the diagnostic is correct, but the test coverage is bad.

So just like rL316500, introduce yet more tests,
and adjust the release notes.

See https://bugs.llvm.org/show_bug.cgi?id=35200

llvm-svn: 317421
2017-11-04 20:27:47 +00:00
Aaron Ballman 3f8bad8626 Move the clang-tblgen-targets project into the Misc folder on IDEs like Visual Studio rather than leave it in the root directory. NFC.
llvm-svn: 317419
2017-11-04 20:06:49 +00:00
Aaron Ballman e89760cb29 Move the clang-tblgen project into the Clang tablegenning folder on IDEs like Visual Studio rather than leave it in the root directory. NFC.
llvm-svn: 317418
2017-11-04 20:06:22 +00:00
Aaron Ballman e7db01f0e0 Move the libclang-headers project into the Misc folder on IDEs like Visual Studio rather than leave it in the root directory. NFC.
llvm-svn: 317417
2017-11-04 20:00:21 +00:00
Sanjay Patel c919758075 [CodeGen] add remquo to list of recognized library calls
This is just an oversight because we already do recognize __builtin_remquo()
with the same signature.

http://en.cppreference.com/w/c/numeric/math/remquo
http://pubs.opengroup.org/onlinepubs/9699919799/functions/remquo.html

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

llvm-svn: 317407
2017-11-04 15:03:11 +00:00
Martell Malone b22e600484 CodeGenCXX: no default dllimport storage for mingw
GNU frontends don't have options like /MT, /MD
This fixes a few link error regressions with libc++ and libc++abi

Reviewers: rnk, mstorsjo, compnerd

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

llvm-svn: 317398
2017-11-04 02:15:49 +00:00
Martell Malone db5b34ce30 [Driver] MinGW: Remove custom linker detection
This is a re-apply of rL313082 which was reverted in rL313088

In rL289668 the ability to specify the default linker at compile time
was added but because the MinGW driver used custom detection we could
not take advantage of this new CMAKE flag CLANG_DEFAULT_LINKER.

rL289668 added no test cases and the mingw driver was either overlooked
or purposefully skipped because it has some custom linker tests
Removing them here because they are covered by the generic case.

Reviewers: rnk

Differntial Revision: https://reviews.llvm.org/D37727

llvm-svn: 317397
2017-11-04 02:07:59 +00:00
Richard Trieu 73cf924104 Update ODR hashing tests
Add a mix of postive and negative tests to check that wrong Decls won't be
flagged in the diagnostic.  Split the check everything test and moved the
pieces closer to where the related tests are.

llvm-svn: 317394
2017-11-04 01:20:50 +00:00
Eugene Zelenko 918e0ca77a [Basic] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 317381
2017-11-03 22:35:27 +00:00
Alex Lorenz 3cee7cfb30 Add -fcxx-exceptions for ExtractionSemicolonPolicy.cpp to appease PS4 bots
llvm-svn: 317372
2017-11-03 21:31:10 +00:00
Aaron Ballman 72f6563bb3 Replace a use of std::for_each() with llvm::for_each(); NFC.
llvm-svn: 317359
2017-11-03 20:09:17 +00:00
Alex Lorenz 3aae328318 Move Extract.cpp that wasn't moved in r317343
llvm-svn: 317344
2017-11-03 18:21:06 +00:00
Alex Lorenz ebbbb81266 [refactor][extract] insert semicolons into extracted/inserted code
when needed

This commit implements the semicolon insertion logic into the extract
refactoring. The following rules are used:

- extracting expression: add terminating ';' to the extracted function.
- extracting statements that don't require terminating ';' (e.g. switch): add
  terminating ';' to the callee.
- extracting statements with ';':  move (if possible) the original ';' from the
  callee and add terminating ';'.
- otherwise, add ';' to both places.

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

llvm-svn: 317343
2017-11-03 18:11:22 +00:00
Kostya Kortchinsky 8acdc98271 [Driver] Add Scudo as a possible -fsanitize= option
Summary:
This change adds Scudo as a possible Sanitizer option via -fsanitize=.
This allows for easier static & shared linking of the Scudo library, it allows
us to enforce PIE (otherwise the security of the allocator is moot), and check
for incompatible Sanitizers combo.

In its current form, Scudo is not compatible with any other Sanitizer, but the
plan is to make it work in conjunction with UBsan (-fsanitize=scudo,undefined),
which will require additional work outside of the scope of this change.

Reviewers: eugenis, kcc, alekseyshl

Reviewed By: eugenis, alekseyshl

Subscribers: llvm-commits, srhines

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

llvm-svn: 317337
2017-11-03 17:04:13 +00:00
Sanjay Patel 594d217502 [CodeGen] add libcall attr tests to show errno-related diffs; NFC
See rL317220 for the builtin siblings.

llvm-svn: 317336
2017-11-03 16:27:27 +00:00
Eric Liu 152ad05050 [Tooling] Fix linking of StandaloneToolExecutorPlugin.
llvm-svn: 317332
2017-11-03 15:57:27 +00:00
Eric Liu 6e6228477b [Tooling] Put createExecutorFromCommandLineArgs implementation in a wrapper. NFC
llvm-svn: 317328
2017-11-03 15:20:57 +00:00
Krasimir Georgiev c47fc31da1 [clang-format] Sort using-declarations case sensitively with a special case for '_'
Summary:
This makes clang-format sort using declarations case-sensitive with the
exception that '_' comes just before 'A'. This is better than the current case
insensitive version, because it groups uppercase names in the same namespace
together.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, klimek

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

llvm-svn: 317325
2017-11-03 14:38:07 +00:00
Erik Verbruggen 4d1eb2d5cb [preamble] Also record the "skipping" state of the preprocessor
When a preamble ends in a conditional preprocessor block that is being
skipped, the preprocessor needs to continue skipping that block when
the preamble is used.

This fixes PR34570.

llvm-svn: 317308
2017-11-03 09:40:07 +00:00
Justin Lebar 648f4cad52 [CUDA] Mark CUDA as a no-errno platform.
Summary:
CUDA doesn't support errno at all, so this is the right thing -- or at
least, in the right direction.

But also, this unbreaks the CUDA test-suite math tests [0] after D39481.
__cuda_cmath.h forwards nexttoward() to __builtin_nexttoward, which,
after that patch, was lowering to a libcall that doesn't exist in NVPTX.

[0] http://lab.llvm.org:8011/builders/clang-cuda-build/builds/14999

Reviewers: tra

Subscribers: sanjoy, cfe-commits

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

llvm-svn: 317297
2017-11-03 02:30:00 +00:00
Richard Smith e124612eda [c++17] Visit class template explicit specializations just like all other class definitions in codegen.
If an explicit specialization has a static data member, it may be a definition and we may need to register it for emission.

llvm-svn: 317296
2017-11-03 01:26:01 +00:00
George Karpenkov 85a34aa21e [analyzer] [NFC] very minor ExprEngineC refactoring
Differential Revision: https://reviews.llvm.org/D39577

llvm-svn: 317294
2017-11-03 00:41:29 +00:00
George Karpenkov 0354483013 [analyzer] do not crash on libcxx03 call_once implementation
Addresses https://bugs.llvm.org/show_bug.cgi?id=35075, rdar://35230961

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

llvm-svn: 317293
2017-11-03 00:36:03 +00:00
David Blaikie 1524e67feb Modular Codegen: Don't home always_inline functions
Since they'll likely (not always - if the address is taken, etc) be
inlined away, even at -O0, separately provided weak definitions are
likely to be unused so skip all of that.

llvm-svn: 317279
2017-11-02 22:28:50 +00:00
David Blaikie 0826729793 Modular Codegen: Don't home/modularize static functions in headers
Consistent with various workarounds in the backwards compatible modules
that allow static functions in headers to exist, be deduplicated to some
degree, and not generally fail right out of the gate... do the same with
modular codegen as there are enough cases (including in libstdc++ and in
LLVM itself - though I cleaned up the easy ones) that it's worth
supporting as a migration/backcompat step.

Simply create a separate, internal linkage function in each object that
needs it. If an available_externally/modularized function references a
static function, but the modularized function is eventually dropped and
not inlined, the static function will be dropped as unreferenced.

llvm-svn: 317274
2017-11-02 21:55:40 +00:00
Eugene Zelenko 4b3289e84f [Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 317273
2017-11-02 21:45:30 +00:00
Erich Keane a957ffbce3 Add default calling convention support for regcall.
Added support for regcall as default calling convention. Also added code to
exclude main when applying default calling conventions.

Patch-By: eandrews

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

llvm-svn: 317268
2017-11-02 21:08:00 +00:00
Sanjay Patel c5c8207eae [CodeGen] fix const-ness of builtin equivalents of <math.h> and <complex.h> functions that might set errno
This just makes const-ness of the builtins match const-ness of their lib function siblings. 
We're deferring fixing some of these that are obviously wrong to follow-up patches. 
Hopefully, the bugs are visible in the new test file (added at rL317220).

As the description in Builtins.def says: "e = const, but only when -fmath-errno=0".

This is step 2 of N to fix builtins and math calls as discussed in D39204.

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

llvm-svn: 317265
2017-11-02 20:39:26 +00:00
Alex Lorenz d44fdc2b66 revert r317228: remove unused function from ObjCRuntime.h, NFC
This function is actually used in LLDB

llvm-svn: 317231
2017-11-02 19:42:40 +00:00
Alex Lorenz a15c4deb7b remove unused function from ObjCRuntime.h, NFC
llvm-svn: 317228
2017-11-02 19:01:34 +00:00
Alexey Bataev 5d2c9a46fc [OPENMP] Fix PR35152: Do not use getInvokeDest() function for EH checks.
The compiler may crash under some conditions if the getInvokeDest() is
used, but later it is not used. Fixed this problem in OpenMP.

llvm-svn: 317227
2017-11-02 18:55:05 +00:00
Alex Lorenz 547e5ad0af [refactor][selection] canonicalize selected string literal to objc
string literal when possible

llvm-svn: 317224
2017-11-02 18:05:48 +00:00
Sanjay Patel 241b8f8fb0 [CodeGen] add builtin attr tests to show errno-related diffs; NFC
llvm-svn: 317220
2017-11-02 17:06:05 +00:00
Jan Korous c217b1b124 Fix comment typo
llvm-svn: 317216
2017-11-02 16:37:00 +00:00
Alexey Bataev 0e1b45897e [OPENMP] Fix PR35156: Get correct thread id with windows exceptions.
If the thread id is requested in windows mode within funclets, we may
generate incorrect function call that could lead to broken codegen.

llvm-svn: 317208
2017-11-02 14:25:34 +00:00
Jonas Hahnfeld 96087f3825 [OpenMP] Extend "Avoid VLAs for reduction" optimization to VLAs as base
We can generate constant sized arrays whenever the array section has constant
length, even if the base expression itself is a VLA.

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

llvm-svn: 317207
2017-11-02 13:30:42 +00:00
Eric Liu 35cbbdd9f4 Fix clang-format CLion integration bug.
CLion's Sax parser threw this error:

Failed to parse clang-format XML replacements. Input: <?xml version='1.0'?>
<replacements xml:space='preserve' incomplete_format='true' line=89>
[...]
[org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 66; Open quote is expected for attribute "line" associated with an  element type  "replacements".]

Patch by Justine Tunney (jart@google.com)!

llvm-svn: 317205
2017-11-02 12:48:48 +00:00
Jan Korous 205bcd0d54 Fix typo in class annotation
llvm-svn: 317200
2017-11-02 12:15:51 +00:00
Shoaib Meenai c37c747b2c [libclang] Add dummy libclang-headers target
`LLVM_DISTRIBUTION_COMPONENTS` assumes that each component has both
`component` and `install-component` targets. Add a dummy no-op target
for `libclang-headers` to placate this check.

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

llvm-svn: 317188
2017-11-02 05:04:00 +00:00
Shoaib Meenai 30e182d454 [clang-rename] Use add_clang_tool
`add_clang_tool` includes a call to `add_clang_executable`, but it also
sets up the install rule, and adds an `install-*` target. The latter is
required for using `LLVM_DISTRIBUTION_COMPONENTS`.

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

llvm-svn: 317150
2017-11-02 01:11:40 +00:00
Richard Smith f501759a85 PR33746: Store the 'inline'ness of a static data member with the update record
for instantiating its definition.

We model the 'inline'ness as being instantiated with the static data member in
order to track whether the declaration has become a definition yet.

llvm-svn: 317147
2017-11-02 01:06:00 +00:00
Saleem Abdulrasool 8f6d944721 CodeGen: simplify EH personality selection (NFC)
Fix a typo in the comment, reorder to ensure that the ordering matches
across the ObjC/ObjC++ cases.  NFCI.

llvm-svn: 317146
2017-11-02 00:25:40 +00:00
Richard Smith 4d629b8023 Fix missing -Wregister warning when 'register' is applied to a function parameter.
llvm-svn: 317140
2017-11-01 23:38:37 +00:00
Eugene Zelenko 06becf8f99 [ASTMatchers] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 317137
2017-11-01 23:09:49 +00:00
Krasimir Georgiev 87b42549ee [clang-format] Make parseUnaryOperator non-recursive, NFCI
Summary:
This patch makes the implementation of parseUnaryOperator non-recursive. We had
a problem with a file starting with tens of thousands of +'es and -'es which
caused clang-format to stack overflow.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, klimek

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

llvm-svn: 317113
2017-11-01 18:20:41 +00:00
NAKAMURA Takumi 1657f2ad99 Fix warnings discovered by rL317076. [-Wunused-private-field]
llvm-svn: 317091
2017-11-01 13:47:55 +00:00
NAKAMURA Takumi c206e449cc Reformat.
llvm-svn: 317089
2017-11-01 13:47:48 +00:00
Richard Smith a31174efe0 Fix -Wunused-private-field to fire regardless of which implicit special members have been implicitly declared.
llvm-svn: 317076
2017-11-01 04:52:12 +00:00
NAKAMURA Takumi 057a942d9e clang/lib/Format/Format.cpp: Fix warnings introduced in rL316903. [-Wpedantic]
llvm-svn: 317075
2017-11-01 04:43:22 +00:00
Richard Trieu 7f932dd063 Change assertion to quick exit from checking function.
Remove the assertion that could be triggered by invalid code.  Replace it with
an early exit from the checking function.

llvm-svn: 317073
2017-11-01 03:57:27 +00:00
George Karpenkov 050b53b311 [analyzer] Removing unused stored field.
llvm-svn: 317070
2017-11-01 02:29:04 +00:00
Craig Topper a2b907a469 [X86] Define i586 and pentium preprocessor defines for -march=lakemont to match GCC
llvm-svn: 317069
2017-11-01 02:18:49 +00:00
Richard Smith 5173136a96 [c++17] Refine resolution of constructor / conversion function disambiguation.
Given a choice between a constructor call and a conversion function in C++17,
we prefer the constructor for direct-initialization and the conversion function
for copy-initialization, matching the behavior in C++14 and before. The
guaranteed copy elision rules were not intended to change the meaning of such
code (other than by removing unnecessary copy constructor calls).

This tweak will be raised with CWG.

llvm-svn: 317066
2017-11-01 01:37:11 +00:00
George Karpenkov ed017b634c [Analyzer] Use value storage for BodyFarm
Differential Revision: https://reviews.llvm.org/D39428

llvm-svn: 317065
2017-11-01 01:36:01 +00:00
Alex Lorenz 61f2c3f58c [refactor][extract] code extracted from inline method should be placed
in a function defined before the outer class

llvm-svn: 317062
2017-11-01 01:12:56 +00:00
Alex Lorenz 1e416fe23d [refactor][extract] prohibit extraction of ObjC property setters
llvm-svn: 317056
2017-11-01 00:20:55 +00:00
Alex Lorenz 7cd48cd8a9 [refactor][selection] code ranges can be selected in objc methods
llvm-svn: 317054
2017-11-01 00:07:12 +00:00
Wolfgang Pieb 173b47ca05 Making a couple of tests a bit more flexible wrt thunk mangling. Fixes checkin for r317047.
llvm-svn: 317053
2017-11-01 00:01:20 +00:00
Benjamin Kramer 0e71fd1957 Make helper function static. NFC.
llvm-svn: 317052
2017-10-31 23:23:36 +00:00
Wolfgang Pieb a347c47f5d Fix for PR33930. Short-circuit metadata mapping when cloning a varargs thunk.
The cloning happens before all metadata nodes are resolved. Prevent the value
mapper from running into unresolved or temporary MD nodes.

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

llvm-svn: 317047
2017-10-31 22:49:48 +00:00
Vlad Tsyrklevich 634c601fe3 [CFI] Add CFI-icall pointer type generalization
Summary:
This change allows generalizing pointers in type signatures used for
cfi-icall by enabling the -fsanitize-cfi-icall-generalize-pointers flag.
This works by 1) emitting an additional generalized type signature
metadata node for functions and 2) llvm.type.test()ing for the
generalized type for translation units with the flag specified.

This flag is incompatible with -fsanitize-cfi-cross-dso because it would
require emitting twice as many type hashes which would increase artifact
size.

Reviewers: pcc, eugenis

Reviewed By: pcc

Subscribers: kcc

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

llvm-svn: 317044
2017-10-31 22:39:44 +00:00
Vitaly Buka 1efe7740ce [clang-fuzzer] Fix incremental builds of the fuzzer
Summary:
Don't use BUILD_IN_SOURCE keep git checkout clean
Don't forward CMAKE_GENERATOR as ExternalProject_Add should do it already
Reset UPDATE_COMMAND to avoid git checkout updates on each build

Reviewers: kcc, morehouse

Subscribers: cfe-commits, mgorny

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

llvm-svn: 317035
2017-10-31 20:49:57 +00:00
Richard Smith fd62945d36 Fix usage of right shift operator in fold expressions
The right shift operator was not seen as a valid operator in a fold expression, which is PR32563.

Patch by Nicolas Lesser ("Blitz Rakete")!

llvm-svn: 317032
2017-10-31 20:29:22 +00:00
Sanjay Patel 7cb25a888c [CodeGen] map sqrt libcalls to llvm.sqrt when errno is not set
The LLVM sqrt intrinsic definition changed with:
D28797
...so we don't have to use any relaxed FP settings other than errno handling.

This patch sidesteps a question raised in PR27435:
https://bugs.llvm.org/show_bug.cgi?id=27435

Is a programmer using __builtin_sqrt() invoking the compiler's intrinsic definition of sqrt or the mathlib definition of sqrt?

But we have an answer now: the builtin should match the behavior of the libm function including errno handling.

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

llvm-svn: 317031
2017-10-31 20:19:39 +00:00
Ivan A. Kosarev b9c59f36fc [CodeGen] Propagate may-alias'ness of lvalues with TBAA info
This patch fixes various places in clang to propagate may-alias
TBAA access descriptors during construction of lvalues, thus
eliminating the need for the LValueBaseInfo::MayAlias flag.

This is part of D38126 reworked to be a separate patch to
simplify review.

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

llvm-svn: 316988
2017-10-31 11:05:34 +00:00
Alex Lorenz b87b6bf73a [refactor] select the entire DeclStmt if one ifs decls is selected
llvm-svn: 316971
2017-10-31 01:28:17 +00:00
Alex Lorenz c38ba6697f Typo correct the condition of 'do-while' before exiting its scope
rdar://35172419

llvm-svn: 316966
2017-10-30 22:55:11 +00:00
Richard Smith a544c51e94 [modules] Retain multiple using-directives in the same scope even if they name the same namespace.
They might have different visibility, and thus discarding all but one of them
can result in rejecting valid code. Also fix name lookup to cope with multiple
using-directives being found that denote the same namespace, where some are not
visible -- don't cache an "already visited" state for a using-directive that we
didn't visit because it was hidden.

llvm-svn: 316965
2017-10-30 22:38:20 +00:00
George Karpenkov 0c3a7c2015 [analyzer] Use the same filename for the header and the implementation of BugReporterVisitor
Differential Revision: https://reviews.llvm.org/D37935

llvm-svn: 316963
2017-10-30 22:31:57 +00:00
George Karpenkov 3c128cb1e6 [analyzer] [tests] Remove empty folders in reference results, do not store diffs.txt
Storing diffs.txt is now redundant, as we simply dump the CmpRuns output
to stdout (it is saved in CI and tends to be small).
Not generating those files enables us to remove empty folders, which
confuse git, as it would not add them with reference results.

llvm-svn: 316948
2017-10-30 19:40:33 +00:00
Richard Smith 849e7da8b7 Undo accidental language mode change in this test.
llvm-svn: 316936
2017-10-30 18:06:18 +00:00
Richard Smith 70a81b1e8b Add a test to make sure that -Wdeprecated doesn't warn on use of 'throw()' in system headers (deprecated in C++17).
llvm-svn: 316935
2017-10-30 18:05:10 +00:00
Gabor Horvath 4581f7497b [analyzer] Left shifting a negative value is undefined
The analyzer did not return an UndefVal in case a negative value was left
shifted. I also altered the UndefResultChecker to emit a clear warning in this
case.

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

llvm-svn: 316924
2017-10-30 17:06:42 +00:00
Krasimir Georgiev 7f64fa8022 [clang-format] Handle CRLF correctly when formatting escaped newlines
Subscribers: klimek

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

Contributed by @peterbudai!

llvm-svn: 316910
2017-10-30 14:41:34 +00:00
Yaxun Liu 561ac06ff2 CodeGen: Fix insertion position of addrspace cast for alloca
For non-zero alloca addr space, alloca is usually casted to default addr
space immediately.

For non-vla, alloca is inserted at AllocaInsertPt, therefore the addr
space cast should also be insterted at AllocaInsertPt. However,
for vla, alloca is inserted at the current insertion point of IRBuilder,
therefore the addr space cast should also inserted at the current
insertion point of IRBuilder.

Currently clang always insert addr space cast at AllocaInsertPt, which
causes invalid IR.

This patch fixes that.

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

llvm-svn: 316909
2017-10-30 14:38:30 +00:00