[PATCH] D50168: [Builtins] Implement __builtin_clrsb to be compatible with gcc

2018-08-07 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

Test case?




Comment at: lib/CodeGen/CGBuiltin.cpp:1563
+Value *Result = Builder.CreateCall(F, {Tmp, Builder.getTrue()});
+if (Result->getType() != ResultType)
+  Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,

CreateIntCast just does nothing if the types match, so this check isn't needed.


https://reviews.llvm.org/D50168



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


[PATCH] D50168: [Builtins] Implement __builtin_clrsb to be compatible with gcc

2018-08-08 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D50168



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


[PATCH] D46942: Add vfs::FileSystem::getRealPath

2018-05-17 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Looks good. Please watch the windows buildbots carefully after landing this.




Comment at: lib/Basic/FileManager.cpp:537
 
-#ifdef LLVM_ON_UNIX
-  char CanonicalNameBuf[PATH_MAX];
-  if (realpath(Dir->getName().str().c_str(), CanonicalNameBuf))
+  SmallString CanonicalNameBuf;
+  if (!FS->getRealPath(Dir->getName(), CanonicalNameBuf))

PATH_MAX is not a standard thing and probably not there on windows. I'd just 
hardcode it to 256.


Repository:
  rC Clang

https://reviews.llvm.org/D46942



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


[PATCH] D47060: [VFS] Implement getRealPath for OverlayFileSystem.

2018-05-18 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg




Comment at: lib/Basic/VirtualFileSystem.cpp:387
+   SmallVectorImpl &Output) const {
+  // Not using overlays_begin/end because this method is const.
+  for (auto I = FSList.rbegin(), E = FSList.rend(); I != E; ++I) {

Those should probably get const overloads. Doesn't have to be in this change 
though.


Repository:
  rC Clang

https://reviews.llvm.org/D47060



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


[PATCH] D47074: [Tooling] Add an overload of runToolOnCodeWithArgs that takes VFS

2018-05-18 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rC Clang

https://reviews.llvm.org/D47074



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


[PATCH] D47262: [VFS] Implement getRealPath in InMemoryFileSystem.

2018-05-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rC Clang

https://reviews.llvm.org/D47262



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


[PATCH] D38228: Fix clangd when built with LLVM_LINK_LLVM_DYLIB=ON

2017-09-25 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D38228



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


[PATCH] D38225: [clangd] Fix missing "message" key when responding with unsupported method

2017-09-25 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

This looks good. Do you have commit access?


https://reviews.llvm.org/D38225



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


[PATCH] D38678: [Sema] Warn about unused variables if we can constant evaluate the initializer.

2017-10-08 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer created this revision.

If the variable construction can be constant evaluated it doesn't have
side effects, so removing it is always safe. We only try to evaluate
variables that are unused, there should be no impact on compile time.


https://reviews.llvm.org/D38678

Files:
  lib/Sema/SemaDecl.cpp
  test/SemaCXX/warn-unused-variables.cpp


Index: test/SemaCXX/warn-unused-variables.cpp
===
--- test/SemaCXX/warn-unused-variables.cpp
+++ test/SemaCXX/warn-unused-variables.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label 
-Wno-c++1y-extensions -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label 
-Wno-c++1y-extensions -verify -std=c++11 %s
 template void f() {
   T t;
   t = 17;
@@ -194,3 +195,35 @@
 }
 
 }
+
+#if __cplusplus >= 201103L
+namespace with_constexpr {
+template 
+struct Literal {
+  T i;
+  Literal() = default;
+  constexpr Literal(T i) : i(i) {}
+};
+
+struct NoLiteral {
+  int i;
+  NoLiteral() = default;
+  constexpr NoLiteral(int i) : i(i) {}
+  ~NoLiteral() {}
+};
+
+static Literal gl1;  // expected-warning {{unused variable 'gl1'}}
+static Literal gl2(1);   // expected-warning {{unused variable 'gl2'}}
+static const Literal gl3(0); // expected-warning {{unused variable 'gl3'}}
+
+template 
+void test(int i) {
+  Literal l1; // expected-warning {{unused variable 'l1'}}
+  Literal l2(42); // expected-warning {{unused variable 'l2'}}
+  Literal l3(i);  // no-warning
+  Literal l4(0);// no-warning
+  NoLiteral nl1;   // no-warning
+  NoLiteral nl2(42);   // no-warning
+}
+}
+#endif
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -1683,7 +1683,8 @@
 dyn_cast(Init);
   if (Construct && !Construct->isElidable()) {
 CXXConstructorDecl *CD = Construct->getConstructor();
-if (!CD->isTrivial() && !RD->hasAttr())
+if (!CD->isTrivial() && !RD->hasAttr() &&
+!VD->evaluateValue())
   return false;
   }
 }


Index: test/SemaCXX/warn-unused-variables.cpp
===
--- test/SemaCXX/warn-unused-variables.cpp
+++ test/SemaCXX/warn-unused-variables.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -Wno-c++1y-extensions -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -Wno-c++1y-extensions -verify -std=c++11 %s
 template void f() {
   T t;
   t = 17;
@@ -194,3 +195,35 @@
 }
 
 }
+
+#if __cplusplus >= 201103L
+namespace with_constexpr {
+template 
+struct Literal {
+  T i;
+  Literal() = default;
+  constexpr Literal(T i) : i(i) {}
+};
+
+struct NoLiteral {
+  int i;
+  NoLiteral() = default;
+  constexpr NoLiteral(int i) : i(i) {}
+  ~NoLiteral() {}
+};
+
+static Literal gl1;  // expected-warning {{unused variable 'gl1'}}
+static Literal gl2(1);   // expected-warning {{unused variable 'gl2'}}
+static const Literal gl3(0); // expected-warning {{unused variable 'gl3'}}
+
+template 
+void test(int i) {
+  Literal l1; // expected-warning {{unused variable 'l1'}}
+  Literal l2(42); // expected-warning {{unused variable 'l2'}}
+  Literal l3(i);  // no-warning
+  Literal l4(0);// no-warning
+  NoLiteral nl1;   // no-warning
+  NoLiteral nl2(42);   // no-warning
+}
+}
+#endif
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -1683,7 +1683,8 @@
 dyn_cast(Init);
   if (Construct && !Construct->isElidable()) {
 CXXConstructorDecl *CD = Construct->getConstructor();
-if (!CD->isTrivial() && !RD->hasAttr())
+if (!CD->isTrivial() && !RD->hasAttr() &&
+!VD->evaluateValue())
   return false;
   }
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D37970: [clangd] Added a command-line arg to mirror clangd input into a file.

2017-10-09 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

This looks useful, thanks!


https://reviews.llvm.org/D37970



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


[PATCH] D38617: Set PreprocessorOpts.GeneratePreamble=true in PrecompiledPreamble.

2017-10-09 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

A testcase would be nice, but this can go in to unblock things.


https://reviews.llvm.org/D38617



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


[PATCH] D51729: [Tooling] JSONCompilationDatabasePlugin infers compile commands for missing files

2018-09-12 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

I like it


Repository:
  rC Clang

https://reviews.llvm.org/D51729



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


[PATCH] D51921: [VFS] vfs::directory_iterator yields path and file type instead of full Status

2018-09-12 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: include/clang/Basic/VirtualFileSystem.h:135
+  // For compatibility with old Status-based API. Prefer using Path directly.
+  StringRef getName() const { return Path; }
+};

sammccall wrote:
> Backwards-compatibility notes:
> 
>  - Almost all users of `directory_iterator` require no source changes (with 
> this change)
>  - Implementations of VFS require changes if they support directory iteration 
> and do not merely wrap other VFSes. Anecdotally, most do not require changes. 
> 
> So this weird API seems worth having to make out-of-tree breakages less 
> painful.
> Happy to update the internal uses though if that seems worthwhile.
Can we mirror llvm::sys::fs::directory_entry's interface? I want the APIs to be 
as close as possible. Upgrading users is not a big deal.


Repository:
  rC Clang

https://reviews.llvm.org/D51921



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


[PATCH] D51921: [VFS] vfs::directory_iterator yields path and file type instead of full Status

2018-09-13 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: include/clang/Basic/VirtualFileSystem.h:135
+  // For compatibility with old Status-based API. Prefer using Path directly.
+  StringRef getName() const { return Path; }
+};

sammccall wrote:
> sammccall wrote:
> > bkramer wrote:
> > > sammccall wrote:
> > > > Backwards-compatibility notes:
> > > > 
> > > >  - Almost all users of `directory_iterator` require no source changes 
> > > > (with this change)
> > > >  - Implementations of VFS require changes if they support directory 
> > > > iteration and do not merely wrap other VFSes. Anecdotally, most do not 
> > > > require changes. 
> > > > 
> > > > So this weird API seems worth having to make out-of-tree breakages less 
> > > > painful.
> > > > Happy to update the internal uses though if that seems worthwhile.
> > > Can we mirror llvm::sys::fs::directory_entry's interface? I want the APIs 
> > > to be as close as possible. Upgrading users is not a big deal.
> > How much of the interface are you talking about? :-)
> > 
> > Making these private and calling the accessors `file()` and `type()` is 
> > easy of course, and consistency is nice.
> > 
> > Supporting status() with similar semantics+performance is both complicated 
> > and... not a good idea, I think. See the other patch where I added a 
> > comment like "this interface is wrong" and didn't fix it :-)
> > 
> > The other random functions on fs::directory_entry seem like random 
> > implementation cruft to me.
> I've done the `path()` and `type()` rename, so now we're consistent with 
> fs::directory_entry.
> And inconsistent with clang::vfs::Status, and with clang::DirectoryEntry 
> (from FileManager).
> Can't win em all!
Not exposing random fields and having the same names as the other 
directory_entry is what I wanted :)

status() is deep in YAGNI territory.


Repository:
  rC Clang

https://reviews.llvm.org/D51921



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


[PATCH] D51921: [VFS] vfs::directory_iterator yields path and file type instead of full Status

2018-09-14 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rC Clang

https://reviews.llvm.org/D51921



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


[PATCH] D49274: [CUDA] Provide integer SIMD functions for CUDA-9.2

2018-07-20 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D49274



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


[PATCH] D48873: [AST] Use llvm::TrailingObjects in CXXTryStmt

2018-07-23 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rC Clang

https://reviews.llvm.org/D48873



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


[PATCH] D50156: [test] Fix %hmaptool path for standalone builds

2018-08-01 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg, thanks


Repository:
  rC Clang

https://reviews.llvm.org/D50156



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


[PATCH] D43371: [clang-include-fixer] Use add_clang_tool instead of add_clang_executable

2018-02-16 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D43371



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


[PATCH] D43567: [ASTMatchers] isTemplateInstantiation: also match explicit instantiation declaration.

2018-02-21 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rC Clang

https://reviews.llvm.org/D43567



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


[PATCH] D33416: [clangd] Allow to use vfs::FileSystem for file accesses.

2017-05-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Looks good. Make sure to watch the windows buildbots after submitting.


https://reviews.llvm.org/D33416



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


[PATCH] D33678: [clangd] Mark results of clangd requests with a tag provided by the FileSystemProvider.

2017-05-30 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D33678



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


[PATCH] D33930: Do not pick up by default the LLVM style if passing -format

2017-06-06 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Looks good, but I'm wondering if we should also change the default in 
clang-apply-replacements itself.


https://reviews.llvm.org/D33930



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


[PATCH] D41487: [clang-format] Adds a FormatStyleSet

2018-01-08 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: include/clang/Format/Format.h:1700
+typedef std::map>
+MapType;

Why unique_ptr?



Comment at: include/clang/Format/Format.h:1706
+// FormatStyleSet.
+void Add(FormatStyle Style);
+// Clears this FormatStyleSet.

Document what happens if the Style for this language is in the set already.



Comment at: lib/Format/Format.cpp:904
+DefaultStyle.Language = Language;
+StyleSet.Add(DefaultStyle);
+  }

std::move



Comment at: lib/Format/Format.cpp:939
+Styles = std::make_shared();
+  (*Styles)[Style.Language].reset(new FormatStyle(Style));
+}

You can std::move `Style` here, it's passed by value.



Comment at: lib/Format/Format.cpp:939
+Styles = std::make_shared();
+  (*Styles)[Style.Language].reset(new FormatStyle(Style));
+}

bkramer wrote:
> You can std::move `Style` here, it's passed by value.
Can Style.Language ever be LK_None? Does that even make sense?


Repository:
  rC Clang

https://reviews.llvm.org/D41487



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


[PATCH] D41487: [clang-format] Adds a FormatStyleSet

2018-01-09 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rC Clang

https://reviews.llvm.org/D41487



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


[PATCH] D23130: [Clang-tidy] Add a check for definitions in the global namespace.

2018-03-14 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

I'd like to, but I don't know when I find time to rebase this thing after more 
than a year of waiting for review.


https://reviews.llvm.org/D23130



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


[PATCH] D47864: [python] Fix most Python binding unittests on Windows

2018-06-07 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

I don't know much about the python bindings, but this is probably fine.


Repository:
  rC Clang

https://reviews.llvm.org/D47864



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


[PATCH] D56665: [AST] Fix double-traversal of code in top-level lambdas in RAV(implicit = yes).

2019-01-14 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

This makes sense to me.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56665



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


[PATCH] D57150: [HeaderSearch] don't immediately request that headers are opened in getFileAndSuggestModule().

2019-01-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added inline comments.



Comment at: lib/Lex/HeaderSearch.cpp:313
   // check whether we'll have a suggestion for a module.
-  const FileEntry *File = getFileMgr().getFile(FileName, /*OpenFile=*/true);
+  const FileEntry *File = getFileMgr().getFile(FileName, /*OpenFile=*/false);
   if (!File)

This deserves a comment that we don't open it because we might not need it. If 
we would use it the file would be closed after reading the contents.


Repository:
  rC Clang

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

https://reviews.llvm.org/D57150



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


[PATCH] D57442: [OpenGL] Fix test on PPC after r352540

2019-01-30 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rC Clang

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

https://reviews.llvm.org/D57442



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


[PATCH] D55415: Revert removal of tidy plugin support from libclang

2018-12-07 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

I'd be interested in hearing how this is used. I added this feature as an 
experiment a while back but it simply didn't work as I envisioned it to. Some 
checks do work but the overall latency makes it unusable in an IDE setting. 
People repeatedly asked me to remove it because it slows down builds while not 
adding value.


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

https://reviews.llvm.org/D55415



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


[PATCH] D55484: ComputeLineNumbers: delete SSE2 vectorization

2018-12-09 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

The performance difference on preprocessing huge files was tiny back then, 
doesn't surprise me that it disappeared. What did you test this on?

Dropping it is fine with me.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55484



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


[PATCH] D55415: Revert removal of tidy plugin support from libclang

2018-12-09 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

I think that's a fair point for bringing it back for now. It's not supported 
though and we will get rid of it eventually.


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

https://reviews.llvm.org/D55415



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


[PATCH] D59387: Make getFullyQualifiedName qualify both the pointee and class type for member ptr types

2019-03-14 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer created this revision.
bkramer added reviewers: saugustine, ilya-biryukov.
Herald added a subscriber: jlebar.
Herald added a project: clang.

We already handle pointers and references, member ptrs are just another
special case. Fixes PR40732.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D59387

Files:
  clang/lib/AST/QualTypeNames.cpp
  clang/unittests/Tooling/QualTypeNamesTest.cpp


Index: clang/unittests/Tooling/QualTypeNamesTest.cpp
===
--- clang/unittests/Tooling/QualTypeNamesTest.cpp
+++ clang/unittests/Tooling/QualTypeNamesTest.cpp
@@ -194,6 +194,7 @@
   GlobalNsPrefix.ExpectedQualTypeNames["ZVal"] = "::A::B::Y::Z";
   GlobalNsPrefix.ExpectedQualTypeNames["GlobalZVal"] = "::Z";
   GlobalNsPrefix.ExpectedQualTypeNames["CheckK"] = "D::aStruct";
+  GlobalNsPrefix.ExpectedQualTypeNames["YZMPtr"] = "::A::B::X ::A::B::Y::Z::*";
   GlobalNsPrefix.runOver(
   "namespace A {\n"
   "  namespace B {\n"
@@ -205,8 +206,9 @@
   "template \n"
   "using Alias = CCC;\n"
   "Alias IntAliasVal;\n"
-  "struct Y { struct Z {}; };\n"
+  "struct Y { struct Z { X YZIPtr; }; };\n"
   "Y::Z ZVal;\n"
+  "X Y::Z::*YZMPtr;\n"
   "  }\n"
   "}\n"
   "struct Z {};\n"
Index: clang/lib/AST/QualTypeNames.cpp
===
--- clang/lib/AST/QualTypeNames.cpp
+++ clang/lib/AST/QualTypeNames.cpp
@@ -379,6 +379,19 @@
 return QT;
   }
 
+  if (auto *MemberPT = dyn_cast(QT.getTypePtr())) {
+// Get the qualifiers.
+Qualifiers Quals = QT.getQualifiers();
+// Fully qualify the pointee and class types.
+QT = getFullyQualifiedType(QT->getPointeeType(), Ctx, WithGlobalNsPrefix);
+QualType Class = getFullyQualifiedType(QualType(MemberPT->getClass(), 0),
+   Ctx, WithGlobalNsPrefix);
+QT = Ctx.getMemberPointerType(QT, Class.getTypePtr());
+// Add back the qualifiers.
+QT = Ctx.getQualifiedType(QT, Quals);
+return QT;
+  }
+
   // In case of myType& we need to strip the reference first, fully
   // qualify and attach the reference once again.
   if (isa(QT.getTypePtr())) {


Index: clang/unittests/Tooling/QualTypeNamesTest.cpp
===
--- clang/unittests/Tooling/QualTypeNamesTest.cpp
+++ clang/unittests/Tooling/QualTypeNamesTest.cpp
@@ -194,6 +194,7 @@
   GlobalNsPrefix.ExpectedQualTypeNames["ZVal"] = "::A::B::Y::Z";
   GlobalNsPrefix.ExpectedQualTypeNames["GlobalZVal"] = "::Z";
   GlobalNsPrefix.ExpectedQualTypeNames["CheckK"] = "D::aStruct";
+  GlobalNsPrefix.ExpectedQualTypeNames["YZMPtr"] = "::A::B::X ::A::B::Y::Z::*";
   GlobalNsPrefix.runOver(
   "namespace A {\n"
   "  namespace B {\n"
@@ -205,8 +206,9 @@
   "template \n"
   "using Alias = CCC;\n"
   "Alias IntAliasVal;\n"
-  "struct Y { struct Z {}; };\n"
+  "struct Y { struct Z { X YZIPtr; }; };\n"
   "Y::Z ZVal;\n"
+  "X Y::Z::*YZMPtr;\n"
   "  }\n"
   "}\n"
   "struct Z {};\n"
Index: clang/lib/AST/QualTypeNames.cpp
===
--- clang/lib/AST/QualTypeNames.cpp
+++ clang/lib/AST/QualTypeNames.cpp
@@ -379,6 +379,19 @@
 return QT;
   }
 
+  if (auto *MemberPT = dyn_cast(QT.getTypePtr())) {
+// Get the qualifiers.
+Qualifiers Quals = QT.getQualifiers();
+// Fully qualify the pointee and class types.
+QT = getFullyQualifiedType(QT->getPointeeType(), Ctx, WithGlobalNsPrefix);
+QualType Class = getFullyQualifiedType(QualType(MemberPT->getClass(), 0),
+   Ctx, WithGlobalNsPrefix);
+QT = Ctx.getMemberPointerType(QT, Class.getTypePtr());
+// Add back the qualifiers.
+QT = Ctx.getQualifiedType(QT, Quals);
+return QT;
+  }
+
   // In case of myType& we need to strip the reference first, fully
   // qualify and attach the reference once again.
   if (isa(QT.getTypePtr())) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D59750: Rename directory housing clang-include-fixer to be eponymous

2019-03-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg. Is the reference from libclang still around? Might need an update.


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

https://reviews.llvm.org/D59750



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


[PATCH] D60201: Make clangd-fuzzer use the normal add_llvm_fuzzer() machinery

2019-04-03 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


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

https://reviews.llvm.org/D60201



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


[PATCH] D52264: Deduplicate replacements from diagnostics.

2018-09-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52264



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


[PATCH] D37382: Fixed a crash in code completion.

2017-09-08 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D37382



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


[PATCH] D37564: Update users of llvm::sys::ExecuteAndWait etc.

2017-09-13 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lgtm too


https://reviews.llvm.org/D37564



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


[PATCH] D45603: Fix evaluation of `__has_include_next` during -frewrite-includes.

2018-04-13 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D45603



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


[PATCH] D46148: [CUDA] Added -f[no-]cuda-short-ptr option

2018-04-27 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lgtm


https://reviews.llvm.org/D46148



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


[PATCH] D48845: [Sema] Add fixit for unused lambda captures

2018-07-03 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: test/FixIt/fixit-unused-lambda-capture.cpp:31
+  // CHECK: [=,&i] { return i; };
+}

This needs tests for:

* capture initializers `[c = foo()] {};`
* Capturing this `[this] {};`
* Capturing *this `[*this] {};`
* VLA capture `int a; int c[a]; [&c] {};`


Repository:
  rC Clang

https://reviews.llvm.org/D48845



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


[PATCH] D49484: [CodeComplete] Allow getDeclaration on RK_Pattern result.

2018-07-18 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rC Clang

https://reviews.llvm.org/D49484



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


[PATCH] D49302: [AST] Various micro-optimizations in CXXInheritance

2018-07-18 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

cool


Repository:
  rC Clang

https://reviews.llvm.org/D49302



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


[PATCH] D49274: [CUDA] Provide integer SIMD functions for CUDA-9.2

2018-07-18 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added inline comments.
This revision is now accepted and ready to land.



Comment at: clang/lib/Headers/__clang_cuda_device_functions.h:1080
+  unsigned int r;
+  asm("vabsdiff2.u32.u32.u32.sat %0,%1,%2,0;" : "=r"(r) : "r"(__a), "r"(__b));
+  return r;

Should this really saturate?



Comment at: clang/lib/Headers/__clang_cuda_device_functions.h:1095
+  unsigned int r;
+  asm("vabsdiff2.s32.s32.s32.sat %0,%1,0,0;" : "=r"(r) : "r"(__a));
+  return r;

vabsdiff4?


https://reviews.llvm.org/D49274



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


[PATCH] D81865: [clang] Use string tables for static diagnostic descriptions

2020-07-27 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Nice, those relocations have annoyed me for years. I'm worried about whether 
the way you're accessing StaticDiagInfoDescriptionStringTable might be 
undefined behavior. I won't block this change on that though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81865



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


[PATCH] D77420: Also look for devtoolset-9 gcc toolchain

2020-04-15 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

looks good


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77420



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


[PATCH] D77420: Also look for devtoolset-9 gcc toolchain

2020-04-16 Thread Benjamin Kramer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7b9c6c16c33d: Also look for devtoolset-9 gcc toolchain 
(authored by stephan.dollberg, committed by bkramer).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77420

Files:
  clang/lib/Driver/ToolChains/Gnu.cpp


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1977,6 +1977,7 @@
   // Non-Solaris is much simpler - most systems just go with "/usr".
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
 // Yet, still look for RHEL devtoolsets.
+Prefixes.push_back("/opt/rh/devtoolset-9/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-8/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-7/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-6/root/usr");


Index: clang/lib/Driver/ToolChains/Gnu.cpp
===
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -1977,6 +1977,7 @@
   // Non-Solaris is much simpler - most systems just go with "/usr".
   if (SysRoot.empty() && TargetTriple.getOS() == llvm::Triple::Linux) {
 // Yet, still look for RHEL devtoolsets.
+Prefixes.push_back("/opt/rh/devtoolset-9/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-8/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-7/root/usr");
 Prefixes.push_back("/opt/rh/devtoolset-6/root/usr");
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D78213: [libclang]: visit BindingDecl in DecompositionDecl

2020-05-02 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

looks good


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78213



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


[PATCH] D78214: [libclang]: visit C++17 if init statements

2020-05-02 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

looks good


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78214



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


[PATCH] D78213: [libclang]: visit BindingDecl in DecompositionDecl

2020-05-02 Thread Benjamin Kramer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4597e3bd475b: [libclang]: visit BindingDecl in 
DecompositionDecl (authored by milianw, committed by bkramer).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78213

Files:
  clang/test/Index/cxx17-structured-binding.cpp
  clang/tools/libclang/CIndex.cpp
  clang/tools/libclang/CursorVisitor.h


Index: clang/tools/libclang/CursorVisitor.h
===
--- clang/tools/libclang/CursorVisitor.h
+++ clang/tools/libclang/CursorVisitor.h
@@ -241,6 +241,7 @@
   bool VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
   bool VisitStaticAssertDecl(StaticAssertDecl *D);
   bool VisitFriendDecl(FriendDecl *D);
+  bool VisitDecompositionDecl(DecompositionDecl *D);
 
   // Name visitor
   bool VisitDeclarationNameInfo(DeclarationNameInfo Name);
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1295,6 +1295,14 @@
   return false;
 }
 
+bool CursorVisitor::VisitDecompositionDecl(DecompositionDecl *D) {
+  for (auto *B : D->bindings()) {
+if (Visit(MakeCXCursor(B, TU, RegionOfInterest)))
+  return true;
+  }
+  return VisitVarDecl(D);
+}
+
 bool CursorVisitor::VisitDeclarationNameInfo(DeclarationNameInfo Name) {
   switch (Name.getName().getNameKind()) {
   case clang::DeclarationName::Identifier:
Index: clang/test/Index/cxx17-structured-binding.cpp
===
--- /dev/null
+++ clang/test/Index/cxx17-structured-binding.cpp
@@ -0,0 +1,25 @@
+// Test is line- and column-sensitive; see below.
+int main() {
+  int a[2] = {1, 2};
+  auto [x, y] = a;
+}
+
+// RUN: c-index-test -test-load-source all -std=c++17 %s | FileCheck 
-check-prefix=CHECK-LOAD %s
+// CHECK-LOAD: cxx17-structured-binding.cpp:2:5: FunctionDecl=main:2:5 
(Definition) Extent=[2:1 - 5:2]
+// CHECK-LOAD: cxx17-structured-binding.cpp:2:12: CompoundStmt= Extent=[2:12 - 
5:2]
+// CHECK-LOAD: cxx17-structured-binding.cpp:3:3: DeclStmt= Extent=[3:3 - 3:21]
+// CHECK-LOAD: cxx17-structured-binding.cpp:3:7: VarDecl=a:3:7 (Definition) 
Extent=[3:3 - 3:20]
+// CHECK-LOAD: cxx17-structured-binding.cpp:3:9: IntegerLiteral= Extent=[3:9 - 
3:10]
+// CHECK-LOAD: cxx17-structured-binding.cpp:3:14: InitListExpr= Extent=[3:14 - 
3:20]
+// CHECK-LOAD: cxx17-structured-binding.cpp:3:15: IntegerLiteral= Extent=[3:15 
- 3:16]
+// CHECK-LOAD: cxx17-structured-binding.cpp:3:18: IntegerLiteral= Extent=[3:18 
- 3:19]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:3: DeclStmt= Extent=[4:3 - 4:19]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:8: UnexposedDecl=[x, y]:4:8 
(Definition) Extent=[4:3 - 4:18]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:9: UnexposedDecl=x:4:9 
(Definition) Extent=[4:9 - 4:10]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:12: UnexposedDecl=y:4:12 
(Definition) Extent=[4:12 - 4:13]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:17: UnexposedExpr= Extent=[4:17 
- 4:18]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:17: DeclRefExpr=a:3:7 
Extent=[4:17 - 4:18]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:17: UnexposedExpr= Extent=[4:17 
- 4:9]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:17: ArraySubscriptExpr= 
Extent=[4:17 - 4:9]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:17: UnexposedExpr=a:3:7 
Extent=[4:17 - 4:18]
+// CHECK-LOAD: cxx17-structured-binding.cpp:4:17: DeclRefExpr=a:3:7 
Extent=[4:17 - 4:18]


Index: clang/tools/libclang/CursorVisitor.h
===
--- clang/tools/libclang/CursorVisitor.h
+++ clang/tools/libclang/CursorVisitor.h
@@ -241,6 +241,7 @@
   bool VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
   bool VisitStaticAssertDecl(StaticAssertDecl *D);
   bool VisitFriendDecl(FriendDecl *D);
+  bool VisitDecompositionDecl(DecompositionDecl *D);
 
   // Name visitor
   bool VisitDeclarationNameInfo(DeclarationNameInfo Name);
Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -1295,6 +1295,14 @@
   return false;
 }
 
+bool CursorVisitor::VisitDecompositionDecl(DecompositionDecl *D) {
+  for (auto *B : D->bindings()) {
+if (Visit(MakeCXCursor(B, TU, RegionOfInterest)))
+  return true;
+  }
+  return VisitVarDecl(D);
+}
+
 bool CursorVisitor::VisitDeclarationNameInfo(DeclarationNameInfo Name) {
   switch (Name.getName().getNameKind()) {
   case clang::DeclarationName::Identifier:
Index: clang/test/Index/cxx17-structured-binding.cpp
===
--- /dev/null
+++ clang/test/Index/cxx17-structured-binding.cpp
@@ -0,0 +1,25 @@
+// Test is line

[PATCH] D78214: [libclang]: visit C++17 if init statements

2020-05-02 Thread Benjamin Kramer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG08e181264318: [libclang]: visit C++17 if init statements 
(authored by milianw, committed by bkramer).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78214

Files:
  clang/test/Index/cxx17-if-with-initializer.cpp
  clang/tools/libclang/CIndex.cpp


Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2680,6 +2680,7 @@
   AddStmt(If->getElse());
   AddStmt(If->getThen());
   AddStmt(If->getCond());
+  AddStmt(If->getInit());
   AddDecl(If->getConditionVariable());
 }
 void EnqueueVisitor::VisitInitListExpr(const InitListExpr *IE) {
Index: clang/test/Index/cxx17-if-with-initializer.cpp
===
--- /dev/null
+++ clang/test/Index/cxx17-if-with-initializer.cpp
@@ -0,0 +1,17 @@
+// Test is line- and column-sensitive; see below.
+
+void foo() {
+  if (bool bar = true; bar) {
+  }
+}
+
+// RUN: c-index-test -test-load-source all -std=c++17 %s | FileCheck 
-check-prefix=CHECK-LOAD %s
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:3:6: FunctionDecl=foo:3:6 
(Definition) Extent=[3:1 - 6:2]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:3:12: CompoundStmt= Extent=[3:12 
- 6:2]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:3: IfStmt= Extent=[4:3 - 5:4]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:7: DeclStmt= Extent=[4:7 - 4:23]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:12: VarDecl=bar:4:12 
(Definition) Extent=[4:7 - 4:22]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:18: CXXBoolLiteralExpr= 
Extent=[4:18 - 4:22]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:24: UnexposedExpr=bar:4:12 
Extent=[4:24 - 4:27]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:24: DeclRefExpr=bar:4:12 
Extent=[4:24 - 4:27]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:29: CompoundStmt= Extent=[4:29 
- 5:4]


Index: clang/tools/libclang/CIndex.cpp
===
--- clang/tools/libclang/CIndex.cpp
+++ clang/tools/libclang/CIndex.cpp
@@ -2680,6 +2680,7 @@
   AddStmt(If->getElse());
   AddStmt(If->getThen());
   AddStmt(If->getCond());
+  AddStmt(If->getInit());
   AddDecl(If->getConditionVariable());
 }
 void EnqueueVisitor::VisitInitListExpr(const InitListExpr *IE) {
Index: clang/test/Index/cxx17-if-with-initializer.cpp
===
--- /dev/null
+++ clang/test/Index/cxx17-if-with-initializer.cpp
@@ -0,0 +1,17 @@
+// Test is line- and column-sensitive; see below.
+
+void foo() {
+  if (bool bar = true; bar) {
+  }
+}
+
+// RUN: c-index-test -test-load-source all -std=c++17 %s | FileCheck -check-prefix=CHECK-LOAD %s
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:3:6: FunctionDecl=foo:3:6 (Definition) Extent=[3:1 - 6:2]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:3:12: CompoundStmt= Extent=[3:12 - 6:2]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:3: IfStmt= Extent=[4:3 - 5:4]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:7: DeclStmt= Extent=[4:7 - 4:23]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:12: VarDecl=bar:4:12 (Definition) Extent=[4:7 - 4:22]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:18: CXXBoolLiteralExpr= Extent=[4:18 - 4:22]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:24: UnexposedExpr=bar:4:12 Extent=[4:24 - 4:27]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:24: DeclRefExpr=bar:4:12 Extent=[4:24 - 4:27]
+// CHECK-LOAD: cxx17-if-with-initializer.cpp:4:29: CompoundStmt= Extent=[4:29 - 5:4]
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D40302: Avoid copying the data of in-memory preambles

2017-11-23 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: include/clang/Frontend/PrecompiledPreamble.h:101
   /// is accessible.
+  /// For in-memory preambles, PrecompiledPreamble instance continues to owns
+  /// the MemoryBuffer with the Preamble after this method returns. The caller

continues to own


https://reviews.llvm.org/D40302



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


[PATCH] D40302: Avoid copying the data of in-memory preambles

2017-11-23 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D40302



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


[PATCH] D40435: [clang-format] Deduplicate using declarations

2017-11-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: lib/Format/UsingDeclarationsSorter.cpp:115
 
+bool usingDeclarationsEqual(const UsingDeclaration &a,
+const UsingDeclaration &b) {

I'd use a lambda instead.


https://reviews.llvm.org/D40435



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


[PATCH] D40435: [clang-format] Deduplicate using declarations

2017-11-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D40435



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


[PATCH] D40439: [Tooling] Remove file/command enumeration from CompilationDatabase.

2017-11-27 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

There are a few users of the C++ API out there, do we have migration path for 
them?


https://reviews.llvm.org/D40439



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


[PATCH] D40485: [clangd] Introduced a Context that stores implicit data

2017-11-27 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer requested changes to this revision.
bkramer added inline comments.
This revision now requires changes to proceed.



Comment at: clangd/Context.h:79
+/// Otherwise returns an empty Context.
+Context &globalCtx();
+

This is a giant code smell. If we want the context route, please pass contexts 
everywhere. I really don't want this kind of technical debt in clangd now.


https://reviews.llvm.org/D40485



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


[PATCH] D40643: [libclang] Add function to get the buffer for a file

2017-11-30 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D40643



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


[PATCH] D40561: [libclang] Fix cursors for functions with trailing return type

2017-12-11 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D40561



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


[PATCH] D132920: [clang] Silence a false positive GCC -Wunused-but-set-parameter warning with constexpr

2022-08-30 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132920

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


[PATCH] D122173: [libc++][ranges] Implement ranges::transform

2022-04-05 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: 
clang/lib/ExtractAPI/Serialization/ranges_transform.module.verify.cpp:1-15
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//

This file doesn't belong in clang/lib. Deleted it in 
302fe7b3c40f7b949f3bebb74997bef9bf74d59f.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122173

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


[PATCH] D130964: [X86][BF16] Enable __bf16 for x86 targets.

2022-08-02 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

In D130964#3694473 , @rjmccall wrote:

> How are you actually implementing `__bf16` on these targets?  There isn't 
> even hardware support for conversions.

`bf16` -> `float` is really just a bit shift. The other direction gets lowered 
to a libcall, compiler-rt has a conversion function with proper rounding. I 
added some support to make the backend promote all other arithmetic to float, 
but I think that's only enabled on x86 so far.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130964

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


[PATCH] D27104: Unify and simplify the behavior of the hasDeclaration matcher.

2017-07-28 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg under the precondition that clang-tidy tests still work.


https://reviews.llvm.org/D27104



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


[PATCH] D36095: [clangd] Allow to get vfs::FileSystem used inside codeComplete.

2017-07-31 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg (it could use a test case though)


https://reviews.llvm.org/D36095



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


[PATCH] D36133: [clangd] Rewrote AST and Preamble management.

2017-08-01 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: clangd/ClangdServer.h:113
+  /// queue. The request will be run on a separate thread.
+  template  void addToFront(Func &&F, Args &&... 
As);
+  /// Add a new request to run function \p F with args \p As to the end of the

Why the template? This is awkward now because it can only be called from 
ClangdServer.cpp



Comment at: clangd/ClangdUnit.cpp:887-889
+tooling::CompileCommand const &CppFile::getCompileCommand() const {
+  return Command;
+}

Move implementation into header



Comment at: clangd/ClangdUnit.cpp:910
+  return WasCancelledBeforeConstruction;
+}
+

Move implementation into header.



Comment at: clangd/ClangdUnit.h:104
 
-~ParsedAST();
+// Providse thread-safe access to ParsedAST.
+class ParsedASTWrapper {

Typo: Providse



Comment at: clangd/ClangdUnitStore.cpp:22
 return;
   OpenedFiles.erase(It);
 }

Not introduced in this commit, but this is equivalent to 
OpenedFiles.erase(File) without the find and check.


https://reviews.llvm.org/D36133



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


[PATCH] D36133: [clangd] Rewrote AST and Preamble management.

2017-08-01 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

ship it!


https://reviews.llvm.org/D36133



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


[PATCH] D36154: Adapt clang-tidy checks to changing semantics of hasDeclaration.

2017-08-01 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: clang-tidy/google/StringReferenceMemberCheck.cpp:31
+  auto String = anyOf(namedDecl(hasName("::std::string")),
   recordDecl(hasName("::string")));
   auto ConstString = qualType(isConstQualified(), hasDeclaration(String));

I think this should be namedDecl too.


https://reviews.llvm.org/D36154



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


[PATCH] D36154: Adapt clang-tidy checks to changing semantics of hasDeclaration.

2017-08-02 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

looks good


https://reviews.llvm.org/D36154



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


[PATCH] D36390: Fix overloaded static functions in SemaCodeComplete

2017-08-07 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: include/clang/Sema/Sema.h:2681
+  bool PartialOverloading = false,
+  bool ExtraFirstArgument = false);
   void AddMethodCandidate(DeclAccessPair FoundDecl,

Shouldn't this be called with the new argument somehere? Otherwise it'll always 
be false.


https://reviews.llvm.org/D36390



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


[PATCH] D36187: [clang-diff] Use the relative name for NamedDecls

2017-08-07 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

There's some similar code in tools/clang/lib/Tooling/Core/Lookup.cpp, it might 
make sense to share it. Otherwise this looks good.




Comment at: lib/Tooling/ASTDiff/ASTDiff.cpp:391
+  if (!ContextPrefix.empty() &&
+  Val.substr(0, ContextPrefix.size()) == ContextPrefix)
+Val = Val.substr(ContextPrefix.size() + 1);

Val.startswith(ContextPrefix)


https://reviews.llvm.org/D36187



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


[PATCH] D36458: Fix crash when current lexer is nullptr

2017-08-08 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

Test case?


https://reviews.llvm.org/D36458



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


[PATCH] D36390: Fix overloaded static functions in SemaCodeComplete

2017-08-08 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added inline comments.



Comment at: include/clang/Sema/Sema.h:2681
+  bool PartialOverloading = false,
+  bool ExtraFirstArgument = false);
   void AddMethodCandidate(DeclAccessPair FoundDecl,

I'd prefer something like "FirstArgumentIsBase"



Comment at: lib/Sema/SemaOverload.cpp:5871
   // is irrelevant.
+
   AddMethodCandidate(Method, FoundDecl, Method->getParent(), QualType(),

Unnecessary whitespace change.



Comment at: lib/Sema/SemaOverload.cpp:6339
   } else {
+// Slice the first argument when we access static method as non-static
+if (Args.size() > 0 && ExtraFirstArgument && isa(FD)

Add a comment that the first argument is the base.



Comment at: lib/Sema/SemaOverload.cpp:6341
+if (Args.size() > 0 && ExtraFirstArgument && isa(FD)
+&& !isa(FD)) {
+  Args = Args.slice(1);

clang-format



Comment at: lib/Sema/SemaOverload.cpp:6342
+&& !isa(FD)) {
+  Args = Args.slice(1);
+}

assert that FD is a static method.


https://reviews.llvm.org/D36390



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


[PATCH] D36458: Fix crash when current lexer is nullptr

2017-08-09 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

Changes like this should come with a small, c-index-test based, test case so we 
don't reintroduce the same bug in the future.


https://reviews.llvm.org/D36458



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


[PATCH] D36397: [clangd] Fixed a data race.

2017-08-14 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

I think this can be committed now. It's still a bit awkward but we can address 
that later.


https://reviews.llvm.org/D36397



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


[PATCH] D36872: Fixed a crash on replaying Preamble's PP conditional stack.

2017-08-21 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

This looks good to me.


https://reviews.llvm.org/D36872



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


[PATCH] D36821: [libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit*

2017-08-21 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


https://reviews.llvm.org/D36821



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


[PATCH] D17993: [CodeGen] Apply 'nonnull' and 'dereferenceable(N)' to 'this' pointer arguments.

2020-11-21 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

In D17993#2409401 , @brooksmoses wrote:

> So, I have bad news: This causes OpenJDK to segfault.  The relevant code is 
> here:
> https://github.com/openjdk/jdk/blob/master/src/hotspot/share/memory/arena.cpp#L311
>
>   void Arena::destruct_contents() {
> if (UseMallocOnly && _first != NULL) {
>   char* end = _first->next() ? _first->top() : _hwm;
>   free_malloced_objects(_first, _first->bottom(), end, _hwm);
> }
> // reset size before chop to avoid a rare racing condition
> // that can have total arena memory exceed total chunk memory
> set_size_in_bytes(0);
> _first->chop();
> reset();
>   }
>
> I've also seen a segfault in Verilator that root-causes to this patch, though 
> I haven't yet tracked that down to the source code.
>
> I hate to say it, but is this a significant enough problem to call for a 
> (temporary, I hope) rollback?

I don't see why this would be enough for a rollback, jdk is supposed to build 
with `-fno-delete-null-pointer-checks`, which disables this optimization:
https://github.com/openjdk/jdk/blob/master/make/autoconf/flags-cflags.m4#L842

Is the build system not setting this when using Clang?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D17993

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


[PATCH] D92297: [CodeGen] -fno-delete-null-pointer-checks: change dereferenceable to dereferenceable_or_null

2020-11-30 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

While it would be nice for `dereferenceable` to not imply nonnull, the 
implementation currently assumes it does and will speculate loads based on 
that. See `llvm::Value::getPointerDereferenceableBytes` and its users.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92297

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


[PATCH] D89708: Move clang/Tooling/Core/Lookup.h to clang/Tooling/Refactoring/Lookup.h

2020-10-19 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89708

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


[PATCH] D109865: [NFC] `goto fail` has failed us in the past...

2021-09-21 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Looks good, thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109865

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


[PATCH] D107760: [clang] Fix warning -Wnon-virtual-dtor.

2021-08-09 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107760

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


[PATCH] D140332: [ADT] Alias llvm::Optional to std::optional

2022-12-19 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer marked an inline comment as done.
bkramer added inline comments.



Comment at: clang/lib/Basic/TargetInfo.cpp:513
   if (Opts.MaxBitIntWidth)
-MaxBitIntWidth = Opts.MaxBitIntWidth;
+MaxBitIntWidth = (unsigned)Opts.MaxBitIntWidth;
 

barannikov88 wrote:
> Nit: C-style casts are generally discouraged (there are several occurrences 
> in this patch).
-> static_cast



Comment at: llvm/lib/CodeGen/RegAllocGreedy.h:83
   public:
-ExtraRegInfo() = default;
+ExtraRegInfo() {}
 ExtraRegInfo(const ExtraRegInfo &) = delete;

barannikov88 wrote:
> Is it somehow different than ' = default'?
It makes the class non-trivial, std::optional::emplace has issues with trivial 
default constructors :(



Comment at: mlir/lib/Dialect/GPU/Transforms/SerializeToHsaco.cpp:182
 
-  return ret;
+  return std::move(ret);
 }

barannikov88 wrote:
> clang-tidy would usually complain on this. Does it solve some gcc issue?
It does, this is a bug in GCC 7.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140332

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


[PATCH] D140332: [ADT] Alias llvm::Optional to std::optional

2022-12-19 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer marked an inline comment as done.
bkramer added a comment.

In D140332#4005988 , @MaskRay wrote:

> Can you push `using OptionalFileEntryRef = 
> CustomizableOptional;` and the renaming as a separate commit to 
> make this patch smaller?
> There is a smaller that this rename may be reverted.
> 205c0589f918f95d2f2c586a01bea2716d73d603 
>  
> reverted a change related to `OptionalFileEntryRef`. I assume that your 
> change is fine.

Yeah, I'll split this into smaller pieces once we agree on the direction and 
just submit the alias. I expect a revert or two.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140332

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


[PATCH] D137760: Add FP8 E4M3 support to APFloat.

2022-11-15 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137760

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


[PATCH] D137760: Add FP8 E4M3 support to APFloat.

2022-11-15 Thread Benjamin Kramer via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG88eb3c62f25d: Add FP8 E4M3 support to APFloat. (authored by 
reedwm, committed by bkramer).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137760

Files:
  clang/include/clang/AST/Stmt.h
  clang/lib/AST/MicrosoftMangle.cpp
  llvm/include/llvm/ADT/APFloat.h
  llvm/lib/Support/APFloat.cpp
  llvm/unittests/ADT/APFloatTest.cpp

Index: llvm/unittests/ADT/APFloatTest.cpp
===
--- llvm/unittests/ADT/APFloatTest.cpp
+++ llvm/unittests/ADT/APFloatTest.cpp
@@ -1683,6 +1683,7 @@
 TEST(APFloatTest, getLargest) {
   EXPECT_EQ(3.402823466e+38f, APFloat::getLargest(APFloat::IEEEsingle()).convertToFloat());
   EXPECT_EQ(1.7976931348623158e+308, APFloat::getLargest(APFloat::IEEEdouble()).convertToDouble());
+  EXPECT_EQ(448, APFloat::getLargest(APFloat::Float8E4M3FN()).convertToDouble());
 }
 
 TEST(APFloatTest, getSmallest) {
@@ -1766,6 +1767,8 @@
   {&APFloat::x87DoubleExtended(), true, {0, 0x8000ULL}, 2},
   {&APFloat::Float8E5M2(), false, {0, 0}, 1},
   {&APFloat::Float8E5M2(), true, {0x80ULL, 0}, 1},
+  {&APFloat::Float8E4M3FN(), false, {0, 0}, 1},
+  {&APFloat::Float8E4M3FN(), true, {0x80ULL, 0}, 1},
   };
   const unsigned NumGetZeroTests = 12;
   for (unsigned i = 0; i < NumGetZeroTests; ++i) {
@@ -3665,6 +3668,16 @@
 EXPECT_EQ(f1.mod(f2), APFloat::opOK);
 EXPECT_TRUE(f1.bitwiseIsEqual(expected));
   }
+  {
+// Test E4M3FN mod where the LHS exponent is maxExponent (8) and the RHS is
+// the max value whose exponent is minExponent (-6). This requires special
+// logic in the mod implementation to prevent overflow to NaN.
+APFloat f1(APFloat::Float8E4M3FN(), "0x1p8");// 256
+APFloat f2(APFloat::Float8E4M3FN(), "0x1.ep-6"); // 0.029296875
+APFloat expected(APFloat::Float8E4M3FN(), "0x1p-8"); // 0.00390625
+EXPECT_EQ(f1.mod(f2), APFloat::opOK);
+EXPECT_TRUE(f1.bitwiseIsEqual(expected));
+  }
 }
 
 TEST(APFloatTest, remainder) {
@@ -4756,6 +4769,389 @@
   EXPECT_TRUE(ilogb(F) == -1);
 }
 
+TEST(APFloatTest, ConvertE4M3FNToE5M2) {
+  bool losesInfo;
+  APFloat test(APFloat::Float8E4M3FN(), "1.0");
+  APFloat::opStatus status = test.convert(
+  APFloat::Float8E5M2(), APFloat::rmNearestTiesToEven, &losesInfo);
+  EXPECT_EQ(1.0f, test.convertToFloat());
+  EXPECT_FALSE(losesInfo);
+  EXPECT_EQ(status, APFloat::opOK);
+
+  test = APFloat(APFloat::Float8E4M3FN(), "0.0");
+  status = test.convert(APFloat::Float8E5M2(), APFloat::rmNearestTiesToEven,
+&losesInfo);
+  EXPECT_EQ(0.0f, test.convertToFloat());
+  EXPECT_FALSE(losesInfo);
+  EXPECT_EQ(status, APFloat::opOK);
+
+  test = APFloat(APFloat::Float8E4M3FN(), "0x1.2p0"); // 1.125
+  status = test.convert(APFloat::Float8E5M2(), APFloat::rmNearestTiesToEven,
+&losesInfo);
+  EXPECT_EQ(0x1.0p0 /* 1.0 */, test.convertToFloat());
+  EXPECT_TRUE(losesInfo);
+  EXPECT_EQ(status, APFloat::opInexact);
+
+  test = APFloat(APFloat::Float8E4M3FN(), "0x1.6p0"); // 1.375
+  status = test.convert(APFloat::Float8E5M2(), APFloat::rmNearestTiesToEven,
+&losesInfo);
+  EXPECT_EQ(0x1.8p0 /* 1.5 */, test.convertToFloat());
+  EXPECT_TRUE(losesInfo);
+  EXPECT_EQ(status, APFloat::opInexact);
+
+  // Convert E4M3 denormal to E5M2 normal. Should not be truncated, despite the
+  // destination format having one fewer significand bit
+  test = APFloat(APFloat::Float8E4M3FN(), "0x1.Cp-7");
+  status = test.convert(APFloat::Float8E5M2(), APFloat::rmNearestTiesToEven,
+&losesInfo);
+  EXPECT_EQ(0x1.Cp-7, test.convertToFloat());
+  EXPECT_FALSE(losesInfo);
+  EXPECT_EQ(status, APFloat::opOK);
+
+  // Test convert from NaN
+  test = APFloat(APFloat::Float8E4M3FN(), "nan");
+  status = test.convert(APFloat::Float8E5M2(), APFloat::rmNearestTiesToEven,
+&losesInfo);
+  EXPECT_TRUE(std::isnan(test.convertToFloat()));
+  EXPECT_FALSE(losesInfo);
+  EXPECT_EQ(status, APFloat::opOK);
+}
+
+TEST(APFloatTest, ConvertE5M2ToE4M3FN) {
+  bool losesInfo;
+  APFloat test(APFloat::Float8E5M2(), "1.0");
+  APFloat::opStatus status = test.convert(
+  APFloat::Float8E4M3FN(), APFloat::rmNearestTiesToEven, &losesInfo);
+  EXPECT_EQ(1.0f, test.convertToFloat());
+  EXPECT_FALSE(losesInfo);
+  EXPECT_EQ(status, APFloat::opOK);
+
+  test = APFloat(APFloat::Float8E5M2(), "0.0");
+  status = test.convert(APFloat::Float8E4M3FN(), APFloat::rmNearestTiesToEven,
+&losesInfo);
+  EXPECT_EQ(0.0f, test.convertToFloat());
+  EXPECT_FALSE(losesInfo);
+  EXPECT_EQ(status, APFloat::opOK);
+
+  test = APFloat(APFloat::Float8E5M2(), "0x1.Cp8"); // 448
+  status = test.convert(APFloat::Float8E4M3FN(), APFloat::rmNearestTiesToEven

[PATCH] D133574: [C2x] reject type definitions in offsetof

2023-01-13 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

GitHub finds around 1.9k instances of this pattern to compute `alignof`. 
There's a lot of duplicates and `#ifdefs` so the real number is going to be 
smaller, but it seems to be quite common. The annoying part is that there is no 
`_Alignof` in C99 so for many of those projects there is no easy fix.

Can this be demoted to a warning?

https://github.com/search?type=code&q=%2Foffsetof%5Cs*%5C%28%5Cs*struct%5Cs*%5C%7B%2F+lang%3Ac


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133574

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


[PATCH] D128571: [X86] Support `_Float16` on SSE2 and up

2022-06-25 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128571

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


[PATCH] D156172: [clang][CodeGen] Emit annotations for function declarations.

2023-09-13 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

Reverted this in 88b7e06dcf9723d0869b0c6bee030b4140e4366d 
 as it 
makes clang crash. Reduced test case in the commit description.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156172

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


[PATCH] D76703: [ARM][CMSE] Fix clang/test/Driver/save-temps.c test.

2020-03-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

looks good


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76703



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


[PATCH] D74954: Add a basic tiling pass for parallel loops

2020-02-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer updated this revision to Diff 246167.
bkramer added a comment.
Herald added a subscriber: wuzish.
Herald added a reviewer: mclow.lists.

- WTF phab?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74954

Files:
  mlir/include/mlir/Dialect/LoopOps/Passes.h
  mlir/include/mlir/InitAllPasses.h
  mlir/lib/Dialect/LoopOps/Transforms/CMakeLists.txt
  mlir/lib/Dialect/LoopOps/Transforms/ParallelLoopTiling.cpp
  mlir/test/Dialect/Loops/parallel-loop-tiling.mlir

Index: mlir/test/Dialect/Loops/parallel-loop-tiling.mlir
===
--- /dev/null
+++ mlir/test/Dialect/Loops/parallel-loop-tiling.mlir
@@ -0,0 +1,80 @@
+// RUN: mlir-opt %s -pass-pipeline='func(parallel-loop-tiling{parallel-loop-tile-sizes=1,4})' -split-input-file | FileCheck %s --dump-input-on-failure
+
+func @parallel_loop(%arg0 : index, %arg1 : index, %arg2 : index,
+%arg3 : index, %arg4 : index, %arg5 : index,
+		%A: memref, %B: memref,
+%C: memref, %result: memref) {
+  loop.parallel (%i0, %i1) = (%arg0, %arg1) to (%arg2, %arg3) step (%arg4, %arg5) {
+%B_elem = load %B[%i0, %i1] : memref
+%C_elem = load %C[%i0, %i1] : memref
+%sum_elem = addf %B_elem, %C_elem : f32
+store %sum_elem, %result[%i0, %i1] : memref
+  }
+  return
+}
+
+// CHECK:   #map0 = affine_map<(d0, d1, d2) -> (d0, d1 - d2)>
+// CHECK-LABEL:   func @parallel_loop(
+// CHECK-SAME:[[VAL_0:%.*]]: index, [[VAL_1:%.*]]: index, [[VAL_2:%.*]]: index, [[VAL_3:%.*]]: index, [[VAL_4:%.*]]: index, [[VAL_5:%.*]]: index, [[VAL_6:%.*]]: memref, [[VAL_7:%.*]]: memref, [[VAL_8:%.*]]: memref, [[VAL_9:%.*]]: memref) {
+// CHECK:   [[VAL_10:%.*]] = constant 0 : index
+// CHECK:   [[VAL_11:%.*]] = constant 1 : index
+// CHECK:   [[VAL_12:%.*]] = constant 4 : index
+// CHECK:   [[VAL_13:%.*]] = muli [[VAL_4]], [[VAL_11]] : index
+// CHECK:   [[VAL_14:%.*]] = muli [[VAL_5]], [[VAL_12]] : index
+// CHECK:   loop.parallel ([[VAL_15:%.*]], [[VAL_16:%.*]]) = ([[VAL_0]], [[VAL_1]]) to ([[VAL_2]], [[VAL_3]]) step ([[VAL_13]], [[VAL_14]]) {
+// CHECK: [[VAL_17:%.*]] = affine.min #map0([[VAL_11]], [[VAL_2]], [[VAL_15]])
+// CHECK: [[VAL_18:%.*]] = affine.min #map0([[VAL_12]], [[VAL_3]], [[VAL_16]])
+// CHECK: loop.parallel ([[VAL_19:%.*]], [[VAL_20:%.*]]) = ([[VAL_10]], [[VAL_10]]) to ([[VAL_17]], [[VAL_18]]) step ([[VAL_4]], [[VAL_5]]) {
+// CHECK:   [[VAL_21:%.*]] = load [[VAL_7]]{{\[}}[[VAL_19]], [[VAL_20]]] : memref
+// CHECK:   [[VAL_22:%.*]] = load [[VAL_8]]{{\[}}[[VAL_19]], [[VAL_20]]] : memref
+// CHECK:   [[VAL_23:%.*]] = addf [[VAL_21]], [[VAL_22]] : f32
+// CHECK:   store [[VAL_23]], [[VAL_9]]{{\[}}[[VAL_19]], [[VAL_20]]] : memref
+// CHECK: }
+// CHECK:   }
+// CHECK:   return
+
+// -
+
+func @tile_nested_innermost() {
+  %c2 = constant 2 : index
+  %c0 = constant 0 : index
+  %c1 = constant 1 : index
+  loop.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
+loop.parallel (%k, %l) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
+}
+  }
+  loop.parallel (%i, %j) = (%c0, %c0) to (%c2, %c2) step (%c1, %c1) {
+  }
+  return
+}
+
+// CHECK-LABEL:   func @tile_nested_innermost() {
+// CHECK:   [[VAL_24:%.*]] = constant 2 : index
+// CHECK:   [[VAL_25:%.*]] = constant 0 : index
+// CHECK:   [[VAL_26:%.*]] = constant 1 : index
+// CHECK:   loop.parallel ([[VAL_27:%.*]], [[VAL_28:%.*]]) = ([[VAL_25]], [[VAL_25]]) to ([[VAL_24]], [[VAL_24]]) step ([[VAL_26]], [[VAL_26]]) {
+// CHECK: [[VAL_29:%.*]] = constant 0 : index
+// CHECK: [[VAL_30:%.*]] = constant 1 : index
+// CHECK: [[VAL_31:%.*]] = constant 4 : index
+// CHECK: [[VAL_32:%.*]] = muli [[VAL_26]], [[VAL_30]] : index
+// CHECK: [[VAL_33:%.*]] = muli [[VAL_26]], [[VAL_31]] : index
+// CHECK: loop.parallel ([[VAL_34:%.*]], [[VAL_35:%.*]]) = ([[VAL_25]], [[VAL_25]]) to ([[VAL_24]], [[VAL_24]]) step ([[VAL_32]], [[VAL_33]]) {
+// CHECK:   [[VAL_36:%.*]] = affine.min #map0([[VAL_30]], [[VAL_24]], [[VAL_34]])
+// CHECK:   [[VAL_37:%.*]] = affine.min #map0([[VAL_31]], [[VAL_24]], [[VAL_35]])
+// CHECK:   loop.parallel ([[VAL_38:%.*]], [[VAL_39:%.*]]) = ([[VAL_29]], [[VAL_29]]) to ([[VAL_36]], [[VAL_37]]) step ([[VAL_26]], [[VAL_26]]) {
+// CHECK:   }
+// CHECK: }
+// CHECK:   }
+// CHECK:   [[VAL_40:%.*]] = constant 0 : index
+// CHECK:   [[VAL_41:%.*]] = constant 1 : index
+// CHECK:   [[VAL_42:%.*]] = constant 4 : index
+// CHECK:   [[VAL_43:%.*]] = muli [[VAL_26]], [[VAL_41]] : index
+// CHECK:   [[VAL_44:%.*]] = muli [[VAL_26]], [[VAL_42

[PATCH] D74954: Add a basic tiling pass for parallel loops

2020-02-24 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer updated this revision to Diff 246166.
bkramer marked 4 inline comments as done.
bkramer added a comment.
Herald added subscribers: libc-commits, libcxx-commits, lldb-commits, 
Sanitizers, cfe-commits, bader, kerbowa, csigg, usaxena95, jdoerfert, ormris, 
jsji, kadircet, rupprecht, jfb, arphaman, dexonsmith, mgrang, jkorous, MaskRay, 
kbarton, aheejin, hiraditya, jgravelle-google, krytarowski, arichardson, 
sbc100, nhaehnle, jvesely, nemanjai, emaste, dschuff, arsenm.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added a reviewer: jhenderson.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: sstefan1.
Herald added a reviewer: mravishankar.
Herald added a reviewer: antiagainst.
Herald added a reviewer: rriddle.
Herald added a reviewer: antiagainst.
Herald added a reviewer: uenoku.
Herald added projects: clang, Sanitizers, LLDB, libc++, libc-project.

- Address moar comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74954

Files:
  clang-tools-extra/clangd/ClangdServer.cpp
  clang-tools-extra/clangd/ClangdServer.h
  clang-tools-extra/clangd/Hover.cpp
  clang-tools-extra/clangd/Selection.cpp
  clang-tools-extra/clangd/Selection.h
  clang-tools-extra/clangd/SemanticSelection.cpp
  clang-tools-extra/clangd/XRefs.cpp
  clang-tools-extra/clangd/refactor/Rename.cpp
  clang-tools-extra/clangd/refactor/Tweak.cpp
  clang-tools-extra/clangd/refactor/Tweak.h
  clang-tools-extra/clangd/unittests/FindTargetTests.cpp
  clang-tools-extra/clangd/unittests/HoverTests.cpp
  clang-tools-extra/clangd/unittests/SelectionTests.cpp
  clang-tools-extra/clangd/unittests/TweakTesting.cpp
  clang-tools-extra/clangd/unittests/TweakTests.cpp
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Driver/Options.td
  clang/include/clang/Parse/Parser.h
  clang/lib/Basic/Targets/AArch64.cpp
  clang/lib/Basic/Targets/X86.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaCast.cpp
  clang/test/CodeGen/codemodels.c
  clang/test/Driver/clang_f_opts.c
  clang/test/Driver/code-model.c
  clang/test/Driver/mbackchain.c
  clang/test/Driver/mcmodel.c
  clang/test/Preprocessor/aarch64-target-features.c
  clang/test/Preprocessor/init-aarch64.c
  clang/test/Preprocessor/init.c
  clang/test/Sema/MicrosoftExtensions.c
  clang/test/Sema/cast.c
  clang/test/SemaCXX/cstyle-cast.cpp
  compiler-rt/lib/profile/GCDAProfiling.c
  libc/CMakeLists.txt
  libc/cmake/modules/LLVMLibCRules.cmake
  libc/docs/fuzzing.rst
  libc/docs/source_layout.rst
  libc/fuzzing/CMakeLists.txt
  libc/fuzzing/string/CMakeLists.txt
  libc/fuzzing/string/strcpy_fuzz.cpp
  libc/src/signal/linux/raise.cpp
  libc/utils/CPP/README.md
  libc/utils/HdrGen/README.md
  libc/utils/UnitTest/README.md
  libcxx/test/support/count_new.h
  libcxx/test/support/type_id.h
  lld/ELF/Writer.cpp
  lld/test/ELF/shuffle-sections-init-fini.s
  lld/test/ELF/shuffle-sections.s
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
  lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  lldb/test/API/lang/cpp/operators/main.cpp
  lldb/test/Shell/SymbolFile/Breakpad/Inputs/basic-elf.yaml
  lldb/test/Shell/SymbolFile/DWARF/dwp-debug-types.s
  lldb/test/Shell/SymbolFile/DWARF/dwp.s
  lldb/test/Shell/lit-lldb-init.in
  llvm/docs/Extensions.rst
  llvm/docs/LangRef.rst
  llvm/docs/LoopTerminology.rst
  llvm/include/llvm/ADT/STLExtras.h
  llvm/include/llvm/Analysis/CFGPrinter.h
  llvm/include/llvm/Analysis/LoopInfo.h
  llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
  llvm/include/llvm/CodeGen/ISDOpcodes.h
  llvm/include/llvm/CodeGen/ScoreboardHazardRecognizer.h
  llvm/include/llvm/CodeGen/SelectionDAG.h
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
  llvm/include/llvm/ExecutionEngine/JITLink/MachO_x86_64.h
  llvm/include/llvm/ExecutionEngine/Orc/Core.h
  llvm/include/llvm/ExecutionEngine/Orc/OrcError.h
  llvm/include/llvm/IR/Intrinsics.td
  llvm/include/

[PATCH] D70488: [InstCombine] Infer fast math flags on fadd/fsub/fmul/fcmp

2019-11-20 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer created this revision.
bkramer added a reviewer: spatel.
Herald added subscribers: cfe-commits, hiraditya.
Herald added projects: clang, LLVM.

Applies nnan, ninf and nsz. This allows more instructions to be folded
away even with no fast math flags, e.g. (int)x * (b ? 1.0 : 0.0) -> b ? x : 0.0

As a side effect this will propagate fast math flags out of inlined fast
math code into surrounding functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70488

Files:
  clang/test/CodeGen/builtins-systemz-zvector.c
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/add-sitofp.ll
  llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll
  llvm/test/Transforms/InstCombine/fadd-fsub-factor.ll
  llvm/test/Transforms/InstCombine/fast-math.ll
  llvm/test/Transforms/InstCombine/fcmp.ll
  llvm/test/Transforms/InstCombine/known-never-nan.ll
  llvm/test/Transforms/InstCombine/minmax-fp.ll
  llvm/test/Transforms/InstCombine/pow_fp_int.ll

Index: llvm/test/Transforms/InstCombine/pow_fp_int.ll
===
--- llvm/test/Transforms/InstCombine/pow_fp_int.ll
+++ llvm/test/Transforms/InstCombine/pow_fp_int.ll
@@ -91,7 +91,7 @@
 define double @pow_uitofp_const_base_power_of_2_fast(i31 %x) {
 ; CHECK-LABEL: @pow_uitofp_const_base_power_of_2_fast(
 ; CHECK-NEXT:[[SUBFP:%.*]] = uitofp i31 [[X:%.*]] to float
-; CHECK-NEXT:[[MUL:%.*]] = fmul afn float [[SUBFP]], 4.00e+00
+; CHECK-NEXT:[[MUL:%.*]] = fmul nnan afn float [[SUBFP]], 4.00e+00
 ; CHECK-NEXT:[[EXP2:%.*]] = call afn float @llvm.exp2.f32(float [[MUL]])
 ; CHECK-NEXT:[[RES:%.*]] = fpext float [[EXP2]] to double
 ; CHECK-NEXT:ret double [[RES]]
@@ -383,7 +383,7 @@
 define double @pow_uitofp_const_base_power_of_2_no_fast(i32 %x) {
 ; CHECK-LABEL: @pow_uitofp_const_base_power_of_2_no_fast(
 ; CHECK-NEXT:[[SUBFP:%.*]] = uitofp i32 [[X:%.*]] to float
-; CHECK-NEXT:[[MUL:%.*]] = fmul float [[SUBFP]], 4.00e+00
+; CHECK-NEXT:[[MUL:%.*]] = fmul nnan float [[SUBFP]], 4.00e+00
 ; CHECK-NEXT:[[EXP2:%.*]] = call float @llvm.exp2.f32(float [[MUL]])
 ; CHECK-NEXT:[[RES:%.*]] = fpext float [[EXP2]] to double
 ; CHECK-NEXT:ret double [[RES]]
Index: llvm/test/Transforms/InstCombine/minmax-fp.ll
===
--- llvm/test/Transforms/InstCombine/minmax-fp.ll
+++ llvm/test/Transforms/InstCombine/minmax-fp.ll
@@ -273,7 +273,7 @@
 ; CHECK-LABEL: define {{[^@]+}}@fsub_fmax(
 ; CHECK-NEXT:[[COND_INV:%.*]] = fcmp nnan nsz ogt <2 x float> [[X:%.*]], [[Y:%.*]]
 ; CHECK-NEXT:[[TMP1:%.*]] = select nnan nsz <2 x i1> [[COND_INV]], <2 x float> [[Y]], <2 x float> [[X]]
-; CHECK-NEXT:[[MAX:%.*]] = fsub <2 x float> , [[TMP1]]
+; CHECK-NEXT:[[MAX:%.*]] = fsub nnan <2 x float> , [[TMP1]]
 ; CHECK-NEXT:ret <2 x float> [[MAX]]
 ;
   %n1 = fsub <2 x float> , %x
Index: llvm/test/Transforms/InstCombine/known-never-nan.ll
===
--- llvm/test/Transforms/InstCombine/known-never-nan.ll
+++ llvm/test/Transforms/InstCombine/known-never-nan.ll
@@ -11,7 +11,7 @@
 ; CHECK-LABEL: @fabs_sqrt_src_maybe_nan(
 ; CHECK-NEXT:[[FABS:%.*]] = call double @llvm.fabs.f64(double [[ARG0:%.*]])
 ; CHECK-NEXT:[[OP:%.*]] = call double @llvm.sqrt.f64(double [[FABS]])
-; CHECK-NEXT:[[TMP:%.*]] = fcmp ord double [[OP]], 0.00e+00
+; CHECK-NEXT:[[TMP:%.*]] = fcmp nsz ord double [[OP]], 0.00e+00
 ; CHECK-NEXT:ret i1 [[TMP]]
 ;
   %fabs = call double @llvm.fabs.f64(double %arg0)
Index: llvm/test/Transforms/InstCombine/fcmp.ll
===
--- llvm/test/Transforms/InstCombine/fcmp.ll
+++ llvm/test/Transforms/InstCombine/fcmp.ll
@@ -535,11 +535,11 @@
 ; Do not fold 1.0 / X > 0.0 when ninf is missing
 define i1 @test24_recipX_noninf_cmp(float %X) {
 ; CHECK-LABEL: @test24_recipX_noninf_cmp(
-; CHECK-NEXT:[[DIV:%.*]] = fdiv ninf float 2.00e+00, [[X:%.*]]
+; CHECK-NEXT:[[DIV:%.*]] = fdiv float 2.00e+00, [[X:%.*]]
 ; CHECK-NEXT:[[CMP:%.*]] = fcmp ogt float [[DIV]], 0.00e+00
 ; CHECK-NEXT:ret i1 [[CMP]]
 ;
-  %div = fdiv ninf float 2.0, %X
+  %div = fdiv float 2.0, %X
   %cmp = fcmp ogt float %div, 0.0
   ret i1 %cmp
 }
Index: llvm/test/Transforms/InstCombine/fast-math.ll
===
--- llvm/test/Transforms/InstCombine/fast-math.ll
+++ llvm/test/Transforms/InstCombine/fast-math.ll
@@ -18,7 +18,7 @@
 define float @notfold(float %a) {
 ; CHECK-LABEL: @notfold(
 ; CHECK-NEXT:[[MUL:%.*]] = fmul fast float [[A:%.*]], 0x3FF34000
-; CHECK-NEXT

[PATCH] D70488: [InstCombine] Infer fast math flags on fadd/fsub/fmul/fcmp

2019-11-20 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer updated this revision to Diff 230245.
bkramer added a comment.

Fix condition


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70488

Files:
  clang/test/CodeGen/builtins-systemz-zvector.c
  llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/add-sitofp.ll
  llvm/test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll
  llvm/test/Transforms/InstCombine/fadd-fsub-factor.ll
  llvm/test/Transforms/InstCombine/fast-math.ll
  llvm/test/Transforms/InstCombine/fcmp.ll
  llvm/test/Transforms/InstCombine/known-never-nan.ll
  llvm/test/Transforms/InstCombine/minmax-fp.ll
  llvm/test/Transforms/InstCombine/pow_fp_int.ll

Index: llvm/test/Transforms/InstCombine/pow_fp_int.ll
===
--- llvm/test/Transforms/InstCombine/pow_fp_int.ll
+++ llvm/test/Transforms/InstCombine/pow_fp_int.ll
@@ -91,7 +91,7 @@
 define double @pow_uitofp_const_base_power_of_2_fast(i31 %x) {
 ; CHECK-LABEL: @pow_uitofp_const_base_power_of_2_fast(
 ; CHECK-NEXT:[[SUBFP:%.*]] = uitofp i31 [[X:%.*]] to float
-; CHECK-NEXT:[[MUL:%.*]] = fmul afn float [[SUBFP]], 4.00e+00
+; CHECK-NEXT:[[MUL:%.*]] = fmul nnan afn float [[SUBFP]], 4.00e+00
 ; CHECK-NEXT:[[EXP2:%.*]] = call afn float @llvm.exp2.f32(float [[MUL]])
 ; CHECK-NEXT:[[RES:%.*]] = fpext float [[EXP2]] to double
 ; CHECK-NEXT:ret double [[RES]]
@@ -383,7 +383,7 @@
 define double @pow_uitofp_const_base_power_of_2_no_fast(i32 %x) {
 ; CHECK-LABEL: @pow_uitofp_const_base_power_of_2_no_fast(
 ; CHECK-NEXT:[[SUBFP:%.*]] = uitofp i32 [[X:%.*]] to float
-; CHECK-NEXT:[[MUL:%.*]] = fmul float [[SUBFP]], 4.00e+00
+; CHECK-NEXT:[[MUL:%.*]] = fmul nnan float [[SUBFP]], 4.00e+00
 ; CHECK-NEXT:[[EXP2:%.*]] = call float @llvm.exp2.f32(float [[MUL]])
 ; CHECK-NEXT:[[RES:%.*]] = fpext float [[EXP2]] to double
 ; CHECK-NEXT:ret double [[RES]]
Index: llvm/test/Transforms/InstCombine/minmax-fp.ll
===
--- llvm/test/Transforms/InstCombine/minmax-fp.ll
+++ llvm/test/Transforms/InstCombine/minmax-fp.ll
@@ -273,7 +273,7 @@
 ; CHECK-LABEL: define {{[^@]+}}@fsub_fmax(
 ; CHECK-NEXT:[[COND_INV:%.*]] = fcmp nnan nsz ogt <2 x float> [[X:%.*]], [[Y:%.*]]
 ; CHECK-NEXT:[[TMP1:%.*]] = select nnan nsz <2 x i1> [[COND_INV]], <2 x float> [[Y]], <2 x float> [[X]]
-; CHECK-NEXT:[[MAX:%.*]] = fsub <2 x float> , [[TMP1]]
+; CHECK-NEXT:[[MAX:%.*]] = fsub nnan <2 x float> , [[TMP1]]
 ; CHECK-NEXT:ret <2 x float> [[MAX]]
 ;
   %n1 = fsub <2 x float> , %x
Index: llvm/test/Transforms/InstCombine/known-never-nan.ll
===
--- llvm/test/Transforms/InstCombine/known-never-nan.ll
+++ llvm/test/Transforms/InstCombine/known-never-nan.ll
@@ -11,7 +11,7 @@
 ; CHECK-LABEL: @fabs_sqrt_src_maybe_nan(
 ; CHECK-NEXT:[[FABS:%.*]] = call double @llvm.fabs.f64(double [[ARG0:%.*]])
 ; CHECK-NEXT:[[OP:%.*]] = call double @llvm.sqrt.f64(double [[FABS]])
-; CHECK-NEXT:[[TMP:%.*]] = fcmp ord double [[OP]], 0.00e+00
+; CHECK-NEXT:[[TMP:%.*]] = fcmp nsz ord double [[OP]], 0.00e+00
 ; CHECK-NEXT:ret i1 [[TMP]]
 ;
   %fabs = call double @llvm.fabs.f64(double %arg0)
Index: llvm/test/Transforms/InstCombine/fcmp.ll
===
--- llvm/test/Transforms/InstCombine/fcmp.ll
+++ llvm/test/Transforms/InstCombine/fcmp.ll
@@ -535,11 +535,11 @@
 ; Do not fold 1.0 / X > 0.0 when ninf is missing
 define i1 @test24_recipX_noninf_cmp(float %X) {
 ; CHECK-LABEL: @test24_recipX_noninf_cmp(
-; CHECK-NEXT:[[DIV:%.*]] = fdiv ninf float 2.00e+00, [[X:%.*]]
+; CHECK-NEXT:[[DIV:%.*]] = fdiv float 2.00e+00, [[X:%.*]]
 ; CHECK-NEXT:[[CMP:%.*]] = fcmp ogt float [[DIV]], 0.00e+00
 ; CHECK-NEXT:ret i1 [[CMP]]
 ;
-  %div = fdiv ninf float 2.0, %X
+  %div = fdiv float 2.0, %X
   %cmp = fcmp ogt float %div, 0.0
   ret i1 %cmp
 }
Index: llvm/test/Transforms/InstCombine/fast-math.ll
===
--- llvm/test/Transforms/InstCombine/fast-math.ll
+++ llvm/test/Transforms/InstCombine/fast-math.ll
@@ -18,7 +18,7 @@
 define float @notfold(float %a) {
 ; CHECK-LABEL: @notfold(
 ; CHECK-NEXT:[[MUL:%.*]] = fmul fast float [[A:%.*]], 0x3FF34000
-; CHECK-NEXT:[[MUL1:%.*]] = fmul float [[MUL]], 0x40026000
+; CHECK-NEXT:[[MUL1:%.*]] = fmul nnan float [[MUL]], 0x40026000
 ; CHECK-NEXT:ret float [[MUL1]]
 ;
   %mul = fmul fast float %a, 0x3FF34000
Index: llvm/test/Transforms/InstCombin

[PATCH] D70518: [clang-include-fixer] Suppress cmd prompt from Vim on Windows

2019-11-21 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70518



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


[PATCH] D70488: [InstCombine] Infer fast math flags on fadd/fsub/fmul/fcmp

2019-11-21 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer added a comment.

In D70488#1753897 , @mcberg2017 wrote:

> For us this would be an impediment as we have math models that want ieee 
> behavior while relaxing precision.  Adding nnan or ninf would obstruct those 
> choices.


Mind elaborating why nnan/ninf are problematic for you? They're supposed to be 
a hint to the optimizer and can be dropped any time.

In D70488#1753832 , @spatel wrote:

> I like the idea, but I'd be more comfortable reviewing the diffs in stages, 
> so we know that the test coverage for the value tracking calls is good. So 
> I'd prefer if we split this somehow - either by the opcode callers (fadd, 
> fsub, fmul...) or the the FMF analysis (nnan, nsz, ninf). That raises a few 
> questions:
>
> 1. Why aren't fdiv and frem included?


We currently cannot infer anything for fdiv/frem in isKnownNeverNaN/Inf so 
there's no way to test it.

> 2. Can we infer FMF for FP intrinsics/libcalls/select/phi? (follow-on patches)

Yeah, that's a logical followup

> 3. We're moving away from FMF on fcmp (recent step: rGebf9bf2cbc8f 
> ), so is 
> it worth including starting from fcmp, or can we wait for that part to 
> settle? (Side question may be if/when we're going to allow FMF on 
> fptrunc/fpextend).

I'll drop fcmp then and split this up once we know that it's actually a 
direction we want to pursue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70488



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


[PATCH] D70902: Fix compatibility with python3 of clang-include-fixer.py

2019-12-03 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70902



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


[PATCH] D70902: Fix compatibility with python3 of clang-include-fixer.py

2019-12-03 Thread Benjamin Kramer via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGaa189ed25fbd: Fix compatibility with python3 of 
clang-include-fixer.py (authored by Yannick Brehon , 
committed by bkramer).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70902

Files:
  clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py


Index: clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py
===
--- clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py
+++ clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py
@@ -211,7 +211,7 @@
 InsertHeaderToVimBuffer(include_fixer_context, text)
 print("Added #include {0} for {1}.".format(selected, symbol))
   except Exception as error:
-print(error.message, file=sys.stderr)
+print(error, file=sys.stderr)
   return
 
 


Index: clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py
===
--- clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py
+++ clang-tools-extra/clang-include-fixer/tool/clang-include-fixer.py
@@ -211,7 +211,7 @@
 InsertHeaderToVimBuffer(include_fixer_context, text)
 print("Added #include {0} for {1}.".format(selected, symbol))
   except Exception as error:
-print(error.message, file=sys.stderr)
+print(error, file=sys.stderr)
   return
 
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D76272: Fix memtag test.

2020-03-17 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

Right, we don't have names for values in release builds.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76272



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


[PATCH] D74384: Use std::foo_t rather than std::foo in LLVM.

2020-02-11 Thread Benjamin Kramer via Phabricator via cfe-commits
bkramer accepted this revision.
bkramer added a comment.

Push and watch the bots


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74384



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


  1   2   3   >