[PATCH] D60055: Check i < FD->getNumParams() before querying

2019-03-31 Thread Violet via Phabricator via cfe-commits
Violet updated this revision to Diff 193041.
Violet added a comment.

Wrong bug number


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60055/new/

https://reviews.llvm.org/D60055

Files:
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/test/SemaCXX/PR41139.cpp


Index: clang/test/SemaCXX/PR41139.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR41139.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
+
+// expected-no-diagnostics
+
+int f1( unsigned ) { return 0; }
+
+template 
+struct S1 {
+S1( R(*f)(Args...) ) {}
+};
+
+int main() {
+S1 s1( f1 );
+}
Index: clang/lib/Sema/SemaTemplateInstantiate.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -2892,7 +2892,7 @@
   unsigned i = PV->getFunctionScopeIndex();
   // This parameter might be from a freestanding function type within the
   // function and isn't necessarily referring to one of FD's parameters.
-  if (FD->getParamDecl(i) == PV)
+  if (i < FD->getNumParams() && FD->getParamDecl(i) == PV)
 return FD->getCanonicalDecl()->getParamDecl(i);
 }
   }


Index: clang/test/SemaCXX/PR41139.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR41139.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
+
+// expected-no-diagnostics
+
+int f1( unsigned ) { return 0; }
+
+template 
+struct S1 {
+S1( R(*f)(Args...) ) {}
+};
+
+int main() {
+S1 s1( f1 );
+}
Index: clang/lib/Sema/SemaTemplateInstantiate.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -2892,7 +2892,7 @@
   unsigned i = PV->getFunctionScopeIndex();
   // This parameter might be from a freestanding function type within the
   // function and isn't necessarily referring to one of FD's parameters.
-  if (FD->getParamDecl(i) == PV)
+  if (i < FD->getNumParams() && FD->getParamDecl(i) == PV)
 return FD->getCanonicalDecl()->getParamDecl(i);
 }
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60055: Check i < FD->getNumParams() before querying

2019-03-31 Thread Violet via Phabricator via cfe-commits
Violet created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

As was already stated in a previous comment, the parameter isn't
necessarily referring to one of the DeclContext's parameter. We
should check the index is within the range to avoid out-of-boundary
access.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60055

Files:
  clang/lib/Sema/SemaTemplateInstantiate.cpp
  clang/test/SemaCXX/PR38077.cpp


Index: clang/test/SemaCXX/PR38077.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR38077.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
+
+// expected-no-diagnostics
+
+int f1( unsigned ) { return 0; }
+
+template 
+struct S1 {
+S1( R(*f)(Args...) ) {}
+};
+
+int main() {
+S1 s1( f1 );
+}
Index: clang/lib/Sema/SemaTemplateInstantiate.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -2892,7 +2892,7 @@
   unsigned i = PV->getFunctionScopeIndex();
   // This parameter might be from a freestanding function type within the
   // function and isn't necessarily referring to one of FD's parameters.
-  if (FD->getParamDecl(i) == PV)
+  if (i < FD->getNumParams() && FD->getParamDecl(i) == PV)
 return FD->getCanonicalDecl()->getParamDecl(i);
 }
   }


Index: clang/test/SemaCXX/PR38077.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/PR38077.cpp
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
+
+// expected-no-diagnostics
+
+int f1( unsigned ) { return 0; }
+
+template 
+struct S1 {
+S1( R(*f)(Args...) ) {}
+};
+
+int main() {
+S1 s1( f1 );
+}
Index: clang/lib/Sema/SemaTemplateInstantiate.cpp
===
--- clang/lib/Sema/SemaTemplateInstantiate.cpp
+++ clang/lib/Sema/SemaTemplateInstantiate.cpp
@@ -2892,7 +2892,7 @@
   unsigned i = PV->getFunctionScopeIndex();
   // This parameter might be from a freestanding function type within the
   // function and isn't necessarily referring to one of FD's parameters.
-  if (FD->getParamDecl(i) == PV)
+  if (i < FD->getNumParams() && FD->getParamDecl(i) == PV)
 return FD->getCanonicalDecl()->getParamDecl(i);
 }
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D58497: Clear the KnownModules cache if the preprocessor is going away

2019-03-31 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added a comment.

In D58497#1449306 , @dblaikie wrote:

> In D58497#1449243 , @nemanjai wrote:
>
> > Ping.
>
>
> Unfortunately Richard Smith is out for a few weeks at the moment, so might 
> take a little bit before he can get to this.
>
> It's odd to me that this lacks a test case - but you mention it's shown up on 
> buildbots? Does it reproduce consistently there? Under what conditions (which 
> buildbots/configurations show this - are they permanently failing because of 
> this?)?
>
> A test case, if at all possible, would be super helpful.


The failure this causes always shows up in the `Modules/builtins.m` test (at 
least in my experience). It is far from predictable and it does not 
consistently reproduce on any build bot. It occasionally shows up and slight 
perturbations in the source make it go away.
Honestly, I don't find this to be all that surprising. Using memory after 
freeing it has inherently unpredictable behaviour. There are certain toolchains 
that will diagnose freeing the same memory twice, but that's not the case here 
- we just happen to use it after freeing it.

> 
> 
>> If there are no objections in the next week or so, I'll commit this and it 
>> can be reviewed post-commit.
> 
> That's generally not considered acceptable practice - if something is sent 
> for review it's because it needs review & time doesn't change that. (there 
> are some exceptions to this - some folks send things out for "hey, anyone got 
> other ideas on this, otherwise I think it's fine" sort of thing)

I am really sorry about how this came across. I understand that given the 
context, this could quite reasonably be interpreted as me stating "I don't want 
to wait any longer, so I'm just going to commit this." That was not at all my 
intention. I merely meant to state that I don't believe this to be in any way 
controversial. I have shown quite clearly in my email that `KnownModules` will 
have pointers to data that the `Preprocessor` owns. If the existing 
`Preprocessor` shared pointer is the last reference, it will obviously be 
deleted now that we're reassigning to it. Thereby, we are deleting the 
`Preprocessor` which will delete all the data it owns and we are keeping 
`KnownModules` alive (with cached pointers to data that is being deleted). 
There is no situation I can think of in which it is reasonable to keep pointers 
to deleted data. If I came across an issue of this nature - clearly undefined 
behaviour - in the PPC back end where I spend most of my time, I'd probably not 
post for review as a fix is clearly in order. But since I am not intimately 
familiar with this code, I thought I'd get another opinion on the fix by 
sending an email to the dev list and posting on Phabricator.

All that being said, it sounds like there is an objection to me committing this 
so I certainly won't proceed without an approval on this review. If you or 
anyone else can offer a suggestion on how I might come up with a test case for 
this - or perhaps an alternative fix for this issue, I am more than happy to 
incorporate your suggestions.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58497/new/

https://reviews.llvm.org/D58497



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60050: Spelling correction for docs for cppcoreguidelines-owning-memory

2019-03-31 Thread Phabricator via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL357371: Spelling correction for docs for 
cppcoreguidelines-owning-memory (authored by sylvestre, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D60050?vs=193025=193026#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60050/new/

https://reviews.llvm.org/D60050

Files:
  
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst


Index: 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
===
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
@@ -50,7 +50,7 @@
   int* NonOwner = new int(42); // First warning here, since new must land in 
an owner
   delete NonOwner; // Second warning here, since only owners are allowed to be 
deleted
 
-  // Example Good, Ownership correclty stated
+  // Example Good, Ownership correctly stated
   gsl::owner Owner = new int(42); // Good
   delete Owner; // Good as well, statically enforced, that only owners get 
deleted
   


Index: clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
===
--- clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
@@ -50,7 +50,7 @@
   int* NonOwner = new int(42); // First warning here, since new must land in an owner
   delete NonOwner; // Second warning here, since only owners are allowed to be deleted
 
-  // Example Good, Ownership correclty stated
+  // Example Good, Ownership correctly stated
   gsl::owner Owner = new int(42); // Good
   delete Owner; // Good as well, statically enforced, that only owners get deleted
   
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r357371 - Spelling correction for docs for cppcoreguidelines-owning-memory

2019-03-31 Thread Sylvestre Ledru via cfe-commits
Author: sylvestre
Date: Sun Mar 31 14:53:00 2019
New Revision: 357371

URL: http://llvm.org/viewvc/llvm-project?rev=357371=rev
Log:
Spelling correction for docs for cppcoreguidelines-owning-memory

Summary: There's a typo in the docs, as mentioned in the title. Please see the 
diff.

Reviewers: JonasToth

Subscribers: sylvestre.ledru, nemanjai, kbarton, cfe-commits

Tags: #clang-tools-extra, #clang

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

Modified:

clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst?rev=357371=357370=357371=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
 Sun Mar 31 14:53:00 2019
@@ -50,7 +50,7 @@ to be deleted.
   int* NonOwner = new int(42); // First warning here, since new must land in 
an owner
   delete NonOwner; // Second warning here, since only owners are allowed to be 
deleted
 
-  // Example Good, Ownership correclty stated
+  // Example Good, Ownership correctly stated
   gsl::owner Owner = new int(42); // Good
   delete Owner; // Good as well, statically enforced, that only owners get 
deleted
   


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60050: Spelling correction for docs for cppcoreguidelines-owning-memory

2019-03-31 Thread Benjamin Brown via Phabricator via cfe-commits
gobennyb added a comment.

In D60050#1449392 , @sylvestre.ledru 
wrote:

> If you have permissions on the repo, no need for a review for such change!


I do not, so if someone could please commit for me, that'd be great. Thanks!


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60050/new/

https://reviews.llvm.org/D60050



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60050: Spelling correction for docs for cppcoreguidelines-owning-memory

2019-03-31 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru added a comment.

If you have permissions on the repo, no need for a review for such change!


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60050/new/

https://reviews.llvm.org/D60050



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59467: [clang] Adding the Likelihood Attribute from C++2a

2019-03-31 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added inline comments.



Comment at: clang/lib/Analysis/CFG.cpp:2208
+}
+
 CFGBlock *CFGBuilder::VisitStmt(Stmt *S, AddStmtChoice asc) {

Tyker wrote:
> riccibruno wrote:
> > I don't understand why this is needed. Can you explain it ? Also I think 
> > that someone familiar with this code should comment on this (maybe @NoQ ?)
> the detail of why are complicated and i don't have them all in head but 
> without this edit in cases like 
> 
> ```
> switch (...) {
> [[likely]] case 1:
> ...
> [[fallthrough]];
> default:
> ...
> }
> ```
> the fallthrough attribute emitted a diagnostic because is wasn't handling 
> attributed case statement. the edit i performed is probably not the optimal 
> way to solve the issue as it only solves the issue for likelihood attribute. 
> but i don't know any other attribute that can be applied on a case statement 
> but if they were others they would probably have the same issue. but the code 
> is quite hard to follow and i didn't wanted to break anything. so this is 
> what i came up with.
> i am going to look into it to find a better solution.
The [[likely]] attribute should not affect the overall topology of the CFG. It 
might be a nice piece of metadata to add to a CFG edge or to a CFG terminator, 
but for most consumers of the CFG (various static analyses such as 
analysis-based warnings or the Static Analyzer) the attribute should have 
little to no effect - the tool would still need to explore both branches. I 
don't know how exactly the fallthrough warning operates, but i find it likely 
(no pun intended) that the fallthrough warning itself should be updated, not 
the CFG.

It is probable that for compiler warnings it'll only cause false negatives, 
which is not as bad as false positives, but i wouldn't rely on that. 
Additionally, false negatives in such rare scenarios will be very hard to 
notice later. So i'm highly in favor of aiming for the correct solution in this 
patch.




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59467/new/

https://reviews.llvm.org/D59467



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60050: Spelling correction for docs for cppcoreguidelines-owning-memory

2019-03-31 Thread Benjamin Brown via Phabricator via cfe-commits
gobennyb created this revision.
gobennyb added a reviewer: JonasToth.
gobennyb created this object with edit policy "Administrators".
gobennyb added a project: clang-tools-extra.
Herald added subscribers: cfe-commits, kbarton, nemanjai.
Herald added a project: clang.

There's a typo in the docs, as mentioned in the title. Please see the diff.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D60050

Files:
  docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst


Index: docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
===
--- docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
+++ docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
@@ -50,7 +50,7 @@
   int* NonOwner = new int(42); // First warning here, since new must land in 
an owner
   delete NonOwner; // Second warning here, since only owners are allowed to be 
deleted
 
-  // Example Good, Ownership correclty stated
+  // Example Good, Ownership correctly stated
   gsl::owner Owner = new int(42); // Good
   delete Owner; // Good as well, statically enforced, that only owners get 
deleted
   


Index: docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
===
--- docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
+++ docs/clang-tidy/checks/cppcoreguidelines-owning-memory.rst
@@ -50,7 +50,7 @@
   int* NonOwner = new int(42); // First warning here, since new must land in an owner
   delete NonOwner; // Second warning here, since only owners are allowed to be deleted
 
-  // Example Good, Ownership correclty stated
+  // Example Good, Ownership correctly stated
   gsl::owner Owner = new int(42); // Good
   delete Owner; // Good as well, statically enforced, that only owners get deleted
   
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59449: [clang-tidy] Integrate clang-tidy-diff.py machinery into run-clang-tidy.py

2019-03-31 Thread Zinovy Nis via Phabricator via cfe-commits
zinovy.nis updated this revision to Diff 193023.
zinovy.nis added a comment.
Herald added a subscriber: jdoerfert.

Added a test.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59449/new/

https://reviews.llvm.org/D59449

Files:
  clang-tidy/tool/run-clang-tidy.py
  test/clang-tidy/run-clang-tidy-diff.cpp

Index: test/clang-tidy/run-clang-tidy-diff.cpp
===
--- /dev/null
+++ test/clang-tidy/run-clang-tidy-diff.cpp
@@ -0,0 +1,27 @@
+// REQUIRES: shell
+// RUN: mkdir -p "%t"
+// RUN: cd   "%t"
+// RUN: sed 's/placeholder_for_f/f/' %s > diff_to.cpp
+// RUN: echo '[{"directory": "%t", "command": "clang++ -o test.o -std=c++11 diff_to.cpp", "file": "diff_to.cpp"}]' > compile_commands.json
+// RUN: clang-tidy -checks=-*,modernize-use-override diff_to.cpp -- -std=c++11 | FileCheck -check-prefix=CHECK-SANITY %s
+// RUN: not diff -U0 %s diff_to.cpp | %run_clang_tidy --diff=0 -checks=-*,modernize-use-override2>&1 | FileCheck %s
+// RUN: not diff -U0 %s diff_to.cpp | %run_clang_tidy --diff=0 -checks=-*,modernize-use-override -quiet 2>&1 | FileCheck -check-prefix=CHECK-QUIET %s
+// RUN: not diff -U0 %s diff_to.cpp | %run_clang_tidy --diff=0 -checks=-*,modernize-use-override2>&1 | FileCheck -check-prefix=CHECK %s
+struct A {
+  virtual void f() {}
+  virtual void g() {}
+};
+// CHECK-NOT: warning:
+// CHECK-QUIET-NOT: warning:
+struct B : public A {
+  void placeholder_for_f() {}
+// CHECK-SANITY: [[@LINE-1]]:8: warning: annotate this
+// CHECK: [[@LINE-2]]:8: warning: annotate this
+// CHECK-QUIET: [[@LINE-3]]:8: warning: annotate this
+  void g() {}
+// CHECK-SANITY: [[@LINE-1]]:8: warning: annotate this
+// CHECK-NOT: warning:
+// CHECK-QUIET-NOT: warning:
+};
+// CHECK-SANITY-NOT: Suppressed
+// CHECK-QUIET-NOT: Suppressed
Index: clang-tidy/tool/run-clang-tidy.py
===
--- clang-tidy/tool/run-clang-tidy.py
+++ clang-tidy/tool/run-clang-tidy.py
@@ -7,7 +7,6 @@
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 #
 #======#
-# FIXME: Integrate with clang-tidy-diff.py
 
 """
 Parallel clang-tidy runner
@@ -60,6 +59,7 @@
 else:
 import queue as queue
 
+
 def find_compilation_database(path):
   """Adjusts the directory until a compilation database is found."""
   result = './'
@@ -77,7 +77,7 @@
   return os.path.normpath(os.path.join(directory, f))
 
 
-def get_tidy_invocation(f, clang_tidy_binary, checks, tmpdir, build_path,
+def get_tidy_invocation(f, lines, clang_tidy_binary, checks, tmpdir, build_path,
 header_filter, extra_arg, extra_arg_before, quiet,
 config):
   """Gets a command line for clang-tidy."""
@@ -87,6 +87,12 @@
   else:
 # Show warnings in all in-project headers by default.
 start.append('-header-filter=^' + build_path + '/.*')
+
+  if lines is not None:
+line_json = json.dumps([{"name": f, "lines": lines}], separators=(',', ':'))
+# Run clang-tidy on files containing changes.
+start.append('-line-filter=' + line_json)
+
   if checks:
 start.append('-checks=' + checks)
   if tmpdir is not None:
@@ -159,8 +165,9 @@
 def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
   """Takes filenames out of queue and runs clang-tidy on them."""
   while True:
-name = queue.get()
-invocation = get_tidy_invocation(name, args.clang_tidy_binary, args.checks,
+(name, lines) = queue.get()
+invocation = get_tidy_invocation(name, lines,
+ args.clang_tidy_binary, args.checks,
  tmpdir, build_path, args.header_filter,
  args.extra_arg, args.extra_arg_before,
  args.quiet, args.config)
@@ -176,11 +183,42 @@
 queue.task_done()
 
 
+def get_changed_lines(prefix_len):
+  iregex = '^%s$' % r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hpp|m|mm|inc)'
+  lines_by_file = {}
+  filename = None
+  for line in sys.stdin:
+match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\n\"]*)' % prefix_len, line)
+if match:
+  filename = match.group(2)
+if filename is None:
+  continue
+
+if not re.match(iregex, filename, re.IGNORECASE):
+  continue
+
+match = re.search('^@@.*\+(\d+)(,(\d+))?', line)
+if match:
+  start_line = int(match.group(1))
+  line_count = 1
+  if match.group(3):
+line_count = int(match.group(3))
+  if line_count == 0:
+continue
+  end_line = start_line + line_count - 1
+  lines_by_file.setdefault(filename, []).append([start_line, end_line])
+
+  return lines_by_file
+
+
 def main():
   parser = argparse.ArgumentParser(description='Runs clang-tidy over all files '
'in a compilation database. Requires '
'clang-tidy and 

[PATCH] D60040: [clangd] Use capacity() instead of size() in RefSlab::bytes()

2019-03-31 Thread Nathan Ridge via Phabricator via cfe-commits
nridge added a comment.

I do not.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60040/new/

https://reviews.llvm.org/D60040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60038: gn build: Add build files for most clang-tools-extra unit tests

2019-03-31 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL357369: gn build: Add build files for most clang-tools-extra 
unit tests (authored by nico, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D60038?vs=192995=193019#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60038/new/

https://reviews.llvm.org/D60038

Files:
  clang-tools-extra/trunk/unittests/clang-tidy/CMakeLists.txt
  llvm/trunk/utils/gn/build/sync_source_lists_from_cmake.py
  llvm/trunk/utils/gn/secondary/clang-tools-extra/clangd/indexer/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/BUILD.gn
  
llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-apply-replacements/BUILD.gn
  
llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-change-namespace/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-doc/BUILD.gn
  
llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-include-fixer/BUILD.gn
  
llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-include-fixer/find-all-symbols/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-move/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-query/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-tidy/BUILD.gn
  llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clangd/BUILD.gn

Index: llvm/trunk/utils/gn/secondary/clang-tools-extra/clangd/indexer/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang-tools-extra/clangd/indexer/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang-tools-extra/clangd/indexer/BUILD.gn
@@ -10,7 +10,7 @@
 "//clang/lib/Tooling",
 "//llvm/lib/Support",
   ]
-  include_dirs = [ "..", ]
+  include_dirs = [ ".." ]
   sources = [
 "IndexerMain.cpp",
   ]
Index: llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-query/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-query/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-query/BUILD.gn
@@ -0,0 +1,21 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangQueryTests") {
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang-tools-extra/clang-query",
+"//clang/lib/AST",
+"//clang/lib/ASTMatchers",
+"//clang/lib/ASTMatchers/Dynamic",
+"//clang/lib/Basic",
+"//clang/lib/Frontend",
+"//clang/lib/Serialization",
+"//clang/lib/Tooling",
+"//llvm/lib/Support",
+  ]
+  include_dirs = [ "//clang-tools-extra/clang-query" ]
+  sources = [
+"QueryEngineTest.cpp",
+"QueryParserTest.cpp",
+  ]
+}
Index: llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-doc/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-doc/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-doc/BUILD.gn
@@ -0,0 +1,29 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangDocTests") {
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang-tools-extra/clang-doc",
+"//clang/lib/AST",
+"//clang/lib/ASTMatchers",
+"//clang/lib/Basic",
+"//clang/lib/Format",
+"//clang/lib/Frontend",
+"//clang/lib/Rewrite",
+"//clang/lib/Serialization",
+"//clang/lib/Tooling",
+"//clang/lib/Tooling/Core",
+"//llvm/lib/Bitcode/Reader",
+"//llvm/lib/Bitcode/Writer",
+"//llvm/lib/Support",
+  ]
+  include_dirs = [ "//clang-tools-extra/clang-doc" ]
+  sources = [
+"BitcodeTest.cpp",
+"ClangDocTest.cpp",
+"MDGeneratorTest.cpp",
+"MergeTest.cpp",
+"SerializeTest.cpp",
+"YAMLGeneratorTest.cpp",
+  ]
+}
Index: llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-apply-replacements/BUILD.gn
===
--- llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-apply-replacements/BUILD.gn
+++ llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/clang-apply-replacements/BUILD.gn
@@ -0,0 +1,15 @@
+import("//llvm/utils/unittest/unittest.gni")
+
+unittest("ClangApplyReplacementsTests") {
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+"//clang-tools-extra/clang-apply-replacements",
+"//clang/lib/Basic",
+"//clang/lib/Tooling/Core",
+"//clang/lib/Tooling/Refactoring",
+  ]
+  include_dirs = [ "//clang-tools-extra/clang-apply-replacements/include" ]
+  sources = [
+"ApplyReplacementsTest.cpp",
+  ]
+}
Index: llvm/trunk/utils/gn/secondary/clang-tools-extra/unittests/BUILD.gn
===
--- 

[clang-tools-extra] r357369 - gn build: Add build files for most clang-tools-extra unit tests

2019-03-31 Thread Nico Weber via cfe-commits
Author: nico
Date: Sun Mar 31 09:49:54 2019
New Revision: 357369

URL: http://llvm.org/viewvc/llvm-project?rev=357369=rev
Log:
gn build: Add build files for most clang-tools-extra unit tests

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

Modified:
clang-tools-extra/trunk/unittests/clang-tidy/CMakeLists.txt

Modified: clang-tools-extra/trunk/unittests/clang-tidy/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/CMakeLists.txt?rev=357369=357368=357369=diff
==
--- clang-tools-extra/trunk/unittests/clang-tidy/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/CMakeLists.txt Sun Mar 31 
09:49:54 2019
@@ -16,7 +16,8 @@ add_extra_unittest(ClangTidyTests
   ObjCModuleTest.cpp
   OverlappingReplacementsTest.cpp
   UsingInserterTest.cpp
-  ReadabilityModuleTest.cpp)
+  ReadabilityModuleTest.cpp
+  )
 
 target_link_libraries(ClangTidyTests
   PRIVATE


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60038: gn build: Add build files for most clang-tools-extra unit tests

2019-03-31 Thread Nico Weber via Phabricator via cfe-commits
thakis marked an inline comment as done.
thakis added a comment.

Thanks!




Comment at: 
llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-apply-replacements/BUILD.gn:3
+
+unittest("ClangApplyReplacementsTests") {
+  configs += [ "//llvm/utils/gn/build:clang_code" ]

mbonadei wrote:
> Why don't we use `output_name` here as well? It seems to be available for 
> executables 
> (https://gn.googlesource.com/gn/+/master/docs/reference.md#target-declarations-executable_declare-an-executable-target-variables).
>  The current style seems to be lisp-case for target names and have 
> `output_name` matching the cmake build.
That's a good question. phosek asked about this too here: 
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181231/614211.html

I don't think there's a really good reason for this. I don't remember why I did 
it this way.

Trying to come up with a justification after the fact: A weak reason is that 
for static libraries it doesn't really matter what they're called on disk 
(other than to llvm-config's lit tests, which is why the GN build matches the 
cmake build -- else I wouldn't set the output name there), but for executables 
you need to know the name of the executable to run it, and it's maybe nice if 
the target has the same name as the executable for that reason.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60038/new/

https://reviews.llvm.org/D60038



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59870: [clang-tidy] Add MagnitudeBitsUpperLimit option to bugprone-too-small-loop-variable

2019-03-31 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas updated this revision to Diff 193017.
ztamas added a comment.

Make 16 the default value of MagnitudeBitsUpperLimit option.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59870/new/

https://reviews.llvm.org/D59870

Files:
  clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
  clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst
  
clang-tools-extra/test/clang-tidy/bugprone-too-small-loop-variable-magniute-bits-upper-limit.cpp
  clang-tools-extra/test/clang-tidy/bugprone-too-small-loop-variable.cpp

Index: clang-tools-extra/test/clang-tidy/bugprone-too-small-loop-variable.cpp
===
--- clang-tools-extra/test/clang-tidy/bugprone-too-small-loop-variable.cpp
+++ clang-tools-extra/test/clang-tidy/bugprone-too-small-loop-variable.cpp
@@ -1,4 +1,8 @@
-// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t -- -- --target=x86_64-linux
+// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t -- \
+// RUN:   -config="{CheckOptions: \
+// RUN: [{key: bugprone-too-small-loop-variable.MagnitudeBitsUpperLimit, \
+// RUN:   value: 1024}]}" \
+// RUN:   -- --target=x86_64-linux
 
 long size() { return 294967296l; }
 
Index: clang-tools-extra/test/clang-tidy/bugprone-too-small-loop-variable-magniute-bits-upper-limit.cpp
===
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/bugprone-too-small-loop-variable-magniute-bits-upper-limit.cpp
@@ -0,0 +1,23 @@
+// RUN: %check_clang_tidy %s bugprone-too-small-loop-variable %t -- -- --target=x86_64-linux
+
+// MagnitudeBitsUpperLimit = 16 (default value)
+
+unsigned long size() { return 294967296l; }
+
+void voidFilteredOutForLoop1() {
+  for (long i = 0; i < size(); ++i) {
+// no warning
+  }
+}
+
+void voidCaughtForLoop1() {
+  for (int i = 0; i < size(); ++i) {
+// no warning
+  }
+}
+
+void voidCaughtForLoop2() {
+  for (short i = 0; i < size(); ++i) {
+// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: loop variable has narrower type 'short' than iteration's upper bound 'unsigned long' [bugprone-too-small-loop-variable]
+  }
+}
Index: clang-tools-extra/docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst
===
--- clang-tools-extra/docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst
+++ clang-tools-extra/docs/clang-tidy/checks/bugprone-too-small-loop-variable.rst
@@ -27,3 +27,20 @@
 
 This algorithm works for small amount of objects, but will lead to freeze for a
 a larger user input.
+
+.. option:: MagnitudeBitsUpperLimit
+
+  Upper limit for the magnitue bits of the loop variable. If it's set the check
+  filters out those catches in which the loop variable's type has more magnitude
+  bits as the specified upper limit. The default value is 16.
+  For example, if the user sets this option to 31 (bits), then a 32-bit ``unsigend int``
+  is ignored by the check, however a 32-bit ``int`` is not (A 32-bit ``signed int``
+  has 31 magnitude bits).
+
+.. code-block:: c++
+
+  int main() {
+long size = 294967296l;
+for (unsigned i = 0; i < size; ++i) {} // no warning with MagnitudeBitsUpperLimit = 31 on a system where unsigned is 32-bit
+for (int i = 0; i < size; ++i) {} // warning with MagnitudeBitsUpperLimit = 31 on a system where int is 32-bit
+  }
Index: clang-tools-extra/docs/ReleaseNotes.rst
===
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -119,6 +119,10 @@
   `CommentUserDefiniedLiterals`, `CommentStringLiterals`,
   `CommentCharacterLiterals` & `CommentNullPtrs` options.
 
+- The :doc:`bugprone-too-small-loop-variable
+  ` now supports
+  `MagnitudeBitsUpperLimit` option.
+
 - The :doc:`google-runtime-int `
   check has been disabled in Objective-C++.
 
Index: clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.h
===
--- clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.h
+++ clang-tools-extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.h
@@ -29,10 +29,14 @@
 /// http://clang.llvm.org/extra/clang-tidy/checks/bugprone-too-small-loop-variable.html
 class TooSmallLoopVariableCheck : public ClangTidyCheck {
 public:
-  TooSmallLoopVariableCheck(StringRef Name, ClangTidyContext *Context)
-  : ClangTidyCheck(Name, Context) {}
+  TooSmallLoopVariableCheck(StringRef Name, ClangTidyContext *Context);
+
+  void storeOptions(ClangTidyOptions::OptionMap ) override;
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult ) override;
+
+private:
+  const unsigned MagnitudeBitsUpperLimit;
 

[PATCH] D58497: Clear the KnownModules cache if the preprocessor is going away

2019-03-31 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment.

In D58497#1449243 , @nemanjai wrote:

> Ping.


Unfortunately Richard Smith is out for a few weeks at the moment, so might take 
a little bit before he can get to this.

It's odd to me that this lacks a test case - but you mention it's shown up on 
buildbots? Does it reproduce consistently there? Under what conditions (which 
buildbots/configurations show this - are they permanently failing because of 
this?)?

A test case, if at all possible, would be super helpful.

> If there are no objections in the next week or so, I'll commit this and it 
> can be reviewed post-commit.

That's generally not considered acceptable practice - if something is sent for 
review it's because it needs review & time doesn't change that. (there are some 
exceptions to this - some folks send things out for "hey, anyone got other 
ideas on this, otherwise I think it's fine" sort of thing)


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58497/new/

https://reviews.llvm.org/D58497



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59467: [clang] Adding the Likelihood Attribute from C++2a

2019-03-31 Thread Gauthier via Phabricator via cfe-commits
Tyker updated this revision to Diff 193016.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59467/new/

https://reviews.llvm.org/D59467

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/AST/StmtCXX.h
  clang/include/clang/AST/TextNodeDumper.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Scope.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Stmt.cpp
  clang/lib/AST/StmtCXX.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/CFG.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/Scope.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAttr.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/CodeGenCXX/cxx2a-likelihood-attr.cpp
  clang/test/PCH/cxx2a-likelihood-attr.cpp
  clang/test/SemaCXX/cxx17-compat.cpp
  clang/test/SemaCXX/cxx2a-likelihood-attr.cpp

Index: clang/test/SemaCXX/cxx2a-likelihood-attr.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/cxx2a-likelihood-attr.cpp
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify -std=c++2a
+
+// formating this file will break the test
+// clang-format off
+
+int f(int);
+
+int f(int i) {
+  if (i == 1)
+[[unlikely]] { f(i); }
+  else if (i == 2)
+[[likely]] return f(i);
+  else
+[[unlikely]] { return f(i + 1); }
+  return i;
+}
+
+[[likely]] typedef int n1;
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+typedef int [[likely]] n2;
+// expected-error@-1 {{'likely' attribute cannot be applied to types}}
+typedef int n3 [[likely]];
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+
+enum [[likely]] E{One};
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+
+[[likely]]
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+
+void test(int i) {
+  [[likely]]
+  // expected-warning@-1 {{attribute 'likely' is not associated with a branch and is ignored}}
+  if (f(i)) [[likely, likely]] {
+// expected-error@-1 {{likely attribute cannot be repeated}}
+// expected-note@-2 {{previous attribute is here}}
+[[unlikely]] return;
+// expected-warning@-1 {{attribute 'unlikely' is not associated with a branch and is ignored}}
+  }
+  else [[unlikely]] if (f(i)) {
+while (f(i))
+  [[likely]] {
+switch (i) {
+  [[likely]] case 1 : default : [[likely]];
+  // expected-warning@-1 {{attribute 'likely' is not associated with a branch and is ignored}}
+  [[unlikely]] case 3 : f(i);
+  [[fallthrough]];
+case 4:
+  return;
+}
+  }
+for (;;)
+  [[likely, unlikely]]
+  // expected-error@-1 {{unlikely and likely attributes are not compatible}}
+  // expected-note@-2 {{previous attribute is here}}
+  [[likely]] return;
+// expected-error@-1 {{likely attribute cannot be repeated}}
+// expected-note@-5 {{previous attribute is here}}
+  }
+  try { // expected-error {{cannot use 'try' with exceptions disabled}}
+[[likely]];
+// expected-warning@-1 {{attribute 'likely' is not associated with a branch and is ignored}}
+  } catch (int) {
+[[likely]] test :
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+[[unlikely]] return;
+  }
+}
\ No newline at end of file
Index: clang/test/SemaCXX/cxx17-compat.cpp
===
--- clang/test/SemaCXX/cxx17-compat.cpp
+++ clang/test/SemaCXX/cxx17-compat.cpp
@@ -56,10 +56,33 @@
 };
 
 void ForRangeInit() {
-  for (int arr[3] = {1, 2, 3}; int n : arr) {}
+  for (int arr[3] = {1, 2, 3}; int n : arr) {
+  }
 #if __cplusplus <= 201703L
-// expected-warning@-2 {{range-based for loop initialization statements are a C++2a extension}}
+  // expected-warning@-2 {{range-based for loop initialization statements are a
+  // C++2a extension}}
 #else
-// expected-warning@-4 {{range-based for loop initialization statements are incompatible with C++ standards before C++2a}}
+  // expected-warning@-4 {{range-based for loop initialization statements are
+  // incompatible with C++ standards before C++2a}}
+#endif
+}
+
+int f(int i) {
+  if (i == 1)
+[[unlikely]]
+#if __cplusplus <= 201703L
+// expected-warning@-2 {{use of the 'unlikely' attribute is a C++2a
+// extension}}
+#endif
+{
+  f(i);
+}
+  else if (i == 2)
+[[likely]]
+#if __cplusplus <= 201703L
+// expected-warning@-2 {{use of the 'likely' attribute is a C++2a
+// extension}}
 #endif
+return f(i);
+  return i;
 }
Index: 

[PATCH] D59467: [clang] Adding the Likelihood Attribute from C++2a

2019-03-31 Thread Gauthier via Phabricator via cfe-commits
Tyker marked an inline comment as done.
Tyker added inline comments.



Comment at: clang/lib/Sema/SemaStmt.cpp:528
+if (ElseLikelihoodAttr && ThenLikelihoodAttr->isEqual(ElseLikelihoodAttr)) 
{
+  Diag(ElseLikelihoodAttr->getLocation(),
+   diag::warn_conflicting_likelihood_attrs)

clang-format passed on the whole file i am fixing it


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59467/new/

https://reviews.llvm.org/D59467



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59467: [clang] Adding the Likelihood Attribute from C++2a

2019-03-31 Thread Gauthier via Phabricator via cfe-commits
Tyker marked an inline comment as done.
Tyker added inline comments.
Herald added a subscriber: rnkovacs.



Comment at: clang/test/SemaCXX/cxx2a-likelihood-attr.cpp:70
+
+// clang-format off

just saw the //clang format off at the bottom ill remove it


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59467/new/

https://reviews.llvm.org/D59467



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59467: [clang] Adding the Likelihood Attribute from C++2a

2019-03-31 Thread Gauthier via Phabricator via cfe-commits
Tyker updated this revision to Diff 193015.
Tyker added a comment.
Herald added a reviewer: martong.
Herald added a reviewer: shafik.

@riccibruno i fixed based on feedback everything except the CFG edit as i still 
need to analyse the situation.

added AST and CodeGen for For, While, Do and CXXFor.
added tests for Semantic, AST, PCH


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59467/new/

https://reviews.llvm.org/D59467

Files:
  clang/include/clang/AST/Stmt.h
  clang/include/clang/AST/StmtCXX.h
  clang/include/clang/AST/TextNodeDumper.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Scope.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/Stmt.cpp
  clang/lib/AST/StmtCXX.cpp
  clang/lib/AST/TextNodeDumper.cpp
  clang/lib/Analysis/CFG.cpp
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/Parse/ParseStmt.cpp
  clang/lib/Sema/Scope.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/Sema/SemaStmtAttr.cpp
  clang/lib/Sema/TreeTransform.h
  clang/lib/Serialization/ASTReaderStmt.cpp
  clang/lib/Serialization/ASTWriterStmt.cpp
  clang/test/CodeGenCXX/cxx2a-likelihood-attr.cpp
  clang/test/PCH/cxx2a-likelihood-attr.cpp
  clang/test/SemaCXX/cxx17-compat.cpp
  clang/test/SemaCXX/cxx2a-likelihood-attr.cpp

Index: clang/test/SemaCXX/cxx2a-likelihood-attr.cpp
===
--- /dev/null
+++ clang/test/SemaCXX/cxx2a-likelihood-attr.cpp
@@ -0,0 +1,70 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify -std=c++2a
+
+// formating this file will break the test
+// clang-format off
+
+int f(int);
+
+int f(int i) {
+  if (i == 1)
+[[unlikely]] { f(i); }
+  else if (i == 2)
+[[likely]] return f(i);
+  else
+[[unlikely]] { return f(i + 1); }
+  return i;
+}
+
+[[likely]] typedef int n1;
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+typedef int [[likely]] n2;
+// expected-error@-1 {{'likely' attribute cannot be applied to types}}
+typedef int n3 [[likely]];
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+
+enum [[likely]] E{One};
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+
+[[likely]]
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+
+void test(int i) {
+  [[likely]]
+  // expected-warning@-1 {{attribute 'likely' is not associated with a branch and is ignored}}
+  if (f(i)) [[likely, likely]] {
+// expected-error@-1 {{likely attribute cannot be repeated}}
+// expected-note@-2 {{previous attribute is here}}
+[[unlikely]] return;
+// expected-warning@-1 {{attribute 'unlikely' is not associated with a branch and is ignored}}
+  }
+  else [[unlikely]] if (f(i)) {
+while (f(i))
+  [[likely]] {
+switch (i) {
+  [[likely]] case 1 : default : [[likely]];
+  // expected-warning@-1 {{attribute 'likely' is not associated with a branch and is ignored}}
+  [[unlikely]] case 3 : f(i);
+  [[fallthrough]];
+case 4:
+  return;
+}
+  }
+for (;;)
+  [[likely, unlikely]]
+  // expected-error@-1 {{unlikely and likely attributes are not compatible}}
+  // expected-note@-2 {{previous attribute is here}}
+  [[likely]] return;
+// expected-error@-1 {{likely attribute cannot be repeated}}
+// expected-note@-5 {{previous attribute is here}}
+  }
+  try { // expected-error {{cannot use 'try' with exceptions disabled}}
+[[likely]];
+// expected-warning@-1 {{attribute 'likely' is not associated with a branch and is ignored}}
+  } catch (int) {
+[[likely]] test :
+// expected-error@-1 {{'likely' attribute cannot be applied to a declaration}}
+[[unlikely]] return;
+  }
+}
+
+// clang-format off
Index: clang/test/SemaCXX/cxx17-compat.cpp
===
--- clang/test/SemaCXX/cxx17-compat.cpp
+++ clang/test/SemaCXX/cxx17-compat.cpp
@@ -56,10 +56,33 @@
 };
 
 void ForRangeInit() {
-  for (int arr[3] = {1, 2, 3}; int n : arr) {}
+  for (int arr[3] = {1, 2, 3}; int n : arr) {
+  }
 #if __cplusplus <= 201703L
-// expected-warning@-2 {{range-based for loop initialization statements are a C++2a extension}}
+  // expected-warning@-2 {{range-based for loop initialization statements are a
+  // C++2a extension}}
 #else
-// expected-warning@-4 {{range-based for loop initialization statements are incompatible with C++ standards before C++2a}}
+  // expected-warning@-4 {{range-based for loop initialization statements are
+  // incompatible with C++ standards before C++2a}}
+#endif
+}
+
+int f(int i) {
+  if (i == 1)
+[[unlikely]]
+#if __cplusplus <= 201703L
+// expected-warning@-2 {{use of the 'unlikely' attribute is 

[PATCH] D60016: [InstCombine] canonicalize select shuffles by commuting

2019-03-31 Thread Sanjay Patel via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC357366: [InstCombine] canonicalize select shuffles by 
commuting (authored by spatel, committed by ).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D60016?vs=192926=193011#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60016/new/

https://reviews.llvm.org/D60016

Files:
  test/CodeGen/avx-cmp-builtins.c
  test/CodeGen/avx-shuffle-builtins.c


Index: test/CodeGen/avx-shuffle-builtins.c
===
--- test/CodeGen/avx-shuffle-builtins.c
+++ test/CodeGen/avx-shuffle-builtins.c
@@ -91,19 +91,19 @@
 
 __m256 test_mm256_insertf128_ps_0(__m256 a, __m128 b) {
   // CHECK-LABEL: @test_mm256_insertf128_ps_0
-  // CHECK: shufflevector{{.*}}
+  // CHECK: shufflevector{{.*}}
   return _mm256_insertf128_ps(a, b, 0);
 }
 
 __m256d test_mm256_insertf128_pd_0(__m256d a, __m128d b) {
   // CHECK-LABEL: @test_mm256_insertf128_pd_0
-  // CHECK: shufflevector{{.*}}
+  // CHECK: shufflevector{{.*}}
   return _mm256_insertf128_pd(a, b, 0);
 }
 
 __m256i test_mm256_insertf128_si256_0(__m256i a, __m128i b) {
   // CHECK-LABEL: @test_mm256_insertf128_si256_0
-  // CHECK: shufflevector{{.*}}
+  // CHECK: shufflevector{{.*}}
   return _mm256_insertf128_si256(a, b, 0);
 }
 
Index: test/CodeGen/avx-cmp-builtins.c
===
--- test/CodeGen/avx-cmp-builtins.c
+++ test/CodeGen/avx-cmp-builtins.c
@@ -22,25 +22,25 @@
 
 __m128 test_cmpgt_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 1)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpgt_ss(a, b);
 }
 
 __m128 test_cmpge_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 2)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpge_ss(a, b);
 }
 
 __m128 test_cmpngt_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 5)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpngt_ss(a, b);
 }
 
 __m128 test_cmpnge_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 6)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpnge_ss(a, b);
 }
 


Index: test/CodeGen/avx-shuffle-builtins.c
===
--- test/CodeGen/avx-shuffle-builtins.c
+++ test/CodeGen/avx-shuffle-builtins.c
@@ -91,19 +91,19 @@
 
 __m256 test_mm256_insertf128_ps_0(__m256 a, __m128 b) {
   // CHECK-LABEL: @test_mm256_insertf128_ps_0
-  // CHECK: shufflevector{{.*}}
+  // CHECK: shufflevector{{.*}}
   return _mm256_insertf128_ps(a, b, 0);
 }
 
 __m256d test_mm256_insertf128_pd_0(__m256d a, __m128d b) {
   // CHECK-LABEL: @test_mm256_insertf128_pd_0
-  // CHECK: shufflevector{{.*}}
+  // CHECK: shufflevector{{.*}}
   return _mm256_insertf128_pd(a, b, 0);
 }
 
 __m256i test_mm256_insertf128_si256_0(__m256i a, __m128i b) {
   // CHECK-LABEL: @test_mm256_insertf128_si256_0
-  // CHECK: shufflevector{{.*}}
+  // CHECK: shufflevector{{.*}}
   return _mm256_insertf128_si256(a, b, 0);
 }
 
Index: test/CodeGen/avx-cmp-builtins.c
===
--- test/CodeGen/avx-cmp-builtins.c
+++ test/CodeGen/avx-cmp-builtins.c
@@ -22,25 +22,25 @@
 
 __m128 test_cmpgt_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 1)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpgt_ss(a, b);
 }
 
 __m128 test_cmpge_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 2)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpge_ss(a, b);
 }
 
 __m128 test_cmpngt_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 5)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpngt_ss(a, b);
 }
 
 __m128 test_cmpnge_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 6)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpnge_ss(a, b);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r357366 - [InstCombine] canonicalize select shuffles by commuting

2019-03-31 Thread Sanjay Patel via cfe-commits
Author: spatel
Date: Sun Mar 31 08:01:30 2019
New Revision: 357366

URL: http://llvm.org/viewvc/llvm-project?rev=357366=rev
Log:
[InstCombine] canonicalize select shuffles by commuting

In PR41304:
https://bugs.llvm.org/show_bug.cgi?id=41304
...we have a case where we want to fold a binop of select-shuffle (blended) 
values.

Rather than try to match commuted variants of the pattern, we can canonicalize 
the
shuffles and check for mask equality with commuted operands.

We don't produce arbitrary shuffle masks in instcombine, but select-shuffles 
are a
special case that the backend is required to handle because we already 
canonicalize
vector select to this shuffle form.

So there should be no codegen difference from this change. It's possible that 
this
improves CSE in IR though.

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

Modified:
cfe/trunk/test/CodeGen/avx-cmp-builtins.c
cfe/trunk/test/CodeGen/avx-shuffle-builtins.c

Modified: cfe/trunk/test/CodeGen/avx-cmp-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx-cmp-builtins.c?rev=357366=357365=357366=diff
==
--- cfe/trunk/test/CodeGen/avx-cmp-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx-cmp-builtins.c Sun Mar 31 08:01:30 2019
@@ -22,25 +22,25 @@ __m128d test_cmp_ss(__m128 a, __m128 b)
 
 __m128 test_cmpgt_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 1)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpgt_ss(a, b);
 }
 
 __m128 test_cmpge_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 2)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpge_ss(a, b);
 }
 
 __m128 test_cmpngt_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 5)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpngt_ss(a, b);
 }
 
 __m128 test_cmpnge_ss(__m128 a, __m128 b) {
   // CHECK: @llvm.x86.sse.cmp.ss({{.*}}, i8 6)
-  // CHECK: shufflevector <{{.*}}, <4 x i32> 
+  // CHECK: shufflevector <{{.*}}, <4 x i32> 
   return _mm_cmpnge_ss(a, b);
 }
 

Modified: cfe/trunk/test/CodeGen/avx-shuffle-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx-shuffle-builtins.c?rev=357366=357365=357366=diff
==
--- cfe/trunk/test/CodeGen/avx-shuffle-builtins.c (original)
+++ cfe/trunk/test/CodeGen/avx-shuffle-builtins.c Sun Mar 31 08:01:30 2019
@@ -91,19 +91,19 @@ test_mm256_broadcast_ss(float const *__a
 
 __m256 test_mm256_insertf128_ps_0(__m256 a, __m128 b) {
   // CHECK-LABEL: @test_mm256_insertf128_ps_0
-  // CHECK: shufflevector{{.*}}
+  // CHECK: shufflevector{{.*}}
   return _mm256_insertf128_ps(a, b, 0);
 }
 
 __m256d test_mm256_insertf128_pd_0(__m256d a, __m128d b) {
   // CHECK-LABEL: @test_mm256_insertf128_pd_0
-  // CHECK: shufflevector{{.*}}
+  // CHECK: shufflevector{{.*}}
   return _mm256_insertf128_pd(a, b, 0);
 }
 
 __m256i test_mm256_insertf128_si256_0(__m256i a, __m128i b) {
   // CHECK-LABEL: @test_mm256_insertf128_si256_0
-  // CHECK: shufflevector{{.*}}
+  // CHECK: shufflevector{{.*}}
   return _mm256_insertf128_si256(a, b, 0);
 }
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59467: [clang] Adding the Likelihood Attribute from C++2a

2019-03-31 Thread Bruno Ricci via Phabricator via cfe-commits
riccibruno added inline comments.



Comment at: clang/lib/CodeGen/CGStmt.cpp:705
+}
+
 void CodeGenFunction::EmitWhileStmt(const WhileStmt ,

Tyker wrote:
> riccibruno wrote:
> > I believe that the lowering is incorrect. I applied your patch and here 
> > ({F8571803}) is the IR that clang generates (obtained with `-O1 -S 
> > -emit-llvm -Xclang -disable-llvm-passes -g0`) for this code:
> > 
> > ```
> > bool f(bool i);
> > bool g(bool i);
> > 
> > bool h1(bool i) {
> >   if (i) [[likely]]
> > return f(i);
> >   return g(i);
> > }
> > 
> > bool h2(bool i) {
> >   if (__builtin_expect(i, true))
> > return f(i);
> >   return g(i);
> > }
> > ```
> > 
> > In particular for the branch in `h1` we have:
> > ```
> >   %tobool = trunc i8 %0 to i1
> >   %expval = call i1 @llvm.expect.i1(i1 %tobool, i1 true)
> >   br i1 %tobool, label %if.then, label %if.end
> > ```
> > Note that `%expval` is not used. Compare this to the branch in `h2`:
> > ```
> >   %tobool = trunc i8 %0 to i1
> >   %conv = zext i1 %tobool to i64
> >   %expval = call i64 @llvm.expect.i64(i64 %conv, i64 1)
> >   %tobool1 = icmp ne i64 %expval, 0
> >   br i1 %tobool1, label %if.then, label %if.end
> > ```
> > where the extra conversions are because of the signature of 
> > `__builtin_expect`.
> from reading the documentation it seemed to me that both were equivalent. but 
> after further checking there aren't.
Looking at how the intrinsic is lowered in the `LowerExpectIntrinsic` pass (in 
`handleBrSelExpect`), it seems that for a branch or select the following 
patterns are supported:

```
  // Handle non-optimized IR code like:
  //   %expval = call i64 @llvm.expect.i64(i64 %conv1, i64 1)
  //   %tobool = icmp ne i64 %expval, 0
  //   br i1 %tobool, label %if.then, label %if.end
  //
  // Or the following simpler case:
  //   %expval = call i1 @llvm.expect.i1(i1 %cmp, i1 1)
  //   br i1 %expval, label %if.then, label %if.end
```




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59467/new/

https://reviews.llvm.org/D59467



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59934: Compare SourceLocations from different TUs by FileID

2019-03-31 Thread Endre Fülöp via Phabricator via cfe-commits
gamesh411 added a comment.

In D59934#1449221 , @Szelethus wrote:

> Hmm. Is your clang recent enough to contain @bruntib's patch D57892 
> ? Is it possible that this patch solves the 
> same issue? With this patch applied, are you able to get a macro expansions 
> from a different TU in the plist output, or does this patch only resolve the 
> regression?


This happens even with D57892  applied.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59934/new/

https://reviews.llvm.org/D59934



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59467: [clang] Adding the Likelihood Attribute from C++2a

2019-03-31 Thread Gauthier via Phabricator via cfe-commits
Tyker marked 2 inline comments as done.
Tyker added inline comments.



Comment at: clang/lib/Analysis/CFG.cpp:2208
+}
+
 CFGBlock *CFGBuilder::VisitStmt(Stmt *S, AddStmtChoice asc) {

riccibruno wrote:
> I don't understand why this is needed. Can you explain it ? Also I think that 
> someone familiar with this code should comment on this (maybe @NoQ ?)
the detail of why are complicated and i don't have them all in head but without 
this edit in cases like 

```
switch (...) {
[[likely]] case 1:
...
[[fallthrough]];
default:
...
}
```
the fallthrough attribute emitted a diagnostic because is wasn't handling 
attributed case statement. the edit i performed is probably not the optimal way 
to solve the issue as it only solves the issue for likelihood attribute. but i 
don't know any other attribute that can be applied on a case statement but if 
they were others they would probably have the same issue. but the code is quite 
hard to follow and i didn't wanted to break anything. so this is what i came up 
with.
i am going to look into it to find a better solution.



Comment at: clang/lib/CodeGen/CGStmt.cpp:705
+}
+
 void CodeGenFunction::EmitWhileStmt(const WhileStmt ,

riccibruno wrote:
> I believe that the lowering is incorrect. I applied your patch and here 
> ({F8571803}) is the IR that clang generates (obtained with `-O1 -S -emit-llvm 
> -Xclang -disable-llvm-passes -g0`) for this code:
> 
> ```
> bool f(bool i);
> bool g(bool i);
> 
> bool h1(bool i) {
>   if (i) [[likely]]
> return f(i);
>   return g(i);
> }
> 
> bool h2(bool i) {
>   if (__builtin_expect(i, true))
> return f(i);
>   return g(i);
> }
> ```
> 
> In particular for the branch in `h1` we have:
> ```
>   %tobool = trunc i8 %0 to i1
>   %expval = call i1 @llvm.expect.i1(i1 %tobool, i1 true)
>   br i1 %tobool, label %if.then, label %if.end
> ```
> Note that `%expval` is not used. Compare this to the branch in `h2`:
> ```
>   %tobool = trunc i8 %0 to i1
>   %conv = zext i1 %tobool to i64
>   %expval = call i64 @llvm.expect.i64(i64 %conv, i64 1)
>   %tobool1 = icmp ne i64 %expval, 0
>   br i1 %tobool1, label %if.then, label %if.end
> ```
> where the extra conversions are because of the signature of 
> `__builtin_expect`.
from reading the documentation it seemed to me that both were equivalent. but 
after further checking there aren't.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59467/new/

https://reviews.llvm.org/D59467



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59870: [clang-tidy] Add MagnitudeBitsUpperLimit option to bugprone-too-small-loop-variable

2019-03-31 Thread Tamás Zolnai via Phabricator via cfe-commits
ztamas added a comment.

In D59870#1446537 , @JonasToth wrote:

> > I think it's the easiest way to specify the bits of the ineteger type to 
> > limit the catches. In real life, I met with this overflow / infinite loop 
> > problem with 16-bit short type, so I think the real use cases are 8 and 16 
> > bit integers. It seems intuitive to me to use the size of the loop 
> > variable's type to separate those catches which can lead broken 
> > functionality in practice from those use cases which are just integer 
> > incompatibilities.
>
> Given your experience and the false positive rate in some projects, should we 
> maybe default to 16 for that option?


Seems a good idea. I'll update the code accordingly.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59870/new/

https://reviews.llvm.org/D59870



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55326: [Driver] Fix incorrect GNU triplet for PowerPC on SUSE Linux

2019-03-31 Thread John Paul Adrian Glaubitz via Phabricator via cfe-commits
glaubitz added a comment.

Well, I don't really know what to add here. The GCCDIST path on 32-bit PowerPC 
SUSE distributions has always been "powerpc64-suse-linux" according to SUSE's 
gcc maintainer Richard Biener and my patch just fixes that.

We're already using this patch in openSUSE without any issues: 
https://build.opensuse.org/package/view_file/devel:tools:compiler/llvm7/clang-fix-powerpc-triplet.patch?expand=1


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55326/new/

https://reviews.llvm.org/D55326



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55326: [Driver] Fix incorrect GNU triplet for PowerPC on SUSE Linux

2019-03-31 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added a comment.
Herald added a subscriber: jdoerfert.
Herald added a project: clang.

Do you plan to follow-up on these questions and comments?
At least the full context is needed and for the test case, I imagine it can be 
similar to other driver test cases. I imagine 
`tools/clang/test/Driver/linux-ld.c` can be augmented with this?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55326/new/

https://reviews.llvm.org/D55326



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60038: gn build: Add build files for most clang-tools-extra unit tests

2019-03-31 Thread Mirko Bonadei via Phabricator via cfe-commits
mbonadei accepted this revision.
mbonadei added a comment.
This revision is now accepted and ready to land.

LGTM, just a small style comment.




Comment at: 
llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-apply-replacements/BUILD.gn:3
+
+unittest("ClangApplyReplacementsTests") {
+  configs += [ "//llvm/utils/gn/build:clang_code" ]

Why don't we use `output_name` here as well? It seems to be available for 
executables 
(https://gn.googlesource.com/gn/+/master/docs/reference.md#target-declarations-executable_declare-an-executable-target-variables).
 The current style seems to be lisp-case for target names and have 
`output_name` matching the cmake build.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60038/new/

https://reviews.llvm.org/D60038



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D58497: Clear the KnownModules cache if the preprocessor is going away

2019-03-31 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added a comment.

Ping.

If there are no objections in the next week or so, I'll commit this and it can 
be reviewed post-commit.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58497/new/

https://reviews.llvm.org/D58497



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59934: Compare SourceLocations from different TUs by FileID

2019-03-31 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a subscriber: bruntib.
Szelethus added a comment.

Hmm. Is your clang recent enough to contain @bruntib's patch D57892 
? Is it possible that this patch solves the 
same issue? With this patch applied, are you able to get a macro expansions 
from a different TU in the plist output, or does this patch only resolve the 
regression?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59934/new/

https://reviews.llvm.org/D59934



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r357363 - COMDAT-fold block descriptors.

2019-03-31 Thread David Chisnall via cfe-commits
Author: theraven
Date: Sun Mar 31 04:22:26 2019
New Revision: 357363

URL: http://llvm.org/viewvc/llvm-project?rev=357363=rev
Log:
COMDAT-fold block descriptors.

Without this change, linking multiple objects containing block
descriptors together on Windows will generate duplicate symbol errors.

Patch by Dustin Howett!

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

Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp
cfe/trunk/test/CodeGenObjC/block-desc-str.m

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=357363=357362=357363=diff
==
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Sun Mar 31 04:22:26 2019
@@ -274,6 +274,8 @@ static llvm::Constant *buildBlockDescrip
  /*constant*/ true, linkage, AddrSpace);
 
   if (linkage == llvm::GlobalValue::LinkOnceODRLinkage) {
+if (CGM.supportsCOMDAT())
+  global->setComdat(CGM.getModule().getOrInsertComdat(descName));
 global->setVisibility(llvm::GlobalValue::HiddenVisibility);
 global->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
   }

Modified: cfe/trunk/test/CodeGenObjC/block-desc-str.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/block-desc-str.m?rev=357363=357362=357363=diff
==
--- cfe/trunk/test/CodeGenObjC/block-desc-str.m (original)
+++ cfe/trunk/test/CodeGenObjC/block-desc-str.m Sun Mar 31 04:22:26 2019
@@ -1,9 +1,13 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm 
-fobjc-runtime=gnustep-1.7 -fblocks -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc 
-fblocks -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm 
-fobjc-runtime=gnustep-1.7 -fblocks -o - %s | FileCheck 
--check-prefix=CHECK-COMDAT %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc 
-fblocks -o - %s | FileCheck --check-prefix=CHECK-COMDAT %s
 // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm -fblocks -o - %s | 
FileCheck %s
 
 // Test that descriptor symbol names don't include '@'.
 
+// CHECK-COMDAT: $"__block_descriptor_40_8_32o_e5_v8\01?0l" = comdat any
+// CHECK-COMDAT: @[[STR:.*]] = private unnamed_addr constant [6 x i8] 
c"v8@?0\00"
+// CHECK-COMDAT: @"__block_descriptor_40_8_32o_e5_v8\01?0l" = linkonce_odr 
hidden unnamed_addr constant { i64, i64, i8*, i8*, i8*, {{.*}} } { i64 0, i64 
40, i8* bitcast ({{.*}} to i8*), i8* bitcast ({{.*}} to i8*), i8* getelementptr 
inbounds ([6 x i8], [6 x i8]* @[[STR]], i32 0, i32 0), {{.*}} }, comdat, align 8
+
 // CHECK: @[[STR:.*]] = private unnamed_addr constant [6 x i8] c"v8@?0\00"
 // CHECK: @"__block_descriptor_40_8_32o_e5_v8\01?0l" = linkonce_odr hidden 
unnamed_addr constant { i64, i64, i8*, i8*, i8*, {{.*}} } { i64 0, i64 40, i8* 
bitcast ({{.*}} to i8*), i8* bitcast ({{.*}} to i8*), i8* getelementptr 
inbounds ([6 x i8], [6 x i8]* @[[STR]], i32 0, i32 0), {{.*}} }, align 8
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r357364 - [gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.

2019-03-31 Thread David Chisnall via cfe-commits
Author: theraven
Date: Sun Mar 31 04:22:33 2019
New Revision: 357364

URL: http://llvm.org/viewvc/llvm-project?rev=357364=rev
Log:
[gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.

Summary:
Based on a patch by Dustin Howett, modified to not change the ABI for
ELF platforms.

Use more Windows-like section names.

This also makes things more readable by PE/COFF debug tools that assume
sections fit in the first header.

With these changes in, it is now possible to build a working WinObjC
with clang and the WinObjC version of GNUstep libobjc (upstream GNUstep
libobjc + a work around for incremental linking, which can be removed
once LINK.EXE gains a feature to opt sections out of receiving extra
padding during an incremental link).

Patch by Dustin Howett!

Reviewers: DHowett-MSFT

Subscribers: cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/test/CodeGenObjC/gnu-init.m

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=357364=357363=357364=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Sun Mar 31 04:22:33 2019
@@ -185,12 +185,16 @@ protected:
   (R.getVersion() >= VersionTuple(major, minor));
   }
 
-  std::string SymbolForProtocol(StringRef Name) {
-return (StringRef("._OBJC_PROTOCOL_") + Name).str();
+  std::string ManglePublicSymbol(StringRef Name) {
+return (StringRef(CGM.getTriple().isOSBinFormatCOFF() ? "$_" : "._") + 
Name).str();
+  }
+
+  std::string SymbolForProtocol(Twine Name) {
+return (ManglePublicSymbol("OBJC_PROTOCOL_") + Name).str();
   }
 
   std::string SymbolForProtocolRef(StringRef Name) {
-return (StringRef("._OBJC_REF_PROTOCOL_") + Name).str();
+return (ManglePublicSymbol("OBJC_REF_PROTOCOL_") + Name).str();
   }
 
 
@@ -906,12 +910,15 @@ class CGObjCGNUstep2 : public CGObjCGNUs
 ConstantStringSection
   };
   static const char *const SectionsBaseNames[8];
+  static const char *const PECOFFSectionsBaseNames[8];
   template
   std::string sectionName() {
-std::string name(SectionsBaseNames[K]);
-if (CGM.getTriple().isOSBinFormatCOFF())
+if (CGM.getTriple().isOSBinFormatCOFF()) {
+  std::string name(PECOFFSectionsBaseNames[K]);
   name += "$m";
-return name;
+  return name;
+}
+return SectionsBaseNames[K];
   }
   /// The GCC ABI superclass message lookup function.  Takes a pointer to a
   /// structure describing the receiver and the class, and a selector as
@@ -932,15 +939,19 @@ class CGObjCGNUstep2 : public CGObjCGNUs
   bool EmittedClass = false;
   /// Generate the name of a symbol for a reference to a class.  Accesses to
   /// classes should be indirected via this.
+
+  typedef std::pair> 
EarlyInitPair;
+  std::vector EarlyInitList;
+
   std::string SymbolForClassRef(StringRef Name, bool isWeak) {
 if (isWeak)
-  return (StringRef("._OBJC_WEAK_REF_CLASS_") + Name).str();
+  return (ManglePublicSymbol("OBJC_WEAK_REF_CLASS_") + Name).str();
 else
-  return (StringRef("._OBJC_REF_CLASS_") + Name).str();
+  return (ManglePublicSymbol("OBJC_REF_CLASS_") + Name).str();
   }
   /// Generate the name of a class symbol.
   std::string SymbolForClass(StringRef Name) {
-return (StringRef("._OBJC_CLASS_") + Name).str();
+return (ManglePublicSymbol("OBJC_CLASS_") + Name).str();
   }
   void CallRuntimeFunction(CGBuilderTy , StringRef FunctionName,
   ArrayRef Args) {
@@ -994,10 +1005,13 @@ class CGObjCGNUstep2 : public CGObjCGNUs
 
 llvm::Constant *isa = TheModule.getNamedGlobal(Sym);
 
-if (!isa)
+if (!isa) {
   isa = new llvm::GlobalVariable(TheModule, IdTy, /* isConstant */false,
   llvm::GlobalValue::ExternalLinkage, nullptr, Sym);
-else if (isa->getType() != PtrToIdTy)
+  if (CGM.getTriple().isOSBinFormatCOFF()) {
+
cast(isa)->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass);
+  }
+} else if (isa->getType() != PtrToIdTy)
   isa = llvm::ConstantExpr::getBitCast(isa, PtrToIdTy);
 
 //  struct
@@ -1012,7 +1026,11 @@ class CGObjCGNUstep2 : public CGObjCGNUs
 
 ConstantInitBuilder Builder(CGM);
 auto Fields = Builder.beginStruct();
-Fields.add(isa);
+if (!CGM.getTriple().isOSBinFormatCOFF()) {
+  Fields.add(isa);
+} else {
+  Fields.addNullPointer(PtrTy);
+}
 // For now, all non-ASCII strings are represented as UTF-16.  As such, the
 // number of bytes is simply double the number of UTF-16 codepoints.  In
 // ASCII strings, the number of bytes is equal to the number of non-ASCII
@@ -1083,6 +1101,10 @@ class CGObjCGNUstep2 : public CGObjCGNUs
   ObjCStrGV->setComdat(TheModule.getOrInsertComdat(StringName));
   

[PATCH] D58724: [gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.

2019-03-31 Thread David Chisnall via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rC357364: [gnustep-objc] Make the GNUstep v2 ABI work for 
Windows DLLs. (authored by theraven, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D58724?vs=193002=193008#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58724/new/

https://reviews.llvm.org/D58724

Files:
  lib/CodeGen/CGObjCGNU.cpp
  test/CodeGenObjC/gnu-init.m

Index: test/CodeGenObjC/gnu-init.m
===
--- test/CodeGenObjC/gnu-init.m
+++ test/CodeGenObjC/gnu-init.m
@@ -73,29 +73,28 @@
 
 
 // Make sure all of our section boundary variables are emitted correctly.
-// CHECK-WIN-DAG: @__start___objc_selectors = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_selectors$a", comdat, align 1
-// CHECK-WIN-DAG: @__stop__objc_selectors = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_selectors$z", comdat, align 1
-// CHECK-WIN-DAG: @__start___objc_classes = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_classes$a", comdat, align 1
-// CHECK-WIN-DAG: @__stop__objc_classes = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_classes$z", comdat, align 1
-// CHECK-WIN-DAG: @__start___objc_class_refs = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_class_refs$a", comdat, align 1
-// CHECK-WIN-DAG: @__stop__objc_class_refs = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_class_refs$z", comdat, align 1
-// CHECK-WIN-DAG: @__start___objc_cats = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_cats$a", comdat, align 1
-// CHECK-WIN-DAG: @__stop__objc_cats = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_cats$z", comdat, align 1
-// CHECK-WIN-DAG: @__start___objc_protocols = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_protocols$a", comdat, align 1
-// CHECK-WIN-DAG: @__stop__objc_protocols = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_protocols$z", comdat, align 1
-// CHECK-WIN-DAG: @__start___objc_protocol_refs = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_protocol_refs$a", comdat, align 1
-// CHECK-WIN-DAG: @__stop__objc_protocol_refs = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_protocol_refs$z", comdat, align 1
-// CHECK-WIN-DAG: @__start___objc_class_aliases = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_class_aliases$a", comdat, align 1
-// CHECK-WIN-DAG: @__stop__objc_class_aliases = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_class_aliases$z", comdat, align 1
-// CHECK-WIN-DAG: @__start___objc_constant_string = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_constant_string$a", comdat, align 1
-// CHECK-WIN-DAG: @__stop__objc_constant_string = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section "__objc_constant_string$z", comdat, align 1
-// CHECK-WIN: @.objc_init = linkonce_odr hidden global { i64, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel*, %.objc_section_sentinel* } { i64 0, %.objc_section_sentinel* @__start___objc_selectors, %.objc_section_sentinel* @__stop__objc_selectors, %.objc_section_sentinel* @__start___objc_classes, %.objc_section_sentinel* @__stop__objc_classes, %.objc_section_sentinel* @__start___objc_class_refs, %.objc_section_sentinel* @__stop__objc_class_refs, %.objc_section_sentinel* @__start___objc_cats, %.objc_section_sentinel* @__stop__objc_cats, %.objc_section_sentinel* @__start___objc_protocols, %.objc_section_sentinel* @__stop__objc_protocols, %.objc_section_sentinel* @__start___objc_protocol_refs, %.objc_section_sentinel* @__stop__objc_protocol_refs, %.objc_section_sentinel* @__start___objc_class_aliases, %.objc_section_sentinel* @__stop__objc_class_aliases, %.objc_section_sentinel* @__start___objc_constant_string, %.objc_section_sentinel* @__stop__objc_constant_string }, comdat, align 8
+// CHECK-WIN-DAG: @"__stop.objcrt$SEL" = linkonce_odr hidden global %.objc_section_sentinel zeroinitializer, section ".objcrt$SEL$z", comdat, align 8
+// CHECK-WIN-DAG: @"__start_.objcrt$CLS" = linkonce_odr hidden global 

[PATCH] D58807: [CodeGen] COMDAT-fold block descriptors

2019-03-31 Thread David Chisnall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL357363: COMDAT-fold block descriptors. (authored by 
theraven, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D58807?vs=189193=193007#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58807/new/

https://reviews.llvm.org/D58807

Files:
  cfe/trunk/lib/CodeGen/CGBlocks.cpp
  cfe/trunk/test/CodeGenObjC/block-desc-str.m


Index: cfe/trunk/lib/CodeGen/CGBlocks.cpp
===
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp
@@ -274,6 +274,8 @@
  /*constant*/ true, linkage, AddrSpace);
 
   if (linkage == llvm::GlobalValue::LinkOnceODRLinkage) {
+if (CGM.supportsCOMDAT())
+  global->setComdat(CGM.getModule().getOrInsertComdat(descName));
 global->setVisibility(llvm::GlobalValue::HiddenVisibility);
 global->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
   }
Index: cfe/trunk/test/CodeGenObjC/block-desc-str.m
===
--- cfe/trunk/test/CodeGenObjC/block-desc-str.m
+++ cfe/trunk/test/CodeGenObjC/block-desc-str.m
@@ -1,9 +1,13 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm 
-fobjc-runtime=gnustep-1.7 -fblocks -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc 
-fblocks -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm 
-fobjc-runtime=gnustep-1.7 -fblocks -o - %s | FileCheck 
--check-prefix=CHECK-COMDAT %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc 
-fblocks -o - %s | FileCheck --check-prefix=CHECK-COMDAT %s
 // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm -fblocks -o - %s | 
FileCheck %s
 
 // Test that descriptor symbol names don't include '@'.
 
+// CHECK-COMDAT: $"__block_descriptor_40_8_32o_e5_v8\01?0l" = comdat any
+// CHECK-COMDAT: @[[STR:.*]] = private unnamed_addr constant [6 x i8] 
c"v8@?0\00"
+// CHECK-COMDAT: @"__block_descriptor_40_8_32o_e5_v8\01?0l" = linkonce_odr 
hidden unnamed_addr constant { i64, i64, i8*, i8*, i8*, {{.*}} } { i64 0, i64 
40, i8* bitcast ({{.*}} to i8*), i8* bitcast ({{.*}} to i8*), i8* getelementptr 
inbounds ([6 x i8], [6 x i8]* @[[STR]], i32 0, i32 0), {{.*}} }, comdat, align 8
+
 // CHECK: @[[STR:.*]] = private unnamed_addr constant [6 x i8] c"v8@?0\00"
 // CHECK: @"__block_descriptor_40_8_32o_e5_v8\01?0l" = linkonce_odr hidden 
unnamed_addr constant { i64, i64, i8*, i8*, i8*, {{.*}} } { i64 0, i64 40, i8* 
bitcast ({{.*}} to i8*), i8* bitcast ({{.*}} to i8*), i8* getelementptr 
inbounds ([6 x i8], [6 x i8]* @[[STR]], i32 0, i32 0), {{.*}} }, align 8
 


Index: cfe/trunk/lib/CodeGen/CGBlocks.cpp
===
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp
@@ -274,6 +274,8 @@
  /*constant*/ true, linkage, AddrSpace);
 
   if (linkage == llvm::GlobalValue::LinkOnceODRLinkage) {
+if (CGM.supportsCOMDAT())
+  global->setComdat(CGM.getModule().getOrInsertComdat(descName));
 global->setVisibility(llvm::GlobalValue::HiddenVisibility);
 global->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
   }
Index: cfe/trunk/test/CodeGenObjC/block-desc-str.m
===
--- cfe/trunk/test/CodeGenObjC/block-desc-str.m
+++ cfe/trunk/test/CodeGenObjC/block-desc-str.m
@@ -1,9 +1,13 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm -fobjc-runtime=gnustep-1.7 -fblocks -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc -fblocks -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm -fobjc-runtime=gnustep-1.7 -fblocks -o - %s | FileCheck --check-prefix=CHECK-COMDAT %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc -fblocks -o - %s | FileCheck --check-prefix=CHECK-COMDAT %s
 // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm -fblocks -o - %s | FileCheck %s
 
 // Test that descriptor symbol names don't include '@'.
 
+// CHECK-COMDAT: $"__block_descriptor_40_8_32o_e5_v8\01?0l" = comdat any
+// CHECK-COMDAT: @[[STR:.*]] = private unnamed_addr constant [6 x i8] c"v8@?0\00"
+// CHECK-COMDAT: @"__block_descriptor_40_8_32o_e5_v8\01?0l" = linkonce_odr hidden unnamed_addr constant { i64, i64, i8*, i8*, i8*, {{.*}} } { i64 0, i64 40, i8* bitcast ({{.*}} to i8*), i8* bitcast ({{.*}} to i8*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @[[STR]], i32 0, i32 0), {{.*}} }, comdat, align 8
+
 // CHECK: @[[STR:.*]] = private unnamed_addr constant [6 x i8] c"v8@?0\00"
 // CHECK: @"__block_descriptor_40_8_32o_e5_v8\01?0l" = 

r357362 - [objc-gnustep] Use .init_array not .ctors when requested.

2019-03-31 Thread David Chisnall via cfe-commits
Author: theraven
Date: Sun Mar 31 04:22:19 2019
New Revision: 357362

URL: http://llvm.org/viewvc/llvm-project?rev=357362=rev
Log:
[objc-gnustep] Use .init_array not .ctors when requested.

This doesn't make a difference most of the time but FreeBSD/ARM doesn't
run anything in the .ctors array.

Modified:
cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
cfe/trunk/test/CodeGenObjC/gnu-init.m

Modified: cfe/trunk/lib/CodeGen/CGObjCGNU.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCGNU.cpp?rev=357362=357361=357362=diff
==
--- cfe/trunk/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCGNU.cpp Sun Mar 31 04:22:19 2019
@@ -1514,7 +1514,12 @@ class CGObjCGNUstep2 : public CGObjCGNUs
 if (CGM.getTriple().isOSBinFormatCOFF())
 InitVar->setSection(".CRT$XCLz");
 else
-  InitVar->setSection(".ctors");
+{
+  if (CGM.getCodeGenOpts().UseInitArray)
+InitVar->setSection(".init_array");
+  else
+InitVar->setSection(".ctors");
+}
 InitVar->setVisibility(llvm::GlobalValue::HiddenVisibility);
 InitVar->setComdat(TheModule.getOrInsertComdat(".objc_ctor"));
 CGM.addUsedGlobal(InitVar);

Modified: cfe/trunk/test/CodeGenObjC/gnu-init.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/gnu-init.m?rev=357362=357361=357362=diff
==
--- cfe/trunk/test/CodeGenObjC/gnu-init.m (original)
+++ cfe/trunk/test/CodeGenObjC/gnu-init.m Sun Mar 31 04:22:19 2019
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm 
-fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s -check-prefix=CHECK-NEW
 // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -S -emit-llvm 
-fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s -check-prefix=CHECK-WIN
 // RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm 
-fobjc-runtime=gnustep-1.8 -o - %s | FileCheck %s -check-prefix=CHECK-OLD
+// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -fuse-init-array -S 
-emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s 
-check-prefix=CHECK-INIT_ARRAY
 
 // Almost minimal Objective-C file, check that it emits calls to the correct
 // runtime entry points.
@@ -39,6 +40,7 @@
 
 // Check that the load function is manually inserted into .ctors.
 // CHECK-NEW: @.objc_ctor = linkonce hidden constant void ()* 
@.objcv2_load_function, section ".ctors", comdat
+// CHECK-INIT_ARRAY: @.objc_ctor = linkonce hidden constant void ()* 
@.objcv2_load_function, section ".init_array", comdat
 
 
 // Make sure that we provide null versions of everything so the __start /


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59934: Compare SourceLocations from different TUs by FileID

2019-03-31 Thread Endre Fülöp via Phabricator via cfe-commits
gamesh411 added a comment.

In D59934#1449109 , @Szelethus wrote:

> I would still like to learn more about this issue. I am somewhat afraid that 
> the our macro expansion is faulty. Can you provide a stacktrace maybe?


The stack trace that belongs to the same debug session I mentioned before:

  #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
  #1  0x7fdcf2121801 in __GI_abort () at abort.c:79
  #2  0x7fdcf589aa40 in llvm::llvm_unreachable_internal (msg=0x7fdcf4a179e5 
"Unsortable locations found", 
  file=0x7fdcf4a05f01 "/llvm/tools/clang/lib/Basic/SourceManager.cpp", 
line=2038)
  at /llvm/lib/Support/ErrorHandling.cpp:221
  #3  0x7fdcf4b81115 in clang::SourceManager::isBeforeInTranslationUnit 
(this=0xdfefc0, LHS=..., RHS=...)
  at /llvm/tools/clang/lib/Basic/SourceManager.cpp:2038
  #4  0x7fdcef3f4359 in clang::MacroDirective::findDirectiveAtLoc 
(this=0x1144500, L=..., SM=...)
  at /llvm/tools/clang/lib/Lex/MacroInfo.cpp:207
  #5  0x7fdceb40e086 in getMacroInfoForLocation (PP=..., SM=..., 
II=0x1135898, Loc=...)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:1115
  #6  0x7fdceb40d596 in getMacroNameAndArgs (ExpanLoc=..., PP=...)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:980
  #7  0x7fdceb40ccf3 in getMacroNameAndPrintExpansion[abi:cxx11]((anonymous 
namespace)::TokenPrinter&, clang::SourceLocation, clang::Preprocessor const&, 
(anonymous namespace)::MacroArgMap const&, 
llvm::SmallPtrSet&) (Printer=..., MacroLoc=..., 
PP=..., PrevArgs=..., AlreadyProcessedTokens=...)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:859
  #8  0x7fdceb40cb0e in getExpandedMacro (MacroLoc=..., PP=...)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:845
  #9  0x7fdceb40b202 in (anonymous 
namespace)::PlistPrinter::ReportMacroExpansions (this=0x7ffe244b7ed0, 
  o=..., indent=4)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:344
  #10 0x7fdceb40ab43 in printBugPath (o=..., FM=..., AnOpts=..., PP=..., 
Path=...)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:479
  #11 0x7fdceb409764 in (anonymous 
namespace)::PlistDiagnostics::FlushDiagnosticsImpl (this=0xe0c610, 
  Diags=std::vector of length 1, capacity 1 = {...}, 
filesMade=0x7ffe244b8898)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:583
  #12 0x7fdceb3fc9d9 in 
clang::ento::PathDiagnosticConsumer::FlushDiagnostics (this=0xe0c610, 
  Files=0x7ffe244b8898)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp:483
  #13 0x7fdceb25aae9 in clang::ento::AnalysisManager::FlushDiagnostics 
(this=0xe14c20)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp:59
  #14 0x7fdceb25a98c in clang::ento::AnalysisManager::~AnalysisManager 
(this=0xe14c20)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp:47
  #15 0x7fdceb25ab3c in clang::ento::AnalysisManager::~AnalysisManager 
(this=0xe14c20)
  at /llvm/tools/clang/lib/StaticAnalyzer/Core/AnalysisManager.cpp:46
  #16 0x7fdcec72dc9f in 
std::default_delete::operator() (this=0xe13a48, 
  __ptr=0xe14c20)
  at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/unique_ptr.h:78
  #17 0x7fdcec72eb3c in std::unique_ptr >::reset (this=0xe13a48, 
__p=0xe14c20)
  at 
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/unique_ptr.h:376
  #18 0x7fdcec6c4079 in (anonymous 
namespace)::AnalysisConsumer::HandleTranslationUnit (this=0xe138b0, C=...)
  at /llvm/tools/clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp:602
  #19 0x7fdceec204b6 in clang::ParseAST (S=..., PrintStats=false, 
SkipFunctionBodies=false)
  at /llvm/tools/clang/lib/Parse/ParseAST.cpp:169
  #20 0x7fdcf37b0eb2 in clang::ASTFrontendAction::ExecuteAction 
(this=0xdeb800)
  at /llvm/tools/clang/lib/Frontend/FrontendAction.cpp:1035
  #21 0x7fdcf37b08e3 in clang::FrontendAction::Execute (this=0xdeb800)
  at /llvm/tools/clang/lib/Frontend/FrontendAction.cpp:934
  #22 0x7fdcf372a2ba in clang::CompilerInstance::ExecuteAction 
(this=0xde68f0, Act=...)
  at /llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:949
  #23 0x7fdcf33b14bb in clang::ExecuteCompilerInvocation (Clang=0xde68f0)
  at /llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:271
  #24 0x0023f7b4 in cc1_main (Argv=..., 
  Argv0=0x7ffe244bc18a "/clang-build-debug/bin/clang-9", 
  MainAddr=0x2320f0 )
  at /llvm/tools/clang/tools/driver/cc1_main.cpp:218
  #25 0x0023349f in ExecuteCC1Tool (argv=..., Tool=...)
  at /llvm/tools/clang/tools/driver/driver.cpp:309
  #26 0x00232864 in main (argc_=339, argv_=0x7ffe244bb0e8)
  at 

[PATCH] D60040: [clangd] Use capacity() instead of size() in RefSlab::bytes()

2019-03-31 Thread Dmitri Gribenko via Phabricator via cfe-commits
gribozavr accepted this revision.
gribozavr added a comment.
This revision is now accepted and ready to land.

Do you have commit access?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60040/new/

https://reviews.llvm.org/D60040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D60046: [python, tests] Disable Clang Python tests on Solaris/SPARC

2019-03-31 Thread Rainer Orth via Phabricator via cfe-commits
ro created this revision.
ro added a reviewer: rsmith.
ro added a project: clang.
Herald added subscribers: fedor.sergeev, mgorny, jyknight.

Running `make check-all` fails on Solaris 11/SPARC since the clang python tests 
FAIL:

  
  ==
  FAIL: test_extent (tests.cindex.test_location.TestLocation)
  --
  Traceback (most recent call last):
File "tests/cindex/test_location.py", line 87, in test_extent
  self.assert_location(one.extent.start,line=1,column=1,offset=0)
File "tests/cindex/test_location.py", line 22, in assert_location
  self.assertEqual(loc.column, column)
  AssertionError: 5 != 1
  
  ==
  FAIL: test_get_children (tests.cindex.test_cursor.TestCursor)
  --
  Traceback (most recent call last):
File "tests/cindex/test_cursor.py", line 70, in test_get_children
  self.assertEqual(tu_nodes[0].is_definition(), True)
  AssertionError: False != True
  
  --
  Ran 126 tests in 2.123s
  
  FAILED (failures=2, skipped=6)
  
  Unfortunately, this aborts the rest of `make check-all`, even with `-k`, so 
this patch
  disables the test as is already done on a couple of other targets.
  
  This allowed the `sparc-sun-solaris2.11` test to finish.


Repository:
  rC Clang

https://reviews.llvm.org/D60046

Files:
  bindings/python/tests/CMakeLists.txt


Index: bindings/python/tests/CMakeLists.txt
===
--- bindings/python/tests/CMakeLists.txt
+++ bindings/python/tests/CMakeLists.txt
@@ -40,6 +40,11 @@
   set(RUN_PYTHON_TESTS FALSE)
 endif()
 
+# Solaris/SPARC has known test failures.
+if(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ${LLVM_NATIVE_ARCH} MATCHES "Sparc")
+  set(RUN_PYTHON_TESTS FALSE)
+endif()
+
 if(RUN_PYTHON_TESTS)
 set_property(GLOBAL APPEND PROPERTY
  LLVM_ADDITIONAL_TEST_TARGETS check-clang-python)


Index: bindings/python/tests/CMakeLists.txt
===
--- bindings/python/tests/CMakeLists.txt
+++ bindings/python/tests/CMakeLists.txt
@@ -40,6 +40,11 @@
   set(RUN_PYTHON_TESTS FALSE)
 endif()
 
+# Solaris/SPARC has known test failures.
+if(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ${LLVM_NATIVE_ARCH} MATCHES "Sparc")
+  set(RUN_PYTHON_TESTS FALSE)
+endif()
+
 if(RUN_PYTHON_TESTS)
 set_property(GLOBAL APPEND PROPERTY
  LLVM_ADDITIONAL_TEST_TARGETS check-clang-python)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D58724: [gnustep-objc] Make the GNUstep v2 ABI work for Windows DLLs.

2019-03-31 Thread David Chisnall via Phabricator via cfe-commits
theraven updated this revision to Diff 193002.
theraven marked 2 inline comments as done.
theraven added a comment.

- Fix ownership with Twine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58724/new/

https://reviews.llvm.org/D58724

Files:
  clang/lib/CodeGen/CGBlocks.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/test/CodeGenObjC/block-desc-str.m
  clang/test/CodeGenObjC/gnu-init.m

Index: clang/test/CodeGenObjC/gnu-init.m
===
--- clang/test/CodeGenObjC/gnu-init.m
+++ clang/test/CodeGenObjC/gnu-init.m
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s -check-prefix=CHECK-NEW
 // RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -S -emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s -check-prefix=CHECK-WIN
 // RUN: %clang_cc1 -triple x86_64-unknown-freebsd -S -emit-llvm -fobjc-runtime=gnustep-1.8 -o - %s | FileCheck %s -check-prefix=CHECK-OLD
+// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -fuse-init-array -S -emit-llvm -fobjc-runtime=gnustep-2.0 -o - %s | FileCheck %s -check-prefix=CHECK-INIT_ARRAY
 
 // Almost minimal Objective-C file, check that it emits calls to the correct
 // runtime entry points.
@@ -39,6 +40,7 @@
 
 // Check that the load function is manually inserted into .ctors.
 // CHECK-NEW: @.objc_ctor = linkonce hidden constant void ()* @.objcv2_load_function, section ".ctors", comdat
+// CHECK-INIT_ARRAY: @.objc_ctor = linkonce hidden constant void ()* @.objcv2_load_function, section ".init_array", comdat
 
 
 // Make sure that we provide null versions of everything so the __start /
Index: clang/test/CodeGenObjC/block-desc-str.m
===
--- clang/test/CodeGenObjC/block-desc-str.m
+++ clang/test/CodeGenObjC/block-desc-str.m
@@ -1,9 +1,13 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm -fobjc-runtime=gnustep-1.7 -fblocks -o - %s | FileCheck %s
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc -fblocks -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm -fobjc-runtime=gnustep-1.7 -fblocks -o - %s | FileCheck --check-prefix=CHECK-COMDAT %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fobjc-runtime=gcc -fblocks -o - %s | FileCheck --check-prefix=CHECK-COMDAT %s
 // RUN: %clang_cc1 -triple=x86_64-apple-darwin10 -emit-llvm -fblocks -o - %s | FileCheck %s
 
 // Test that descriptor symbol names don't include '@'.
 
+// CHECK-COMDAT: $"__block_descriptor_40_8_32o_e5_v8\01?0l" = comdat any
+// CHECK-COMDAT: @[[STR:.*]] = private unnamed_addr constant [6 x i8] c"v8@?0\00"
+// CHECK-COMDAT: @"__block_descriptor_40_8_32o_e5_v8\01?0l" = linkonce_odr hidden unnamed_addr constant { i64, i64, i8*, i8*, i8*, {{.*}} } { i64 0, i64 40, i8* bitcast ({{.*}} to i8*), i8* bitcast ({{.*}} to i8*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @[[STR]], i32 0, i32 0), {{.*}} }, comdat, align 8
+
 // CHECK: @[[STR:.*]] = private unnamed_addr constant [6 x i8] c"v8@?0\00"
 // CHECK: @"__block_descriptor_40_8_32o_e5_v8\01?0l" = linkonce_odr hidden unnamed_addr constant { i64, i64, i8*, i8*, i8*, {{.*}} } { i64 0, i64 40, i8* bitcast ({{.*}} to i8*), i8* bitcast ({{.*}} to i8*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @[[STR]], i32 0, i32 0), {{.*}} }, align 8
 
Index: clang/lib/CodeGen/CGObjCGNU.cpp
===
--- clang/lib/CodeGen/CGObjCGNU.cpp
+++ clang/lib/CodeGen/CGObjCGNU.cpp
@@ -185,12 +185,16 @@
   (R.getVersion() >= VersionTuple(major, minor));
   }
 
+  Twine ManglePublicSymbol(Twine Name) {
+return StringRef(CGM.getTriple().isOSBinFormatCOFF() ? "$_" : "._") + Name;
+  }
+
   std::string SymbolForProtocol(StringRef Name) {
-return (StringRef("._OBJC_PROTOCOL_") + Name).str();
+return (ManglePublicSymbol("OBJC_PROTOCOL_") + Name).str();
   }
 
   std::string SymbolForProtocolRef(StringRef Name) {
-return (StringRef("._OBJC_REF_PROTOCOL_") + Name).str();
+return (ManglePublicSymbol("OBJC_REF_PROTOCOL_") + Name).str();
   }
 
 
@@ -906,12 +910,15 @@
 ConstantStringSection
   };
   static const char *const SectionsBaseNames[8];
+  static const char *const PECOFFSectionsBaseNames[8];
   template
   std::string sectionName() {
-std::string name(SectionsBaseNames[K]);
-if (CGM.getTriple().isOSBinFormatCOFF())
+if (CGM.getTriple().isOSBinFormatCOFF()) {
+  std::string name(PECOFFSectionsBaseNames[K]);
   name += "$m";
-return name;
+  return name;
+}
+return SectionsBaseNames[K];
   }
   /// The GCC ABI superclass message lookup function.  Takes a pointer to a
   /// structure describing the receiver and the class, and a selector as
@@ -932,15 +939,19 @@
   bool EmittedClass = false;
   /// Generate the name of a symbol for a reference to 

r357359 - Range-style std::find{,_if} -> llvm::find{,_if}. NFC

2019-03-31 Thread Fangrui Song via cfe-commits
Author: maskray
Date: Sun Mar 31 01:48:19 2019
New Revision: 357359

URL: http://llvm.org/viewvc/llvm-project?rev=357359=rev
Log:
Range-style std::find{,_if} -> llvm::find{,_if}. NFC

Modified:
cfe/trunk/include/clang/AST/DeclContextInternals.h
cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
cfe/trunk/lib/ARCMigrate/ARCMT.cpp
cfe/trunk/lib/AST/CXXInheritance.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
cfe/trunk/lib/AST/VTableBuilder.cpp
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/lib/Basic/Targets/PPC.cpp
cfe/trunk/lib/Basic/Targets/Sparc.h
cfe/trunk/lib/Basic/Targets/X86.cpp
cfe/trunk/lib/Driver/Job.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/Hexagon.cpp
cfe/trunk/lib/Edit/EditedSource.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/TextDiagnostic.cpp
cfe/trunk/lib/Index/IndexingContext.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/lib/Lex/Preprocessor.cpp
cfe/trunk/lib/Sema/SemaAccess.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ModuleManager.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
cfe/trunk/tools/driver/driver.cpp
cfe/trunk/tools/libclang/CIndexHigh.cpp
cfe/trunk/tools/libclang/CXCursor.cpp
cfe/trunk/unittests/AST/ASTImporterTest.cpp
cfe/trunk/unittests/Tooling/ToolingTest.cpp

Modified: cfe/trunk/include/clang/AST/DeclContextInternals.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclContextInternals.h?rev=357359=357358=357359=diff
==
--- cfe/trunk/include/clang/AST/DeclContextInternals.h (original)
+++ cfe/trunk/include/clang/AST/DeclContextInternals.h Sun Mar 31 01:48:19 2019
@@ -113,12 +113,11 @@ public:
 }
 
 DeclsTy  = *getAsVector();
-DeclsTy::iterator I = std::find(Vec.begin(), Vec.end(), D);
+DeclsTy::iterator I = llvm::find(Vec, D);
 assert(I != Vec.end() && "list does not contain decl");
 Vec.erase(I);
 
-assert(std::find(Vec.begin(), Vec.end(), D)
- == Vec.end() && "list still contains decl");
+assert(llvm::find(Vec, D) == Vec.end() && "list still contains decl");
   }
 
   /// Remove any declarations which were imported from an external

Modified: cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h?rev=357359=357358=357359=diff
==
--- cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyTIL.h Sun Mar 31 
01:48:19 2019
@@ -1604,7 +1604,7 @@ public:
 
   /// Return the index of BB, or Predecessors.size if BB is not a predecessor.
   unsigned findPredecessorIndex(const BasicBlock *BB) const {
-auto I = std::find(Predecessors.cbegin(), Predecessors.cend(), BB);
+auto I = llvm::find(Predecessors, BB);
 return std::distance(Predecessors.cbegin(), I);
   }
 

Modified: cfe/trunk/lib/ARCMigrate/ARCMT.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ARCMT.cpp?rev=357359=357358=357359=diff
==
--- cfe/trunk/lib/ARCMigrate/ARCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ARCMT.cpp Sun Mar 31 01:48:19 2019
@@ -64,10 +64,10 @@ bool CapturedDiagList::hasDiagnostic(Arr
   while (I != List.end()) {
 FullSourceLoc diagLoc = I->getLocation();
 if ((IDs.empty() || // empty means any diagnostic in the range.
- std::find(IDs.begin(), IDs.end(), I->getID()) != IDs.end()) &&
+ llvm::find(IDs, I->getID()) != IDs.end()) &&
 !diagLoc.isBeforeInTranslationUnitThan(range.getBegin()) &&
 (diagLoc == range.getEnd() ||
-   diagLoc.isBeforeInTranslationUnitThan(range.getEnd( {
+ diagLoc.isBeforeInTranslationUnitThan(range.getEnd( {
   return true;
 }
 

Modified: cfe/trunk/lib/AST/CXXInheritance.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CXXInheritance.cpp?rev=357359=357358=357359=diff
==
--- cfe/trunk/lib/AST/CXXInheritance.cpp (original)
+++ cfe/trunk/lib/AST/CXXInheritance.cpp Sun Mar 31 01:48:19 2019
@@ -554,8 +554,7 @@ void OverridingMethods::add(unsigned Ove
 UniqueVirtualMethod Overriding) {
   SmallVectorImpl 
 = Overrides[OverriddenSubobject];
-  if 

[PATCH] D59934: Compare SourceLocations from different TUs by FileID

2019-03-31 Thread Kristóf Umann via Phabricator via cfe-commits
Szelethus added a comment.

I would still like to learn more about this issue. I am somewhat afraid that 
the our macro expansion is faulty. Can you provide a stacktrace maybe?


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59934/new/

https://reviews.llvm.org/D59934



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits