]> granicus.if.org Git - clang/log
clang
6 years ago[analyzer] InnerPointerChecker: improve warning messages and notes.
Reka Kovacs [Fri, 10 Aug 2018 23:56:57 +0000 (23:56 +0000)]
[analyzer] InnerPointerChecker: improve warning messages and notes.

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

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

6 years ago[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use...
George Karpenkov [Fri, 10 Aug 2018 23:51:43 +0000 (23:51 +0000)]
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck - II

Some files were missed by https://reviews.llvm.org/D50545

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

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

6 years ago[analyzer] Record nullability implications on getting items from NSDictionary
George Karpenkov [Fri, 10 Aug 2018 22:27:04 +0000 (22:27 +0000)]
[analyzer] Record nullability implications on getting items from NSDictionary

If we get an item from a dictionary, we know that the item is non-null
if and only if the key is non-null.

This patch is a rather hacky way to record this implication, because
some logic needs to be duplicated from the solver.
And yet, it's pretty simple, performant, and works.

Other possible approaches:

 - Record the implication, in future rely on Z3 to pick it up.
 - Generalize the current code and move it to the constraint manager.

rdar://34990742

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

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

6 years ago[analyzer] Fix tracking expressions through negation operator
George Karpenkov [Fri, 10 Aug 2018 21:42:19 +0000 (21:42 +0000)]
[analyzer] Fix tracking expressions through negation operator

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

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

6 years ago[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use...
George Karpenkov [Fri, 10 Aug 2018 21:36:45 +0000 (21:36 +0000)]
[analyzer] [NFC] [tests] Move plist-based diagnostics tests to separate files, use diff instead of a FileCheck

Some of the analyzer tests check the exact plist output, in order to
verify that the diagnostics produced is correct.
Current testing setup has many issues:

plist output clobbers tests, making them harder to read
it is impossible to debug test failures given error messages from FileCheck.
The only recourse is manually creating the files and using the diff
again, it is impossible to update the tests given the error message:
the only process is a tedious manual one,
going from a separate plist file to CHECK directives.

This patch offers a much better approach of using "diff" directly in place of FileCheck,
and moving tests to separate files.

Generated using the following script:

```
import os
import glob
import re
import subprocess

diagnostics_key = "// CHECK:  <key>diagnostics</key>"

def process_file(f, data):
    idx = data.index(diagnostics_key)
    plist_out_f = 'ExpectedOutputs/plists/%s.plist' % f
    plist_out_folder = os.path.join('ExpectedOutputs/plists/', os.path.dirname(f))
    plist_data = data[idx:]
    plist_data = plist_data.replace('// CHECK: ', '')
    plist_data = plist_data.replace('// CHECK-NEXT: ', '')
    plist_data += "</dict>\n</plist>\n"
    data = data[:idx]

    ptn = re.compile("FileCheck --?input-file(=| )(%t|%t\.plist) %s")

    if not ptn.findall(data):
        print "none found =/ skipping..."
        return

    data = ptn.sub(lambda m: "tail -n +11 %s | diff -u -w - %%S/../%s" % (m.group(2), plist_out_f), data)

    with open(f, 'w') as out_f:
        out_f.write(data)

    subprocess.check_call(["mkdir", "-p", plist_out_folder])
    with open(plist_out_f, 'w') as out_f:
        out_f.write(plist_data)

def main():
    files = glob.glob("**/*.*")
    for f in files:
        with open(f) as f_handler:
            data = f_handler.read()
        if diagnostics_key in data:
            print "Converting %s" %f
            process_file(f, data)

if __name__ == "__main__":
    main()
```

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

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

6 years agoInvalidate static locals when escaping lambdas
George Karpenkov [Fri, 10 Aug 2018 18:28:04 +0000 (18:28 +0000)]
Invalidate static locals when escaping lambdas

Lambdas can affect static locals even without an explicit capture.

rdar://39537031

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

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

6 years agoAllow relockable scopes with thread safety attributes.
Aaron Ballman [Fri, 10 Aug 2018 17:33:47 +0000 (17:33 +0000)]
Allow relockable scopes with thread safety attributes.

Patch by Aaron Puchert

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

6 years agoMake changes to the check strings so that the test I modified in r339438
Akira Hatanaka [Fri, 10 Aug 2018 17:07:27 +0000 (17:07 +0000)]
Make changes to the check strings so that the test I modified in r339438
passes on 32-bit targets.

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

6 years ago[CodeGen] Merge equivalent block copy/helper functions.
Akira Hatanaka [Fri, 10 Aug 2018 15:09:24 +0000 (15:09 +0000)]
[CodeGen] Merge equivalent block copy/helper functions.

Clang generates copy and dispose helper functions for each block literal
on the stack. Often these functions are equivalent for different blocks.
This commit makes changes to merge equivalent copy and dispose helper
functions and reduce code size.

To enable merging equivalent copy/dispose functions, the captured object
infomation is encoded into the helper function name. This allows IRGen
to check whether an equivalent helper function has already been emitted
and reuse the function instead of generating a new helper function
whenever a block is defined. In addition, the helper functions are
marked as linkonce_odr to enable merging helper functions that have the
same name across translation units and marked as unnamed_addr to enable
the linker's deduplication pass to merge functions that have different
names but the same content.

rdar://problem/42640608

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

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

6 years agoFix a deprecated warning in the last commit.
David Chisnall [Fri, 10 Aug 2018 12:53:18 +0000 (12:53 +0000)]
Fix a deprecated warning in the last commit.

Done as a separate commit to make it easier to cherry pick the changes
to the release branch.

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

6 years agoAdd Windows support for the GNUstep Objective-C ABI V2.
David Chisnall [Fri, 10 Aug 2018 12:53:13 +0000 (12:53 +0000)]
Add Windows support for the GNUstep Objective-C ABI V2.

Summary:
Introduces funclet-based unwinding for Objective-C and fixes an issue
where global blocks can't have their isa pointers initialised on
Windows.

After discussion with Dustin, this changes the name mangling of
Objective-C types to prevent a C++ catch statement of type struct X*
from catching an Objective-C object of type X*.

Reviewers: rjmccall, DHowett-MSFT

Reviewed By: rjmccall, DHowett-MSFT

Subscribers: mgrang, mstorsjo, smeenai, cfe-commits

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

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

6 years agoclang-cl: accept -fcrash-diagnostics-dir=
Hans Wennborg [Fri, 10 Aug 2018 11:40:50 +0000 (11:40 +0000)]
clang-cl: accept -fcrash-diagnostics-dir=

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

6 years agoFix a wrong type bug in ParsedAttr::TypeTagForDatatypeData
Bruno Ricci [Fri, 10 Aug 2018 11:20:20 +0000 (11:20 +0000)]
Fix a wrong type bug in ParsedAttr::TypeTagForDatatypeData

This patch fixes a wrong type bug inside ParsedAttr::TypeTagForDatatypeData.
The details to the best of my knowledge are as follow. The incredible thing
is that everything works out just fine by chance due to a sequence of lucky
coincidences in the layout of various types.

The struct ParsedAttr::TypeTagForDatatypeData contains among other things
a ParsedType *MatchingCType, where ParsedType is just OpaquePtr<QualType>.

However the member MatchingCType is initialized in the constructor for
type_tag_for_datatype attribute as follows:

new (&ExtraData.MatchingCType) ParsedType(matchingCType);

This results in the ParsedType being constructed in the location of the
ParsedType * Later ParsedAttr::getMatchingCType do return
*getTypeTagForDatatypeDataSlot().MatchingCType; which instead of
dereferencing the ParsedType * will dereference the QualType inside
the ParsedType. Now this QualType in this case contains no qualifiers
and therefore is a valid Type *. Therefore getMatchingCType returns a
Type or at least the stuff that is in the first sizeof(void*) bytes of it,
But it turns out that Type inherits from ExtQualsCommonBase and that the
first member of ExtQualsCommonBase is a const Type *const BaseType. This
Type * in this case points to the original Type pointed to by the
QualType and so everything works fine even though all the types were wrong.

This bug was only found because I changed the layout of Type,
which obviously broke all of this long chain of improbable events.

Reviewed By: erichkeane

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

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

6 years agoclang-cl: Support /guard:cf,nochecks
Hans Wennborg [Fri, 10 Aug 2018 09:49:21 +0000 (09:49 +0000)]
clang-cl: Support /guard:cf,nochecks

This extension emits the guard cf table without inserting the
instrumentation. Currently that's what clang-cl does with /guard:cf
anyway, but this allows a user to request that explicitly.

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

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

6 years agoFix size calculation from r339380
Richard Trieu [Fri, 10 Aug 2018 01:30:10 +0000 (01:30 +0000)]
Fix size calculation from r339380

r339380 changed the trailing types of ParsedAttr to use llvm::TrailingObjects.
However, it did not copy over one of the size attributes, causing a too
small allocation for this object.  The error was detected with
AddressSanitizer use-after-poison

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

6 years agoMark up deprecated methods as such
Stephen Kelly [Thu, 9 Aug 2018 22:45:38 +0000 (22:45 +0000)]
Mark up deprecated methods as such

Reviewers: teemperor!

Subscribers: cfe-commits

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

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

6 years agoRemove obsolete set call
Stephen Kelly [Thu, 9 Aug 2018 22:44:03 +0000 (22:44 +0000)]
Remove obsolete set call

Summary:
Case case of the switch statement here makes the same call, but it is
already done at the start of the function.

Reviewers: rsmith, dblaikie

Subscribers: cfe-commits

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

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

6 years agoAMDGPU: Add another missing builtin
Matt Arsenault [Thu, 9 Aug 2018 22:18:37 +0000 (22:18 +0000)]
AMDGPU: Add another missing builtin

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

6 years agoAdded LLVM metadata to generated IR to increase vectorization width
Emmett Neyman [Thu, 9 Aug 2018 21:59:01 +0000 (21:59 +0000)]
Added LLVM metadata to generated IR to increase vectorization width

Summary: Edited `loop_proto_to_llvm` to emit metadata at the end of the generated IR. This metadata will increase the vector width when the IR is optimized.

Reviewers: morehouse, kcc

Reviewed By: morehouse

Subscribers: cfe-commits, llvm-commits

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

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

6 years agoFix and recommit r339382 based on solution from RSmith:
Erich Keane [Thu, 9 Aug 2018 21:18:13 +0000 (21:18 +0000)]
Fix and recommit r339382 based on solution from RSmith:

As sent on cfe-commits:
 "You need to use "friend TrailingObjects;" here, not
 "friend class TrailingObjects;", to avoid breaking MSVC
 (which doesn't implement injected-class-names quite according to spec)."

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

6 years agoRevert -r339382, which apparently breaks the Windows build.
Erich Keane [Thu, 9 Aug 2018 21:13:46 +0000 (21:13 +0000)]
Revert -r339382, which apparently breaks the Windows build.

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

6 years agoPort getLocEnd -> getEndLoc
Stephen Kelly [Thu, 9 Aug 2018 21:09:38 +0000 (21:09 +0000)]
Port getLocEnd -> getEndLoc

Reviewers: teemperor!

Subscribers: cfe-commits

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

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

6 years agoPort getLocStart -> getBeginLoc
Stephen Kelly [Thu, 9 Aug 2018 21:08:08 +0000 (21:08 +0000)]
Port getLocStart -> getBeginLoc

Reviewers: teemperor!

Subscribers: jholewinski, whisperity, jfb, cfe-commits

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

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

6 years agoPort getStartLoc -> getBeginLoc
Stephen Kelly [Thu, 9 Aug 2018 21:05:56 +0000 (21:05 +0000)]
Port getStartLoc -> getBeginLoc

Reviewers: teemperor!

Subscribers: cfe-commits

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

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

6 years ago[NFC] Complete the rule-of-5 for ParsedAttr
Erich Keane [Thu, 9 Aug 2018 21:04:34 +0000 (21:04 +0000)]
[NFC] Complete the rule-of-5 for ParsedAttr

Add move assign/construct as 'deleted' to ParsedAttr
to complete the rule-of-5.

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

6 years ago[NFC] Simplify 'friend' declaration in ParsedAttr
Erich Keane [Thu, 9 Aug 2018 21:03:39 +0000 (21:03 +0000)]
[NFC] Simplify 'friend' declaration in ParsedAttr

As suggested in the post-commit review for D50531,
change from the templatized TrailingObjects friend declaration
to a version referring to the base.

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

6 years ago[NFC] Convert ParsedAttr to use llvm::TrailingObjects
Erich Keane [Thu, 9 Aug 2018 20:25:12 +0000 (20:25 +0000)]
[NFC] Convert ParsedAttr to use llvm::TrailingObjects

ParsedAttr is using a hand-rolled trailing-objects
implementation that gets cleaned up quite a bit by
just using llvm::TrailingObjects. This is a large
TrailingObjects list, but most things are length '0'.

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

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

6 years agoFix build
Stephen Kelly [Thu, 9 Aug 2018 20:21:09 +0000 (20:21 +0000)]
Fix build

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

6 years ago[Sema] P0961R1: Relaxing the structured bindings customization point finding rules
Erik Pilkington [Thu, 9 Aug 2018 20:11:13 +0000 (20:11 +0000)]
[Sema] P0961R1: Relaxing the structured bindings customization point finding rules

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

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

6 years agoAdd getEndLoc API to replace getLocEnd
Stephen Kelly [Thu, 9 Aug 2018 20:05:47 +0000 (20:05 +0000)]
Add getEndLoc API to replace getLocEnd

Subscribers: cfe-commits

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

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

6 years agoAdd getBeginLoc API to replace getStartLoc
Stephen Kelly [Thu, 9 Aug 2018 20:05:18 +0000 (20:05 +0000)]
Add getBeginLoc API to replace getStartLoc

Reviewers: teemperor!

Subscribers: cfe-commits

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

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

6 years agoAdd getBeginLoc API to replace getLocStart
Stephen Kelly [Thu, 9 Aug 2018 20:05:03 +0000 (20:05 +0000)]
Add getBeginLoc API to replace getLocStart

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Fix the bug in UninitializedObjectChecker caused by not handling block...
George Karpenkov [Thu, 9 Aug 2018 19:03:12 +0000 (19:03 +0000)]
[analyzer] Fix the bug in UninitializedObjectChecker caused by not handling block pointers

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

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

6 years ago[AArch64][NFC] better matching of AArch64 target in aarch64-cpus.c tests
Sjoerd Meijer [Thu, 9 Aug 2018 14:07:27 +0000 (14:07 +0000)]
[AArch64][NFC] better matching of AArch64 target in aarch64-cpus.c tests

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

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

6 years agoImplement diagnostic stream operator for ParsedAttr.
Erich Keane [Thu, 9 Aug 2018 13:21:32 +0000 (13:21 +0000)]
Implement diagnostic stream operator for ParsedAttr.

As a part of attempting to clean up the way attributes are
printed, this patch adds an operator << to the diagnostics/
partialdiagnostics so that ParsedAttr can be sent directly.

This patch also rewrites a large amount* of the times when
ParsedAttr was printed using its IdentifierInfo object instead
of being printed itself.
*"a large amount" == "All I could find".

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

6 years agoFix structural inequivalency of forward EnumDecl
Gabor Marton [Thu, 9 Aug 2018 12:36:25 +0000 (12:36 +0000)]
Fix structural inequivalency of forward EnumDecl

Summary:
Currently we consider one forward declared RecordDecl and another with a
definition equal. We have to do the same in case of enums.

Reviewers: a_sidorin, r.stahl, xazax.hun

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years agoAdd support for importing imaginary literals
Gabor Marton [Thu, 9 Aug 2018 12:18:07 +0000 (12:18 +0000)]
Add support for importing imaginary literals

Reviewers: a_sidorin, r.stahl, xazax.hun

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years agoCorrectly initialise global blocks on Windows.
David Chisnall [Thu, 9 Aug 2018 08:02:42 +0000 (08:02 +0000)]
Correctly initialise global blocks on Windows.

Summary:
Windows does not allow globals to be initialised to point to globals in
another DLL.  Exported globals may be referenced only from code.  Work
around this by creating an initialiser that runs in early library
initialisation and sets the isa pointer.

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

6 years ago[CMake] Use normalized Windows target triples
Petr Hosek [Thu, 9 Aug 2018 02:16:18 +0000 (02:16 +0000)]
[CMake] Use normalized Windows target triples

Changes the default Windows target triple returned by
GetHostTriple.cmake from the old environment names (which we wanted to
move away from) to newer, normalized ones. This also requires updating
all tests to use the new systems names in constraints.

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

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

6 years agoRefactor attribute printing to be a bit more obviously-correct.
Richard Smith [Thu, 9 Aug 2018 01:21:06 +0000 (01:21 +0000)]
Refactor attribute printing to be a bit more obviously-correct.

No functionality change intended.

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

6 years agoAdded another optimization pass to make vectorizing possible
Emmett Neyman [Thu, 9 Aug 2018 00:58:23 +0000 (00:58 +0000)]
Added another optimization pass to make vectorizing possible

Summary: I noticed that my code wasn't going deep into the loop vectorizer code so added another pass that makes it go further.

Reviewers: morehouse, kcc

Reviewed By: morehouse

Subscribers: cfe-commits, llvm-commits

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

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

6 years agoDelete some unreachable AST printing code.
Richard Smith [Thu, 9 Aug 2018 00:44:49 +0000 (00:44 +0000)]
Delete some unreachable AST printing code.

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

6 years ago[VFS] Remove superfluous semicolon from unittest.
Craig Topper [Wed, 8 Aug 2018 22:31:14 +0000 (22:31 +0000)]
[VFS] Remove superfluous semicolon from unittest.

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

6 years ago[Builtins] Add __builtin_clrsb support to IntExprEvaluator::VisitBuiltinCallExpr
Craig Topper [Wed, 8 Aug 2018 22:31:12 +0000 (22:31 +0000)]
[Builtins] Add __builtin_clrsb support to IntExprEvaluator::VisitBuiltinCallExpr

This addresses a FIXME that has existed since before clang supported the builtin.

This time with only reviewed changes.

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

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

6 years ago[ADT] Normalize empty triple components
Petr Hosek [Wed, 8 Aug 2018 22:23:57 +0000 (22:23 +0000)]
[ADT] Normalize empty triple components

LLVM triple normalization is handling "unknown" and empty components
differently; for example given "x86_64-unknown-linux-gnu" and
"x86_64-linux-gnu" which should be equivalent, triple normalization
returns "x86_64-unknown-linux-gnu" and "x86_64--linux-gnu". autoconf's
config.sub returns "x86_64-unknown-linux-gnu" for both
"x86_64-linux-gnu" and "x86_64-unknown-linux-gnu". This changes the
triple normalization to behave the same way, replacing empty triple
components with "unknown".

This addresses PR37129.

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

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

6 years agoRevert r339287 "[Builtins] Add __builtin_clrsb support to IntExprEvaluator::VisitBuil...
Craig Topper [Wed, 8 Aug 2018 21:21:21 +0000 (21:21 +0000)]
Revert r339287 "[Builtins] Add __builtin_clrsb support to IntExprEvaluator::VisitBuiltinCallExpr"

This add an additional unintended change in it.

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

6 years ago[Builtins] Add __builtin_clrsb support to IntExprEvaluator::VisitBuiltinCallExpr
Craig Topper [Wed, 8 Aug 2018 20:59:40 +0000 (20:59 +0000)]
[Builtins] Add __builtin_clrsb support to IntExprEvaluator::VisitBuiltinCallExpr

This addresses a FIXME that has existed since before clang supported the builtin.

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

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

6 years ago[Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL
Pirama Arumuga Nainar [Wed, 8 Aug 2018 20:38:38 +0000 (20:38 +0000)]
[Headers] Define *_HAS_SUBNORM for FLT, DBL, LDBL

Summary:
These macros are defined in the C11 standard and can be defined based on
the __*_HAS_DENORM__ default macros.

Reviewers: bruno, rsmith, doug.gregor

Subscribers: llvm-commits, enh, srhines

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

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

6 years ago[Builtins] Implement __builtin_clrsb to be compatible with gcc
Craig Topper [Wed, 8 Aug 2018 19:55:52 +0000 (19:55 +0000)]
[Builtins] Implement __builtin_clrsb to be compatible with gcc

gcc defines an intrinsic called __builtin_clrsb which counts the number of extra sign bits on a number. This is equivalent to counting the number of leading zeros on a positive number or the number of leading ones on a negative number and subtracting one from the result. Since we can't count leading ones we need to invert negative numbers to count zeros.

This patch will cause the builtin to be expanded inline while gcc uses a call to a function like clrsbdi2 that is implemented in libgcc. But this is similar to what we already do for popcnt. And I don't think compiler-rt supports clrsbdi2.

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

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

6 years ago[CodeGen][Timers] Enable llvm::TimePassesIsEnabled when -ftime-report is specified
Craig Topper [Wed, 8 Aug 2018 19:14:23 +0000 (19:14 +0000)]
[CodeGen][Timers] Enable llvm::TimePassesIsEnabled when -ftime-report is specified

r330571 added a new FrontendTimesIsEnabled variable and replaced many usages of llvm::TimePassesIsEnabled. Including the place that set llvm::TimePassesIsEnabled for -ftime-report. The effect of this is that -ftime-report now only contains the timers specifically referenced in CodeGenAction.cpp and none of the timers in the backend.

This commit adds back the assignment, but otherwise leaves everything else unchanged.

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

6 years agoAMDGPU: Fix enabling denormals by default on pre-VI targets
Matt Arsenault [Wed, 8 Aug 2018 17:48:37 +0000 (17:48 +0000)]
AMDGPU: Fix enabling denormals by default on pre-VI targets

Fast FMAF is not a sufficient condition to enable denormals.
Before VI, enabling denormals caused F32 instructions to
run at F64 speeds.

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

6 years agoCDDecl More automatic variable tail padding test
JF Bastien [Wed, 8 Aug 2018 17:05:17 +0000 (17:05 +0000)]
CDDecl More automatic variable tail padding test

Test tail padded automatic variable at different width, because they encounter different codegen.

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

6 years ago[DebugInfo][OpenCL] Address post-commit review for r338299
Scott Linder [Wed, 8 Aug 2018 15:56:12 +0000 (15:56 +0000)]
[DebugInfo][OpenCL] Address post-commit review for r338299

NFC refactor of code to generate debug info for OpenCL 2.X blocks.

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

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

6 years ago[CGObjCGNU] Rename GetSelector helper method to fix -Woverloaded-virtual warning...
Simon Pilgrim [Wed, 8 Aug 2018 15:53:14 +0000 (15:53 +0000)]
[CGObjCGNU] Rename GetSelector helper method to fix -Woverloaded-virtual warning (PR38210)

As suggested by @theraven on PR38210, this patch fixes the gcc -Woverloaded-virtual warnings by renaming the extra CGObjCGNU::GetSelector method to CGObjCGNU::GetTypedSelector

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

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

6 years agoFix -Wdocumentation warnings. NFCI.
Simon Pilgrim [Wed, 8 Aug 2018 15:34:00 +0000 (15:34 +0000)]
Fix -Wdocumentation warnings. NFCI.

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

6 years ago[AST] Check described template at structural equivalence check.
Balazs Keri [Wed, 8 Aug 2018 15:04:27 +0000 (15:04 +0000)]
[AST] Check described template at structural equivalence check.

Summary:
When checking a class or function the described class or function template
is checked too.
Split StructuralEquivalenceContext::Finish into multiple functions.
Improved test with symmetric check, added new tests.

Reviewers: martong, a.sidorin, a_sidorin, bruno

Reviewed By: martong, a.sidorin

Subscribers: rnkovacs, cfe-commits

Tags: #clang

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

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

6 years ago[analyzer] Fix a typo in `RegionStore.txt`.
Henry Wong [Wed, 8 Aug 2018 13:37:28 +0000 (13:37 +0000)]
[analyzer] Fix a typo in `RegionStore.txt`.

Summary: The typo of the description for default bindings can be confusing.

Reviewers: NoQ, george.karpenkov

Reviewed By: NoQ, george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, cfe-commits, MTC

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

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

6 years ago[analyzer][UninitializedObjectChecker] Pointer/reference objects are dereferenced...
Kristof Umann [Wed, 8 Aug 2018 13:18:53 +0000 (13:18 +0000)]
[analyzer][UninitializedObjectChecker] Pointer/reference objects are dereferenced according to dynamic type

This patch fixed an issue where the dynamic type of pointer/reference
object was known by the analyzer, but wasn't obtained in the checker,
which resulted in false negatives. This should also increase reliability
of the checker, as derefencing is always done now according to the
dynamic type (even if that happens to be the same as the static type).

Special thanks to Artem Degrachev for setting me on the right track.

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

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

6 years ago[analyzer][UninitializedObjectChecker] Fixed a false negative by no longer filtering...
Kristof Umann [Wed, 8 Aug 2018 12:23:02 +0000 (12:23 +0000)]
[analyzer][UninitializedObjectChecker] Fixed a false negative by no longer filtering out certain constructor calls

As of now, all constructor calls are ignored that are being called
by a constructor. The point of this was not to analyze the fields
of an object, so an uninitialized field wouldn't be reported
multiple times.

This however introduced false negatives when the two constructors
were in no relation to one another -- see the test file for a neat
example for this with singletons. This patch aims so fix this issue.

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

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

6 years ago[ASTImporter] Load external Decls when getting field index.
Balazs Keri [Wed, 8 Aug 2018 09:40:57 +0000 (09:40 +0000)]
[ASTImporter] Load external Decls when getting field index.

Summary:
At equality check of fields without name the index of fields is compared.
At determining the index of a field all fields of the parent context
should be loaded from external source to find the field at all.

Reviewers: a.sidorin, a_sidorin, r.stahl

Reviewed By: a.sidorin

Subscribers: martong, cfe-commits

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

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

6 years agoFixed a breaking test case
Balaji V. Iyer [Wed, 8 Aug 2018 02:47:28 +0000 (02:47 +0000)]
Fixed a breaking test case

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

6 years ago[NFC][VFS] Fix typos in comments.
Volodymyr Sapsai [Wed, 8 Aug 2018 01:28:37 +0000 (01:28 +0000)]
[NFC][VFS] Fix typos in comments.

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

6 years agoPR38286: Don't crash when attempting to define a constructor for an
Richard Smith [Wed, 8 Aug 2018 00:42:42 +0000 (00:42 +0000)]
PR38286: Don't crash when attempting to define a constructor for an
incomplete class template.

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

6 years ago[CodeGen] IncompleteArray Support
Balaji V. Iyer [Wed, 8 Aug 2018 00:01:21 +0000 (00:01 +0000)]
[CodeGen] IncompleteArray Support

Added code to support ArrayType that is not ConstantArray.

https://reviews.llvm.org/D49952
rdar://42476155

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

6 years ago[analyzer] Avoid querying this-pointers for static-methods.
Matt Davis [Tue, 7 Aug 2018 23:13:28 +0000 (23:13 +0000)]
[analyzer] Avoid querying this-pointers for static-methods.

Summary:
The loop-widening code processes c++ methods looking for `this` pointers.  In
the case of static methods (which do not have `this` pointers), an assertion
was triggering.   This patch avoids trying to process `this` pointers for
static methods, and thus avoids triggering the assertion .

Reviewers: dcoughlin, george.karpenkov, NoQ

Reviewed By: NoQ

Subscribers: NoQ, xazax.hun, szepet, a.sidorin, mikhail.ramalho, cfe-commits

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

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

6 years ago[VFS] Unify iteration code for VFSFromYamlDirIterImpl, NFC intended.
Volodymyr Sapsai [Tue, 7 Aug 2018 23:00:40 +0000 (23:00 +0000)]
[VFS] Unify iteration code for VFSFromYamlDirIterImpl, NFC intended.

First and subsequent iteration steps are similar, capture this similarity.

Reviewers: bruno, benlangmuir

Reviewed By: bruno

Subscribers: dexonsmith, cfe-commits

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

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

6 years ago[Sema] Ensure an auto non-type template parameter is dependent
Erik Pilkington [Tue, 7 Aug 2018 22:59:02 +0000 (22:59 +0000)]
[Sema] Ensure an auto non-type template parameter is dependent

The dependent auto was getting stripped away while rebuilding the template
parameter type, so substitute it in.

rdar://41852459

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

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

6 years ago[NFC] Improve auto-var-init alignment check
JF Bastien [Tue, 7 Aug 2018 22:43:44 +0000 (22:43 +0000)]
[NFC] Improve auto-var-init alignment check

We're not actually testing for alignment, we just want to know that whatever incoming alignment got propagated. Do that by capturing the alignment and checking that it's actually what's passed later, instead of hard-coding an alignment value.

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

6 years ago[NFC] CGDecl factor out constant emission
JF Bastien [Tue, 7 Aug 2018 21:55:13 +0000 (21:55 +0000)]
[NFC] CGDecl factor out constant emission

The code is cleaner this way, and with some changes I'm playing with it makes sense to split it out so we can reuse it.

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

6 years agoFix one hard coded value I missed in r339185.
Douglas Yung [Tue, 7 Aug 2018 21:37:14 +0000 (21:37 +0000)]
Fix one hard coded value I missed in r339185.

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

6 years agoClean up and simplify RequireCompleteType.
Richard Smith [Tue, 7 Aug 2018 21:35:41 +0000 (21:35 +0000)]
Clean up and simplify RequireCompleteType.

No functional change intended, except that we will now produce more
"declared here" notes.

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

6 years agoMake test more robust by not checking hard coded debug info values, but instead check...
Douglas Yung [Tue, 7 Aug 2018 21:22:49 +0000 (21:22 +0000)]
Make test more robust by not checking hard coded debug info values, but instead check the relationships between them.

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

6 years ago[analyzer] [tests] Do not be verbose by default when updating reference results.
George Karpenkov [Tue, 7 Aug 2018 21:14:35 +0000 (21:14 +0000)]
[analyzer] [tests] Do not be verbose by default when updating reference results.

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

6 years ago[Headers] Expand _Unwind_Exception for SEH on MinGW/x86_64
Martin Storsjo [Tue, 7 Aug 2018 20:02:40 +0000 (20:02 +0000)]
[Headers] Expand _Unwind_Exception for SEH on MinGW/x86_64

This matches how GCC defines this struct.

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

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

6 years ago[Sema] Fix for crash on conditional operation with address_space pointer
Leonard Chan [Tue, 7 Aug 2018 19:43:53 +0000 (19:43 +0000)]
[Sema] Fix for crash on conditional operation with address_space pointer

Compiling the following causes clang to crash

```
char *cmp(__attribute__((address_space(1))) char *x, __attribute__((address_space(2))) char *y) {
  return x < y ? x : y;
}
```

with the message: "wrong cast for pointers in different address
spaces(must be an address space cast)!"

This is because during IR emission, the source and dest type for a
bitcast should not have differing address spaces.

This fix prints an error since the code shouldn't compile in the first place.

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

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

6 years ago[VFS] Emit an error when entry at root level uses a relative path.
Volodymyr Sapsai [Tue, 7 Aug 2018 19:05:41 +0000 (19:05 +0000)]
[VFS] Emit an error when entry at root level uses a relative path.

Entries with only a filename prevent us from building a file system tree and
cause the assertion

> Assertion failed: (NewParentE && "Parent entry must exist"), function uniqueOverlayTree, file clang/lib/Basic/VirtualFileSystem.cpp, line 1303.

Entries with a relative path are simply not discoverable during header search.

rdar://problem/28990865

Reviewers: bruno, benlangmuir

Reviewed By: bruno

Subscribers: dexonsmith, cfe-commits

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

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

6 years ago[WebAssembly] Remove use of lld -flavor flag
Sam Clegg [Tue, 7 Aug 2018 18:55:41 +0000 (18:55 +0000)]
[WebAssembly] Remove use of lld -flavor flag

This flag is deprecated. The preferred way to select the lld
flavor is by calling it by one of its aliases.

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

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

6 years ago[WebAssembly] Force use of lld for test/Driver/wasm-toolchain.c(pp)
David Greene [Tue, 7 Aug 2018 17:44:43 +0000 (17:44 +0000)]
[WebAssembly] Force use of lld for test/Driver/wasm-toolchain.c(pp)

lld is the only supported linker that works for WebAssembly, so ensure
clang is using it for this test. This gets the tests passing when
configuring clang to use a different linker by default.

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

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

6 years ago[OPENMP] Mark variables captured in declare target region as implicitly
Alexey Bataev [Tue, 7 Aug 2018 16:14:36 +0000 (16:14 +0000)]
[OPENMP] Mark variables captured in declare target region as implicitly
declare target.

According to OpenMP 5.0, variables captured in lambdas in declare target
regions must be considered as implicitly declare target.

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

6 years ago[OpenCL] Restore r338899 (reverted in r338904), fixing stack-use-after-return
Scott Linder [Tue, 7 Aug 2018 15:52:49 +0000 (15:52 +0000)]
[OpenCL] Restore r338899 (reverted in r338904), fixing stack-use-after-return

Always emit alloca in entry block for enqueue_kernel builtin.

Ensures the statically sized alloca is not converted to DYNAMIC_STACKALLOC
later because it is not in the entry block.

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

6 years ago[analyzer][UninitializedObjectChecker] New flag to turn off dereferencing
Kristof Umann [Tue, 7 Aug 2018 12:55:26 +0000 (12:55 +0000)]
[analyzer][UninitializedObjectChecker] New flag to turn off dereferencing

Even for a checker being in alpha, some reports about pointees held so little
value to the user that it's safer to disable pointer/reference chasing for now.
It can be enabled with a new flag, in which case checker should function as it
has always been. This can be set with `CheckPointeeInitialization`.

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

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

6 years ago[AST][NFC] Use unsigned in the bit-fields of IdentifierInfo
Bruno Ricci [Tue, 7 Aug 2018 12:40:41 +0000 (12:40 +0000)]
[AST][NFC] Use unsigned in the bit-fields of IdentifierInfo

Avoid mixing bool and unsigned in the bit-fields of IdentifierInfo
since MSVC packs this poorly. Also clang-format the changes.

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

6 years ago[AST][NFC] Use unsigned in the bit-fields of PrintingPolicy
Bruno Ricci [Tue, 7 Aug 2018 12:23:41 +0000 (12:23 +0000)]
[AST][NFC] Use unsigned in the bit-fields of PrintingPolicy

Avoid the mix between bools and unsigned since MSVC pack
this poorly.

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

6 years ago[objc-gnustep] Don't emit .guess ivar offset vars.
David Chisnall [Tue, 7 Aug 2018 12:02:46 +0000 (12:02 +0000)]
[objc-gnustep] Don't emit .guess ivar offset vars.

These were intended to allow non-fragile and fragile ABI code to be
mixed, as long as the fragile classes were higher up the hierarchy than
the non-fragile ones.  Unfortunately:

 - No one actually wants to do this.
 - Recent versions of Linux's run-time linker break it.

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

6 years ago[clang-format] comment reflow: add last line's penalty when ending broken
Krasimir Georgiev [Tue, 7 Aug 2018 10:23:24 +0000 (10:23 +0000)]
[clang-format] comment reflow: add last line's penalty when ending broken

Summary:
This fixes a bug in clang-format where the last line's penalty is not
taken into account when its ending is broken. Usually the last line's penalty
is handled by addNextStateToQueue, but in cases where the trailing `*/` is put
on a newline, the contents of the last line have to be considered for penalizing.

Reviewers: mprobst

Reviewed By: mprobst

Subscribers: cfe-commits

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

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

6 years agoFix clash of gcc toolchains in driver regression tests
Karl-Johan Karlsson [Tue, 7 Aug 2018 08:10:33 +0000 (08:10 +0000)]
Fix clash of gcc toolchains in driver regression tests

For some regression tests the path to the right toolchain is specified
using the -sysroot switch. However, if clang was configured with a
custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the
equivalent configure command), the path to the custom gcc toolchain path
takes precedence to the one specified by sysroot. This causes several
regression tests to fail as they will be using an unexpected path. This
patch fixes this issue by adding --gcc-toolchain='' to all tests that
rely on that. The empty string causes the driver to pick the path from
sysroot instead.

This patch contain the same kind of fixes as done in rC225182

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

6 years agoAMDGPU: Add builtin for s_dcache_wb
Matt Arsenault [Tue, 7 Aug 2018 07:49:13 +0000 (07:49 +0000)]
AMDGPU: Add builtin for s_dcache_wb

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

6 years agoAMDGPU: Add builtin for s_dcache_inv_vol
Matt Arsenault [Tue, 7 Aug 2018 07:49:04 +0000 (07:49 +0000)]
AMDGPU: Add builtin for s_dcache_inv_vol

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

6 years agoAuto var init test fix #2
JF Bastien [Tue, 7 Aug 2018 04:44:13 +0000 (04:44 +0000)]
Auto var init test fix #2

It turns out that the AVX bots have different alignment for their vectors, and my test mistakenly assumed a particular vector alignent on the stack. Instead, capture the alignment and test for it in subsequent operations.

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

6 years agoRemove broken command flag
JF Bastien [Tue, 7 Aug 2018 04:03:03 +0000 (04:03 +0000)]
Remove broken command flag

I was using it for testing, r339089 shouldn't have contained it.

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

6 years ago[NFC] Test automatic variable initialization
JF Bastien [Tue, 7 Aug 2018 03:12:52 +0000 (03:12 +0000)]
[NFC] Test automatic variable initialization

Summary:
r337887 started using memset for automatic variable initialization where sensible. A follow-up discussion leads me to believe that we should better test automatic variable initialization, and that there are probably follow-up patches in clang and LLVM to improve codegen. It’ll be important to measure -O0 compile time, and figure out which transforms should be in the frontend versus the backend.

This patch is just a test of the current behavior, no questions asked. Follow-up patches will tune the code generation.

<rdar://problem/42981573>

Subscribers: dexonsmith, cfe-commits

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

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

6 years ago[analyzer] pr37204: Take signedness into account in getTruthValue().
Artem Dergachev [Tue, 7 Aug 2018 02:27:38 +0000 (02:27 +0000)]
[analyzer] pr37204: Take signedness into account in getTruthValue().

It now actually produces a signed APSInt when the QualType passed into it is
signed, which is what any caller would expect.

Fixes a couple of crashes.

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

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

6 years ago[analyzer] NFC: Document that we support implicit argument constructors.
Artem Dergachev [Tue, 7 Aug 2018 02:22:59 +0000 (02:22 +0000)]
[analyzer] NFC: Document that we support implicit argument constructors.

The change in the AST in r338135 caused us to accidentally support
inlining constructors of operator implicit arguments. Previously they were
hard to support because they were treated as arguments in expressions
but not in declarations, but now they can be transparently treated as
simple temporaries.

Add tests and comments to explain how it now works.

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

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

6 years agoPerforming a test commmit as requested by Chris Lattner.
Balaji V. Iyer [Tue, 7 Aug 2018 00:31:44 +0000 (00:31 +0000)]
Performing a test commmit as requested by Chris Lattner.
-This line, and those below, will be ignored--

M    TemplateBase.h

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

6 years agoChanged how LLVM IR was generated to increase vectorization
Emmett Neyman [Mon, 6 Aug 2018 23:11:38 +0000 (23:11 +0000)]
Changed how LLVM IR was generated to increase vectorization

Summary: Changed the structure of the generated IR to make it easier to vectorize

Reviewers: morehouse, kcc

Reviewed By: morehouse

Subscribers: cfe-commits, llvm-commits

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

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

6 years ago[analyzer] Add ASTContext to CheckerManager
George Karpenkov [Mon, 6 Aug 2018 23:09:07 +0000 (23:09 +0000)]
[analyzer] Add ASTContext to CheckerManager

Some checkers require ASTContext. Having it in the constructor saves a
lot of boilerplate of having to pass it around.

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

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

6 years ago[lit, python] Always add quotes around the python path in lit
Stella Stamenova [Mon, 6 Aug 2018 22:37:45 +0000 (22:37 +0000)]
[lit, python] Always add quotes around the python path in lit

Summary:
The issue with the python path is that the path to python on Windows can contain spaces. To make the tests always work, the path to python needs to be surrounded by quotes.

This is a companion change to: https://reviews.llvm.org/D50206

Reviewers: asmith, zturner

Subscribers: cfe-commits

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

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

6 years ago[analyzer] InnerPointerChecker: fix displayed checker name.
Reka Kovacs [Mon, 6 Aug 2018 22:03:42 +0000 (22:03 +0000)]
[analyzer] InnerPointerChecker: fix displayed checker name.

For InnerPointerChecker to function properly, both the checker itself
and parts of MallocChecker that handle relevant use-after-free problems
need to be turned on. So far, the latter part has been developed within
MallocChecker's NewDelete sub-checker, often causing warnings to appear
under that name. This patch defines a new CheckKind within MallocChecker
for the inner pointer checking functionality, so that the correct name
is displayed in warnings and in the ExplodedGraph.

Tested on clang-tidy.

Differential Review: https://reviews.llvm.org/D50211

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

6 years ago[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested...
Simon Marchi [Mon, 6 Aug 2018 21:48:20 +0000 (21:48 +0000)]
[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

Summary:
InMemoryFileSystem::status behaves differently than
RealFileSystem::status.  The Name contained in the Status returned by
RealFileSystem::status will be the path as requested by the caller,
whereas InMemoryFileSystem::status returns the normalized path.

For example, when requested the status for "../src/first.h",
RealFileSystem returns a Status with "../src/first.h" as the Name.
InMemoryFileSystem returns "/absolute/path/to/src/first.h".

The reason for this change is that I want to make a unit test in the
clangd testsuite (where we use an InMemoryFileSystem) to reproduce a
bug I get with the clangd program (where a RealFileSystem is used).
This difference in behavior "hides" the bug in the unit test version.

An indirect impact of this change is that a -Wnonportable-include-path
warning is now emitted in test PCH/case-insensitive-include.c.  This is
because the real path of the included file (with the wrong case) was not
available previously, whereas it is now.

Reviewers: malaperle, ilya-biryukov, bkramer

Reviewed By: ilya-biryukov

Subscribers: eric_niebler, malaperle, omtcyfz, hokein, bkramer, ilya-biryukov, ioeric, cfe-commits

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

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

6 years ago[MinGW] Predefine UNICODE if -municode is specified during compilation
Martin Storsjo [Mon, 6 Aug 2018 19:48:44 +0000 (19:48 +0000)]
[MinGW] Predefine UNICODE if -municode is specified during compilation

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

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