[PATCH] D56424: [clang-tidy] Add check for underscores in googletest names.

2019-01-15 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

In D56424#1356959 , @karepker wrote:

> Hi all, ping on this patch. I've addressed all comments to the best of my 
> ability. Is there anything outstanding that needs to be changed?


Round about this time of a review we normally hear @JonasToth asking if you've 
run this on a large C++ code base like LLVM (with fix-its), and seen if the 
project still builds afterwards..might be worth doing that ahead of time if you 
haven't done so already


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56424



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


[PATCH] D56424: [clang-tidy] Add check for underscores in googletest names.

2019-01-15 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In D56424#1357471 , @MyDeveloperDay 
wrote:

> In D56424#1356959 , @karepker wrote:
>
> > Hi all, ping on this patch. I've addressed all comments to the best of my 
> > ability. Is there anything outstanding that needs to be changed?
>
>
> Round about this time of a review we normally hear @JonasToth asking if 
> you've run this on a large C++ code base like LLVM (with fix-its), and seen 
> if the project still builds afterwards..might be worth doing that ahead of 
> time if you haven't done so already


From docs: `This check does not propose any fixes.`.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56424



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


[PATCH] D55433: [clang-tidy] Adding a new modernize use nodiscard checker

2019-01-15 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

In D55433#1351707 , @JonasToth wrote:

> > I do not have commit rights. I'm not sure what constitutes someone who can 
> > commit, but let me contribute a little more before taking that step,  I 
> > have another idea for a checker I'd like to try after this one, I just 
> > wanted to get one under my belt first.
>
> See this: https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access
>
> I will commit for you then. More patches always welcome ;)


@JonasToth, I notice when you commit you commit in 2 places, is this by hand or 
automatic? or if this process is mandated or written down somewhere?

rCTE350760 : [clang-tidy] Adding a new 
modernize use nodiscard checker
rL350760 : [clang-tidy] Adding a new 
modernize use nodiscard checker

Do you have any guidance on how YOU commit (especially in clang-tools-extra) 
that might be useful to others just starting out?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55433



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


[PATCH] D56424: [clang-tidy] Add check for underscores in googletest names.

2019-01-15 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

In D56424#1357481 , @lebedev.ri wrote:

> In D56424#1357471 , @MyDeveloperDay 
> wrote:
>
> > In D56424#1356959 , @karepker 
> > wrote:
> >
> > > Hi all, ping on this patch. I've addressed all comments to the best of my 
> > > ability. Is there anything outstanding that needs to be changed?
> >
> >
> > Round about this time of a review we normally hear @JonasToth asking if 
> > you've run this on a large C++ code base like LLVM (with fix-its), and seen 
> > if the project still builds afterwards..might be worth doing that ahead of 
> > time if you haven't done so already
>
>
> From docs: `This check does not propose any fixes.`.


Thats a great suggestion for the future then transform

  TEST(TestCase_Name, Test_Name) {} 

into

  TEST(TestCase_Name, TestName) {}


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56424



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


[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

2019-01-15 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc added a subscriber: hans.
chandlerc added a comment.

Adding Hans so he can be aware of the progress.


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

https://reviews.llvm.org/D56571



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


[PATCH] D55340: NFC: Move dump of individual Stmts to TextNodeDumper

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
steveire closed this revision.
steveire added a comment.

Closing after it was reopened by spammer.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55340



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


[PATCH] D56592: [clangd] Fix updated file detection logic in indexing

2019-01-15 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 181735.
kadircet marked 6 inline comments as done.
kadircet added a comment.

- Address comments


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56592

Files:
  clangd/index/Background.cpp
  clangd/index/Background.h
  unittests/clangd/BackgroundIndexTests.cpp

Index: unittests/clangd/BackgroundIndexTests.cpp
===
--- unittests/clangd/BackgroundIndexTests.cpp
+++ unittests/clangd/BackgroundIndexTests.cpp
@@ -351,11 +351,82 @@
   EXPECT_EQ(CacheHits, 2U); // Check both A.cc and A.h loaded from cache.
 
   // Check if the new symbol has arrived.
-  auto ShardSource = MSS.loadShard(testPath("root/A.cc"));
+  ShardHeader = MSS.loadShard(testPath("root/A.h"));
   EXPECT_NE(ShardHeader, nullptr);
+  EXPECT_THAT(*ShardHeader->Symbols, Contains(Named("A_CCnew")));
+  auto ShardSource = MSS.loadShard(testPath("root/A.cc"));
+  EXPECT_NE(ShardSource, nullptr);
   EXPECT_THAT(*ShardSource->Symbols,
   Contains(AllOf(Named("f_b"), Declared(), Defined(;
 }
 
+TEST_F(BackgroundIndexTest, ShardStorageEmptyFile) {
+  MockFSProvider FS;
+  FS.Files[testPath("root/A.h")] = R"cpp(
+  void common();
+  void f_b();
+  class A_CC {};
+  )cpp";
+  FS.Files[testPath("root/B.h")] = R"cpp(
+  #include "A.h"
+  )cpp";
+  FS.Files[testPath("root/A.cc")] =
+  "#include \"B.h\"\nvoid g() { (void)common; }";
+
+  llvm::StringMap Storage;
+  size_t CacheHits = 0;
+  MemoryShardStorage MSS(Storage, CacheHits);
+
+  tooling::CompileCommand Cmd;
+  Cmd.Filename = testPath("root/A.cc");
+  Cmd.Directory = testPath("root");
+  Cmd.CommandLine = {"clang++", testPath("root/A.cc")};
+  // Check that A.cc, A.h and B.h has been stored.
+  {
+OverlayCDB CDB(/*Base=*/nullptr);
+BackgroundIndex Idx(Context::empty(), "", FS, CDB,
+[&](llvm::StringRef) { return &MSS; });
+CDB.setCompileCommand(testPath("root/A.cc"), Cmd);
+ASSERT_TRUE(Idx.blockUntilIdleForTest());
+  }
+  EXPECT_THAT(Storage.keys(),
+  UnorderedElementsAre(testPath("root/A.cc"), testPath("root/A.h"),
+   testPath("root/B.h")));
+  auto ShardHeader = MSS.loadShard(testPath("root/B.h"));
+  EXPECT_NE(ShardHeader, nullptr);
+  EXPECT_TRUE(ShardHeader->Symbols->empty());
+
+  // Check that A.cc, A.h and B.h has been loaded.
+  {
+CacheHits = 0;
+OverlayCDB CDB(/*Base=*/nullptr);
+BackgroundIndex Idx(Context::empty(), "", FS, CDB,
+[&](llvm::StringRef) { return &MSS; });
+CDB.setCompileCommand(testPath("root/A.cc"), Cmd);
+ASSERT_TRUE(Idx.blockUntilIdleForTest());
+  }
+  EXPECT_EQ(CacheHits, 3U);
+
+  // Update B.h to contain some symbols.
+  FS.Files[testPath("root/B.h")] = R"cpp(
+  #include "A.h"
+  void new_func();
+  )cpp";
+  // Check that B.h has been stored with new contents.
+  {
+CacheHits = 0;
+OverlayCDB CDB(/*Base=*/nullptr);
+BackgroundIndex Idx(Context::empty(), "", FS, CDB,
+[&](llvm::StringRef) { return &MSS; });
+CDB.setCompileCommand(testPath("root/A.cc"), Cmd);
+ASSERT_TRUE(Idx.blockUntilIdleForTest());
+  }
+  EXPECT_EQ(CacheHits, 3U);
+  ShardHeader = MSS.loadShard(testPath("root/B.h"));
+  EXPECT_NE(ShardHeader, nullptr);
+  EXPECT_THAT(*ShardHeader->Symbols,
+  Contains(AllOf(Named("new_func"), Declared(), Not(Defined();
+}
+
 } // namespace clangd
 } // namespace clang
Index: clangd/index/Background.h
===
--- clangd/index/Background.h
+++ clangd/index/Background.h
@@ -91,10 +91,11 @@
   blockUntilIdleForTest(llvm::Optional TimeoutSeconds = 10);
 
 private:
-  /// Given index results from a TU, only update files in \p FilesToUpdate.
-  /// Also stores new index information on IndexStorage.
+  /// Given index results from a TU, only update symbols coming from files with
+  /// different digests than \p DigestsSnapshot. Also stores new index
+  /// information on IndexStorage.
   void update(llvm::StringRef MainFile, IndexFileIn Index,
-  const llvm::StringMap &FilesToUpdate,
+  const llvm::StringMap &DigestsSnapshot,
   BackgroundIndexStorage *IndexStorage);
 
   // configuration
Index: clangd/index/Background.cpp
===
--- clangd/index/Background.cpp
+++ clangd/index/Background.cpp
@@ -91,12 +91,10 @@
 
 // Creates a filter to not collect index results from files with unchanged
 // digests.
-// \p FileDigests contains file digests for the current indexed files, and all
-// changed files will be added to \p FilesToUpdate.
+// \p FileDigests contains file digests for the current indexed files.
 decltype(SymbolCollector::Options::FileFilter)
-createFileFilter(const llvm::StringMap &FileDi

[clang-tools-extra] r351170 - [clangd] Fix updated file detection logic in indexing

2019-01-15 Thread Kadir Cetinkaya via cfe-commits
Author: kadircet
Date: Tue Jan 15 01:03:33 2019
New Revision: 351170

URL: http://llvm.org/viewvc/llvm-project?rev=351170&view=rev
Log:
[clangd] Fix updated file detection logic in indexing

Summary:
Files without any symbols were never marked as updated during indexing, which 
resulted in failure while writing shards for these files.

This patch fixes the logic to mark files that are seen for the first time but 
don't contain any symbols as updated.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

Modified:
clang-tools-extra/trunk/clangd/index/Background.cpp
clang-tools-extra/trunk/clangd/index/Background.h
clang-tools-extra/trunk/unittests/clangd/BackgroundIndexTests.cpp

Modified: clang-tools-extra/trunk/clangd/index/Background.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Background.cpp?rev=351170&r1=351169&r2=351170&view=diff
==
--- clang-tools-extra/trunk/clangd/index/Background.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/Background.cpp Tue Jan 15 01:03:33 2019
@@ -91,12 +91,10 @@ IncludeGraph getSubGraph(const URI &U, c
 
 // Creates a filter to not collect index results from files with unchanged
 // digests.
-// \p FileDigests contains file digests for the current indexed files, and all
-// changed files will be added to \p FilesToUpdate.
+// \p FileDigests contains file digests for the current indexed files.
 decltype(SymbolCollector::Options::FileFilter)
-createFileFilter(const llvm::StringMap &FileDigests,
- llvm::StringMap &FilesToUpdate) {
-  return [&FileDigests, &FilesToUpdate](const SourceManager &SM, FileID FID) {
+createFileFilter(const llvm::StringMap &FileDigests) {
+  return [&FileDigests](const SourceManager &SM, FileID FID) {
 const auto *F = SM.getFileEntryForID(FID);
 if (!F)
   return false; // Skip invalid files.
@@ -109,8 +107,6 @@ createFileFilter(const llvm::StringMapsecond == Digest)
   return false; // Skip files that haven't changed.
-
-FilesToUpdate[*AbsPath] = *Digest;
 return true;
   };
 }
@@ -264,22 +260,34 @@ void BackgroundIndex::enqueueTask(Task T
   QueueCV.notify_all();
 }
 
-/// Given index results from a TU, only update files in \p FilesToUpdate.
+/// Given index results from a TU, only update symbols coming from files that
+/// are different or missing from than \p DigestsSnapshot. Also stores new 
index
+/// information on IndexStorage.
 void BackgroundIndex::update(llvm::StringRef MainFile, IndexFileIn Index,
- const llvm::StringMap &FilesToUpdate,
+ const llvm::StringMap 
&DigestsSnapshot,
  BackgroundIndexStorage *IndexStorage) {
   // Partition symbols/references into files.
   struct File {
 llvm::DenseSet Symbols;
 llvm::DenseSet Refs;
+FileDigest Digest;
   };
   llvm::StringMap Files;
   URIToFileCache URICache(MainFile);
+  for (const auto &IndexIt : *Index.Sources) {
+const auto &IGN = IndexIt.getValue();
+const auto AbsPath = URICache.resolve(IGN.URI);
+const auto DigestIt = DigestsSnapshot.find(AbsPath);
+// File has different contents.
+if (DigestIt == DigestsSnapshot.end() || DigestIt->getValue() != 
IGN.Digest)
+  Files.try_emplace(AbsPath).first->getValue().Digest = IGN.Digest;
+  }
   for (const auto &Sym : *Index.Symbols) {
 if (Sym.CanonicalDeclaration) {
   auto DeclPath = URICache.resolve(Sym.CanonicalDeclaration.FileURI);
-  if (FilesToUpdate.count(DeclPath) != 0)
-Files[DeclPath].Symbols.insert(&Sym);
+  const auto FileIt = Files.find(DeclPath);
+  if (FileIt != Files.end())
+FileIt->second.Symbols.insert(&Sym);
 }
 // For symbols with different declaration and definition locations, we 
store
 // the full symbol in both the header file and the implementation file, so
@@ -288,16 +296,18 @@ void BackgroundIndex::update(llvm::Strin
 if (Sym.Definition &&
 Sym.Definition.FileURI != Sym.CanonicalDeclaration.FileURI) {
   auto DefPath = URICache.resolve(Sym.Definition.FileURI);
-  if (FilesToUpdate.count(DefPath) != 0)
-Files[DefPath].Symbols.insert(&Sym);
+  const auto FileIt = Files.find(DefPath);
+  if (FileIt != Files.end())
+FileIt->second.Symbols.insert(&Sym);
 }
   }
   llvm::DenseMap RefToIDs;
   for (const auto &SymRefs : *Index.Refs) {
 for (const auto &R : SymRefs.second) {
   auto Path = URICache.resolve(R.Location.FileURI);
-  if (FilesToUpdate.count(Path) != 0) {
-auto &F = Files[Path];
+  const auto FileIt = Files.find(Path);
+  if (FileIt != Files.end()) {
+auto &F = FileIt->getValue();
 RefToIDs[&R] = SymRefs.first;
 F.Refs.insert(&R);
   }
@@ -305,18 +315,14 @@ vo

[PATCH] D56592: [clangd] Fix updated file detection logic in indexing

2019-01-15 Thread Kadir Cetinkaya via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rCTE351170: [clangd] Fix updated file detection logic in 
indexing (authored by kadircet, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56592?vs=181735&id=181736#toc

Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56592

Files:
  clangd/index/Background.cpp
  clangd/index/Background.h
  unittests/clangd/BackgroundIndexTests.cpp

Index: clangd/index/Background.h
===
--- clangd/index/Background.h
+++ clangd/index/Background.h
@@ -91,10 +91,11 @@
   blockUntilIdleForTest(llvm::Optional TimeoutSeconds = 10);
 
 private:
-  /// Given index results from a TU, only update files in \p FilesToUpdate.
-  /// Also stores new index information on IndexStorage.
+  /// Given index results from a TU, only update symbols coming from files with
+  /// different digests than \p DigestsSnapshot. Also stores new index
+  /// information on IndexStorage.
   void update(llvm::StringRef MainFile, IndexFileIn Index,
-  const llvm::StringMap &FilesToUpdate,
+  const llvm::StringMap &DigestsSnapshot,
   BackgroundIndexStorage *IndexStorage);
 
   // configuration
Index: clangd/index/Background.cpp
===
--- clangd/index/Background.cpp
+++ clangd/index/Background.cpp
@@ -91,12 +91,10 @@
 
 // Creates a filter to not collect index results from files with unchanged
 // digests.
-// \p FileDigests contains file digests for the current indexed files, and all
-// changed files will be added to \p FilesToUpdate.
+// \p FileDigests contains file digests for the current indexed files.
 decltype(SymbolCollector::Options::FileFilter)
-createFileFilter(const llvm::StringMap &FileDigests,
- llvm::StringMap &FilesToUpdate) {
-  return [&FileDigests, &FilesToUpdate](const SourceManager &SM, FileID FID) {
+createFileFilter(const llvm::StringMap &FileDigests) {
+  return [&FileDigests](const SourceManager &SM, FileID FID) {
 const auto *F = SM.getFileEntryForID(FID);
 if (!F)
   return false; // Skip invalid files.
@@ -109,8 +107,6 @@
 auto D = FileDigests.find(*AbsPath);
 if (D != FileDigests.end() && D->second == Digest)
   return false; // Skip files that haven't changed.
-
-FilesToUpdate[*AbsPath] = *Digest;
 return true;
   };
 }
@@ -264,22 +260,34 @@
   QueueCV.notify_all();
 }
 
-/// Given index results from a TU, only update files in \p FilesToUpdate.
+/// Given index results from a TU, only update symbols coming from files that
+/// are different or missing from than \p DigestsSnapshot. Also stores new index
+/// information on IndexStorage.
 void BackgroundIndex::update(llvm::StringRef MainFile, IndexFileIn Index,
- const llvm::StringMap &FilesToUpdate,
+ const llvm::StringMap &DigestsSnapshot,
  BackgroundIndexStorage *IndexStorage) {
   // Partition symbols/references into files.
   struct File {
 llvm::DenseSet Symbols;
 llvm::DenseSet Refs;
+FileDigest Digest;
   };
   llvm::StringMap Files;
   URIToFileCache URICache(MainFile);
+  for (const auto &IndexIt : *Index.Sources) {
+const auto &IGN = IndexIt.getValue();
+const auto AbsPath = URICache.resolve(IGN.URI);
+const auto DigestIt = DigestsSnapshot.find(AbsPath);
+// File has different contents.
+if (DigestIt == DigestsSnapshot.end() || DigestIt->getValue() != IGN.Digest)
+  Files.try_emplace(AbsPath).first->getValue().Digest = IGN.Digest;
+  }
   for (const auto &Sym : *Index.Symbols) {
 if (Sym.CanonicalDeclaration) {
   auto DeclPath = URICache.resolve(Sym.CanonicalDeclaration.FileURI);
-  if (FilesToUpdate.count(DeclPath) != 0)
-Files[DeclPath].Symbols.insert(&Sym);
+  const auto FileIt = Files.find(DeclPath);
+  if (FileIt != Files.end())
+FileIt->second.Symbols.insert(&Sym);
 }
 // For symbols with different declaration and definition locations, we store
 // the full symbol in both the header file and the implementation file, so
@@ -288,16 +296,18 @@
 if (Sym.Definition &&
 Sym.Definition.FileURI != Sym.CanonicalDeclaration.FileURI) {
   auto DefPath = URICache.resolve(Sym.Definition.FileURI);
-  if (FilesToUpdate.count(DefPath) != 0)
-Files[DefPath].Symbols.insert(&Sym);
+  const auto FileIt = Files.find(DefPath);
+  if (FileIt != Files.end())
+FileIt->second.Symbols.insert(&Sym);
 }
   }
   llvm::DenseMap RefToIDs;
   for (const auto &SymRefs : *Index.Refs) {
 for (const auto &R : SymRefs.second) {
   auto Path = URICache.resolve(R.Location.FileURI);
-  if (FilesToUpdate.count(Path) != 0) {
-auto &F = Files[Path];
+  const auto FileIt = Fi

r351172 - [ASTDump] NFC: Move dump of type nodes to NodeDumper

2019-01-15 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Tue Jan 15 01:30:00 2019
New Revision: 351172

URL: http://llvm.org/viewvc/llvm-project?rev=351172&view=rev
Log:
[ASTDump] NFC: Move dump of type nodes to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/AST/TextNodeDumper.h
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/TextNodeDumper.cpp

Modified: cfe/trunk/include/clang/AST/TextNodeDumper.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TextNodeDumper.h?rev=351172&r1=351171&r2=351172&view=diff
==
--- cfe/trunk/include/clang/AST/TextNodeDumper.h (original)
+++ cfe/trunk/include/clang/AST/TextNodeDumper.h Tue Jan 15 01:30:00 2019
@@ -22,6 +22,7 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/TemplateArgumentVisitor.h"
+#include "clang/AST/TypeVisitor.h"
 
 namespace clang {
 
@@ -127,7 +128,8 @@ class TextNodeDumper
const comments::FullComment *>,
   public ConstAttrVisitor,
   public ConstTemplateArgumentVisitor,
-  public ConstStmtVisitor {
+  public ConstStmtVisitor,
+  public TypeVisitor {
   raw_ostream &OS;
   const bool ShowColors;
 
@@ -259,6 +261,26 @@ public:
   void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node);
   void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node);
 
+  void VisitRValueReferenceType(const ReferenceType *T);
+  void VisitArrayType(const ArrayType *T);
+  void VisitConstantArrayType(const ConstantArrayType *T);
+  void VisitVariableArrayType(const VariableArrayType *T);
+  void VisitDependentSizedArrayType(const DependentSizedArrayType *T);
+  void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *T);
+  void VisitVectorType(const VectorType *T);
+  void VisitFunctionType(const FunctionType *T);
+  void VisitFunctionProtoType(const FunctionProtoType *T);
+  void VisitUnresolvedUsingType(const UnresolvedUsingType *T);
+  void VisitTypedefType(const TypedefType *T);
+  void VisitUnaryTransformType(const UnaryTransformType *T);
+  void VisitTagType(const TagType *T);
+  void VisitTemplateTypeParmType(const TemplateTypeParmType *T);
+  void VisitAutoType(const AutoType *T);
+  void VisitTemplateSpecializationType(const TemplateSpecializationType *T);
+  void VisitInjectedClassNameType(const InjectedClassNameType *T);
+  void VisitObjCInterfaceType(const ObjCInterfaceType *T);
+  void VisitPackExpansionType(const PackExpansionType *T);
+
 private:
   void dumpCXXTemporary(const CXXTemporary *Temporary);
 };

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351172&r1=351171&r2=351172&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Tue Jan 15 01:30:00 2019
@@ -134,99 +134,39 @@ namespace  {
 void VisitReferenceType(const ReferenceType *T) {
   dumpTypeAsChild(T->getPointeeType());
 }
-void VisitRValueReferenceType(const ReferenceType *T) {
-  if (T->isSpelledAsLValue())
-OS << " written as lvalue reference";
-  VisitReferenceType(T);
-}
 void VisitMemberPointerType(const MemberPointerType *T) {
   dumpTypeAsChild(T->getClass());
   dumpTypeAsChild(T->getPointeeType());
 }
 void VisitArrayType(const ArrayType *T) {
-  switch (T->getSizeModifier()) {
-case ArrayType::Normal: break;
-case ArrayType::Static: OS << " static"; break;
-case ArrayType::Star: OS << " *"; break;
-  }
-  OS << " " << T->getIndexTypeQualifiers().getAsString();
   dumpTypeAsChild(T->getElementType());
 }
-void VisitConstantArrayType(const ConstantArrayType *T) {
-  OS << " " << T->getSize();
-  VisitArrayType(T);
-}
 void VisitVariableArrayType(const VariableArrayType *T) {
-  OS << " ";
-  NodeDumper.dumpSourceRange(T->getBracketsRange());
   VisitArrayType(T);
   dumpStmt(T->getSizeExpr());
 }
 void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
-  switch (T->getSizeModifier()) {
-case ArrayType::Normal: break;
-case ArrayType::Static: OS << " static"; break;
-case ArrayType::Star: OS << " *"; break;
-  }
-  OS << " " << T->getIndexTypeQualifiers().getAsString();
-  OS << " ";
-  NodeDumper.dumpSourceRange(T->getBracketsRange());
   dumpTypeAsChild(T->getElementType());
   dumpStmt(T->getSizeExpr());
 }
 void VisitDependentSizedExtVectorType(
 const DependentSizedExtVectorType *T) {
-  OS << " ";
-  NodeDumper.dumpLocation(T->getAttributeLoc());
   dumpTypeAsChild(T->getElementType());
   dumpStmt(T->getSizeExpr());
 }
 void VisitVectorType(cons

[PATCH] D56642: NFC: Move dump of type nodes to NodeDumper

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC351172: [ASTDump] NFC: Move dump of type nodes to NodeDumper 
(authored by steveire, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56642?vs=181632&id=181738#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D56642

Files:
  include/clang/AST/TextNodeDumper.h
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp

Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -22,6 +22,7 @@
 #include "clang/AST/ExprCXX.h"
 #include "clang/AST/StmtVisitor.h"
 #include "clang/AST/TemplateArgumentVisitor.h"
+#include "clang/AST/TypeVisitor.h"
 
 namespace clang {
 
@@ -127,7 +128,8 @@
const comments::FullComment *>,
   public ConstAttrVisitor,
   public ConstTemplateArgumentVisitor,
-  public ConstStmtVisitor {
+  public ConstStmtVisitor,
+  public TypeVisitor {
   raw_ostream &OS;
   const bool ShowColors;
 
@@ -259,6 +261,26 @@
   void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node);
   void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node);
 
+  void VisitRValueReferenceType(const ReferenceType *T);
+  void VisitArrayType(const ArrayType *T);
+  void VisitConstantArrayType(const ConstantArrayType *T);
+  void VisitVariableArrayType(const VariableArrayType *T);
+  void VisitDependentSizedArrayType(const DependentSizedArrayType *T);
+  void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *T);
+  void VisitVectorType(const VectorType *T);
+  void VisitFunctionType(const FunctionType *T);
+  void VisitFunctionProtoType(const FunctionProtoType *T);
+  void VisitUnresolvedUsingType(const UnresolvedUsingType *T);
+  void VisitTypedefType(const TypedefType *T);
+  void VisitUnaryTransformType(const UnaryTransformType *T);
+  void VisitTagType(const TagType *T);
+  void VisitTemplateTypeParmType(const TemplateTypeParmType *T);
+  void VisitAutoType(const AutoType *T);
+  void VisitTemplateSpecializationType(const TemplateSpecializationType *T);
+  void VisitInjectedClassNameType(const InjectedClassNameType *T);
+  void VisitObjCInterfaceType(const ObjCInterfaceType *T);
+  void VisitPackExpansionType(const PackExpansionType *T);
+
 private:
   void dumpCXXTemporary(const CXXTemporary *Temporary);
 };
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -134,99 +134,39 @@
 void VisitReferenceType(const ReferenceType *T) {
   dumpTypeAsChild(T->getPointeeType());
 }
-void VisitRValueReferenceType(const ReferenceType *T) {
-  if (T->isSpelledAsLValue())
-OS << " written as lvalue reference";
-  VisitReferenceType(T);
-}
 void VisitMemberPointerType(const MemberPointerType *T) {
   dumpTypeAsChild(T->getClass());
   dumpTypeAsChild(T->getPointeeType());
 }
 void VisitArrayType(const ArrayType *T) {
-  switch (T->getSizeModifier()) {
-case ArrayType::Normal: break;
-case ArrayType::Static: OS << " static"; break;
-case ArrayType::Star: OS << " *"; break;
-  }
-  OS << " " << T->getIndexTypeQualifiers().getAsString();
   dumpTypeAsChild(T->getElementType());
 }
-void VisitConstantArrayType(const ConstantArrayType *T) {
-  OS << " " << T->getSize();
-  VisitArrayType(T);
-}
 void VisitVariableArrayType(const VariableArrayType *T) {
-  OS << " ";
-  NodeDumper.dumpSourceRange(T->getBracketsRange());
   VisitArrayType(T);
   dumpStmt(T->getSizeExpr());
 }
 void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
-  switch (T->getSizeModifier()) {
-case ArrayType::Normal: break;
-case ArrayType::Static: OS << " static"; break;
-case ArrayType::Star: OS << " *"; break;
-  }
-  OS << " " << T->getIndexTypeQualifiers().getAsString();
-  OS << " ";
-  NodeDumper.dumpSourceRange(T->getBracketsRange());
   dumpTypeAsChild(T->getElementType());
   dumpStmt(T->getSizeExpr());
 }
 void VisitDependentSizedExtVectorType(
 const DependentSizedExtVectorType *T) {
-  OS << " ";
-  NodeDumper.dumpLocation(T->getAttributeLoc());
   dumpTypeAsChild(T->getElementType());
   dumpStmt(T->getSizeExpr());
 }
 void VisitVectorType(const VectorType *T) {
-  switch (T->getVectorKind()) {
-case VectorType::GenericVector: break;
-case VectorType::AltiVecVector: OS << " altivec"; break;
-case VectorType::AltiVecPixel: OS << " altivec pixel"; break;
-case VectorType::AltiVecBool: OS << " altivec bool"; break;
-case VectorType::NeonVector: OS << " neon"; break;
-ca

[PATCH] D56006: [AST] Fix a -Wimplicit-fallthrough warning in ScanfFormatString.cpp

2019-01-15 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

Sorry for the late reply; I was on vacation. It seems Erich Keane already fixed 
this in r350941.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56006



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


r351175 - NFC: Move Decl node handling to TextNodeDumper

2019-01-15 Thread Stephen Kelly via cfe-commits
Author: steveire
Date: Tue Jan 15 01:35:52 2019
New Revision: 351175

URL: http://llvm.org/viewvc/llvm-project?rev=351175&view=rev
Log:
NFC: Move Decl node handling to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

Modified:
cfe/trunk/include/clang/AST/TextNodeDumper.h
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/TextNodeDumper.cpp

Modified: cfe/trunk/include/clang/AST/TextNodeDumper.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TextNodeDumper.h?rev=351175&r1=351174&r2=351175&view=diff
==
--- cfe/trunk/include/clang/AST/TextNodeDumper.h (original)
+++ cfe/trunk/include/clang/AST/TextNodeDumper.h Tue Jan 15 01:35:52 2019
@@ -165,6 +165,8 @@ public:
 
   void Visit(QualType T);
 
+  void Visit(const Decl *D);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351175&r1=351174&r2=351175&view=diff
==
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Tue Jan 15 01:35:52 2019
@@ -435,35 +435,6 @@ void ASTDumper::dumpAttr(const Attr *A)
   });
 }
 
-static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
-
-template
-static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable *D) {
-  const T *First = D->getFirstDecl();
-  if (First != D)
-OS << " first " << First;
-}
-
-template
-static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable *D) {
-  const T *Prev = D->getPreviousDecl();
-  if (Prev)
-OS << " prev " << Prev;
-}
-
-/// Dump the previous declaration in the redeclaration chain for a declaration,
-/// if any.
-static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
-  switch (D->getKind()) {
-#define DECL(DERIVED, BASE) \
-  case Decl::DERIVED: \
-return dumpPreviousDeclImpl(OS, cast(D));
-#define ABSTRACT_DECL(DECL)
-#include "clang/AST/DeclNodes.inc"
-  }
-  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
-}
-
 
//===--===//
 //  C++ Utilities
 
//===--===//
@@ -536,46 +507,9 @@ void ASTDumper::dumpObjCTypeParamList(co
 
 void ASTDumper::dumpDecl(const Decl *D) {
   dumpChild([=] {
-if (!D) {
-  ColorScope Color(OS, ShowColors, NullColor);
-  OS << "<<>>";
+NodeDumper.Visit(D);
+if (!D)
   return;
-}
-
-{
-  ColorScope Color(OS, ShowColors, DeclKindNameColor);
-  OS << D->getDeclKindName() << "Decl";
-}
-NodeDumper.dumpPointer(D);
-if (D->getLexicalDeclContext() != D->getDeclContext())
-  OS << " parent " << cast(D->getDeclContext());
-dumpPreviousDecl(OS, D);
-NodeDumper.dumpSourceRange(D->getSourceRange());
-OS << ' ';
-NodeDumper.dumpLocation(D->getLocation());
-if (D->isFromASTFile())
-  OS << " imported";
-if (Module *M = D->getOwningModule())
-  OS << " in " << M->getFullModuleName();
-if (auto *ND = dyn_cast(D))
-  for (Module *M : D->getASTContext().getModulesWithMergedDefinition(
-   const_cast(ND)))
-dumpChild([=] { OS << "also in " << M->getFullModuleName(); });
-if (const NamedDecl *ND = dyn_cast(D))
-  if (ND->isHidden())
-OS << " hidden";
-if (D->isImplicit())
-  OS << " implicit";
-if (D->isUsed())
-  OS << " used";
-else if (D->isThisDeclarationReferenced())
-  OS << " referenced";
-if (D->isInvalidDecl())
-  OS << " invalid";
-if (const FunctionDecl *FD = dyn_cast(D))
-  if (FD->isConstexpr())
-OS << " constexpr";
-
 
 ConstDeclVisitor::Visit(D);
 

Modified: cfe/trunk/lib/AST/TextNodeDumper.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TextNodeDumper.cpp?rev=351175&r1=351174&r2=351175&view=diff
==
--- cfe/trunk/lib/AST/TextNodeDumper.cpp (original)
+++ cfe/trunk/lib/AST/TextNodeDumper.cpp Tue Jan 15 01:35:52 2019
@@ -12,11 +12,42 @@
 
//===--===//
 
 #include "clang/AST/TextNodeDumper.h"
+#include "clang/AST/DeclFriend.h"
+#include "clang/AST/DeclOpenMP.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/LocInfoType.h"
 
 using namespace clang;
 
+static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
+
+template 
+static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable *D) {
+  const T *First = D->getFirstDecl();
+  if (First != D)
+OS << " first " << First;
+}
+
+template 
+static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable *D) {

[PATCH] D56643: NFC: Move Decl node handling to TextNodeDumper

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC351175: NFC: Move Decl node handling to TextNodeDumper 
(authored by steveire, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56643?vs=181453&id=181740#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D56643

Files:
  include/clang/AST/TextNodeDumper.h
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp

Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -165,6 +165,8 @@
 
   void Visit(QualType T);
 
+  void Visit(const Decl *D);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -435,35 +435,6 @@
   });
 }
 
-static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
-
-template
-static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable *D) {
-  const T *First = D->getFirstDecl();
-  if (First != D)
-OS << " first " << First;
-}
-
-template
-static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable *D) {
-  const T *Prev = D->getPreviousDecl();
-  if (Prev)
-OS << " prev " << Prev;
-}
-
-/// Dump the previous declaration in the redeclaration chain for a declaration,
-/// if any.
-static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
-  switch (D->getKind()) {
-#define DECL(DERIVED, BASE) \
-  case Decl::DERIVED: \
-return dumpPreviousDeclImpl(OS, cast(D));
-#define ABSTRACT_DECL(DECL)
-#include "clang/AST/DeclNodes.inc"
-  }
-  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
-}
-
 //===--===//
 //  C++ Utilities
 //===--===//
@@ -536,46 +507,9 @@
 
 void ASTDumper::dumpDecl(const Decl *D) {
   dumpChild([=] {
-if (!D) {
-  ColorScope Color(OS, ShowColors, NullColor);
-  OS << "<<>>";
+NodeDumper.Visit(D);
+if (!D)
   return;
-}
-
-{
-  ColorScope Color(OS, ShowColors, DeclKindNameColor);
-  OS << D->getDeclKindName() << "Decl";
-}
-NodeDumper.dumpPointer(D);
-if (D->getLexicalDeclContext() != D->getDeclContext())
-  OS << " parent " << cast(D->getDeclContext());
-dumpPreviousDecl(OS, D);
-NodeDumper.dumpSourceRange(D->getSourceRange());
-OS << ' ';
-NodeDumper.dumpLocation(D->getLocation());
-if (D->isFromASTFile())
-  OS << " imported";
-if (Module *M = D->getOwningModule())
-  OS << " in " << M->getFullModuleName();
-if (auto *ND = dyn_cast(D))
-  for (Module *M : D->getASTContext().getModulesWithMergedDefinition(
-   const_cast(ND)))
-dumpChild([=] { OS << "also in " << M->getFullModuleName(); });
-if (const NamedDecl *ND = dyn_cast(D))
-  if (ND->isHidden())
-OS << " hidden";
-if (D->isImplicit())
-  OS << " implicit";
-if (D->isUsed())
-  OS << " used";
-else if (D->isThisDeclarationReferenced())
-  OS << " referenced";
-if (D->isInvalidDecl())
-  OS << " invalid";
-if (const FunctionDecl *FD = dyn_cast(D))
-  if (FD->isConstexpr())
-OS << " constexpr";
-
 
 ConstDeclVisitor::Visit(D);
 
Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -12,11 +12,42 @@
 //===--===//
 
 #include "clang/AST/TextNodeDumper.h"
+#include "clang/AST/DeclFriend.h"
+#include "clang/AST/DeclOpenMP.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/LocInfoType.h"
 
 using namespace clang;
 
+static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
+
+template 
+static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable *D) {
+  const T *First = D->getFirstDecl();
+  if (First != D)
+OS << " first " << First;
+}
+
+template 
+static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable *D) {
+  const T *Prev = D->getPreviousDecl();
+  if (Prev)
+OS << " prev " << Prev;
+}
+
+/// Dump the previous declaration in the redeclaration chain for a declaration,
+/// if any.
+static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
+  switch (D->getKind()) {
+#define DECL(DERIVED, BASE)\
+  case Decl::DERIVED:  \
+return dumpPreviousDeclImpl(OS, cast(D));
+#define ABSTRACT_DECL(DECL)
+#include "clang/AST/DeclNodes.inc"
+  }
+  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
+}
+
 TextNode

[PATCH] D56707: Implement CXXCtorInitializer dump in terms of Visitor

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
steveire created this revision.
steveire added a reviewer: aaron.ballman.
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

https://reviews.llvm.org/D56707

Files:
  include/clang/AST/TextNodeDumper.h
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -258,6 +258,20 @@
   OS << " constexpr";
 }
 
+void TextNodeDumper::Visit(const CXXCtorInitializer *Init) {
+  OS << "CXXCtorInitializer";
+  if (Init->isAnyMemberInitializer()) {
+OS << ' ';
+dumpBareDeclRef(Init->getAnyMember());
+  } else if (Init->isBaseInitializer()) {
+dumpType(QualType(Init->getBaseClass(), 0));
+  } else if (Init->isDelegatingInitializer()) {
+dumpType(Init->getTypeSourceInfo()->getType());
+  } else {
+llvm_unreachable("Unknown initializer type");
+  }
+}
+
 void TextNodeDumper::dumpPointer(const void *Ptr) {
   ColorScope Color(OS, ShowColors, AddressColor);
   OS << ' ' << Ptr;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -441,17 +441,7 @@
 
 void ASTDumper::dumpCXXCtorInitializer(const CXXCtorInitializer *Init) {
   dumpChild([=] {
-OS << "CXXCtorInitializer";
-if (Init->isAnyMemberInitializer()) {
-  OS << ' ';
-  NodeDumper.dumpBareDeclRef(Init->getAnyMember());
-} else if (Init->isBaseInitializer()) {
-  NodeDumper.dumpType(QualType(Init->getBaseClass(), 0));
-} else if (Init->isDelegatingInitializer()) {
-  NodeDumper.dumpType(Init->getTypeSourceInfo()->getType());
-} else {
-  llvm_unreachable("Unknown initializer type");
-}
+NodeDumper.Visit(Init);
 dumpStmt(Init->getInit());
   });
 }
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -167,6 +167,8 @@
 
   void Visit(const Decl *D);
 
+  void Visit(const CXXCtorInitializer *Init);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -258,6 +258,20 @@
   OS << " constexpr";
 }
 
+void TextNodeDumper::Visit(const CXXCtorInitializer *Init) {
+  OS << "CXXCtorInitializer";
+  if (Init->isAnyMemberInitializer()) {
+OS << ' ';
+dumpBareDeclRef(Init->getAnyMember());
+  } else if (Init->isBaseInitializer()) {
+dumpType(QualType(Init->getBaseClass(), 0));
+  } else if (Init->isDelegatingInitializer()) {
+dumpType(Init->getTypeSourceInfo()->getType());
+  } else {
+llvm_unreachable("Unknown initializer type");
+  }
+}
+
 void TextNodeDumper::dumpPointer(const void *Ptr) {
   ColorScope Color(OS, ShowColors, AddressColor);
   OS << ' ' << Ptr;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -441,17 +441,7 @@
 
 void ASTDumper::dumpCXXCtorInitializer(const CXXCtorInitializer *Init) {
   dumpChild([=] {
-OS << "CXXCtorInitializer";
-if (Init->isAnyMemberInitializer()) {
-  OS << ' ';
-  NodeDumper.dumpBareDeclRef(Init->getAnyMember());
-} else if (Init->isBaseInitializer()) {
-  NodeDumper.dumpType(QualType(Init->getBaseClass(), 0));
-} else if (Init->isDelegatingInitializer()) {
-  NodeDumper.dumpType(Init->getTypeSourceInfo()->getType());
-} else {
-  llvm_unreachable("Unknown initializer type");
-}
+NodeDumper.Visit(Init);
 dumpStmt(Init->getInit());
   });
 }
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -167,6 +167,8 @@
 
   void Visit(const Decl *D);
 
+  void Visit(const CXXCtorInitializer *Init);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D56708: NFC: Implement OMPClause dump in terms of visitors

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
steveire created this revision.
steveire added a reviewer: aaron.ballman.
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

https://reviews.llvm.org/D56708

Files:
  include/clang/AST/TextNodeDumper.h
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -272,6 +272,24 @@
   }
 }
 
+void TextNodeDumper::Visit(const OMPClause *C) {
+  if (!C) {
+ColorScope Color(OS, ShowColors, NullColor);
+OS << "<<>> OMPClause";
+return;
+  }
+  {
+ColorScope Color(OS, ShowColors, AttrColor);
+StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
+OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
+   << ClauseName.drop_front() << "Clause";
+  }
+  dumpPointer(C);
+  dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
+  if (C->isImplicit())
+OS << " ";
+}
+
 void TextNodeDumper::dumpPointer(const void *Ptr) {
   ColorScope Color(OS, ShowColors, AddressColor);
   OS << ' ' << Ptr;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -292,6 +292,7 @@
 void VisitCapturedStmt(const CapturedStmt *Node);
 
 // OpenMP
+void Visit(const OMPClause *C);
 void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
 
 // Exprs
@@ -1448,27 +1449,17 @@
 //  OpenMP dumping methods.
 
//===--===//
 
+void ASTDumper::Visit(const OMPClause *C) {
+  for (auto *S : C->children())
+dumpStmt(S);
+}
+
 void ASTDumper::VisitOMPExecutableDirective(
 const OMPExecutableDirective *Node) {
   for (auto *C : Node->clauses()) {
 dumpChild([=] {
-  if (!C) {
-ColorScope Color(OS, ShowColors, NullColor);
-OS << "<<>> OMPClause";
-return;
-  }
-  {
-ColorScope Color(OS, ShowColors, AttrColor);
-StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
-OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
-   << ClauseName.drop_front() << "Clause";
-  }
-  NodeDumper.dumpPointer(C);
-  NodeDumper.dumpSourceRange(SourceRange(C->getBeginLoc(), 
C->getEndLoc()));
-  if (C->isImplicit())
-OS << " ";
-  for (auto *S : C->children())
-dumpStmt(S);
+  NodeDumper.Visit(C);
+  Visit(C);
 });
   }
 }
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -169,6 +169,8 @@
 
   void Visit(const CXXCtorInitializer *Init);
 
+  void Visit(const OMPClause *C);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -272,6 +272,24 @@
   }
 }
 
+void TextNodeDumper::Visit(const OMPClause *C) {
+  if (!C) {
+ColorScope Color(OS, ShowColors, NullColor);
+OS << "<<>> OMPClause";
+return;
+  }
+  {
+ColorScope Color(OS, ShowColors, AttrColor);
+StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
+OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
+   << ClauseName.drop_front() << "Clause";
+  }
+  dumpPointer(C);
+  dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
+  if (C->isImplicit())
+OS << " ";
+}
+
 void TextNodeDumper::dumpPointer(const void *Ptr) {
   ColorScope Color(OS, ShowColors, AddressColor);
   OS << ' ' << Ptr;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -292,6 +292,7 @@
 void VisitCapturedStmt(const CapturedStmt *Node);
 
 // OpenMP
+void Visit(const OMPClause *C);
 void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
 
 // Exprs
@@ -1448,27 +1449,17 @@
 //  OpenMP dumping methods.
 //===--===//
 
+void ASTDumper::Visit(const OMPClause *C) {
+  for (auto *S : C->children())
+dumpStmt(S);
+}
+
 void ASTDumper::VisitOMPExecutableDirective(
 const OMPExecutableDirective *Node) {
   for (auto *C : Node->clauses()) {
 dumpChild([=] {
-  if (!C) {
-ColorScope Color(OS, ShowColors, NullColor);
-OS << "<<>> OMPClause";
-return;
-  }
-  {
-ColorScope Color(OS, ShowColors, AttrColor);
-StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
-OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
-   << ClauseName.drop_front() << "Clause";
-  }
-  No

[PATCH] D56709: Implement BlockDecl::Capture dump in terms of visitors

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
steveire created this revision.
steveire added a reviewer: aaron.ballman.
Herald added a subscriber: cfe-commits.

Repository:
  rC Clang

https://reviews.llvm.org/D56709

Files:
  include/clang/AST/TextNodeDumper.h
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -272,6 +272,18 @@
   }
 }
 
+void TextNodeDumper::Visit(const BlockDecl::Capture &C) {
+  OS << "capture";
+  if (C.isByRef())
+OS << " byref";
+  if (C.isNested())
+OS << " nested";
+  if (C.getVariable()) {
+OS << ' ';
+dumpBareDeclRef(C.getVariable());
+  }
+}
+
 void TextNodeDumper::Visit(const OMPClause *C) {
   if (!C) {
 ColorScope Color(OS, ShowColors, NullColor);
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -283,6 +283,7 @@
 void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
 void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
 void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
+void Visit(const BlockDecl::Capture &C);
 void VisitBlockDecl(const BlockDecl *D);
 
 // Stmts.
@@ -1371,6 +1372,11 @@
   NodeDumper.dumpDeclRef(D->getPropertyIvarDecl());
 }
 
+void ASTDumper::Visit(const BlockDecl::Capture &C) {
+  if (C.hasCopyExpr())
+dumpStmt(C.getCopyExpr());
+}
+
 void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
   for (auto I : D->parameters())
 dumpDecl(I);
@@ -1383,17 +1389,8 @@
 
   for (const auto &I : D->captures()) {
 dumpChild([=] {
-  OS << "capture";
-  if (I.isByRef())
-OS << " byref";
-  if (I.isNested())
-OS << " nested";
-  if (I.getVariable()) {
-OS << ' ';
-NodeDumper.dumpBareDeclRef(I.getVariable());
-  }
-  if (I.hasCopyExpr())
-dumpStmt(I.getCopyExpr());
+  NodeDumper.Visit(I);
+  Visit(I);
 });
   }
   dumpStmt(D->getBody());
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -171,6 +171,8 @@
 
   void Visit(const OMPClause *C);
 
+  void Visit(const BlockDecl::Capture &C);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -272,6 +272,18 @@
   }
 }
 
+void TextNodeDumper::Visit(const BlockDecl::Capture &C) {
+  OS << "capture";
+  if (C.isByRef())
+OS << " byref";
+  if (C.isNested())
+OS << " nested";
+  if (C.getVariable()) {
+OS << ' ';
+dumpBareDeclRef(C.getVariable());
+  }
+}
+
 void TextNodeDumper::Visit(const OMPClause *C) {
   if (!C) {
 ColorScope Color(OS, ShowColors, NullColor);
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -283,6 +283,7 @@
 void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
 void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
 void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
+void Visit(const BlockDecl::Capture &C);
 void VisitBlockDecl(const BlockDecl *D);
 
 // Stmts.
@@ -1371,6 +1372,11 @@
   NodeDumper.dumpDeclRef(D->getPropertyIvarDecl());
 }
 
+void ASTDumper::Visit(const BlockDecl::Capture &C) {
+  if (C.hasCopyExpr())
+dumpStmt(C.getCopyExpr());
+}
+
 void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
   for (auto I : D->parameters())
 dumpDecl(I);
@@ -1383,17 +1389,8 @@
 
   for (const auto &I : D->captures()) {
 dumpChild([=] {
-  OS << "capture";
-  if (I.isByRef())
-OS << " byref";
-  if (I.isNested())
-OS << " nested";
-  if (I.getVariable()) {
-OS << ' ';
-NodeDumper.dumpBareDeclRef(I.getVariable());
-  }
-  if (I.hasCopyExpr())
-dumpStmt(I.getCopyExpr());
+  NodeDumper.Visit(I);
+  Visit(I);
 });
   }
   dumpStmt(D->getBody());
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -171,6 +171,8 @@
 
   void Visit(const OMPClause *C);
 
+  void Visit(const BlockDecl::Capture &C);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r351177 - [clang][UBSan] Sanitization for alignment assumptions.

2019-01-15 Thread Roman Lebedev via cfe-commits
Author: lebedevri
Date: Tue Jan 15 01:44:25 2019
New Revision: 351177

URL: http://llvm.org/viewvc/llvm-project?rev=351177&view=rev
Log:
[clang][UBSan] Sanitization for alignment assumptions.

Summary:
UB isn't nice. It's cool and powerful, but not nice.
Having a way to detect it is nice though.
[[ https://wg21.link/p1007r3 | P1007R3: std::assume_aligned ]] / 
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1007r2.pdf says:
```
We propose to add this functionality via a library function instead of a core 
language attribute.
...
If the pointer passed in is not aligned to at least N bytes, calling 
assume_aligned results in undefined behaviour.
```

This differential teaches clang to sanitize all the various variants of this 
assume-aligned attribute.

Requires D54588 for LLVM IRBuilder changes.
The compiler-rt part is D54590.

This is a second commit, the original one was r351105,
which was mass-reverted in r351159 because 2 compiler-rt tests were failing.

Reviewers: ABataev, craig.topper, vsk, rsmith, rnk, #sanitizers, erichkeane, 
filcab, rjmccall

Reviewed By: rjmccall

Subscribers: chandlerc, ldionne, EricWF, mclow.lists, cfe-commits, bkramer

Tags: #sanitizers

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

Added:

cfe/trunk/test/CodeGen/catch-alignment-assumption-attribute-align_value-on-lvalue.cpp

cfe/trunk/test/CodeGen/catch-alignment-assumption-attribute-align_value-on-paramvar.cpp

cfe/trunk/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function-variable.cpp

cfe/trunk/test/CodeGen/catch-alignment-assumption-attribute-alloc_align-on-function.cpp

cfe/trunk/test/CodeGen/catch-alignment-assumption-attribute-assume_aligned-on-function-two-params.cpp

cfe/trunk/test/CodeGen/catch-alignment-assumption-attribute-assume_aligned-on-function.cpp
cfe/trunk/test/CodeGen/catch-alignment-assumption-blacklist.c

cfe/trunk/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params-variable.cpp

cfe/trunk/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-three-params.cpp

cfe/trunk/test/CodeGen/catch-alignment-assumption-builtin_assume_aligned-two-params.cpp
cfe/trunk/test/CodeGen/catch-alignment-assumption-openmp.cpp
Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=351177&r1=351176&r2=351177&view=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Tue Jan 15 01:44:25 2019
@@ -321,6 +321,49 @@ Undefined Behavior Sanitizer (UBSan)
 * The Implicit Conversion Sanitizer (``-fsanitize=implicit-conversion``) has
   learned to sanitize compound assignment operators.
 
+* ``alignment`` check has learned to sanitize the assume_aligned-like 
attributes:
+
+  .. code-block:: c++
+
+  typedef char **__attribute__((align_value(1024))) aligned_char;
+  struct ac_struct {
+aligned_char a;
+  };
+  char **load_from_ac_struct(struct ac_struct *x) {
+return x->a; // <- check that loaded 'a' is aligned
+  }
+
+  char **passthrough(__attribute__((align_value(1024))) char **x) {
+return x; // <- check the pointer passed as function argument
+  }
+
+  char **__attribute__((alloc_align(2)))
+  alloc_align(int size, unsigned long alignment);
+
+  char **caller(int size) {
+return alloc_align(size, 1024); // <- check returned pointer
+  }
+
+  char **__attribute__((assume_aligned(1024))) get_ptr();
+
+  char **caller2() {
+return get_ptr(); // <- check returned pointer
+  }
+
+  void *caller3(char **x) {
+return __builtin_assume_aligned(x, 1024);  // <- check returned pointer
+  }
+
+  void *caller4(char **x, unsigned long offset) {
+return __builtin_assume_aligned(x, 1024, offset);  // <- check 
returned pointer accounting for the offest
+  }
+
+  void process(char *data, int width) {
+  #pragma omp for simd aligned(data : 1024) // <- aligned clause will 
be checked.
+  for (int x = 0; x < width; x++)
+  data[x] *= data[x];
+  }
+
 Core Analysis Improvements
 ==
 

Modified: cfe/trunk/docs/UndefinedBehaviorSanitizer.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UndefinedBehaviorSanitizer.rst?rev=351177&r1=351176&r2=351177&view=diff
==
--- cfe/trunk/docs/UndefinedBehaviorSanitizer.rst (original)
+++ cfe/trunk/docs/UndefinedBehavio

[PATCH] D55083: Re-arrange content in FunctionDecl dump

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 181744.
steveire added a comment.

Update


Repository:
  rC Clang

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

https://reviews.llvm.org/D55083

Files:
  lib/AST/ASTDumper.cpp
  test/AST/ast-dump-funcs.cpp


Index: test/AST/ast-dump-funcs.cpp
===
--- test/AST/ast-dump-funcs.cpp
+++ test/AST/ast-dump-funcs.cpp
@@ -56,10 +56,10 @@
 struct T : S { // T is not referenced, but S is
   void f(float, int = 100) override;
   // CHECK: CXXMethodDecl 0x{{[^ ]*}}  col:8 f 
'void (float, int)'
+  // CHECK-NEXT: Overrides: [ 0x{{[^ ]*}} S::f 'void (float, int)' ]
   // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}}  col:15 'float'
   // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}}  col:21 'int' cinit
   // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}}  'int' 100
-  // CHECK-NEXT: Overrides: [ 0x{{[^ ]*}} S::f 'void (float, int)' ]
   // CHECK-NEXT: OverrideAttr
 
   // CHECK: CXXConstructorDecl 0x{{[^ ]*}}  col:8 implicit 
T 'void (const T &)' inline default_delete noexcept-unevaluated
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -612,22 +612,6 @@
 }
   }
 
-  if (const FunctionTemplateSpecializationInfo *FTSI =
-  D->getTemplateSpecializationInfo())
-dumpTemplateArgumentList(*FTSI->TemplateArguments);
-
-  if (!D->param_begin() && D->getNumParams())
-dumpChild([=] { OS << ">"; });
-  else
-for (const ParmVarDecl *Parameter : D->parameters())
-  dumpDecl(Parameter);
-
-  if (const CXXConstructorDecl *C = dyn_cast(D))
-for (CXXConstructorDecl::init_const_iterator I = C->init_begin(),
- E = C->init_end();
- I != E; ++I)
-  dumpCXXCtorInitializer(*I);
-
   if (const CXXMethodDecl *MD = dyn_cast(D)) {
 if (MD->size_overridden_methods() != 0) {
   auto dumpOverride = [=](const CXXMethodDecl *D) {
@@ -651,6 +635,22 @@
 }
   }
 
+  if (const FunctionTemplateSpecializationInfo *FTSI =
+  D->getTemplateSpecializationInfo())
+dumpTemplateArgumentList(*FTSI->TemplateArguments);
+
+  if (!D->param_begin() && D->getNumParams())
+dumpChild([=] { OS << ">"; });
+  else
+for (const ParmVarDecl *Parameter : D->parameters())
+  dumpDecl(Parameter);
+
+  if (const CXXConstructorDecl *C = dyn_cast(D))
+for (CXXConstructorDecl::init_const_iterator I = C->init_begin(),
+ E = C->init_end();
+ I != E; ++I)
+  dumpCXXCtorInitializer(*I);
+
   if (D->doesThisDeclarationHaveABody())
 dumpStmt(D->getBody());
 }


Index: test/AST/ast-dump-funcs.cpp
===
--- test/AST/ast-dump-funcs.cpp
+++ test/AST/ast-dump-funcs.cpp
@@ -56,10 +56,10 @@
 struct T : S { // T is not referenced, but S is
   void f(float, int = 100) override;
   // CHECK: CXXMethodDecl 0x{{[^ ]*}}  col:8 f 'void (float, int)'
+  // CHECK-NEXT: Overrides: [ 0x{{[^ ]*}} S::f 'void (float, int)' ]
   // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}}  col:15 'float'
   // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}}  col:21 'int' cinit
   // CHECK-NEXT: IntegerLiteral 0x{{[^ ]*}}  'int' 100
-  // CHECK-NEXT: Overrides: [ 0x{{[^ ]*}} S::f 'void (float, int)' ]
   // CHECK-NEXT: OverrideAttr
 
   // CHECK: CXXConstructorDecl 0x{{[^ ]*}}  col:8 implicit T 'void (const T &)' inline default_delete noexcept-unevaluated
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -612,22 +612,6 @@
 }
   }
 
-  if (const FunctionTemplateSpecializationInfo *FTSI =
-  D->getTemplateSpecializationInfo())
-dumpTemplateArgumentList(*FTSI->TemplateArguments);
-
-  if (!D->param_begin() && D->getNumParams())
-dumpChild([=] { OS << ">"; });
-  else
-for (const ParmVarDecl *Parameter : D->parameters())
-  dumpDecl(Parameter);
-
-  if (const CXXConstructorDecl *C = dyn_cast(D))
-for (CXXConstructorDecl::init_const_iterator I = C->init_begin(),
- E = C->init_end();
- I != E; ++I)
-  dumpCXXCtorInitializer(*I);
-
   if (const CXXMethodDecl *MD = dyn_cast(D)) {
 if (MD->size_overridden_methods() != 0) {
   auto dumpOverride = [=](const CXXMethodDecl *D) {
@@ -651,6 +635,22 @@
 }
   }
 
+  if (const FunctionTemplateSpecializationInfo *FTSI =
+  D->getTemplateSpecializationInfo())
+dumpTemplateArgumentList(*FTSI->TemplateArguments);
+
+  if (!D->param_begin() && D->getNumParams())
+dumpChild([=] { OS << ">"; });
+  else
+for (const ParmVarDecl *Parameter : D->parameters())
+  dumpDecl(Parameter);
+
+  if (const CXXConstructorDecl *C = dyn_cast(D))
+for (CXXConstructorDecl::in

[PATCH] D56708: NFC: Implement OMPClause dump in terms of visitors

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 181749.
steveire added a comment.

Update


Repository:
  rC Clang

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

https://reviews.llvm.org/D56708

Files:
  include/clang/AST/TextNodeDumper.h
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -272,6 +272,24 @@
   }
 }
 
+void TextNodeDumper::Visit(const OMPClause *C) {
+  if (!C) {
+ColorScope Color(OS, ShowColors, NullColor);
+OS << "<<>> OMPClause";
+return;
+  }
+  {
+ColorScope Color(OS, ShowColors, AttrColor);
+StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
+OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
+   << ClauseName.drop_front() << "Clause";
+  }
+  dumpPointer(C);
+  dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
+  if (C->isImplicit())
+OS << " ";
+}
+
 void TextNodeDumper::dumpPointer(const void *Ptr) {
   ColorScope Color(OS, ShowColors, AddressColor);
   OS << ' ' << Ptr;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -292,6 +292,7 @@
 void VisitCapturedStmt(const CapturedStmt *Node);
 
 // OpenMP
+void Visit(const OMPClause *C);
 void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
 
 // Exprs
@@ -1448,29 +1449,18 @@
 //  OpenMP dumping methods.
 
//===--===//
 
+void ASTDumper::Visit(const OMPClause *C) {
+  dumpChild([=] {
+NodeDumper.Visit(C);
+for (auto *S : C->children())
+  dumpStmt(S);
+  });
+}
+
 void ASTDumper::VisitOMPExecutableDirective(
 const OMPExecutableDirective *Node) {
-  for (auto *C : Node->clauses()) {
-dumpChild([=] {
-  if (!C) {
-ColorScope Color(OS, ShowColors, NullColor);
-OS << "<<>> OMPClause";
-return;
-  }
-  {
-ColorScope Color(OS, ShowColors, AttrColor);
-StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
-OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
-   << ClauseName.drop_front() << "Clause";
-  }
-  NodeDumper.dumpPointer(C);
-  NodeDumper.dumpSourceRange(SourceRange(C->getBeginLoc(), 
C->getEndLoc()));
-  if (C->isImplicit())
-OS << " ";
-  for (auto *S : C->children())
-dumpStmt(S);
-});
-  }
+  for (auto *C : Node->clauses())
+Visit(C);
 }
 
 
//===--===//
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -169,6 +169,8 @@
 
   void Visit(const CXXCtorInitializer *Init);
 
+  void Visit(const OMPClause *C);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -272,6 +272,24 @@
   }
 }
 
+void TextNodeDumper::Visit(const OMPClause *C) {
+  if (!C) {
+ColorScope Color(OS, ShowColors, NullColor);
+OS << "<<>> OMPClause";
+return;
+  }
+  {
+ColorScope Color(OS, ShowColors, AttrColor);
+StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
+OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
+   << ClauseName.drop_front() << "Clause";
+  }
+  dumpPointer(C);
+  dumpSourceRange(SourceRange(C->getBeginLoc(), C->getEndLoc()));
+  if (C->isImplicit())
+OS << " ";
+}
+
 void TextNodeDumper::dumpPointer(const void *Ptr) {
   ColorScope Color(OS, ShowColors, AddressColor);
   OS << ' ' << Ptr;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -292,6 +292,7 @@
 void VisitCapturedStmt(const CapturedStmt *Node);
 
 // OpenMP
+void Visit(const OMPClause *C);
 void VisitOMPExecutableDirective(const OMPExecutableDirective *Node);
 
 // Exprs
@@ -1448,29 +1449,18 @@
 //  OpenMP dumping methods.
 //===--===//
 
+void ASTDumper::Visit(const OMPClause *C) {
+  dumpChild([=] {
+NodeDumper.Visit(C);
+for (auto *S : C->children())
+  dumpStmt(S);
+  });
+}
+
 void ASTDumper::VisitOMPExecutableDirective(
 const OMPExecutableDirective *Node) {
-  for (auto *C : Node->clauses()) {
-dumpChild([=] {
-  if (!C) {
-ColorScope Color(OS, ShowColors, NullColor);
-OS << "<<>> OMPClause";
-return;
-  }
-  {
-ColorScope Color(OS, Sh

[PATCH] D56709: Implement BlockDecl::Capture dump in terms of visitors

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
steveire updated this revision to Diff 181751.
steveire added a comment.

Update


Repository:
  rC Clang

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

https://reviews.llvm.org/D56709

Files:
  include/clang/AST/TextNodeDumper.h
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -272,6 +272,18 @@
   }
 }
 
+void TextNodeDumper::Visit(const BlockDecl::Capture &C) {
+  OS << "capture";
+  if (C.isByRef())
+OS << " byref";
+  if (C.isNested())
+OS << " nested";
+  if (C.getVariable()) {
+OS << ' ';
+dumpBareDeclRef(C.getVariable());
+  }
+}
+
 void TextNodeDumper::Visit(const OMPClause *C) {
   if (!C) {
 ColorScope Color(OS, ShowColors, NullColor);
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -283,6 +283,7 @@
 void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
 void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
 void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
+void Visit(const BlockDecl::Capture &C);
 void VisitBlockDecl(const BlockDecl *D);
 
 // Stmts.
@@ -1371,6 +1372,14 @@
   NodeDumper.dumpDeclRef(D->getPropertyIvarDecl());
 }
 
+void ASTDumper::Visit(const BlockDecl::Capture &C) {
+  dumpChild([=] {
+NodeDumper.Visit(C);
+if (C.hasCopyExpr())
+  dumpStmt(C.getCopyExpr());
+  });
+}
+
 void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
   for (auto I : D->parameters())
 dumpDecl(I);
@@ -1381,21 +1390,8 @@
   if (D->capturesCXXThis())
 dumpChild([=]{ OS << "capture this"; });
 
-  for (const auto &I : D->captures()) {
-dumpChild([=] {
-  OS << "capture";
-  if (I.isByRef())
-OS << " byref";
-  if (I.isNested())
-OS << " nested";
-  if (I.getVariable()) {
-OS << ' ';
-NodeDumper.dumpBareDeclRef(I.getVariable());
-  }
-  if (I.hasCopyExpr())
-dumpStmt(I.getCopyExpr());
-});
-  }
+  for (const auto &I : D->captures())
+Visit(I);
   dumpStmt(D->getBody());
 }
 
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -171,6 +171,8 @@
 
   void Visit(const OMPClause *C);
 
+  void Visit(const BlockDecl::Capture &C);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(SourceLocation Loc);
   void dumpSourceRange(SourceRange R);


Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -272,6 +272,18 @@
   }
 }
 
+void TextNodeDumper::Visit(const BlockDecl::Capture &C) {
+  OS << "capture";
+  if (C.isByRef())
+OS << " byref";
+  if (C.isNested())
+OS << " nested";
+  if (C.getVariable()) {
+OS << ' ';
+dumpBareDeclRef(C.getVariable());
+  }
+}
+
 void TextNodeDumper::Visit(const OMPClause *C) {
   if (!C) {
 ColorScope Color(OS, ShowColors, NullColor);
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -283,6 +283,7 @@
 void VisitObjCCompatibleAliasDecl(const ObjCCompatibleAliasDecl *D);
 void VisitObjCPropertyDecl(const ObjCPropertyDecl *D);
 void VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D);
+void Visit(const BlockDecl::Capture &C);
 void VisitBlockDecl(const BlockDecl *D);
 
 // Stmts.
@@ -1371,6 +1372,14 @@
   NodeDumper.dumpDeclRef(D->getPropertyIvarDecl());
 }
 
+void ASTDumper::Visit(const BlockDecl::Capture &C) {
+  dumpChild([=] {
+NodeDumper.Visit(C);
+if (C.hasCopyExpr())
+  dumpStmt(C.getCopyExpr());
+  });
+}
+
 void ASTDumper::VisitBlockDecl(const BlockDecl *D) {
   for (auto I : D->parameters())
 dumpDecl(I);
@@ -1381,21 +1390,8 @@
   if (D->capturesCXXThis())
 dumpChild([=]{ OS << "capture this"; });
 
-  for (const auto &I : D->captures()) {
-dumpChild([=] {
-  OS << "capture";
-  if (I.isByRef())
-OS << " byref";
-  if (I.isNested())
-OS << " nested";
-  if (I.getVariable()) {
-OS << ' ';
-NodeDumper.dumpBareDeclRef(I.getVariable());
-  }
-  if (I.hasCopyExpr())
-dumpStmt(I.getCopyExpr());
-});
-  }
+  for (const auto &I : D->captures())
+Visit(I);
   dumpStmt(D->getBody());
 }
 
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -171,6 +171,8 @@
 
   void Visit(const OMPClause *C);
 
+  void Visit(const BlockDecl::Capture &C);
+
   void dumpPointer(const void *Ptr);
   void dumpLocation(S

[PATCH] D56429: fix python3 compability issue

2019-01-15 Thread Jakub Stasiak via Phabricator via cfe-commits
jstasiak marked an inline comment as done.
jstasiak added inline comments.



Comment at: bindings/python/clang/cindex.py:3001
+contents = b(contents)
+unsaved_files_array[i].name = b(fspath(name))
+unsaved_files_array[i].contents = contents

Nitpicking: the description only mentions changes related to file contents but 
this modification (`fspath(name)` -> `b(fspath(name))`) likely fixes a 
different issue, it may be worth mentioning this in the commit message. Unless 
this extra `b()` call is not strictly necessary here but added for consistency?



Repository:
  rC Clang

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

https://reviews.llvm.org/D56429



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


[PATCH] D56646: [OpenCL] opencl-c.h: read_image*(): sampler-less, and image{1, 2}d_array_t variants are OpenCL-1.2+, mark them as such

2019-01-15 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Overall I feel we need to find some way to test the header better...


Repository:
  rC Clang

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

https://reviews.llvm.org/D56646



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


[PATCH] D56646: [OpenCL] opencl-c.h: read_image*(): sampler-less, and image{1,2}d_array_t variants are OpenCL-1.2+, mark them as such

2019-01-15 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment.

In D56646#1357650 , @Anastasia wrote:

> LGTM!


Thank you for the review.

In D56646#1357650 , @Anastasia wrote:

> Overall I feel we need to find some way to test the header better...


Yeah, i will not be hugely surprised if there is a bunch more things like this 
here.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56646



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


[PATCH] D56661: [clang-tidy] Fix incorrect array name generation in cppcoreguidelines-pro-bounds-constant-array-index

2019-01-15 Thread Dmitry Venikov via Phabricator via cfe-commits
Quolyk updated this revision to Diff 181763.
Quolyk added a comment.

Patch is not yet fixed.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56661

Files:
  clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
  
test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index-gslheader.cpp
  test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index.cpp

Index: test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index.cpp
===
--- test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index.cpp
+++ test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index.cpp
@@ -23,46 +23,46 @@
   return base + 3;
 }
 
-void f(std::array a, int pos) {
-  a [ pos / 2 /*comment*/] = 1;
+void f(std::array list, int pos) {
+  list [ pos / 2 /*comment*/] = 1;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use array subscript when the index is not an integer constant expression; use gsl::at() instead [cppcoreguidelines-pro-bounds-constant-array-index]
-  int j = a[pos - 1];
+  int j = list[pos - 1];
   // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: do not use array subscript when the index is not an integer constant expression; use gsl::at() instead
 
-  a.at(pos-1) = 2; // OK, at() instead of []
-  gsl::at(a, pos-1) = 2; // OK, gsl::at() instead of []
+  list.at(pos-1) = 2; // OK, at() instead of []
+  gsl::at(list, pos-1) = 2; // OK, gsl::at() instead of []
 
-  a[-1] = 3;
+  list[-1] = 3;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: std::array<> index -1 is negative [cppcoreguidelines-pro-bounds-constant-array-index]
-  a[10] = 4;
+  list[10] = 4;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: std::array<> index 10 is past the end of the array (which contains 10 elements) [cppcoreguidelines-pro-bounds-constant-array-index]
 
-  a[const_index(7)] = 3;
+  list[const_index(7)] = 3;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: std::array<> index 10 is past the end of the array (which contains 10 elements)
 
-  a[0] = 3; // OK, constant index and inside bounds
-  a[1] = 3; // OK, constant index and inside bounds
-  a[9] = 3; // OK, constant index and inside bounds
-  a[const_index(6)] = 3; // OK, constant index and inside bounds
+  list[0] = 3; // OK, constant index and inside bounds
+  list[1] = 3; // OK, constant index and inside bounds
+  list[9] = 3; // OK, constant index and inside bounds
+  list[const_index(6)] = 3; // OK, constant index and inside bounds
 }
 
 void g() {
-  int a[10];
+  int list[10];
   for (int i = 0; i < 10; ++i) {
-a[i] = i;
+list[i] = i;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use array subscript when the index is not an integer constant expression; use gsl::at() instead
-// CHECK-FIXES: gsl::at(a, i) = i;
-gsl::at(a, i) = i; // OK, gsl::at() instead of []
+// CHECK-FIXES: gsl::at(list, i) = i;
+gsl::at(list, i) = i; // OK, gsl::at() instead of []
   }
 
-  a[-1] = 3; // flagged by clang-diagnostic-array-bounds
-  a[10] = 4; // flagged by clang-diagnostic-array-bounds
-  a[const_index(7)] = 3; // flagged by clang-diagnostic-array-bounds
-
-  a[0] = 3; // OK, constant index and inside bounds
-  a[1] = 3; // OK, constant index and inside bounds
-  a[9] = 3; // OK, constant index and inside bounds
-  a[const_index(6)] = 3; // OK, constant index and inside bounds
+  list[-1] = 3; // flagged by clang-diagnostic-array-bounds
+  list[10] = 4; // flagged by clang-diagnostic-array-bounds
+  list[const_index(7)] = 3; // flagged by clang-diagnostic-array-bounds
+
+  list[0] = 3; // OK, constant index and inside bounds
+  list[1] = 3; // OK, constant index and inside bounds
+  list[9] = 3; // OK, constant index and inside bounds
+  list[const_index(6)] = 3; // OK, constant index and inside bounds
 }
 
 struct S {
Index: test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index-gslheader.cpp
===
--- test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index-gslheader.cpp
+++ test/clang-tidy/cppcoreguidelines-pro-bounds-constant-array-index-gslheader.cpp
@@ -24,48 +24,48 @@
   return base + 3;
 }
 
-void f(std::array a, int pos) {
-  a [ pos / 2 /*comment*/] = 1;
+void f(std::array list, int pos) {
+  list [ pos / 2 /*comment*/] = 1;
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use array subscript when the index is not an integer constant expression; use gsl::at() instead [cppcoreguidelines-pro-bounds-constant-array-index]
-  // CHECK-FIXES: gsl::at(a,  pos / 2 /*comment*/) = 1;
-  int j = a[pos - 1];
+  // CHECK-FIXES: gsl::at(list,  pos / 2 /*comment*/) = 1;
+  int j = list[pos - 1];
   // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: do not use array subscript when the index is not an integer constant expression; use gsl::at() instead
-  // CHECK-FIXES: int j = gsl::at(a, pos - 1);
+  // CHECK-

r351188 - [OpenCL] opencl-c.h: read_image*(): sampler-less, and image{1, 2}d_array_t variants are OpenCL-1.2+, mark them as such

2019-01-15 Thread Roman Lebedev via cfe-commits
Author: lebedevri
Date: Tue Jan 15 03:20:02 2019
New Revision: 351188

URL: http://llvm.org/viewvc/llvm-project?rev=351188&view=rev
Log:
[OpenCL] opencl-c.h: read_image*(): sampler-less, and image{1,2}d_array_t 
variants are OpenCL-1.2+, mark them as such

Summary:
Refer to [[ 
https://www.khronos.org/registry/OpenCL/specs/opencl-1.1.pdf#page=242 | 
`6.11.13.2 Built-in Image Functions` ]],
and [[ https://www.khronos.org/registry/OpenCL/specs/opencl-1.1.pdf#page=306 | 
`9.6.8 Image Read and Write Functions` ]] of the OpenCL 1.1 spec.

* There is no mention of `image1d_array_t` and `image2d_array_t` anywhere in 
the OpenCL 1.1 spec.
* All the `read_image{f,i,ui,h}()` functions, as of OpenCL 1.1 spec, have a 
second required parameter `sampler_t sampler`

Should have prevented the following regression:
https://redmine.darktable.org/issues/12493

Reviewers: yaxunl, Anastasia, echuraev, asavonic

Reviewed By: Anastasia

Subscribers: cfe-commits

Tags: #clang

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

Modified:
cfe/trunk/lib/Headers/opencl-c.h

Modified: cfe/trunk/lib/Headers/opencl-c.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/opencl-c.h?rev=351188&r1=351187&r2=351188&view=diff
==
--- cfe/trunk/lib/Headers/opencl-c.h (original)
+++ cfe/trunk/lib/Headers/opencl-c.h Tue Jan 15 03:20:02 2019
@@ -14610,6 +14610,7 @@ int4 __purefn __ovld read_imagei(read_on
 uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t 
sampler, int4 coord);
 uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t 
sampler, float4 coord);
 
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
 float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, 
sampler_t sampler, int4 coord);
 float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, 
sampler_t sampler, float4 coord);
 
@@ -14617,6 +14618,7 @@ int4 __purefn __ovld read_imagei(read_on
 int4 __purefn __ovld read_imagei(read_only image2d_array_t image_array, 
sampler_t sampler, float4 coord);
 uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, 
sampler_t sampler, int4 coord);
 uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, 
sampler_t sampler, float4 coord);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
 
 float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t 
sampler, int coord);
 float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t 
sampler, float coord);
@@ -14626,6 +14628,7 @@ int4 __purefn __ovld read_imagei(read_on
 uint4 __purefn __ovld read_imageui(read_only image1d_t image, sampler_t 
sampler, int coord);
 uint4 __purefn __ovld read_imageui(read_only image1d_t image, sampler_t 
sampler, float coord);
 
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
 float4 __purefn __ovld read_imagef(read_only image1d_array_t image_array, 
sampler_t sampler, int2 coord);
 float4 __purefn __ovld read_imagef(read_only image1d_array_t image_array, 
sampler_t sampler, float2 coord);
 
@@ -14633,6 +14636,7 @@ int4 __purefn __ovld read_imagei(read_on
 int4 __purefn __ovld read_imagei(read_only image1d_array_t image_array, 
sampler_t sampler, float2 coord);
 uint4 __purefn __ovld read_imageui(read_only image1d_array_t image_array, 
sampler_t sampler, int2 coord);
 uint4 __purefn __ovld read_imageui(read_only image1d_array_t image_array, 
sampler_t sampler, float2 coord);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
 
 #ifdef cl_khr_depth_images
 float __purefn __ovld read_imagef(read_only image2d_depth_t image, sampler_t 
sampler, float2 coord);
@@ -14735,6 +14739,8 @@ uint4 __purefn __ovld read_imageui(read_
 #endif //cl_khr_mipmap_image
 #endif //__OPENCL_C_VERSION__ >= CL_VERSION_2_0
 
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
+
 /**
 * Sampler-less Image Access
 */
@@ -14768,24 +14774,31 @@ float4 __purefn __ovld read_imagef(read_
 int4 __purefn __ovld read_imagei(read_only image3d_t image, int4 coord);
 uint4 __purefn __ovld read_imageui(read_only image3d_t image, int4 coord);
 
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
+
 // Image read functions returning half4 type
 #ifdef cl_khr_fp16
 half4 __purefn __ovld read_imageh(read_only image1d_t image, sampler_t 
sampler, int coord);
 half4 __purefn __ovld read_imageh(read_only image1d_t image, sampler_t 
sampler, float coord);
-half4 __purefn __ovld read_imageh(read_only image1d_array_t image, sampler_t 
sampler, int2 coord);
-half4 __purefn __ovld read_imageh(read_only image1d_array_t image, sampler_t 
sampler, float2 coord);
 half4 __purefn __ovld read_imageh(read_only image2d_t image, sampler_t 
sampler, int2 coord);
 half4 __purefn __ovld read_imageh(read_only image2d_t image, sampler_t 
sampler, float2 coord);
 half4 __purefn __ovld read_imageh(read_only image3d_t image, sampler_t 
sampler, int4 coord);
 half4 __purefn __ovld read_imageh(read_only image3d_t image, sampler_t 

[PATCH] D55850: [OpenCL] Allow address spaces as method qualifiers

2019-01-15 Thread Bruno De Fraine via Phabricator via cfe-commits
brunodf added inline comments.



Comment at: lib/Sema/SemaType.cpp:4877
   T = Context.getFunctionType(T, ParamTys, EPI);
   T = state.getSema().Context.getAddrSpaceQualType(T, AS);
 } else {

I follow all of the above (from the point "a class member function has an 
address space"), but then I take issue with this line (already from Mikael).

You look at the declaration's attributes, to derive the ASIdx relating to the 
method's this argument. You mark the relevant attributes as invalid, to prevent 
them from being considered in "processTypeAttrs" after the switch that we break 
below. The ASIdx is stored in the qualifiers EPI to go to the FunctionProtoType 
(this will affect getThisType). This all seems fine.

But then this line adds the address space qualification to T, the type of the 
declared function itself. This seems unnecessary, and conceptually wrong: while 
the function may have an address space in syntax, this address space applies to 
the this argument, not to the function object (and a pointer to the function is 
not a pointer to this address space etc.). In short, I think this line should 
be removed.


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

https://reviews.llvm.org/D55850



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


[PATCH] D56611: [clangd] A code action to swap branches of an if statement

2019-01-15 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: clangd/refactor/actions/SwapIfBranches.cpp:36
+
+  bool VisitIfStmt(IfStmt *If) {
+auto R = toHalfOpenFileRange(Ctx.getSourceManager(), Ctx.getLangOpts(),

jkorous wrote:
> It seems to me we don't find If token whenever
> CursorLoc == location of 'f' of the If token
> 
> For example if there's "if" starting at location 1:1 I think we proceed like 
> this (hope my pseudocode is clear):
> 
> 1. `If->getIfLoc()` returns `SourceLocation{1:1}`
> 2. we construct `SourceRange{begin = 1:1, end = 1:1}`
> 3. `toHalfOpenFileRange()` returns `SourceRange{1:1, 1:2}`
> 4. the condition for `SourceLocation L` in `halfOpenRangeContains()` is `1:1 
> <= LOffset && LOffset < 1:2` which is only ever true for L == 1:1
> 
> Do I understand it right?
In step (3) the constructed range is intended to be `SourceRange{1:1, 1:3}`, 
i.e. it should cover both chars of the `if` keyword.
I haven't checked it, though, will make sure that's the case when actually 
testing this.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56611



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


[PATCH] D56646: [OpenCL] opencl-c.h: read_image*(): sampler-less, and image{1, 2}d_array_t variants are OpenCL-1.2+, mark them as such

2019-01-15 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL351188: [OpenCL] opencl-c.h: read_image*(): sampler-less, 
and image{1,2}d_array_t… (authored by lebedevri, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56646?vs=181466&id=181764#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56646

Files:
  cfe/trunk/lib/Headers/opencl-c.h


Index: cfe/trunk/lib/Headers/opencl-c.h
===
--- cfe/trunk/lib/Headers/opencl-c.h
+++ cfe/trunk/lib/Headers/opencl-c.h
@@ -14610,6 +14610,7 @@
 uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t 
sampler, int4 coord);
 uint4 __purefn __ovld read_imageui(read_only image3d_t image, sampler_t 
sampler, float4 coord);
 
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
 float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, 
sampler_t sampler, int4 coord);
 float4 __purefn __ovld read_imagef(read_only image2d_array_t image_array, 
sampler_t sampler, float4 coord);
 
@@ -14617,6 +14618,7 @@
 int4 __purefn __ovld read_imagei(read_only image2d_array_t image_array, 
sampler_t sampler, float4 coord);
 uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, 
sampler_t sampler, int4 coord);
 uint4 __purefn __ovld read_imageui(read_only image2d_array_t image_array, 
sampler_t sampler, float4 coord);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
 
 float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t 
sampler, int coord);
 float4 __purefn __ovld read_imagef(read_only image1d_t image, sampler_t 
sampler, float coord);
@@ -14626,6 +14628,7 @@
 uint4 __purefn __ovld read_imageui(read_only image1d_t image, sampler_t 
sampler, int coord);
 uint4 __purefn __ovld read_imageui(read_only image1d_t image, sampler_t 
sampler, float coord);
 
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
 float4 __purefn __ovld read_imagef(read_only image1d_array_t image_array, 
sampler_t sampler, int2 coord);
 float4 __purefn __ovld read_imagef(read_only image1d_array_t image_array, 
sampler_t sampler, float2 coord);
 
@@ -14633,6 +14636,7 @@
 int4 __purefn __ovld read_imagei(read_only image1d_array_t image_array, 
sampler_t sampler, float2 coord);
 uint4 __purefn __ovld read_imageui(read_only image1d_array_t image_array, 
sampler_t sampler, int2 coord);
 uint4 __purefn __ovld read_imageui(read_only image1d_array_t image_array, 
sampler_t sampler, float2 coord);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
 
 #ifdef cl_khr_depth_images
 float __purefn __ovld read_imagef(read_only image2d_depth_t image, sampler_t 
sampler, float2 coord);
@@ -14735,6 +14739,8 @@
 #endif //cl_khr_mipmap_image
 #endif //__OPENCL_C_VERSION__ >= CL_VERSION_2_0
 
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
+
 /**
 * Sampler-less Image Access
 */
@@ -14768,24 +14774,31 @@
 int4 __purefn __ovld read_imagei(read_only image3d_t image, int4 coord);
 uint4 __purefn __ovld read_imageui(read_only image3d_t image, int4 coord);
 
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
+
 // Image read functions returning half4 type
 #ifdef cl_khr_fp16
 half4 __purefn __ovld read_imageh(read_only image1d_t image, sampler_t 
sampler, int coord);
 half4 __purefn __ovld read_imageh(read_only image1d_t image, sampler_t 
sampler, float coord);
-half4 __purefn __ovld read_imageh(read_only image1d_array_t image, sampler_t 
sampler, int2 coord);
-half4 __purefn __ovld read_imageh(read_only image1d_array_t image, sampler_t 
sampler, float2 coord);
 half4 __purefn __ovld read_imageh(read_only image2d_t image, sampler_t 
sampler, int2 coord);
 half4 __purefn __ovld read_imageh(read_only image2d_t image, sampler_t 
sampler, float2 coord);
 half4 __purefn __ovld read_imageh(read_only image3d_t image, sampler_t 
sampler, int4 coord);
 half4 __purefn __ovld read_imageh(read_only image3d_t image, sampler_t 
sampler, float4 coord);
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
+half4 __purefn __ovld read_imageh(read_only image1d_array_t image, sampler_t 
sampler, int2 coord);
+half4 __purefn __ovld read_imageh(read_only image1d_array_t image, sampler_t 
sampler, float2 coord);
 half4 __purefn __ovld read_imageh(read_only image2d_array_t image, sampler_t 
sampler, int4 coord);
 half4 __purefn __ovld read_imageh(read_only image2d_array_t image, sampler_t 
sampler, float4 coord);
+/**
+ * Sampler-less Image Access
+ */
 half4 __purefn __ovld read_imageh(read_only image1d_t image, int coord);
 half4 __purefn __ovld read_imageh(read_only image2d_t image, int2 coord);
 half4 __purefn __ovld read_imageh(read_only image3d_t image, int4 coord);
 half4 __purefn __ovld read_imageh(read_only image1d_array_t image, int2 coord);
 half4 __purefn __ovld read_imageh(read_only image2d_array_t image, int4 coord);
 half4 __purefn __ovld read_imageh(read_only image1d_buffer_t image, int c

[PATCH] D56003: [RFC] [CFE] Allocatable Global Register Variables for ARM

2019-01-15 Thread Carey Williams via Phabricator via cfe-commits
carwil updated this revision to Diff 181766.
carwil set the repository for this revision to rC Clang.
carwil added a comment.
Herald added a subscriber: cfe-commits.

Added cfe-commits.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56003

Files:
  docs/ClangCommandLineReference.rst
  include/clang/Driver/Options.td
  lib/Basic/Targets/ARM.cpp
  lib/Basic/Targets/ARM.h
  lib/Driver/ToolChains/Arch/ARM.cpp
  test/Driver/arm-reserved-regs.c
  test/Sema/arm-global-regs.c

Index: test/Sema/arm-global-regs.c
===
--- /dev/null
+++ test/Sema/arm-global-regs.c
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -ffreestanding -fsyntax-only -verify -triple arm %s
+
+// Check a small subset of valid and invalid global register variable declarations.
+
+register unsigned arm_r3 __asm("r3");   //expected-error {{register 'r3' unsuitable for global register variables on this target}}
+
+register unsigned arm_r12 __asm("r12"); //expected-error {{register 'r12' unsuitable for global register variables on this target}}
+
+register unsigned arm_r5 __asm("r5");
+
+register unsigned arm_r9 __asm("r9");
+
+register unsigned arm_sp __asm("sp");
\ No newline at end of file
Index: test/Driver/arm-reserved-regs.c
===
--- /dev/null
+++ test/Driver/arm-reserved-regs.c
@@ -0,0 +1,11 @@
+// RUN: %clang -target arm-arm-none-eabi -### -ffixed-r11 -c %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RESERVED-FRAME-POINTER %s
+// CHECK-NO-RESERVED-FRAME-POINTER: option '-ffixed-r11' cannot be specified without '-fomit-frame-pointer'
+
+// RUN: %clang -target arm-arm-none-eabi -### -ffixed-r7 -mthumb -c %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RESERVED-FRAME-POINTER-THUMB %s
+// CHECK-NO-RESERVED-FRAME-POINTER-THUMB: option '-ffixed-r7' cannot be specified without '-fomit-frame-pointer'
+
+// RUN: %clang -target arm-arm-none-eabi -### -ffixed-r11 -fomit-frame-pointer -c %s 2>&1 | FileCheck -check-prefix=CHECK-RESERVED-NO-FRAME-POINTER %s
+// CHECK-RESERVED-NO-FRAME-POINTER-NOT: option '-ffixed-r11' cannot be specified without '-fomit-frame-pointer'
+
+// RUN: %clang -target arm-arm-none-eabi -### -ffixed-r7 -mthumb -fomit-frame-pointer -c %s 2>&1 | FileCheck -check-prefix=CHECK-RESERVED-NO-FRAME-POINTER-THUMB %s
+// CHECK-RESERVED-NO-FRAME-POINTER-THUMB-NOT: option '-ffixed-r7' cannot be specified without '-fomit-frame-pointer'
\ No newline at end of file
Index: lib/Driver/ToolChains/Arch/ARM.cpp
===
--- lib/Driver/ToolChains/Arch/ARM.cpp
+++ lib/Driver/ToolChains/Arch/ARM.cpp
@@ -548,11 +548,42 @@
   Features.push_back("+strict-align");
   }
 
-  // llvm does not support reserving registers in general. There is support
-  // for reserving r9 on ARM though (defined as a platform-specific register
-  // in ARM EABI).
-  if (Args.hasArg(options::OPT_ffixed_r9))
-Features.push_back("+reserve-r9");
+  // Do not allow r9 reservation with -frwpi.
+  if (Args.hasArg(options::OPT_ffixed_r9) && Args.hasArg(options::OPT_frwpi)) {
+Arg *A = Args.getLastArg(options::OPT_ffixed_r9);
+Arg *B = Args.getLastArg(options::OPT_frwpi);
+D.Diag(diag::err_opt_not_valid_with_opt) << A->getAsString(Args) << B->getAsString(Args);
+  }
+
+  // Do not allow fp reservation unless it's been explicity omitted.
+  if (!Args.hasArg(options::OPT_fomit_frame_pointer) ||
+   Args.hasArg(options::OPT_fno_omit_frame_pointer)) {
+if (Triple.isOSDarwin() || (!Triple.isOSWindows() && Triple.isThumb())) {
+  if (Args.hasArg(options::OPT_ffixed_r7)) {
+Arg *A = Args.getLastArg(options::OPT_ffixed_r7);
+D.Diag(diag::err_opt_not_valid_without_opt) << A->getAsString(Args)
+<< "-fomit-frame-pointer"
+<< " or with -fno-omit-frame-pointer.";
+  }
+} else if (Args.hasArg(options::OPT_ffixed_r11)) {
+Arg *A = Args.getLastArg(options::OPT_ffixed_r11);
+D.Diag(diag::err_opt_not_valid_without_opt) << A->getAsString(Args)
+<< "-fomit-frame-pointer"
+<< " or with -fno-omit-frame-pointer.";
+}
+  }
+
+// Reservation of general purpose registers.
+#define HANDLE_FFIXED_R(n) \
+  if (Args.hasArg(options::OPT_ffixed_r##n)) \
+Features.push_back("+reserve-r" #n)
+  HANDLE_FFIXED_R(5);
+  HANDLE_FFIXED_R(6);
+  HANDLE_FFIXED_R(7);
+  HANDLE_FFIXED_R(8);
+  HANDLE_FFIXED_R(9);
+  HANDLE_FFIXED_R(10);
+  HANDLE_FFIXED_R(11);
 
   // The kext linker doesn't know how to deal with movw/movt.
   if (KernelOrKext || Args.hasArg(options::OPT_mno_movt))
Index: lib/Basic/Targets/ARM.h
===
--- lib/Basic/Targets/ARM.h
+++ lib/

[PATCH] D51866: [analyzer][UninitializedObjectChecker] New flag to ignore guarded uninitialized fields

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

Ping^2


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

https://reviews.llvm.org/D51866



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


[PATCH] D55083: Re-arrange content in FunctionDecl dump

2019-01-15 Thread Stephen Kelly via Phabricator via cfe-commits
steveire marked an inline comment as done.
steveire added inline comments.



Comment at: test/AST/ast-dump-funcs.cpp:59
   // CHECK: CXXMethodDecl 0x{{[^ ]*}}  col:8 f 
'void (float, int)'
+  // CHECK-NEXT: Overrides: [ 0x{{[^ ]*}} S::f 'void (float, int)' ]
   // CHECK-NEXT: ParmVarDecl 0x{{[^ ]*}}  col:15 'float'

aaron.ballman wrote:
> I don't think this belongs at the start of the function -- the parameter 
> information seems far more interesting than what the method overrides.
Output does not occur in order of 'interesting-ness'.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55083



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


[PATCH] D55256: [clangd] Support clang-tidy configuration in clangd.

2019-01-15 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Nice! I think we should get to `.clang-tidy` files subsequently, but this is a 
great start and allows us to hook up the right set of checks in other 
environments.




Comment at: clangd/ClangdLSPServer.h:132
 
-  RealFileSystemProvider FSProvider;
   /// Options used for code completion

ilya-biryukov wrote:
> Could we instead call `getRealFS()` when we try to initialize a clang-tidy 
> options provider in `main()` and avoid changing this?
> To avoid adding extra non-real-fs "modes of operation" to `ClangdLSPServer`. 
> Unless you see other uses for this.
We already have out-of-tree modifications to ClangdLSPServer to use non-real 
FSes.
Given that, I think this change is OK... though better still might be to move 
it into `ClangdServer::Options`



Comment at: clangd/ClangdUnit.cpp:136
 auto *ExistingCallbacks = PP.getPPCallbacks();
+// Don't reply preamble if we don't run any clang-tidy checks without
+// PPCallbacks.

I have a hard time understanding this comment.
`No need to replay events if nobody is listening`?



Comment at: clangd/ClangdUnit.cpp:274
 CTContext.emplace(llvm::make_unique(
-tidy::ClangTidyGlobalOptions(), CTOpts));
+tidy::ClangTidyGlobalOptions(), ClangTidyOpts));
 CTContext->setDiagnosticsEngine(&Clang->getDiagnostics());

this is a copy



Comment at: clangd/ClangdUnit.cpp:540
   
llvm::MemoryBuffer::getMemBufferCopy(Inputs.Contents),
-  PCHs, std::move(VFS));
+  PCHs, std::move(VFS), Inputs.ClangTidyOpts);
 }

this is a copy



Comment at: clangd/ClangdUnit.h:83
+IntrusiveRefCntPtr VFS,
+tidy::ClangTidyOptions ClangTidyOpts);
 

Passing by value is OK here if deliberate, but let's try to avoid too many 
random copies below.



Comment at: clangd/tool/ClangdMain.cpp:204
 
+static llvm::cl::opt ClangTidyChecks(
+"clang-tidy-checks",

Maybe add a TODO or FIXME to respect .clang-tidy files?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D55256



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


[PATCH] D56680: [Tooling] Make clang-tool find libc++ dir on mac when running on a file without compilation database.

2019-01-15 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56680



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


[PATCH] D49466: Initial implementation of -fmacro-prefix-map and -ffile-prefix-map

2019-01-15 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

As discussed with dankm on IRC, I still would like to see the correct behavior 
going into 8.0, i.e. not change it later. Since this also matters for potential 
faster implementations later, it seems like a good idea to do it now. The 
changes are well-localized.

(1) Do path prefix matching and not string prefix matching. The difference is 
that the file name must be longer than the prefix and the prefix must be 
followed by a path separator.
(2) The longest prefix match wins. Substituation is applied only once per file 
name, independent of the rules. This gives more predictable output and allows 
switching to a tree-lookup later.


Repository:
  rC Clang

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

https://reviews.llvm.org/D49466



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


Re: r351172 - [ASTDump] NFC: Move dump of type nodes to NodeDumper

2019-01-15 Thread Aaron Ballman via cfe-commits
On Tue, Jan 15, 2019 at 4:33 AM Stephen Kelly via cfe-commits
 wrote:
>
> Author: steveire
> Date: Tue Jan 15 01:30:00 2019
> New Revision: 351172
>
> URL: http://llvm.org/viewvc/llvm-project?rev=351172&view=rev
> Log:
> [ASTDump] NFC: Move dump of type nodes to NodeDumper
>
> Reviewers: aaron.ballman
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D56642
>
> Modified:
> cfe/trunk/include/clang/AST/TextNodeDumper.h
> cfe/trunk/lib/AST/ASTDumper.cpp
> cfe/trunk/lib/AST/TextNodeDumper.cpp
>
> Modified: cfe/trunk/include/clang/AST/TextNodeDumper.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TextNodeDumper.h?rev=351172&r1=351171&r2=351172&view=diff
> ==
> --- cfe/trunk/include/clang/AST/TextNodeDumper.h (original)
> +++ cfe/trunk/include/clang/AST/TextNodeDumper.h Tue Jan 15 01:30:00 2019
> @@ -22,6 +22,7 @@
>  #include "clang/AST/ExprCXX.h"
>  #include "clang/AST/StmtVisitor.h"
>  #include "clang/AST/TemplateArgumentVisitor.h"
> +#include "clang/AST/TypeVisitor.h"
>
>  namespace clang {
>
> @@ -127,7 +128,8 @@ class TextNodeDumper
> const comments::FullComment *>,
>public ConstAttrVisitor,
>public ConstTemplateArgumentVisitor,
> -  public ConstStmtVisitor {
> +  public ConstStmtVisitor,
> +  public TypeVisitor {
>raw_ostream &OS;
>const bool ShowColors;
>
> @@ -259,6 +261,26 @@ public:
>void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node);
>void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node);
>
> +  void VisitRValueReferenceType(const ReferenceType *T);
> +  void VisitArrayType(const ArrayType *T);
> +  void VisitConstantArrayType(const ConstantArrayType *T);
> +  void VisitVariableArrayType(const VariableArrayType *T);
> +  void VisitDependentSizedArrayType(const DependentSizedArrayType *T);
> +  void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType 
> *T);
> +  void VisitVectorType(const VectorType *T);
> +  void VisitFunctionType(const FunctionType *T);
> +  void VisitFunctionProtoType(const FunctionProtoType *T);
> +  void VisitUnresolvedUsingType(const UnresolvedUsingType *T);
> +  void VisitTypedefType(const TypedefType *T);
> +  void VisitUnaryTransformType(const UnaryTransformType *T);
> +  void VisitTagType(const TagType *T);
> +  void VisitTemplateTypeParmType(const TemplateTypeParmType *T);
> +  void VisitAutoType(const AutoType *T);
> +  void VisitTemplateSpecializationType(const TemplateSpecializationType *T);
> +  void VisitInjectedClassNameType(const InjectedClassNameType *T);
> +  void VisitObjCInterfaceType(const ObjCInterfaceType *T);
> +  void VisitPackExpansionType(const PackExpansionType *T);
> +
>  private:
>void dumpCXXTemporary(const CXXTemporary *Temporary);
>  };
>
> Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351172&r1=351171&r2=351172&view=diff
> ==
> --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDumper.cpp Tue Jan 15 01:30:00 2019
> @@ -134,99 +134,39 @@ namespace  {
>  void VisitReferenceType(const ReferenceType *T) {
>dumpTypeAsChild(T->getPointeeType());
>  }
> -void VisitRValueReferenceType(const ReferenceType *T) {
> -  if (T->isSpelledAsLValue())
> -OS << " written as lvalue reference";
> -  VisitReferenceType(T);
> -}
>  void VisitMemberPointerType(const MemberPointerType *T) {
>dumpTypeAsChild(T->getClass());
>dumpTypeAsChild(T->getPointeeType());
>  }
>  void VisitArrayType(const ArrayType *T) {
> -  switch (T->getSizeModifier()) {
> -case ArrayType::Normal: break;
> -case ArrayType::Static: OS << " static"; break;
> -case ArrayType::Star: OS << " *"; break;
> -  }
> -  OS << " " << T->getIndexTypeQualifiers().getAsString();
>dumpTypeAsChild(T->getElementType());
>  }
> -void VisitConstantArrayType(const ConstantArrayType *T) {
> -  OS << " " << T->getSize();
> -  VisitArrayType(T);
> -}
>  void VisitVariableArrayType(const VariableArrayType *T) {
> -  OS << " ";
> -  NodeDumper.dumpSourceRange(T->getBracketsRange());
>VisitArrayType(T);
>dumpStmt(T->getSizeExpr());
>  }
>  void VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
> -  switch (T->getSizeModifier()) {
> -case ArrayType::Normal: break;
> -case ArrayType::Static: OS << " static"; break;
> -case ArrayType::Star: OS << " *"; break;
> -  }
> -  OS << " " << T->getIndexTypeQualifiers().getAsString();
> -  OS << " ";
> -  NodeDumper.dumpSourceRange(T->getBracketsRange());
>dumpTypeAsChild(T->getElementType());
>dumpStmt(T->getSi

Re: r351175 - NFC: Move Decl node handling to TextNodeDumper

2019-01-15 Thread Aaron Ballman via cfe-commits
On Tue, Jan 15, 2019 at 4:39 AM Stephen Kelly via cfe-commits
 wrote:
>
> Author: steveire
> Date: Tue Jan 15 01:35:52 2019
> New Revision: 351175
>
> URL: http://llvm.org/viewvc/llvm-project?rev=351175&view=rev
> Log:
> NFC: Move Decl node handling to TextNodeDumper
>
> Reviewers: aaron.ballman
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D56643
>
> Modified:
> cfe/trunk/include/clang/AST/TextNodeDumper.h
> cfe/trunk/lib/AST/ASTDumper.cpp
> cfe/trunk/lib/AST/TextNodeDumper.cpp
>
> Modified: cfe/trunk/include/clang/AST/TextNodeDumper.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TextNodeDumper.h?rev=351175&r1=351174&r2=351175&view=diff
> ==
> --- cfe/trunk/include/clang/AST/TextNodeDumper.h (original)
> +++ cfe/trunk/include/clang/AST/TextNodeDumper.h Tue Jan 15 01:35:52 2019
> @@ -165,6 +165,8 @@ public:
>
>void Visit(QualType T);
>
> +  void Visit(const Decl *D);
> +
>void dumpPointer(const void *Ptr);
>void dumpLocation(SourceLocation Loc);
>void dumpSourceRange(SourceRange R);
>
> Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351175&r1=351174&r2=351175&view=diff
> ==
> --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDumper.cpp Tue Jan 15 01:35:52 2019
> @@ -435,35 +435,6 @@ void ASTDumper::dumpAttr(const Attr *A)
>});
>  }
>
> -static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
> -
> -template
> -static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable *D) {
> -  const T *First = D->getFirstDecl();
> -  if (First != D)
> -OS << " first " << First;
> -}
> -
> -template
> -static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable *D) {
> -  const T *Prev = D->getPreviousDecl();
> -  if (Prev)
> -OS << " prev " << Prev;
> -}
> -
> -/// Dump the previous declaration in the redeclaration chain for a 
> declaration,
> -/// if any.
> -static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
> -  switch (D->getKind()) {
> -#define DECL(DERIVED, BASE) \
> -  case Decl::DERIVED: \
> -return dumpPreviousDeclImpl(OS, cast(D));
> -#define ABSTRACT_DECL(DECL)
> -#include "clang/AST/DeclNodes.inc"
> -  }
> -  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
> -}
> -
>  
> //===--===//
>  //  C++ Utilities
>  
> //===--===//
> @@ -536,46 +507,9 @@ void ASTDumper::dumpObjCTypeParamList(co
>
>  void ASTDumper::dumpDecl(const Decl *D) {
>dumpChild([=] {
> -if (!D) {
> -  ColorScope Color(OS, ShowColors, NullColor);
> -  OS << "<<>>";
> +NodeDumper.Visit(D);
> +if (!D)
>return;
> -}
> -
> -{
> -  ColorScope Color(OS, ShowColors, DeclKindNameColor);
> -  OS << D->getDeclKindName() << "Decl";
> -}
> -NodeDumper.dumpPointer(D);
> -if (D->getLexicalDeclContext() != D->getDeclContext())
> -  OS << " parent " << cast(D->getDeclContext());
> -dumpPreviousDecl(OS, D);
> -NodeDumper.dumpSourceRange(D->getSourceRange());
> -OS << ' ';
> -NodeDumper.dumpLocation(D->getLocation());
> -if (D->isFromASTFile())
> -  OS << " imported";
> -if (Module *M = D->getOwningModule())
> -  OS << " in " << M->getFullModuleName();
> -if (auto *ND = dyn_cast(D))
> -  for (Module *M : D->getASTContext().getModulesWithMergedDefinition(
> -   const_cast(ND)))
> -dumpChild([=] { OS << "also in " << M->getFullModuleName(); });
> -if (const NamedDecl *ND = dyn_cast(D))

This wasn't switched over to `const auto *` as asked for in the review.

> -  if (ND->isHidden())
> -OS << " hidden";
> -if (D->isImplicit())
> -  OS << " implicit";
> -if (D->isUsed())
> -  OS << " used";
> -else if (D->isThisDeclarationReferenced())
> -  OS << " referenced";
> -if (D->isInvalidDecl())
> -  OS << " invalid";
> -if (const FunctionDecl *FD = dyn_cast(D))
> -  if (FD->isConstexpr())
> -OS << " constexpr";
> -
>
>  ConstDeclVisitor::Visit(D);
>
>
> Modified: cfe/trunk/lib/AST/TextNodeDumper.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TextNodeDumper.cpp?rev=351175&r1=351174&r2=351175&view=diff
> ==
> --- cfe/trunk/lib/AST/TextNodeDumper.cpp (original)
> +++ cfe/trunk/lib/AST/TextNodeDumper.cpp Tue Jan 15 01:35:52 2019
> @@ -12,11 +12,42 @@
>  
> //===--===//
>
>  #include "clang/AST/TextNodeDumper.h"
> +#include "clang/AST/DeclFriend.h"
> +#include "clang/AST/DeclOpenMP.h"
>  #include "cl

Re: r351160 - [X86] Make _xgetbv/_xsetbv on non-windows platforms

2019-01-15 Thread Benjamin Kramer via cfe-commits
I'm seeing breakages on v8 with this, it defines its own _xgetbv. Any ideas
what do do about this?

https://chromium.googlesource.com/v8/v8.git/+/master/src/x64/assembler-x64.cc#36

src/x64/assembler-x64.cc:35:1: error: inline variables are incompatible
with C++ standards before C++17 [-Werror,-Wc++98-c++11-c++14-compat]
V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
^
include/v8config.h:294:20: note: expanded from macro 'V8_INLINE'
# define V8_INLINE inline __attribute__((always_inline))
   ^
src/x64/assembler-x64.cc:35:41: error: expected ')'
V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
^
src/x64/assembler-x64.cc:35:20: note: to match this '('
V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
   ^
lib/clang/include/xsaveintrin.h:49:53: note: expanded from macro '_xgetbv'
#define _xgetbv(A) __builtin_ia32_xgetbv((long long)(A))

On Tue, Jan 15, 2019 at 6:06 AM Craig Topper via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ctopper
> Date: Mon Jan 14 21:03:18 2019
> New Revision: 351160
>
> URL: http://llvm.org/viewvc/llvm-project?rev=351160&view=rev
> Log:
> [X86] Make _xgetbv/_xsetbv on non-windows platforms
>
> Summary:
> This patch attempts to redo what was tried in r278783, but was reverted.
>
> These intrinsics should be available on non-windows platforms with "xsave"
> feature check. But on Windows platforms they shouldn't have feature check
> since that's how MSVC behaves.
>
> To accomplish this I've added a MS builtin with no feature check. And a
> normal gcc builtin with a feature check. When _MSC_VER is not defined
> _xgetbv/_xsetbv will be macros pointing to the gcc builtin name.
>
> I've moved the forward declarations from intrin.h to immintrin.h to match
> the MSDN documentation and used that as the header file for the MS builtin.
>
> I'm not super happy with this implementation, and I'm open to suggestions
> for better ways to do it.
>
> Reviewers: rnk, RKSimon, spatel
>
> Reviewed By: rnk
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D56686
>
> Modified:
> cfe/trunk/include/clang/Basic/BuiltinsX86.def
> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> cfe/trunk/lib/Headers/immintrin.h
> cfe/trunk/lib/Headers/intrin.h
> cfe/trunk/lib/Headers/xsaveintrin.h
> cfe/trunk/test/CodeGen/builtins-x86.c
> cfe/trunk/test/CodeGen/x86_32-xsave.c
> cfe/trunk/test/CodeGen/x86_64-xsave.c
> cfe/trunk/test/Headers/ms-intrin.cpp
>
> Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=351160&r1=351159&r2=351160&view=diff
>
> ==
> --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
> +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Jan 14 21:03:18 2019
> @@ -693,6 +693,10 @@ TARGET_BUILTIN(__builtin_ia32_fxsave, "v
>  // XSAVE
>  TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "n", "xsave")
>  TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "n", "xsave")
> +TARGET_BUILTIN(__builtin_ia32_xgetbv, "ULLiUi", "n", "xsave")
> +TARGET_HEADER_BUILTIN(_xgetbv, "UWiUi", "nh", "immintrin.h",
> ALL_MS_LANGUAGES, "")
> +TARGET_BUILTIN(__builtin_ia32_xsetbv, "vUiULLi", "n", "xsave")
> +TARGET_HEADER_BUILTIN(_xsetbv, "vUiUWi", "nh", "immintrin.h",
> ALL_MS_LANGUAGES, "")
>  TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "n", "xsaveopt")
>  TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "n", "xsaves")
>  TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "n", "xsavec")
>
> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=351160&r1=351159&r2=351160&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Jan 14 21:03:18 2019
> @@ -9831,7 +9831,9 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>case X86::BI__builtin_ia32_xsavec:
>case X86::BI__builtin_ia32_xsavec64:
>case X86::BI__builtin_ia32_xsaves:
> -  case X86::BI__builtin_ia32_xsaves64: {
> +  case X86::BI__builtin_ia32_xsaves64:
> +  case X86::BI__builtin_ia32_xsetbv:
> +  case X86::BI_xsetbv: {
>  Intrinsic::ID ID;
>  #define INTRINSIC_X86_XSAVE_ID(NAME) \
>  case X86::BI__builtin_ia32_##NAME: \
> @@ -9851,6 +9853,10 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>  INTRINSIC_X86_XSAVE_ID(xsavec64);
>  INTRINSIC_X86_XSAVE_ID(xsaves);
>  INTRINSIC_X86_XSAVE_ID(xsaves64);
> +INTRINSIC_X86_XSAVE_ID(xsetbv);
> +case X86::BI_xsetbv:
> +  ID = Intrinsic::x86_xsetbv;
> +  break;
>  }
>  #undef INTRINSIC_X86_XSAVE_ID
>  Value *Mhi = Builder.CreateTrunc(
> @@ -9860,6 +9866,9 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>  Ops.push_back(Mlo);
>  return Builder.CreateCall(CGM.getIn

[PATCH] D56718: [clangd] Update docs to mention YCM integration and new LSP features

2019-01-15 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ioeric, 
ilya-biryukov.

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D56718

Files:
  docs/clangd.rst


Index: docs/clangd.rst
===
--- docs/clangd.rst
+++ docs/clangd.rst
@@ -77,35 +77,35 @@
 +-++--+
 | Source hover| Yes|   Yes|
 +-++--+
-| Find References | Yes|   No |
-+-++--+
-| Code Lens   | Yes|   No |
+| Find References | Yes|   Yes|
 +-++--+
 | Document Symbols| Yes|   Yes|
 +-++--+
 | Workspace Symbols   | Yes|   Yes|
 +-++--+
-| Syntax and Semantic Coloring| No |   No |
+| Code Lens   | Yes|   No |
 +-++--+
-| Code folding| No |   No |
+| Code folding| Yes|   No |
 +-++--+
-| Call hierarchy  | No |   No |
+| Extract Local Variable  | Yes|   No |
 +-++--+
-| Type hierarchy  | No |   No |
+| Extract Function/Method | Yes|   No |
 +-++--+
-| Organize Includes   | No |   No |
+| Quick Assist| Yes|   No |
 +-++--+
-| Quick Assist| No |   No |
+| Hide Method | Yes|   No |
 +-++--+
-| Extract Local Variable  | No |   No |
+| Implement Method| Yes|   No |
 +-++--+
-| Extract Function/Method | No |   No |
+| Gen. Getters/Setters| Yes|   No |
 +-++--+
-| Hide Method | No |   No |
+| Syntax and Semantic Coloring| No |   No |
 +-++--+
-| Implement Method| No |   No |
+| Call hierarchy  | No |   No |
 +-++--+
-| Gen. Getters/Setters| No |   No |
+| Type hierarchy  | No |   No |
++-++--+
+| Organize Includes   | No |   No |
 +-++--+
 
 Editor Integration
@@ -119,6 +119,15 @@
 Vim Integration
 ---
 
+YouCompleteMe
+~
+
+One of the options of using :program:`Clangd` in :program:`vim` is to utilize
+`YouCompleteMe
+`_ plugin. Please see the
+`Installation section on your OS
+`_ for instructions.
+
 LanguageClient-neovim
 ~
 


Index: docs/clangd.rst
===
--- docs/clangd.rst
+++ docs/clangd.rst
@@ -77,35 +77,35 @@
 +-++--+
 | Source hover| Yes|   Yes|
 +-++--+
-| Find References | Yes|   No |
-+-++--+
-| Code Lens   | Yes|   No |
+| Find References | Yes|   Yes|
 +-++--+
 | Document Symbols| Yes|   Yes|
 +-++--+
 | Workspace Symbols   | Yes|   Yes|
 +-++--+
-| Syntax and Semantic Coloring| No |   No |
+| Code Lens   | Yes|   No |
 +-++--+
-| Co

[clang-tools-extra] r351194 - Update year in license files

2019-01-15 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Jan 15 07:10:32 2019
New Revision: 351194

URL: http://llvm.org/viewvc/llvm-project?rev=351194&view=rev
Log:
Update year in license files

In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

Modified:
clang-tools-extra/trunk/LICENSE.TXT
clang-tools-extra/trunk/clangd/clients/clangd-vscode/LICENSE

Modified: clang-tools-extra/trunk/LICENSE.TXT
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/LICENSE.TXT?rev=351194&r1=351193&r2=351194&view=diff
==
--- clang-tools-extra/trunk/LICENSE.TXT (original)
+++ clang-tools-extra/trunk/LICENSE.TXT Tue Jan 15 07:10:32 2019
@@ -4,7 +4,7 @@ LLVM Release License
 University of Illinois/NCSA
 Open Source License
 
-Copyright (c) 2007-2018 University of Illinois at Urbana-Champaign.
+Copyright (c) 2007-2019 University of Illinois at Urbana-Champaign.
 All rights reserved.
 
 Developed by:

Modified: clang-tools-extra/trunk/clangd/clients/clangd-vscode/LICENSE
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/clients/clangd-vscode/LICENSE?rev=351194&r1=351193&r2=351194&view=diff
==
--- clang-tools-extra/trunk/clangd/clients/clangd-vscode/LICENSE (original)
+++ clang-tools-extra/trunk/clangd/clients/clangd-vscode/LICENSE Tue Jan 15 
07:10:32 2019
@@ -1,6 +1,6 @@
 The MIT License (MIT)
 
-Copyright (c) 2017 The LLVM Developers
+Copyright (c) 2019 The LLVM Developers
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal


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


[libunwind] r351194 - Update year in license files

2019-01-15 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Jan 15 07:10:32 2019
New Revision: 351194

URL: http://llvm.org/viewvc/llvm-project?rev=351194&view=rev
Log:
Update year in license files

In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

Modified:
libunwind/trunk/LICENSE.TXT

Modified: libunwind/trunk/LICENSE.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/LICENSE.TXT?rev=351194&r1=351193&r2=351194&view=diff
==
--- libunwind/trunk/LICENSE.TXT (original)
+++ libunwind/trunk/LICENSE.TXT Tue Jan 15 07:10:32 2019
@@ -14,7 +14,7 @@ Full text of the relevant licenses is in
 University of Illinois/NCSA
 Open Source License
 
-Copyright (c) 2009-2018 by the contributors listed in CREDITS.TXT
+Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT
 
 All rights reserved.
 


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


[libclc] r351194 - Update year in license files

2019-01-15 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Jan 15 07:10:32 2019
New Revision: 351194

URL: http://llvm.org/viewvc/llvm-project?rev=351194&view=rev
Log:
Update year in license files

In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

Modified:
libclc/trunk/LICENSE.TXT

Modified: libclc/trunk/LICENSE.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/LICENSE.TXT?rev=351194&r1=351193&r2=351194&view=diff
==
--- libclc/trunk/LICENSE.TXT (original)
+++ libclc/trunk/LICENSE.TXT Tue Jan 15 07:10:32 2019
@@ -11,7 +11,7 @@ Full text of the relevant licenses is in
 
 ==
 
-Copyright (c) 2011-2018 by the contributors listed in CREDITS.TXT
+Copyright (c) 2011-2019 by the contributors listed in CREDITS.TXT
 
 All rights reserved.
 


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


r351194 - Update year in license files

2019-01-15 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Jan 15 07:10:32 2019
New Revision: 351194

URL: http://llvm.org/viewvc/llvm-project?rev=351194&view=rev
Log:
Update year in license files

In last year's update (D48219) it was suggested that the release manager
might want to do this, so here we go.

Modified:
cfe/trunk/LICENSE.TXT

Modified: cfe/trunk/LICENSE.TXT
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/LICENSE.TXT?rev=351194&r1=351193&r2=351194&view=diff
==
--- cfe/trunk/LICENSE.TXT (original)
+++ cfe/trunk/LICENSE.TXT Tue Jan 15 07:10:32 2019
@@ -4,7 +4,7 @@ LLVM Release License
 University of Illinois/NCSA
 Open Source License
 
-Copyright (c) 2007-2018 University of Illinois at Urbana-Champaign.
+Copyright (c) 2007-2019 University of Illinois at Urbana-Champaign.
 All rights reserved.
 
 Developed by:


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


r351196 - Reduce ASTMatchers stack footprint. Addresses http://llvm.org/PR38851

2019-01-15 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Jan 15 07:34:26 2019
New Revision: 351196

URL: http://llvm.org/viewvc/llvm-project?rev=351196&view=rev
Log:
Reduce ASTMatchers stack footprint. Addresses http://llvm.org/PR38851

The BoundNodesTreeBuilder class is used both directly and indirectly as a local
variable in matchesAncestorOfRecursively, memoizedMatchesAncestorOfRecursively
and other functions that happen to be on long recursive call paths. By reducing
the inline storage size of the SmallVector we dramatically reduce the stack
requirements of ASTMatchers. Running clang-tidy with a large number of checks
enabled on a few arbitrarily chosen files show no performance regression.

Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=351196&r1=351195&r2=351196&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Tue Jan 15 
07:34:26 2019
@@ -261,7 +261,7 @@ public:
   }
 
 private:
-  SmallVector Bindings;
+  SmallVector Bindings;
 };
 
 class ASTMatchFinder;


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


[PATCH] D56723: [CodeComplete] Propagate preferred types through parser in more cases

2019-01-15 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov created this revision.
ilya-biryukov added reviewers: kadircet, rsmith.

Preferred types are used by code completion for ranking. This commit
considerably increases the number of points in code where those types
are propagated.

In order to avoid complicating signatures of Parser's methods, a
preferred type is kept as a member variable in the parser and updated
during parsing.


Repository:
  rC Clang

https://reviews.llvm.org/D56723

Files:
  include/clang/Parse/Parser.h
  include/clang/Sema/CodeCompleteConsumer.h
  include/clang/Sema/Sema.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseExpr.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Parse/ParseInit.cpp
  lib/Parse/ParseStmt.cpp
  lib/Parse/ParseTemplate.cpp
  lib/Sema/SemaCodeComplete.cpp
  unittests/Sema/CodeCompleteTest.cpp

Index: unittests/Sema/CodeCompleteTest.cpp
===
--- unittests/Sema/CodeCompleteTest.cpp
+++ unittests/Sema/CodeCompleteTest.cpp
@@ -340,4 +340,96 @@
   EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
 }
 
+TEST(PreferredTypeTest, Members) {
+  StringRef Code = R"cpp(
+struct vector {
+  int *begin();
+  vector clone();
+};
+
+void test(int *a) {
+  a = ^vector().^clone().^begin();
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("int *"));
+}
+
+TEST(PreferredTypeTest, Conditions) {
+  StringRef Code = R"cpp(
+struct vector {
+  bool empty();
+};
+
+void test() {
+  if (^vector().^empty()) {}
+  while (^vector().^empty()) {}
+  for (; ^vector().^empty();) {}
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("_Bool"));
+}
+
+TEST(PreferredTypeTest, InitAndAssignment) {
+  StringRef Code = R"cpp(
+struct vector {
+  int* begin();
+};
+
+void test() {
+  const int* x = ^vector().^begin();
+  x = ^vector().^begin();
+
+  if (const int* y = ^vector().^begin()) {}
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("const int *"));
+}
+
+TEST(PreferredTypeTest, UnaryExprs) {
+  StringRef Code = R"cpp(
+void test(long long a) {
+  a = +^a;
+  a = -^a
+  a = ++^a;
+  a = --^a;
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("long long"));
+
+  Code = R"cpp(
+void test(int a, int *ptr) {
+  !^a;
+  !^ptr;
+  !!!^a;
+
+  a = !^a;
+  a = !^ptr;
+  a = !!!^a;
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("_Bool"));
+
+  Code = R"cpp(
+void test(int a) {
+  const int* x = &^a;
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("const int"));
+
+  Code = R"cpp(
+void test(int *a) {
+  int x = *^a;
+  int &r = *^a;
+}
+  )cpp";
+  EXPECT_THAT(collectPreferredTypes(Code), Each("int *"));
+
+  Code = R"cpp(
+void test(int a) {
+  *^a;
+  &^a;
+}
+
+  )cpp";
+}
 } // namespace
Index: lib/Sema/SemaCodeComplete.cpp
===
--- lib/Sema/SemaCodeComplete.cpp
+++ lib/Sema/SemaCodeComplete.cpp
@@ -348,6 +348,180 @@
 };
 } // namespace
 
+PreferredTypeBuilder::RestoreRAII
+PreferredTypeBuilder::update(llvm::function_ref Updater) {
+  RestoreRAII R(*this);
+  Updater();
+  return R;
+}
+
+PreferredTypeBuilder::RestoreRAII PreferredTypeBuilder::enterReturn(Sema &S) {
+  return update([&]() {
+if (isa(S.CurContext)) {
+  if (sema::BlockScopeInfo *BSI = S.getCurBlock())
+Type = BSI->ReturnType;
+  return;
+}
+if (const auto *Function = dyn_cast(S.CurContext)) {
+  Type = Function->getReturnType();
+  return;
+}
+if (const auto *Method = dyn_cast(S.CurContext)) {
+  Type = Method->getReturnType();
+  return;
+}
+Type = QualType();
+  });
+}
+
+PreferredTypeBuilder::RestoreRAII
+PreferredTypeBuilder::enterVariableInit(Decl *D) {
+  return update([&]() {
+auto *VD = llvm::dyn_cast_or_null(D);
+Type = VD ? VD->getType() : QualType();
+  });
+}
+
+static QualType getPreferredTypeOfBinaryRHS(Sema &S, Expr *LHS,
+tok::TokenKind Op) {
+  if (!LHS)
+return QualType();
+
+  QualType LHSType = LHS->getType();
+  if (LHSType->isPointerType()) {
+if (Op == tok::plus || Op == tok::plusequal || Op == tok::minusequal)
+  return S.getASTContext().getPointerDiffType();
+// Pointer difference is more common than subtracting an int from a pointer.
+if (Op == tok::minus)
+  return LHSType;
+  }
+
+  switch (Op) {
+  // No way to infer the type of RHS from LHS.
+  case tok::comma:
+return QualType();
+  // Prefer the type of the left operand for all of these.
+  // Arithmetic operations.
+  case tok::plus:
+  case tok::plusequal:
+  case tok::minus:
+  case tok::minusequal:
+  case tok::percent:
+  case tok::percentequal:
+  case tok::slash:
+  case tok::slashequal:
+  case tok::star:
+  case tok::starequal:
+  /

[PATCH] D56723: [CodeComplete] Propagate preferred types through parser in more cases

2019-01-15 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment.

@kadircet for preferred-type related bits.
@rsmith for parser-related bits. More specifically, (1) should we be worried 
that this might affect parser performance on the hot path and (2) whether there 
are better alternatives to do something like this.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56723



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


[PATCH] D55868: [Fixed Point Arithmetic] Fixed Point Addition Constant Expression Evaluation

2019-01-15 Thread Bevin Hansson via Phabricator via cfe-commits
ebevhan added inline comments.



Comment at: clang/lib/AST/ExprConstant.cpp:7568
 
+static bool EvaluateFixedPoint(const Expr *E, APValue &Result, EvalInfo &Info) 
{
+  if (E->getType()->isFixedPointType()) {

This could provide an APFixedPoint rather than APValue.



Comment at: clang/lib/AST/ExprConstant.cpp:7582
+
+static bool EvaluateFixedPointOrInteger(const Expr *E, APValue &Result,
+EvalInfo &Info) {

Technically, this will always produce an APFixedPoint so it doesn't really need 
to return APValue either.



Comment at: clang/lib/AST/ExprConstant.cpp:7584
+EvalInfo &Info) {
+  auto FXSema = Info.Ctx.getFixedPointSemantics(E->getType());
+  if (E->getType()->isIntegerType()) {

The semantic is not used in the fixed-point path.



Comment at: clang/lib/AST/ExprConstant.cpp:9927
   }
   return Success(-Value, E);
 }

I think I've mentioned this before, but just as a reminder; this doesn't 
perform correctly for saturation.



Comment at: clang/lib/AST/ExprConstant.cpp:9979
+APFixedPoint Result =
+LHSFX.getFixedPoint().add(RHSFX.getFixedPoint()).convert(ResultFXSema);
+return Success(Result, E);

Perhaps this should call HandleOverflow (or do something else) to signal that 
overflow occurred. HandleOverflow only seems to emit a note, though, but I 
think it should probably be a warning.

Maybe for casts as well? Might get double warnings then, though.



Comment at: clang/lib/Basic/FixedPoint.cpp:25
   bool Upscaling = DstScale > getScale();
+  bool Overflowed = false;
 

I think it's a bit cleaner if you avoid this variable and simply assign 
`Overflow` directly here, with the 'else' cases below replaced with `else if 
(Overflow)`.

That style isn't cleaner in `add` if you use the APInt add_ov functions though, 
so maybe it's better to keep it this way for consistency.



Comment at: clang/lib/Basic/FixedPoint.cpp:170
+Result = ThisVal + OtherVal;
+Overflowed = ThisVal.isSigned() ? Result.slt(ThisVal) : 
Result.ult(ThisVal);
+  }

You could use the add_ov functions here.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55868



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


[PATCH] D56661: [clang-tidy] Fix incorrect array name generation in cppcoreguidelines-pro-bounds-constant-array-index

2019-01-15 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

Thank you for working on this!

Could you please run the check over LLVM or any other significant codebase once 
you have the fix implemented and report if the transformation still breaks code?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56661



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


r351200 - Remove irrelevant references to legacy git repositories from

2019-01-15 Thread James Y Knight via cfe-commits
Author: jyknight
Date: Tue Jan 15 08:18:52 2019
New Revision: 351200

URL: http://llvm.org/viewvc/llvm-project?rev=351200&view=rev
Log:
Remove irrelevant references to legacy git repositories from
compiler identification lines in test-cases.

(Doing so only because it's then easier to search for references which
are actually important and need fixing.)

Modified:

cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif

Modified: 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif?rev=351200&r1=351199&r2=351200&view=diff
==
--- 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
 (original)
+++ 
cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
 Tue Jan 15 08:18:52 2019
@@ -106,7 +106,7 @@
 "fullName": "clang static analyzer",
 "language": "en-US",
 "name": "clang",
-"version": "clang version 8.0.0 
(https://github.com/llvm-project/clang.git 
a5ccb257a7a70928ede717a7c282f5fc8cbed310) 
(https://github.com/llvm-mirror/llvm.git 
73cebd79c512f7129eca16b0f3a7abd21d2881e8)"
+"version": "clang version 8.0.0"
   }
 }
   ],


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


[PATCH] D56728: Regression test case for r350891 [Correct the source range returned from preprocessor callbacks]

2019-01-15 Thread Jordan Rupprecht via Phabricator via cfe-commits
rupprecht created this revision.
rupprecht added a reviewer: aaron.ballman.
Herald added subscribers: cfe-commits, jsji, kbarton, nemanjai.

r350891 caused some internal failures that this test case exposes.


Repository:
  rC Clang

https://reviews.llvm.org/D56728

Files:
  unittests/Lex/PPCallbacksTest.cpp


Index: unittests/Lex/PPCallbacksTest.cpp
===
--- unittests/Lex/PPCallbacksTest.cpp
+++ unittests/Lex/PPCallbacksTest.cpp
@@ -483,6 +483,16 @@
   EXPECT_EQ(
   GetSourceStringToEnd(CharSourceRange(Results7[1].ConditionRange, false)),
   "defined(FLOOFY)");
+  const auto &Results8 =
+  DirectiveExprRange("#define FLOOFY 0\n#if __FILE__ > FLOOFY\n#endif\n");
+  EXPECT_EQ(Results8.size(), 1U);
+  EXPECT_EQ(
+  GetSourceStringToEnd(CharSourceRange(Results8[0].ConditionRange, false)),
+  "__FILE__ > FLOOFY");
+  EXPECT_EQ(
+  Lexer::getSourceText(CharSourceRange(Results8[0].ConditionRange, false),
+   SourceMgr, LangOpts),
+  "__FILE__ > FLOOFY");
 }
 
 } // namespace


Index: unittests/Lex/PPCallbacksTest.cpp
===
--- unittests/Lex/PPCallbacksTest.cpp
+++ unittests/Lex/PPCallbacksTest.cpp
@@ -483,6 +483,16 @@
   EXPECT_EQ(
   GetSourceStringToEnd(CharSourceRange(Results7[1].ConditionRange, false)),
   "defined(FLOOFY)");
+  const auto &Results8 =
+  DirectiveExprRange("#define FLOOFY 0\n#if __FILE__ > FLOOFY\n#endif\n");
+  EXPECT_EQ(Results8.size(), 1U);
+  EXPECT_EQ(
+  GetSourceStringToEnd(CharSourceRange(Results8[0].ConditionRange, false)),
+  "__FILE__ > FLOOFY");
+  EXPECT_EQ(
+  Lexer::getSourceText(CharSourceRange(Results8[0].ConditionRange, false),
+   SourceMgr, LangOpts),
+  "__FILE__ > FLOOFY");
 }
 
 } // namespace
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r351208 - Revert "Update clang-tools-extra for r350891 from Clang."

2019-01-15 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Tue Jan 15 09:20:04 2019
New Revision: 351208

URL: http://llvm.org/viewvc/llvm-project?rev=351208&view=rev
Log:
Revert "Update clang-tools-extra for r350891 from Clang."

This reverts commit r350892.

Modified:
clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.modularize
clang-tools-extra/trunk/test/pp-trace/pp-trace-conditional.cpp
clang-tools-extra/trunk/test/pp-trace/pp-trace-macro.cpp

Modified: 
clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.modularize
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.modularize?rev=351208&r1=351207&r2=351208&view=diff
==
--- clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.modularize 
(original)
+++ clang-tools-extra/trunk/test/modularize/ProblemsInconsistent.modularize Tue 
Jan 15 09:20:04 2019
@@ -60,6 +60,16 @@ Inputs/InconsistentHeader2.h
 # CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentHeader2.h
 # CHECK-NEXT:   {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h
 # CHECK-NEXT: (no macro definition)
+# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:11:2
+# CHECK-NEXT: #if SYMBOL == 1
+# CHECK-NEXT: ^
+# CHECK-NEXT: error: Conditional expression instance 'SYMBOL == 1' has 
different values in this header, depending on how it was included.
+# CHECK-NEXT:   'SYMBOL == 1' expanded to: 'true' with respect to these 
inclusion paths:
+# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentHeader1.h
+# CHECK-NEXT:   {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h
+# CHECK-NEXT:   'SYMBOL == 1' expanded to: 'false' with respect to these 
inclusion paths:
+# CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentHeader2.h
+# CHECK-NEXT:   {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h
 # CHECK-NEXT: {{.*}}{{[/\\]}}Inputs{{[/\\]}}InconsistentSubHeader.h:2:2
 # CHECK-NEXT: #ifdef SYMBOL1
 # CHECK-NEXT: ^

Modified: clang-tools-extra/trunk/test/pp-trace/pp-trace-conditional.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/pp-trace/pp-trace-conditional.cpp?rev=351208&r1=351207&r2=351208&view=diff
==
--- clang-tools-extra/trunk/test/pp-trace/pp-trace-conditional.cpp (original)
+++ clang-tools-extra/trunk/test/pp-trace/pp-trace-conditional.cpp Tue Jan 15 
09:20:04 2019
@@ -79,14 +79,14 @@
 // CHECK-NEXT:   MacroDirective: MD_Define
 // CHECK:  - Callback: If
 // CHECK-NEXT:   Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:2"
-// CHECK-NEXT:   ConditionRange: 
["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:5", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:5"]
+// CHECK-NEXT:   ConditionRange: 
["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:4", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:4:1"]
 // CHECK-NEXT:   ConditionValue: CVK_True
 // CHECK-NEXT: - Callback: Endif
 // CHECK-NEXT:   Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:4:2"
 // CHECK-NEXT:   IfLoc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:3:2"
 // CHECK-NEXT: - Callback: If
 // CHECK-NEXT:   Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:2"
-// CHECK-NEXT:   ConditionRange: 
["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:5", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:5"]
+// CHECK-NEXT:   ConditionRange: 
["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:4", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:7:1"]
 // CHECK-NEXT:   ConditionValue: CVK_False
 // CHECK-NEXT: - Callback: Endif
 // CHECK-NEXT:   Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:7:2"
@@ -95,7 +95,7 @@
 // CHECK-NEXT:   Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:6:1", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:7:2"]
 // CHECK-NEXT: - Callback: If
 // CHECK-NEXT:   Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:2"
-// CHECK-NEXT:   ConditionRange: 
["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:5", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:5"]
+// CHECK-NEXT:   ConditionRange: 
["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:9:4", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:10:1"]
 // CHECK-NEXT:   ConditionValue: CVK_True
 // CHECK-NEXT: - Callback: Else
 // CHECK-NEXT:   Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:10:2"
@@ -107,7 +107,7 @@
 // CHECK-NEXT:   Range: ["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:10:1", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:11:2"]
 // CHECK-NEXT: - Callback: If
 // CHECK-NEXT:   Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:2"
-// CHECK-NEXT:   ConditionRange: 
["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:5", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:5"]
+// CHECK-NEXT:   ConditionRange: 
["{{.*}}{{[/\\]}}pp-trace-conditional.cpp:13:4", 
"{{.*}}{{[/\\]}}pp-trace-conditional.cpp:14:1"]
 // CHECK-NEXT:   ConditionValue: CVK_False
 // CHECK-NEXT: - Callback: Else
 // CHECK-NEXT:   Loc: "{{.*}}{{[/\\]}}pp-trace-conditional.cpp:14:2"
@@ -119,11 +119,11 @@
 // CHECK-NEXT:   If

r351209 - Revert "Correct the source range returned from preprocessor callbacks."

2019-01-15 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Tue Jan 15 09:20:05 2019
New Revision: 351209

URL: http://llvm.org/viewvc/llvm-project?rev=351209&view=rev
Log:
Revert "Correct the source range returned from preprocessor callbacks."

This reverts commit r350891. Also add a test case that would return an
empty string with r350891.

Modified:
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/lib/Lex/PPExpressions.cpp
cfe/trunk/unittests/Lex/PPCallbacksTest.cpp

Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=351209&r1=351208&r2=351209&view=diff
==
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Tue Jan 15 09:20:05 2019
@@ -1816,8 +1816,8 @@ public:
   void CheckEndOfDirective(const char *DirType, bool EnableMacros = false);
 
   /// Read and discard all tokens remaining on the current line until
-  /// the tok::eod token is found. Returns the range of the skipped tokens.
-  SourceRange DiscardUntilEndOfDirective();
+  /// the tok::eod token is found.
+  void DiscardUntilEndOfDirective();
 
   /// Returns true if the preprocessor has seen a use of
   /// __DATE__ or __TIME__ in the file so far.
@@ -1982,9 +1982,6 @@ private:
 
 /// True if the expression contained identifiers that were undefined.
 bool IncludedUndefinedIds;
-
-/// The source range for the expression.
-SourceRange ExprRange;
   };
 
   /// Evaluate an integer constant expression that may occur after a

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=351209&r1=351208&r2=351209&view=diff
==
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Jan 15 09:20:05 2019
@@ -79,18 +79,12 @@ Preprocessor::AllocateVisibilityMacroDir
 
 /// Read and discard all tokens remaining on the current line until
 /// the tok::eod token is found.
-SourceRange Preprocessor::DiscardUntilEndOfDirective() {
+void Preprocessor::DiscardUntilEndOfDirective() {
   Token Tmp;
-  SourceRange Res;
-
-  LexUnexpandedToken(Tmp);
-  Res.setBegin(Tmp.getLocation());
-  while (Tmp.isNot(tok::eod)) {
-assert(Tmp.isNot(tok::eof) && "EOF seen while discarding directive 
tokens");
+  do {
 LexUnexpandedToken(Tmp);
-  }
-  Res.setEnd(Tmp.getLocation());
-  return Res;
+assert(Tmp.isNot(tok::eof) && "EOF seen while discarding directive 
tokens");
+  } while (Tmp.isNot(tok::eod));
 }
 
 /// Enumerates possible cases of #define/#undef a reserved identifier.
@@ -544,19 +538,19 @@ void Preprocessor::SkipExcludedCondition
 if (CondInfo.WasSkipping || CondInfo.FoundNonSkip) {
   DiscardUntilEndOfDirective();
 } else {
+  const SourceLocation CondBegin = CurPPLexer->getSourceLocation();
   // Restore the value of LexingRawMode so that identifiers are
   // looked up, etc, inside the #elif expression.
   assert(CurPPLexer->LexingRawMode && "We have to be skipping here!");
   CurPPLexer->LexingRawMode = false;
   IdentifierInfo *IfNDefMacro = nullptr;
-  DirectiveEvalResult DER = EvaluateDirectiveExpression(IfNDefMacro);
-  const bool CondValue = DER.Conditional;
+  const bool CondValue = 
EvaluateDirectiveExpression(IfNDefMacro).Conditional;
   CurPPLexer->LexingRawMode = true;
   if (Callbacks) {
-Callbacks->Elif(
-Tok.getLocation(), DER.ExprRange,
-(CondValue ? PPCallbacks::CVK_True : PPCallbacks::CVK_False),
-CondInfo.IfLoc);
+const SourceLocation CondEnd = CurPPLexer->getSourceLocation();
+Callbacks->Elif(Tok.getLocation(),
+SourceRange(CondBegin, CondEnd),
+(CondValue ? PPCallbacks::CVK_True : 
PPCallbacks::CVK_False), CondInfo.IfLoc);
   }
   // If this condition is true, enter it!
   if (CondValue) {
@@ -1122,24 +1116,19 @@ void Preprocessor::HandleLineDirective()
 ; // ok
   else if (StrTok.isNot(tok::string_literal)) {
 Diag(StrTok, diag::err_pp_line_invalid_filename);
-DiscardUntilEndOfDirective();
-return;
+return DiscardUntilEndOfDirective();
   } else if (StrTok.hasUDSuffix()) {
 Diag(StrTok, diag::err_invalid_string_udl);
-DiscardUntilEndOfDirective();
-return;
+return DiscardUntilEndOfDirective();
   } else {
 // Parse and validate the string, converting it into a unique ID.
 StringLiteralParser Literal(StrTok, *this);
 assert(Literal.isAscii() && "Didn't allow wide strings in");
-if (Literal.hadError) {
-  DiscardUntilEndOfDirective();
-  return;
-}
+if (Literal.hadError)
+ 

Re: r350891 - Correct the source range returned from preprocessor callbacks.

2019-01-15 Thread Benjamin Kramer via cfe-commits
With this patch some ranges just come back empty. I rolled the change back
in r351209, which also includes a test case that shows the empty ranges
with this patch.

On Thu, Jan 10, 2019 at 10:26 PM Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: aaronballman
> Date: Thu Jan 10 13:22:13 2019
> New Revision: 350891
>
> URL: http://llvm.org/viewvc/llvm-project?rev=350891&view=rev
> Log:
> Correct the source range returned from preprocessor callbacks.
>
> This adjusts the source range passed in to the preprocessor callbacks to
> only include the condition range itself, rather than all of the
> conditionally skipped tokens.
>
> Modified:
> cfe/trunk/include/clang/Lex/Preprocessor.h
> cfe/trunk/lib/Lex/PPDirectives.cpp
> cfe/trunk/lib/Lex/PPExpressions.cpp
> cfe/trunk/unittests/Lex/PPCallbacksTest.cpp
>
> Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=350891&r1=350890&r2=350891&view=diff
>
> ==
> --- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
> +++ cfe/trunk/include/clang/Lex/Preprocessor.h Thu Jan 10 13:22:13 2019
> @@ -1816,8 +1816,8 @@ public:
>void CheckEndOfDirective(const char *DirType, bool EnableMacros =
> false);
>
>/// Read and discard all tokens remaining on the current line until
> -  /// the tok::eod token is found.
> -  void DiscardUntilEndOfDirective();
> +  /// the tok::eod token is found. Returns the range of the skipped
> tokens.
> +  SourceRange DiscardUntilEndOfDirective();
>
>/// Returns true if the preprocessor has seen a use of
>/// __DATE__ or __TIME__ in the file so far.
> @@ -1982,6 +1982,9 @@ private:
>
>  /// True if the expression contained identifiers that were undefined.
>  bool IncludedUndefinedIds;
> +
> +/// The source range for the expression.
> +SourceRange ExprRange;
>};
>
>/// Evaluate an integer constant expression that may occur after a
>
> Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=350891&r1=350890&r2=350891&view=diff
>
> ==
> --- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
> +++ cfe/trunk/lib/Lex/PPDirectives.cpp Thu Jan 10 13:22:13 2019
> @@ -79,12 +79,18 @@ Preprocessor::AllocateVisibilityMacroDir
>
>  /// Read and discard all tokens remaining on the current line until
>  /// the tok::eod token is found.
> -void Preprocessor::DiscardUntilEndOfDirective() {
> +SourceRange Preprocessor::DiscardUntilEndOfDirective() {
>Token Tmp;
> -  do {
> -LexUnexpandedToken(Tmp);
> +  SourceRange Res;
> +
> +  LexUnexpandedToken(Tmp);
> +  Res.setBegin(Tmp.getLocation());
> +  while (Tmp.isNot(tok::eod)) {
>  assert(Tmp.isNot(tok::eof) && "EOF seen while discarding directive
> tokens");
> -  } while (Tmp.isNot(tok::eod));
> +LexUnexpandedToken(Tmp);
> +  }
> +  Res.setEnd(Tmp.getLocation());
> +  return Res;
>  }
>
>  /// Enumerates possible cases of #define/#undef a reserved identifier.
> @@ -538,19 +544,19 @@ void Preprocessor::SkipExcludedCondition
>  if (CondInfo.WasSkipping || CondInfo.FoundNonSkip) {
>DiscardUntilEndOfDirective();
>  } else {
> -  const SourceLocation CondBegin =
> CurPPLexer->getSourceLocation();
>// Restore the value of LexingRawMode so that identifiers are
>// looked up, etc, inside the #elif expression.
>assert(CurPPLexer->LexingRawMode && "We have to be skipping
> here!");
>CurPPLexer->LexingRawMode = false;
>IdentifierInfo *IfNDefMacro = nullptr;
> -  const bool CondValue =
> EvaluateDirectiveExpression(IfNDefMacro).Conditional;
> +  DirectiveEvalResult DER =
> EvaluateDirectiveExpression(IfNDefMacro);
> +  const bool CondValue = DER.Conditional;
>CurPPLexer->LexingRawMode = true;
>if (Callbacks) {
> -const SourceLocation CondEnd =
> CurPPLexer->getSourceLocation();
> -Callbacks->Elif(Tok.getLocation(),
> -SourceRange(CondBegin, CondEnd),
> -(CondValue ? PPCallbacks::CVK_True :
> PPCallbacks::CVK_False), CondInfo.IfLoc);
> +Callbacks->Elif(
> +Tok.getLocation(), DER.ExprRange,
> +(CondValue ? PPCallbacks::CVK_True :
> PPCallbacks::CVK_False),
> +CondInfo.IfLoc);
>}
>// If this condition is true, enter it!
>if (CondValue) {
> @@ -1116,19 +1122,24 @@ void Preprocessor::HandleLineDirective()
>  ; // ok
>else if (StrTok.isNot(tok::string_literal)) {
>  Diag(StrTok, diag::err_pp_line_invalid_filename);
> -return DiscardUntilEndOfDirective();
> +DiscardUntilEndOfDirective();
> +retu

[PATCH] D56718: [clangd] Update docs to mention YCM integration and new LSP features

2019-01-15 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments.



Comment at: docs/clangd.rst:125
+
+One of the options of using :program:`Clangd` in :program:`vim` is to utilize
+`YouCompleteMe

Given how little information we actually provide for each option here (it's 
literally just pointers to the docs), maybe make this a list instead to avoid 
copy-pasting between those two?
Something like:

You can use Clangd in vim with one of the following plugins:
- YouCompleteMe, see installation instructions.
- LanguageClient-neovim, see clangd wiki page for instructions.




Comment at: docs/clangd.rst:129
+`Installation section on your OS
+`_ for instructions.
+

I believe this does not mention how to install clangd, though (and 
libclang-based is still the default, right?) Do we want to mention how to 
configure it to use clangd here?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56718



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


r351210 - Revert "[X86] Make _xgetbv/_xsetbv on non-windows platforms"

2019-01-15 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Tue Jan 15 09:23:36 2019
New Revision: 351210

URL: http://llvm.org/viewvc/llvm-project?rev=351210&view=rev
Log:
Revert "[X86] Make _xgetbv/_xsetbv on non-windows platforms"

This reverts commit r351160. Breaks building v8.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/immintrin.h
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/lib/Headers/xsaveintrin.h
cfe/trunk/test/CodeGen/builtins-x86.c
cfe/trunk/test/CodeGen/x86_32-xsave.c
cfe/trunk/test/CodeGen/x86_64-xsave.c
cfe/trunk/test/Headers/ms-intrin.cpp

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=351210&r1=351209&r2=351210&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Jan 15 09:23:36 2019
@@ -693,10 +693,6 @@ TARGET_BUILTIN(__builtin_ia32_fxsave, "v
 // XSAVE
 TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "n", "xsave")
 TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "n", "xsave")
-TARGET_BUILTIN(__builtin_ia32_xgetbv, "ULLiUi", "n", "xsave")
-TARGET_HEADER_BUILTIN(_xgetbv, "UWiUi", "nh", "immintrin.h", ALL_MS_LANGUAGES, 
"")
-TARGET_BUILTIN(__builtin_ia32_xsetbv, "vUiULLi", "n", "xsave")
-TARGET_HEADER_BUILTIN(_xsetbv, "vUiUWi", "nh", "immintrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "n", "xsaveopt")
 TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "n", "xsaves")
 TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "n", "xsavec")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=351210&r1=351209&r2=351210&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Tue Jan 15 09:23:36 2019
@@ -9833,9 +9833,7 @@ Value *CodeGenFunction::EmitX86BuiltinEx
   case X86::BI__builtin_ia32_xsavec:
   case X86::BI__builtin_ia32_xsavec64:
   case X86::BI__builtin_ia32_xsaves:
-  case X86::BI__builtin_ia32_xsaves64:
-  case X86::BI__builtin_ia32_xsetbv:
-  case X86::BI_xsetbv: {
+  case X86::BI__builtin_ia32_xsaves64: {
 Intrinsic::ID ID;
 #define INTRINSIC_X86_XSAVE_ID(NAME) \
 case X86::BI__builtin_ia32_##NAME: \
@@ -9855,10 +9853,6 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 INTRINSIC_X86_XSAVE_ID(xsavec64);
 INTRINSIC_X86_XSAVE_ID(xsaves);
 INTRINSIC_X86_XSAVE_ID(xsaves64);
-INTRINSIC_X86_XSAVE_ID(xsetbv);
-case X86::BI_xsetbv:
-  ID = Intrinsic::x86_xsetbv;
-  break;
 }
 #undef INTRINSIC_X86_XSAVE_ID
 Value *Mhi = Builder.CreateTrunc(
@@ -9868,9 +9862,6 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 Ops.push_back(Mlo);
 return Builder.CreateCall(CGM.getIntrinsic(ID), Ops);
   }
-  case X86::BI__builtin_ia32_xgetbv:
-  case X86::BI_xgetbv:
-return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::x86_xgetbv), Ops);
   case X86::BI__builtin_ia32_storedqudi128_mask:
   case X86::BI__builtin_ia32_storedqusi128_mask:
   case X86::BI__builtin_ia32_storedquhi128_mask:

Modified: cfe/trunk/lib/Headers/immintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/immintrin.h?rev=351210&r1=351209&r2=351210&view=diff
==
--- cfe/trunk/lib/Headers/immintrin.h (original)
+++ cfe/trunk/lib/Headers/immintrin.h Tue Jan 15 09:23:36 2019
@@ -378,8 +378,9 @@ _storebe_i64(void * __P, long long __D)
 #include 
 #endif
 
-/* No feature check desired due to internal MSC_VER checks */
+#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVE__)
 #include 
+#endif
 
 #if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEOPT__)
 #include 

Modified: cfe/trunk/lib/Headers/intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=351210&r1=351209&r2=351210&view=diff
==
--- cfe/trunk/lib/Headers/intrin.h (original)
+++ cfe/trunk/lib/Headers/intrin.h Tue Jan 15 09:23:36 2019
@@ -200,7 +200,10 @@ __attribute__((__deprecated__("use other
 _WriteBarrier(void);
 unsigned __int32 xbegin(void);
 void _xend(void);
+static __inline__
 #define _XCR_XFEATURE_ENABLED_MASK 0
+unsigned __int64 __cdecl _xgetbv(unsigned int);
+void __cdecl _xsetbv(unsigned int, unsigned __int64);
 
 /* These additional intrinsics are turned on in x64/amd64/x86_64 mode. */
 #ifdef __x86_64__
@@ -536,6 +539,12 @@ __cpuidex(int __info[4], int __level, in
   __asm__ ("cpuid" : "=a"(__info[0]), "=b" (__info[1]), "=c"(__info[2]), 
"=d"(__info[3])
: "a"(__level), "c"(__ecx));
 }
+static __inline__ unsigned __int64 __cdecl __DEFAULT_FN_ATTRS

Re: r351160 - [X86] Make _xgetbv/_xsetbv on non-windows platforms

2019-01-15 Thread Benjamin Kramer via cfe-commits
I rolled it back for now in r351210, this pattern seems to be quite common
even outside of v8. Let's figure out if we can keep the code working or if
it needs to be fixed all over the place :(

On Tue, Jan 15, 2019 at 3:02 PM Benjamin Kramer  wrote:

> I'm seeing breakages on v8 with this, it defines its own _xgetbv. Any
> ideas what do do about this?
>
>
> https://chromium.googlesource.com/v8/v8.git/+/master/src/x64/assembler-x64.cc#36
>
> src/x64/assembler-x64.cc:35:1: error: inline variables are incompatible
> with C++ standards before C++17 [-Werror,-Wc++98-c++11-c++14-compat]
> V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
> ^
> include/v8config.h:294:20: note: expanded from macro 'V8_INLINE'
> # define V8_INLINE inline __attribute__((always_inline))
>^
> src/x64/assembler-x64.cc:35:41: error: expected ')'
> V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
> ^
> src/x64/assembler-x64.cc:35:20: note: to match this '('
> V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
>^
> lib/clang/include/xsaveintrin.h:49:53: note: expanded from macro '_xgetbv'
> #define _xgetbv(A) __builtin_ia32_xgetbv((long long)(A))
>
> On Tue, Jan 15, 2019 at 6:06 AM Craig Topper via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: ctopper
>> Date: Mon Jan 14 21:03:18 2019
>> New Revision: 351160
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=351160&view=rev
>> Log:
>> [X86] Make _xgetbv/_xsetbv on non-windows platforms
>>
>> Summary:
>> This patch attempts to redo what was tried in r278783, but was reverted.
>>
>> These intrinsics should be available on non-windows platforms with
>> "xsave" feature check. But on Windows platforms they shouldn't have feature
>> check since that's how MSVC behaves.
>>
>> To accomplish this I've added a MS builtin with no feature check. And a
>> normal gcc builtin with a feature check. When _MSC_VER is not defined
>> _xgetbv/_xsetbv will be macros pointing to the gcc builtin name.
>>
>> I've moved the forward declarations from intrin.h to immintrin.h to match
>> the MSDN documentation and used that as the header file for the MS builtin.
>>
>> I'm not super happy with this implementation, and I'm open to suggestions
>> for better ways to do it.
>>
>> Reviewers: rnk, RKSimon, spatel
>>
>> Reviewed By: rnk
>>
>> Subscribers: cfe-commits
>>
>> Differential Revision: https://reviews.llvm.org/D56686
>>
>> Modified:
>> cfe/trunk/include/clang/Basic/BuiltinsX86.def
>> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>> cfe/trunk/lib/Headers/immintrin.h
>> cfe/trunk/lib/Headers/intrin.h
>> cfe/trunk/lib/Headers/xsaveintrin.h
>> cfe/trunk/test/CodeGen/builtins-x86.c
>> cfe/trunk/test/CodeGen/x86_32-xsave.c
>> cfe/trunk/test/CodeGen/x86_64-xsave.c
>> cfe/trunk/test/Headers/ms-intrin.cpp
>>
>> Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=351160&r1=351159&r2=351160&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
>> +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Jan 14 21:03:18 2019
>> @@ -693,6 +693,10 @@ TARGET_BUILTIN(__builtin_ia32_fxsave, "v
>>  // XSAVE
>>  TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "n", "xsave")
>>  TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "n", "xsave")
>> +TARGET_BUILTIN(__builtin_ia32_xgetbv, "ULLiUi", "n", "xsave")
>> +TARGET_HEADER_BUILTIN(_xgetbv, "UWiUi", "nh", "immintrin.h",
>> ALL_MS_LANGUAGES, "")
>> +TARGET_BUILTIN(__builtin_ia32_xsetbv, "vUiULLi", "n", "xsave")
>> +TARGET_HEADER_BUILTIN(_xsetbv, "vUiUWi", "nh", "immintrin.h",
>> ALL_MS_LANGUAGES, "")
>>  TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "n", "xsaveopt")
>>  TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "n", "xsaves")
>>  TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "n", "xsavec")
>>
>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=351160&r1=351159&r2=351160&view=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Jan 14 21:03:18 2019
>> @@ -9831,7 +9831,9 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>>case X86::BI__builtin_ia32_xsavec:
>>case X86::BI__builtin_ia32_xsavec64:
>>case X86::BI__builtin_ia32_xsaves:
>> -  case X86::BI__builtin_ia32_xsaves64: {
>> +  case X86::BI__builtin_ia32_xsaves64:
>> +  case X86::BI__builtin_ia32_xsetbv:
>> +  case X86::BI_xsetbv: {
>>  Intrinsic::ID ID;
>>  #define INTRINSIC_X86_XSAVE_ID(NAME) \
>>  case X86::BI__builtin_ia32_##NAME: \
>> @@ -9851,6 +9853,10 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>>  INTRINSIC_X86_XSAVE_ID(xsavec64);
>>  INTRINSIC_X86_XSAVE_ID(xsav

[PATCH] D56728: Regression test case for r350891 [Correct the source range returned from preprocessor callbacks]

2019-01-15 Thread Jordan Rupprecht via Phabricator via cfe-commits
rupprecht abandoned this revision.
rupprecht added a comment.

Looks like this test case was submitted as part of rL351209 
.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56728



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


[PATCH] D56267: [clangd] Interfaces for writing code actions

2019-01-15 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment.

Offline discussion:

- CRTP doesn't buy anything. Simple inheritance is less clean than current 
function-passing version but probably more familiar.
- `Tweak` is a good name: short, evocative but not commonly used, works as a 
noun and a verb.
- Registry might be a good enough fit to use directly

Here's the result of my local, er, tweaking to `ActionProvider.h`.

  //===--- Tweak.h -*- 
C++-*-===//
  //
  // The LLVM Compiler Infrastructure
  //
  // This file is distributed under the University of Illinois Open Source
  // License. See LICENSE.TXT for details.
  //
  
//===--===//
  // A tweak is a small context-sensitive refactoring-like action that is
  // triggered at a cursor location, examines the AST and produces a set of 
edits.
  //
  // It has two main pieces of logic:
  //   - prepare() quickly checks whether the action is applicable at the 
cursor.
  // It must be cheap as all tweaks are prepared to list them for the user.
  //   - apply() computes the actual edits.
  // This can be more expensive, only the chosen tweak is applied.
  
//===--===//
  
  #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_ACTIONS_ACTIONPROVIDER_H
  #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_ACTIONS_ACTIONPROVIDER_H
  
  #include "ClangdUnit.h"
  #include "Protocol.h"
  #include "llvm/ADT/Optional.h"
  #include "llvm/ADT/StringRef.h"
  namespace clang {
  namespace clangd {
  
  // Abstract base for small context-sensitive refactoring actions.
  class Tweak {
  public:
// Information about the location where the tweak was triggered.
struct Selection {
  // The path of an active document the action was invoked in.
  llvm::StringRef File;
  // The text of the active document.
  llvm::StringRef Code;
  // Parsed AST of the active file.
  ParsedAST &AST;
  // A location of the cursor in the editor.
  SourceLocation Cursor;
  // FIXME: full selection bounds.
  // FIXME: AST node under cursor.
  // FIXME: allow tweaks to specify matchers, and include match results.
  // FIXME: allow access to index and other source files.
};
  
// Tweaks must have a no-op default constructor.
virtual ~Tweak() = default;
  
virtual const char* id() = 0;
// Determines whether this tweak can run at the selection.
// This function may record information to be used later.
// It should run as fast as possible, particularly when returning false.
virtual bool prepare(const Selection &) = 0;
  
// Generate the edits for this tweak.
// REQUIRES: prepare() was called and returned true.
virtual llvm::Expected
apply(const Selection &) = 0;
  
// Description of this tweak at the selected location.
// e.g. "Out-line definition of toString()".
// REQUIRES: prepare() was called and returned true.
virtual std::string describe() const;
  };
  
  // All tweaks must be registered, next to their definition.
  #define REGISTER_TWEAK(Subclass)  
 \
static ::llvm::Registry<::clang::clangd::Tweak>::Add  
   \
TweakRegistrationFor##Subclass(Subclass{}.id(), #Subclass);
  
  // Calls prepare() on all tweaks, returning those that can run on the 
selection.
  std::vector> prepareTweaks(const Tweak::Selection &);
  // Calls prepare() on the tweak with a given ID.
  // If prepare() returns false, returns an error.
  Expected> prepareTweak(StringRef ID,
const Tweak::Selection &);
  
  } // namespace clangd
  } // namespace clang
  
  #endif


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D56267



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


r351212 - Fix cpu-dispatch MV regression caused by r347812

2019-01-15 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Tue Jan 15 09:51:09 2019
New Revision: 351212

URL: http://llvm.org/viewvc/llvm-project?rev=351212&view=rev
Log:
Fix cpu-dispatch MV regression caused by r347812

r347812 permitted forward declarations for cpu-dispatch functions, which
are occassionally useful as exposition in  header files.  However, this 
inadvertently
permitted this function to become multiversioned after a usage.  This
patch ensures that the "CausesMV" checks are still run in the
forward-declaration case.

Change-Id: Icb6f975a2d068f088b89e3bbe26cf1d24f5a972c

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/attr-cpuspecific.c

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=351212&r1=351211&r2=351212&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Jan 15 09:51:09 2019
@@ -9816,7 +9816,8 @@ static bool CheckMultiVersionAdditionalD
 return true;
   }
 
-  if (CheckMultiVersionAdditionalRules(S, OldFD, NewFD, false, NewMVType)) {
+  if (CheckMultiVersionAdditionalRules(S, OldFD, NewFD,
+   !OldFD->isMultiVersion(), NewMVType)) {
 NewFD->setInvalidDecl();
 return true;
   }

Modified: cfe/trunk/test/Sema/attr-cpuspecific.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-cpuspecific.c?rev=351212&r1=351211&r2=351212&view=diff
==
--- cfe/trunk/test/Sema/attr-cpuspecific.c (original)
+++ cfe/trunk/test/Sema/attr-cpuspecific.c Tue Jan 15 09:51:09 2019
@@ -40,6 +40,14 @@ int __attribute__((cpu_dispatch(atom)))
 int allow_fwd_decl(void);
 int __attribute__((cpu_dispatch(atom))) allow_fwd_decl(void) {}
 
+int allow_fwd_decl2(void);
+void use_fwd_decl(void) {
+  allow_fwd_decl2();
+}
+// expected-error@+1 {{function declaration cannot become a multiversioned 
function after first usage}}
+int __attribute__((cpu_dispatch(atom))) allow_fwd_decl2(void) {}
+
+
 int __attribute__((cpu_specific(atom))) redecl4(void);
 // expected-error@+1 {{function declaration is missing 'cpu_specific' or 
'cpu_dispatch' attribute in a multiversioned function}}
 int redecl4(void);


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


Re: r344241 - [tests] Include Python binding tests in CMake rules

2019-01-15 Thread Nico Weber via cfe-commits
The tests probably shouldn't run when LLVM_ENABLE_PIC=OFF is set, since
they all fail there (due to lib/libclang.so not existing).

On Thu, Oct 11, 2018 at 7:59 AM Michal Gorny via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: mgorny
> Date: Thu Oct 11 04:58:14 2018
> New Revision: 344241
>
> URL: http://llvm.org/viewvc/llvm-project?rev=344241&view=rev
> Log:
> [tests] Include Python binding tests in CMake rules
>
> Add a new CMake rule check-clang-python to run the Python bindings'
> test suite, and include it in check-all.
>
> Differential Revision: https://reviews.llvm.org/D52840
>
> Added:
> cfe/trunk/bindings/python/tests/CMakeLists.txt
> Modified:
> cfe/trunk/CMakeLists.txt
>
> Modified: cfe/trunk/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=344241&r1=344240&r2=344241&view=diff
>
> ==
> --- cfe/trunk/CMakeLists.txt (original)
> +++ cfe/trunk/CMakeLists.txt Thu Oct 11 04:58:14 2018
> @@ -502,6 +502,7 @@ if( CLANG_INCLUDE_TESTS )
>)
>endif()
>add_subdirectory(utils/perf-training)
> +  add_subdirectory(bindings/python/tests)
>  endif()
>
>  option(CLANG_INCLUDE_DOCS "Generate build targets for the Clang docs."
>
> Added: cfe/trunk/bindings/python/tests/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344241&view=auto
>
> ==
> --- cfe/trunk/bindings/python/tests/CMakeLists.txt (added)
> +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 04:58:14 2018
> @@ -0,0 +1,7 @@
> +# Test target to run Python test suite from main build.
> +
> +add_custom_target(check-clang-python
> +   COMMAND CLANG_LIBRARY_PATH=$
> ${PYTHON_EXECUTABLE} -m unittest discover
> +   DEPENDS libclang
> +   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
> +add_dependencies(check-all check-clang-python)
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r344241 - [tests] Include Python binding tests in CMake rules

2019-01-15 Thread Michał Górny via cfe-commits
On Tue, 2019-01-15 at 13:10 -0500, Nico Weber wrote:
> The tests probably shouldn't run when LLVM_ENABLE_PIC=OFF is set, since
> they all fail there (due to lib/libclang.so not existing).

Hmm, maybe we could make them conditional to the existence
of libclang.so target?  Would that work for you?

> 
> On Thu, Oct 11, 2018 at 7:59 AM Michal Gorny via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> 
> > Author: mgorny
> > Date: Thu Oct 11 04:58:14 2018
> > New Revision: 344241
> > 
> > URL: http://llvm.org/viewvc/llvm-project?rev=344241&view=rev
> > Log:
> > [tests] Include Python binding tests in CMake rules
> > 
> > Add a new CMake rule check-clang-python to run the Python bindings'
> > test suite, and include it in check-all.
> > 
> > Differential Revision: https://reviews.llvm.org/D52840
> > 
> > Added:
> > cfe/trunk/bindings/python/tests/CMakeLists.txt
> > Modified:
> > cfe/trunk/CMakeLists.txt
> > 
> > Modified: cfe/trunk/CMakeLists.txt
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=344241&r1=344240&r2=344241&view=diff
> > 
> > ==
> > --- cfe/trunk/CMakeLists.txt (original)
> > +++ cfe/trunk/CMakeLists.txt Thu Oct 11 04:58:14 2018
> > @@ -502,6 +502,7 @@ if( CLANG_INCLUDE_TESTS )
> >)
> >endif()
> >add_subdirectory(utils/perf-training)
> > +  add_subdirectory(bindings/python/tests)
> >  endif()
> > 
> >  option(CLANG_INCLUDE_DOCS "Generate build targets for the Clang docs."
> > 
> > Added: cfe/trunk/bindings/python/tests/CMakeLists.txt
> > URL:
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344241&view=auto
> > 
> > ==
> > --- cfe/trunk/bindings/python/tests/CMakeLists.txt (added)
> > +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 04:58:14 2018
> > @@ -0,0 +1,7 @@
> > +# Test target to run Python test suite from main build.
> > +
> > +add_custom_target(check-clang-python
> > +   COMMAND CLANG_LIBRARY_PATH=$
> > ${PYTHON_EXECUTABLE} -m unittest discover
> > +   DEPENDS libclang
> > +   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
> > +add_dependencies(check-all check-clang-python)
> > 
> > 
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> > 

-- 
Best regards,
Michał Górny


signature.asc
Description: This is a digitally signed message part
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D56731: Add -Wimplicit-ctad warning to diagnose CTAD on types with no user defined deduction guides.

2019-01-15 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF created this revision.
EricWF added reviewers: rsmith, james.dennett, gromer.

Some style guides want to allow using CTAD only on types that "opt-in"; i.e. on 
types that are designed to support it and not just types that *happen* to work 
with it.

This patch implements the `-Wimplicit-ctad` warning, which is off by default, 
which warns when CTAD is used on a type that does not define any deduction 
guides.


Repository:
  rC Clang

https://reviews.llvm.org/D56731

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaInit.cpp
  test/SemaCXX/cxx1z-class-template-argument-deduction.cpp

Index: test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
===
--- test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
+++ test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
@@ -409,6 +409,35 @@
 
 }
 
+#pragma clang diagnostic push
+#pragma clang diagnostic warning "-Wimplicit-ctad"
+namespace test_implicit_ctad_warning {
+
+template 
+struct Tag {};
+
+template 
+struct NoExplicit {
+  NoExplicit(T) {}
+  NoExplicit(T, int) {}
+};
+
+// expected-warning@+1 {{class template argument deduction for 'NoExplicit' that has no user defined deduction guides}}
+NoExplicit ne(42);
+
+template 
+struct HasExplicit {
+  HasExplicit(U) {}
+  HasExplicit(U, int) {}
+};
+template  HasExplicit(U, int) -> HasExplicit>;
+
+HasExplicit he(42);
+
+
+}
+#pragma clang diagnostic pop
+
 #else
 
 // expected-no-diagnostics
Index: lib/Sema/SemaInit.cpp
===
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -9264,9 +9264,15 @@
   OverloadCandidateSet Candidates(Kind.getLocation(),
   OverloadCandidateSet::CSK_Normal);
   OverloadCandidateSet::iterator Best;
+
+  // Record if at least a user-declared deduction guide was considered
+  bool HasUserDeclaredDeductionGuideCandidate = false;
+
   auto tryToResolveOverload =
   [&](bool OnlyListConstructors) -> OverloadingResult {
 Candidates.clear(OverloadCandidateSet::CSK_Normal);
+HasUserDeclaredDeductionGuideCandidate = false;
+
 for (auto I = Guides.begin(), E = Guides.end(); I != E; ++I) {
   NamedDecl *D = (*I)->getUnderlyingDecl();
   if (D->isInvalidDecl())
@@ -9278,6 +9284,8 @@
   if (!GD)
 continue;
 
+  HasUserDeclaredDeductionGuideCandidate |= !GD->isImplicit();
+
   // C++ [over.match.ctor]p1: (non-list copy-initialization from non-class)
   //   For copy-initialization, the candidate functions are all the
   //   converting constructors (12.3.1) of that class.
@@ -9430,5 +9438,14 @@
   Diag(TSInfo->getTypeLoc().getBeginLoc(),
diag::warn_cxx14_compat_class_template_argument_deduction)
   << TSInfo->getTypeLoc().getSourceRange() << 1 << DeducedType;
+
+
+  // -Wimplicit-ctad: Warn if CTAD was used on a
+  if (!HasUserDeclaredDeductionGuideCandidate) {
+Diag(TSInfo->getTypeLoc().getBeginLoc(),
+ diag::warn_class_template_argument_deduction_no_user_defined_guides)
+<< TemplateName;
+  }
+
   return DeducedType;
 }
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -2125,6 +2125,9 @@
   "class template argument deduction is incompatible with C++ standards "
   "before C++17%select{|; for compatibility, use explicit type name %1}0">,
   InGroup, DefaultIgnore;
+def warn_class_template_argument_deduction_no_user_defined_guides : Warning<
+  "class template argument deduction for %0 that has no user defined deduction guides" >,
+  InGroup, DefaultIgnore;
 
 // C++14 deduced return types
 def err_auto_fn_deduction_failure : Error<
Index: include/clang/Basic/DiagnosticGroups.td
===
--- include/clang/Basic/DiagnosticGroups.td
+++ include/clang/Basic/DiagnosticGroups.td
@@ -1050,3 +1050,5 @@
 
 // A group for cross translation unit static analysis related warnings.
 def CrossTU : DiagGroup<"ctu">;
+
+def ImplicitCTADUsage : DiagGroup<"implicit-ctad">;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r344241 - [tests] Include Python binding tests in CMake rules

2019-01-15 Thread Nico Weber via cfe-commits
As long as check-all passes with LLVM_ENABLE_PIC=OFF I'm happy :-) (Note
it's .dylib on macOS and .dll on Windows, and by default
setting LLVM_ENABLE_PIC=OFF causes a static library to be created instead
on non-win).

On Tue, Jan 15, 2019 at 1:16 PM Michał Górny  wrote:

> On Tue, 2019-01-15 at 13:10 -0500, Nico Weber wrote:
> > The tests probably shouldn't run when LLVM_ENABLE_PIC=OFF is set, since
> > they all fail there (due to lib/libclang.so not existing).
>
> Hmm, maybe we could make them conditional to the existence
> of libclang.so target?  Would that work for you?
>
> >
> > On Thu, Oct 11, 2018 at 7:59 AM Michal Gorny via cfe-commits <
> > cfe-commits@lists.llvm.org> wrote:
> >
> > > Author: mgorny
> > > Date: Thu Oct 11 04:58:14 2018
> > > New Revision: 344241
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=344241&view=rev
> > > Log:
> > > [tests] Include Python binding tests in CMake rules
> > >
> > > Add a new CMake rule check-clang-python to run the Python bindings'
> > > test suite, and include it in check-all.
> > >
> > > Differential Revision: https://reviews.llvm.org/D52840
> > >
> > > Added:
> > > cfe/trunk/bindings/python/tests/CMakeLists.txt
> > > Modified:
> > > cfe/trunk/CMakeLists.txt
> > >
> > > Modified: cfe/trunk/CMakeLists.txt
> > > URL:
> > >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=344241&r1=344240&r2=344241&view=diff
> > >
> > >
> ==
> > > --- cfe/trunk/CMakeLists.txt (original)
> > > +++ cfe/trunk/CMakeLists.txt Thu Oct 11 04:58:14 2018
> > > @@ -502,6 +502,7 @@ if( CLANG_INCLUDE_TESTS )
> > >)
> > >endif()
> > >add_subdirectory(utils/perf-training)
> > > +  add_subdirectory(bindings/python/tests)
> > >  endif()
> > >
> > >  option(CLANG_INCLUDE_DOCS "Generate build targets for the Clang docs."
> > >
> > > Added: cfe/trunk/bindings/python/tests/CMakeLists.txt
> > > URL:
> > >
> http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/tests/CMakeLists.txt?rev=344241&view=auto
> > >
> > >
> ==
> > > --- cfe/trunk/bindings/python/tests/CMakeLists.txt (added)
> > > +++ cfe/trunk/bindings/python/tests/CMakeLists.txt Thu Oct 11 04:58:14
> 2018
> > > @@ -0,0 +1,7 @@
> > > +# Test target to run Python test suite from main build.
> > > +
> > > +add_custom_target(check-clang-python
> > > +   COMMAND CLANG_LIBRARY_PATH=$
> > > ${PYTHON_EXECUTABLE} -m unittest discover
> > > +   DEPENDS libclang
> > > +   WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
> > > +add_dependencies(check-all check-clang-python)
> > >
> > >
> > > ___
> > > cfe-commits mailing list
> > > cfe-commits@lists.llvm.org
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> > >
>
> --
> Best regards,
> Michał Górny
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53541: [COFF, ARM64] Do not emit x86_seh_recoverfp intrinsic

2019-01-15 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang added a comment.

In D53541#1356904 , @rnk wrote:

> In D53541#1353251 , @mgrang wrote:
>
> > > What about the three stack pointer case of stack realignment plus a 
> > > dynamic alloca? Typically this is the case where recoverfp is necessary.
> >
> > @rnk Sorry, I missed your comment earlier. I am not sure what scenario the 
> > three stack pointer case is. Could you please give me a test case for it?
>
>
> I think you just need a local variable with an alignment greater than the ABI 
> provides, something like:
>
>   struct Foo {
> Foo();
> int x, y, z;
>   };
>   int filter(int);
>   void may_throw();
>   void seh_byval(int n) {
> Foo __declspec(align(32)) o;
> __try {
>   may_throw();
> } __except(filter(o.x)) {
> }
>   }
>


We seem to be generating the same code as MSVC. Here's my test case:

  struct Foo {
void (*ptr)();
int x, y, z;
  };
  
  int filter(int);
  void may_throw();
  void seh_byval(int n) {
struct Foo __declspec(align(32)) o;
__try {
  may_throw();
} __except(filter(o.x)) {
}
  }

MSVC:

  |seh_byval$filt$0| PROC
  stp fp,lr,[sp,#-0x10]!
  mov fp,x1
  |$LN5@seh_byval$|
  ldr x8,[fp,#0x10]
  ldr w0,[x8,#8]
  bl  filter
  nop
  |$LN7@seh_byval$|
  ldp fp,lr,[sp],#0x10
  ret

LLVM:

  .seh_proc "?filt$0@0@seh_byval@@"
  ; %bb.0:; %entry
  movzx8, #:abs_g1_s:.Lseh_byval$frame_escape_0
  movkx8, #:abs_g0_nc:.Lseh_byval$frame_escape_0
  add x8, x1, x8
  ldr w0, [x8, #8]
  b   filter


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

https://reviews.llvm.org/D53541



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


[PATCH] D55433: [clang-tidy] Adding a new modernize use nodiscard checker

2019-01-15 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

In D55433#1357483 , @MyDeveloperDay 
wrote:

> In D55433#1351707 , @JonasToth wrote:
>
> > > I do not have commit rights. I'm not sure what constitutes someone who 
> > > can commit, but let me contribute a little more before taking that step,  
> > > I have another idea for a checker I'd like to try after this one, I just 
> > > wanted to get one under my belt first.
> >
> > See this: https://llvm.org/docs/DeveloperPolicy.html#obtaining-commit-access
> >
> > I will commit for you then. More patches always welcome ;)
>
>
> @JonasToth, I notice when you commit you commit in 2 places, is this by hand 
> or automatic? or if this process is mandated or written down somewhere?
>
> rCTE350760 : [clang-tidy] Adding a new 
> modernize use nodiscard checker
>  rL350760 : [clang-tidy] Adding a new 
> modernize use nodiscard checker
>
> Do you have any guidance on how YOU commit (especially in clang-tools-extra) 
> that might be useful to others just starting out?


These are done automatically, probably because its all LLVM but split
into multiple repositories, this changes with the new monorepo.

I use `arc` and `git-svn`, see
https://www.llvm.org/docs/Phabricator.html and
https://www.llvm.org/docs/GettingStarted.html#developers-work-with-git-svn


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55433



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


r351217 - [Solaris] Move enabling IAS for SPARC from the Solaris toolchain to Generic_GCC.

2019-01-15 Thread Brad Smith via cfe-commits
Author: brad
Date: Tue Jan 15 10:24:03 2019
New Revision: 351217

URL: http://llvm.org/viewvc/llvm-project?rev=351217&view=rev
Log:
[Solaris] Move enabling IAS for SPARC from the Solaris toolchain to Generic_GCC.

Modified:
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/lib/Driver/ToolChains/Solaris.h

Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=351217&r1=351216&r2=351217&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Jan 15 10:24:03 2019
@@ -2475,6 +2475,12 @@ bool Generic_GCC::IsIntegratedAssemblerD
   case llvm::Triple::mips64:
   case llvm::Triple::mips64el:
 return true;
+  case llvm::Triple::sparc:
+  case llvm::Triple::sparcel:
+  case llvm::Triple::sparcv9:
+if (getTriple().isOSSolaris())
+  return true;
+return false;
   default:
 return false;
   }

Modified: cfe/trunk/lib/Driver/ToolChains/Solaris.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Solaris.h?rev=351217&r1=351216&r2=351217&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Solaris.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/Solaris.h Tue Jan 15 10:24:03 2019
@@ -55,8 +55,6 @@ public:
   Solaris(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
 
-  bool IsIntegratedAssemblerDefault() const override { return true; }
-
   void
   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
 llvm::opt::ArgStringList &CC1Args) const override;


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


[PATCH] D56731: Add -Wimplicit-ctad warning to diagnose CTAD on types with no user defined deduction guides.

2019-01-15 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added inline comments.



Comment at: include/clang/Basic/DiagnosticGroups.td:1054
+
+def ImplicitCTADUsage : DiagGroup<"implicit-ctad">;

Should this be in some group?
Alternatively, would it make sense to add it to new `-Wctad` group?



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2129
+def warn_class_template_argument_deduction_no_user_defined_guides : Warning<
+  "class template argument deduction for %0 that has no user defined deduction 
guides" >,
+  InGroup, DefaultIgnore;

`class template argument deduction  for %0 that has no 
user`
the sentence looks incomplete to me.



Comment at: lib/Sema/SemaInit.cpp:9443
+
+  // -Wimplicit-ctad: Warn if CTAD was used on a
+  if (!HasUserDeclaredDeductionGuideCandidate) {

on a  ?


Repository:
  rC Clang

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

https://reviews.llvm.org/D56731



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


Re: r351160 - [X86] Make _xgetbv/_xsetbv on non-windows platforms

2019-01-15 Thread Craig Topper via cfe-commits
Does V8 work with gcc which also has _xgetbv? Or is it because I had to
make _xgetbv a macro to make the patch work?

~Craig


On Tue, Jan 15, 2019 at 9:28 AM Benjamin Kramer via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> I rolled it back for now in r351210, this pattern seems to be quite common
> even outside of v8. Let's figure out if we can keep the code working or if
> it needs to be fixed all over the place :(
>
> On Tue, Jan 15, 2019 at 3:02 PM Benjamin Kramer 
> wrote:
>
>> I'm seeing breakages on v8 with this, it defines its own _xgetbv. Any
>> ideas what do do about this?
>>
>>
>> https://chromium.googlesource.com/v8/v8.git/+/master/src/x64/assembler-x64.cc#36
>>
>> src/x64/assembler-x64.cc:35:1: error: inline variables are incompatible
>> with C++ standards before C++17 [-Werror,-Wc++98-c++11-c++14-compat]
>> V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
>> ^
>> include/v8config.h:294:20: note: expanded from macro 'V8_INLINE'
>> # define V8_INLINE inline __attribute__((always_inline))
>>^
>> src/x64/assembler-x64.cc:35:41: error: expected ')'
>> V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
>> ^
>> src/x64/assembler-x64.cc:35:20: note: to match this '('
>> V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
>>^
>> lib/clang/include/xsaveintrin.h:49:53: note: expanded from macro '_xgetbv'
>> #define _xgetbv(A) __builtin_ia32_xgetbv((long long)(A))
>>
>> On Tue, Jan 15, 2019 at 6:06 AM Craig Topper via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: ctopper
>>> Date: Mon Jan 14 21:03:18 2019
>>> New Revision: 351160
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=351160&view=rev
>>> Log:
>>> [X86] Make _xgetbv/_xsetbv on non-windows platforms
>>>
>>> Summary:
>>> This patch attempts to redo what was tried in r278783, but was reverted.
>>>
>>> These intrinsics should be available on non-windows platforms with
>>> "xsave" feature check. But on Windows platforms they shouldn't have feature
>>> check since that's how MSVC behaves.
>>>
>>> To accomplish this I've added a MS builtin with no feature check. And a
>>> normal gcc builtin with a feature check. When _MSC_VER is not defined
>>> _xgetbv/_xsetbv will be macros pointing to the gcc builtin name.
>>>
>>> I've moved the forward declarations from intrin.h to immintrin.h to
>>> match the MSDN documentation and used that as the header file for the MS
>>> builtin.
>>>
>>> I'm not super happy with this implementation, and I'm open to
>>> suggestions for better ways to do it.
>>>
>>> Reviewers: rnk, RKSimon, spatel
>>>
>>> Reviewed By: rnk
>>>
>>> Subscribers: cfe-commits
>>>
>>> Differential Revision: https://reviews.llvm.org/D56686
>>>
>>> Modified:
>>> cfe/trunk/include/clang/Basic/BuiltinsX86.def
>>> cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>> cfe/trunk/lib/Headers/immintrin.h
>>> cfe/trunk/lib/Headers/intrin.h
>>> cfe/trunk/lib/Headers/xsaveintrin.h
>>> cfe/trunk/test/CodeGen/builtins-x86.c
>>> cfe/trunk/test/CodeGen/x86_32-xsave.c
>>> cfe/trunk/test/CodeGen/x86_64-xsave.c
>>> cfe/trunk/test/Headers/ms-intrin.cpp
>>>
>>> Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=351160&r1=351159&r2=351160&view=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
>>> +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Jan 14 21:03:18
>>> 2019
>>> @@ -693,6 +693,10 @@ TARGET_BUILTIN(__builtin_ia32_fxsave, "v
>>>  // XSAVE
>>>  TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "n", "xsave")
>>>  TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "n", "xsave")
>>> +TARGET_BUILTIN(__builtin_ia32_xgetbv, "ULLiUi", "n", "xsave")
>>> +TARGET_HEADER_BUILTIN(_xgetbv, "UWiUi", "nh", "immintrin.h",
>>> ALL_MS_LANGUAGES, "")
>>> +TARGET_BUILTIN(__builtin_ia32_xsetbv, "vUiULLi", "n", "xsave")
>>> +TARGET_HEADER_BUILTIN(_xsetbv, "vUiUWi", "nh", "immintrin.h",
>>> ALL_MS_LANGUAGES, "")
>>>  TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "n", "xsaveopt")
>>>  TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "n", "xsaves")
>>>  TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "n", "xsavec")
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=351160&r1=351159&r2=351160&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Jan 14 21:03:18 2019
>>> @@ -9831,7 +9831,9 @@ Value *CodeGenFunction::EmitX86BuiltinEx
>>>case X86::BI__builtin_ia32_xsavec:
>>>case X86::BI__builtin_ia32_xsavec64:
>>>case X86::BI__builtin_ia32_xsaves:
>>> -  case X86::BI__builtin_ia32_xsaves64: {
>>> +  case X86::BI_

[PATCH] D56732: [clang] [test] Disable Python binding tests w/ LLVM_ENABLE_PIC=OFF

2019-01-15 Thread Michał Górny via Phabricator via cfe-commits
mgorny created this revision.
mgorny added a reviewer: thakis.

Disable Python binding tests when LLVM_ENABLE_PIC is disabled,
as libclang.so is not being built in that case.  Reported by Nico Weber.

@thakis, could you test it, please?


Repository:
  rC Clang

https://reviews.llvm.org/D56732

Files:
  bindings/python/tests/CMakeLists.txt


Index: bindings/python/tests/CMakeLists.txt
===
--- bindings/python/tests/CMakeLists.txt
+++ bindings/python/tests/CMakeLists.txt
@@ -10,6 +10,11 @@
 set(RUN_PYTHON_TESTS TRUE)
 set_target_properties(check-clang-python PROPERTIES FOLDER "Clang tests")
 
+# Tests require libclang.so which is only built with LLVM_ENABLE_PIC=ON
+if(NOT LLVM_ENABLE_PIC)
+  set(RUN_PYTHON_TESTS FALSE)
+endif()
+
 # Do not try to run if libclang was built with ASan because
 # the sanitizer library will likely be loaded too late to perform
 # interception and will then fail.


Index: bindings/python/tests/CMakeLists.txt
===
--- bindings/python/tests/CMakeLists.txt
+++ bindings/python/tests/CMakeLists.txt
@@ -10,6 +10,11 @@
 set(RUN_PYTHON_TESTS TRUE)
 set_target_properties(check-clang-python PROPERTIES FOLDER "Clang tests")
 
+# Tests require libclang.so which is only built with LLVM_ENABLE_PIC=ON
+if(NOT LLVM_ENABLE_PIC)
+  set(RUN_PYTHON_TESTS FALSE)
+endif()
+
 # Do not try to run if libclang was built with ASan because
 # the sanitizer library will likely be loaded too late to perform
 # interception and will then fail.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D56563: [clang-tidy] add options documentation to readability-identifier-naming checker

2019-01-15 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a comment.

Thank you very much for working on this!
See https://bugs.llvm.org/show_bug.cgi?id=34990 for the bug report, I 
mentionend this revision.

TBH i did not read through all the document, but scrolled mostly starting from 
25%, it looks good to me.
Given its length, what do you think about a short link-list at the beginning 
that will point to the section in the docs? With that its easier to see whats 
all handled by the check.




Comment at: docs/clang-tidy/checks/readability-identifier-naming.rst:9
+This check will try to enforce coding guidelines on the identifiers naming. It
+supports one the following casing types and tries to convert from one to
+another if a mismatch is detected

It supports one `of` the following, i think the `of` is missing?



Comment at: docs/clang-tidy/checks/readability-identifier-naming.rst:26
 Many configuration options are available, in order to be able to create
-different rules for different kind of identifier. In general, the
-rules are falling back to a more generic rule if the specific case is not
-configured.
+different rules for different kinds of identifier. In general, the rules are
+falling back to a more generic rule if the specific case is not configured.

`kinds of identifiers`? second 's'



Comment at: docs/clang-tidy/checks/readability-identifier-naming.rst:70
+public:
+  pre_abstract_class_post();
+};

That would have been a change of the constructor name, the other examples don't 
have this behaviour, probably copy&paste artifact?


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

https://reviews.llvm.org/D56563



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


[PATCH] D56731: Add -Wimplicit-ctad warning to diagnose CTAD on types with no user defined deduction guides.

2019-01-15 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments.



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2129
+def warn_class_template_argument_deduction_no_user_defined_guides : Warning<
+  "class template argument deduction for %0 that has no user defined deduction 
guides" >,
+  InGroup, DefaultIgnore;

`s/user defined/user-defined/`, and perhaps `s/that has/with/` for brevity.



Comment at: lib/Sema/SemaInit.cpp:9287
 
+  HasUserDeclaredDeductionGuideCandidate |= !GD->isImplicit();
+

Nitpick: I don't know if this is LLVM style, but I wish this were written as

if (!GD->isImplicit())
  HasUserDeclaredDeductionGuideCandidate = true;

for clarity. Also, is it "user-defined" (per the error message) or 
"user-declared" (per the name of this variable)?



Comment at: test/SemaCXX/cxx1z-class-template-argument-deduction.cpp:426
+// expected-warning@+1 {{class template argument deduction for 'NoExplicit' 
that has no user defined deduction guides}}
+NoExplicit ne(42);
+

I suggest that additional (more realistic) motivating examples can be found in 
STL's CppCon 2018 talk. E.g.

```
template
struct Pair {
T first; U second;
explicit Pair(const T& t, const U& u) : first(t), second(u) {}
};
Pair p(42, "hello world");  // constructs a Pair

template
struct Pair2 {
T first; U second;
explicit Pair2(T t, U u) : first(t), second(u) {}
};
Pair2 p(42, "hello world");  // constructs a Pair2
```

I would expect (and, with your patch, receive) diagnostics for both of these.

But for something like `Vector("a", "b")` your patch gives no diagnostic: 
https://godbolt.org/z/_9zhav
And for something like [`std::optional o(x);` in generic 
context](https://quuxplusone.github.io/blog/2018/12/11/dont-inherit-from-std-types/)
 your patch gives no diagnostic.

I do have a patch out for a general-purpose `-Wctad` that would give warnings 
on those latter cases as well: D54565
I think `-Wimplicit-ctad` is a good start, but it doesn't solve all the cases 
I'd like to see solved.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56731



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


[PATCH] D55676: [Modules] Fix decl order for DeclsInPrototype

2019-01-15 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

Ping!


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

https://reviews.llvm.org/D55676



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


[PATCH] D56733: [OPENMP] update release note for implemented OMP 5.0 features

2019-01-15 Thread Alexey Bataev via Phabricator via cfe-commits
ABataev added a comment.

It would be good to update `OpenMPSupport.rst` too to show supported features 
from OpenMP 5.0.


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

https://reviews.llvm.org/D56733



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


Re: r351160 - [X86] Make _xgetbv/_xsetbv on non-windows platforms

2019-01-15 Thread Benjamin Kramer via cfe-commits
I think the main issue is that libstdc++ 4.9 includes x86intrin.h
transitively from . That's probably broken with all compilers :(

On Tue, Jan 15, 2019 at 7:31 PM Craig Topper  wrote:

> Does V8 work with gcc which also has _xgetbv? Or is it because I had to
> make _xgetbv a macro to make the patch work?
>
> ~Craig
>
>
> On Tue, Jan 15, 2019 at 9:28 AM Benjamin Kramer via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> I rolled it back for now in r351210, this pattern seems to be quite
>> common even outside of v8. Let's figure out if we can keep the code working
>> or if it needs to be fixed all over the place :(
>>
>> On Tue, Jan 15, 2019 at 3:02 PM Benjamin Kramer 
>> wrote:
>>
>>> I'm seeing breakages on v8 with this, it defines its own _xgetbv. Any
>>> ideas what do do about this?
>>>
>>>
>>> https://chromium.googlesource.com/v8/v8.git/+/master/src/x64/assembler-x64.cc#36
>>>
>>> src/x64/assembler-x64.cc:35:1: error: inline variables are incompatible
>>> with C++ standards before C++17 [-Werror,-Wc++98-c++11-c++14-compat]
>>> V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
>>> ^
>>> include/v8config.h:294:20: note: expanded from macro 'V8_INLINE'
>>> # define V8_INLINE inline __attribute__((always_inline))
>>>^
>>> src/x64/assembler-x64.cc:35:41: error: expected ')'
>>> V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
>>> ^
>>> src/x64/assembler-x64.cc:35:20: note: to match this '('
>>> V8_INLINE uint64_t _xgetbv(unsigned int xcr) {
>>>^
>>> lib/clang/include/xsaveintrin.h:49:53: note: expanded from macro
>>> '_xgetbv'
>>> #define _xgetbv(A) __builtin_ia32_xgetbv((long long)(A))
>>>
>>> On Tue, Jan 15, 2019 at 6:06 AM Craig Topper via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: ctopper
 Date: Mon Jan 14 21:03:18 2019
 New Revision: 351160

 URL: http://llvm.org/viewvc/llvm-project?rev=351160&view=rev
 Log:
 [X86] Make _xgetbv/_xsetbv on non-windows platforms

 Summary:
 This patch attempts to redo what was tried in r278783, but was reverted.

 These intrinsics should be available on non-windows platforms with
 "xsave" feature check. But on Windows platforms they shouldn't have feature
 check since that's how MSVC behaves.

 To accomplish this I've added a MS builtin with no feature check. And a
 normal gcc builtin with a feature check. When _MSC_VER is not defined
 _xgetbv/_xsetbv will be macros pointing to the gcc builtin name.

 I've moved the forward declarations from intrin.h to immintrin.h to
 match the MSDN documentation and used that as the header file for the MS
 builtin.

 I'm not super happy with this implementation, and I'm open to
 suggestions for better ways to do it.

 Reviewers: rnk, RKSimon, spatel

 Reviewed By: rnk

 Subscribers: cfe-commits

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

 Modified:
 cfe/trunk/include/clang/Basic/BuiltinsX86.def
 cfe/trunk/lib/CodeGen/CGBuiltin.cpp
 cfe/trunk/lib/Headers/immintrin.h
 cfe/trunk/lib/Headers/intrin.h
 cfe/trunk/lib/Headers/xsaveintrin.h
 cfe/trunk/test/CodeGen/builtins-x86.c
 cfe/trunk/test/CodeGen/x86_32-xsave.c
 cfe/trunk/test/CodeGen/x86_64-xsave.c
 cfe/trunk/test/Headers/ms-intrin.cpp

 Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=351160&r1=351159&r2=351160&view=diff

 ==
 --- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
 +++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Jan 14 21:03:18
 2019
 @@ -693,6 +693,10 @@ TARGET_BUILTIN(__builtin_ia32_fxsave, "v
  // XSAVE
  TARGET_BUILTIN(__builtin_ia32_xsave, "vv*ULLi", "n", "xsave")
  TARGET_BUILTIN(__builtin_ia32_xrstor, "vv*ULLi", "n", "xsave")
 +TARGET_BUILTIN(__builtin_ia32_xgetbv, "ULLiUi", "n", "xsave")
 +TARGET_HEADER_BUILTIN(_xgetbv, "UWiUi", "nh", "immintrin.h",
 ALL_MS_LANGUAGES, "")
 +TARGET_BUILTIN(__builtin_ia32_xsetbv, "vUiULLi", "n", "xsave")
 +TARGET_HEADER_BUILTIN(_xsetbv, "vUiUWi", "nh", "immintrin.h",
 ALL_MS_LANGUAGES, "")
  TARGET_BUILTIN(__builtin_ia32_xsaveopt, "vv*ULLi", "n", "xsaveopt")
  TARGET_BUILTIN(__builtin_ia32_xrstors, "vv*ULLi", "n", "xsaves")
  TARGET_BUILTIN(__builtin_ia32_xsavec, "vv*ULLi", "n", "xsavec")

 Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
 URL:
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=351160&r1=351159&r2=351160&view=diff

 ==
 --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
 +++ cfe/trunk/li

[PATCH] D56707: Implement CXXCtorInitializer dump in terms of Visitor

2019-01-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rC Clang

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

https://reviews.llvm.org/D56707



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


[PATCH] D56735: [OpenCL] Fix overloading ranking rules to work correctly for address space coversions

2019-01-15 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia created this revision.
Anastasia added a reviewer: rjmccall.
Herald added a subscriber: yaxunl.

This bug was pointed out in https://reviews.llvm.org/D55850#inline-496966


https://reviews.llvm.org/D56735

Files:
  lib/Sema/SemaOverload.cpp
  test/SemaOpenCLCXX/address_space_overloading.cl


Index: test/SemaOpenCLCXX/address_space_overloading.cl
===
--- /dev/null
+++ test/SemaOpenCLCXX/address_space_overloading.cl
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=c++
+
+// expected-no-diagnostics
+void foo(const __global int *a);
+void foo(const __generic int *a);
+
+void kernel ker() {
+  __global int *a;
+  __generic int *c;
+  __local int *d;
+  foo(a);
+  foo(c);
+  foo(d);
+}
Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -4019,7 +4019,8 @@
 // to unwrap. This essentially mimics what
 // IsQualificationConversion does, but here we're checking for a
 // strict subset of qualifiers.
-if (T1.getCVRQualifiers() == T2.getCVRQualifiers())
+if (T1.getCVRQualifiers() == T2.getCVRQualifiers() &&
+T1.getAddressSpace() == T2.getAddressSpace())
   // The qualifiers are the same, so this doesn't tell us anything
   // about how the sequences rank.
   ;


Index: test/SemaOpenCLCXX/address_space_overloading.cl
===
--- /dev/null
+++ test/SemaOpenCLCXX/address_space_overloading.cl
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=c++
+
+// expected-no-diagnostics
+void foo(const __global int *a);
+void foo(const __generic int *a);
+
+void kernel ker() {
+  __global int *a;
+  __generic int *c;
+  __local int *d;
+  foo(a);
+  foo(c);
+  foo(d);
+}
Index: lib/Sema/SemaOverload.cpp
===
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -4019,7 +4019,8 @@
 // to unwrap. This essentially mimics what
 // IsQualificationConversion does, but here we're checking for a
 // strict subset of qualifiers.
-if (T1.getCVRQualifiers() == T2.getCVRQualifiers())
+if (T1.getCVRQualifiers() == T2.getCVRQualifiers() &&
+T1.getAddressSpace() == T2.getAddressSpace())
   // The qualifiers are the same, so this doesn't tell us anything
   // about how the sequences rank.
   ;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D53541: [COFF, ARM64] Do not emit x86_seh_recoverfp intrinsic

2019-01-15 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I can't compile the example you gave yet because I haven't applied your patches 
locally, but this is the "three stack pointer" case that I have in mind:

  struct Foo {
void (*ptr)();
int x, y, z;
  };
  
  void escape(void *);
  void large_align(int a0, int a1, int a2, int a3, int a4, int a5, int a6, int 
a7,
   int stackarg) {
struct Foo __declspec(align(32)) alignedlocal;
alignedlocal.x = 42;
int vla[a0];
escape(&alignedlocal);
vla[0] = stackarg;
escape(&vla[0]);
  }

This is LLVM's generated code:

  "?large_align@@YAXH@Z": ; @"?large_align@@YAXH@Z"
  .seh_proc "?large_align@@YAXH@Z"
  ; %bb.0:; %entry
  stp x21, x22, [sp, #-48]!   ; 16-byte Folded Spill
  stp x19, x20, [sp, #16] ; 16-byte Folded Spill
  stp x29, x30, [sp, #32] ; 16-byte Folded Spill
  add x29, sp, #32; =32
  sub x9, sp, #48 ; =48
  and sp, x9, #0xffe0
  mov x19, sp
  mov w8, #42
  str w8, [x19, #8]
  mov w8, w0
  ldr w22, [x29, #16]
  lsl x8, x8, #2
  add x8, x8, #15 ; =15
  lsr x15, x8, #4
  mov x21, sp
  bl  __chkstk
  mov x8, sp
  sub x20, x8, x15, lsl #4
  mov sp, x20
  add x0, x19, #0 ; =0
  bl  "?escape@@YAXPEAX@Z"
  mov x0, x20
  str w22, [x20]
  bl  "?escape@@YAXPEAX@Z"
  mov sp, x21
  sub sp, x29, #32; =32
  ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
  ldp x19, x20, [sp, #16] ; 16-byte Folded Reload
  ldp x21, x22, [sp], #48 ; 16-byte Folded Reload
  ret

I see three pointers used to address the stack:

- sp: to address vla
- x19: to address locals, the so-called "base" pointer
- x29: to address parameters on the stack, looks like the traditional FP, 
points to FP+LR pair as well

At least for x86, the unwind info doesn't describe X19, it just describes X29, 
since that's what you need to restore CSRs and find the parent stack frame. We 
saw that the Windows EH runtime passes in some value based on the unwind info. 
For x86, it was just whatever EBP held, so recoverfp simply aligns that value 
forward to recover the base pointer (ESI) and then uses that to recover locals. 
For x64, the runtime passes in the value of RSP after the prologue ends, so we 
adjust it by the "parent frame offset" to get back the value we put in RBP. It 
looks like for x64 we never handled the case I'm asking you about, because this 
program doesn't print the right value:

  #include 
  struct Foo {
void (*ptr)();
int x, y, z;
  };
  int filter(int n) {
printf("o.x: %d\n", n);
return 1;
  }
  void may_throw() {
__builtin_trap();
  }
  int main() {
struct Foo __declspec(align(32)) o;
o.x = 42;
__try {
  may_throw();
} __except(filter(o.x)) {
}
  }

I get "o.x: 0" instead of 42. I bet we can find something about that in 
bugzilla somewhere. =/

So, hopefully that explains the intended purpose of `llvm.x86.seh.recoverfp`, 
and why we might need to generalize it into something non-x86 specific. Maybe 
`llvm.eh.recoverfp`. Let me know if I can clarify anything else.


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

https://reviews.llvm.org/D53541



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


[PATCH] D55868: [Fixed Point Arithmetic] Fixed Point Addition Constant Expression Evaluation

2019-01-15 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Yeah, I would recommend splitting the `APFixedPoint` in `APValue` changes into 
a separate patch.




Comment at: clang/lib/AST/ExprConstant.cpp:9959
+  }
+  llvm_unreachable("unknown cast resulting in fixed point value");
+}

leonardchan wrote:
> rjmccall wrote:
> > This is obviously unreachable because of the `default` case in the 
> > `switch`.  Should this be moved into the `default` case, and then you can 
> > put your `Error` call in cases for the known-missing fixed-point 
> > conversions?
> > 
> > You should go ahead and add cases for `CK_NoOp` and `CK_LValueToRValue`, 
> > they should be obvious from the other evaluators.
> > 
> > You should add tests for constant-evaluating fixed-point conversions.
> I think it would be better to keep it as an error since elsewhere, we emit 
> errors indicating a particular operation or conversion has not yet been 
> implemented.
Okay.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55868



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


[PATCH] D56708: NFC: Implement OMPClause dump in terms of visitors

2019-01-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM aside from a nit.




Comment at: lib/AST/ASTDumper.cpp:1462
 const OMPExecutableDirective *Node) {
-  for (auto *C : Node->clauses()) {
-dumpChild([=] {
-  if (!C) {
-ColorScope Color(OS, ShowColors, NullColor);
-OS << "<<>> OMPClause";
-return;
-  }
-  {
-ColorScope Color(OS, ShowColors, AttrColor);
-StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
-OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
-   << ClauseName.drop_front() << "Clause";
-  }
-  NodeDumper.dumpPointer(C);
-  NodeDumper.dumpSourceRange(SourceRange(C->getBeginLoc(), 
C->getEndLoc()));
-  if (C->isImplicit())
-OS << " ";
-  for (auto *S : C->children())
-dumpStmt(S);
-});
-  }
+  for (auto *C : Node->clauses())
+Visit(C);

`const auto *`



Comment at: lib/AST/TextNodeDumper.cpp:276-280
+  if (!C) {
+ColorScope Color(OS, ShowColors, NullColor);
+OS << "<<>> OMPClause";
+return;
+  }

This pattern is coming up quite frequently. I wonder if we should factor this 
out into something like:
```
template 
bool dumpNullObject(const Ty *Val, StringRef Label) const {
  if (!Val) {
ColorScope Color(OS, ShowColors, NullColor);
OS << "<<>> " << Label;  
  }
  return !Val;
}
```
So that uses become:
```
if (dumpNullObject(Whatever, "Whatever"))
  return;
```
Doesn't have to be done as part of this patch, but it seems like it might 
reduce some redundancy.


Repository:
  rC Clang

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

https://reviews.llvm.org/D56708



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


[PATCH] D55850: [OpenCL] Allow address spaces as method qualifiers

2019-01-15 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia updated this revision to Diff 181825.
Anastasia added a comment.

Rebased on top of recent related changes and addressed remaining review 
comments.

This now depends on: https://reviews.llvm.org/D56735


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

https://reviews.llvm.org/D55850

Files:
  include/clang/Sema/ParsedAttr.h
  lib/Parse/ParseDecl.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaType.cpp
  test/CodeGenOpenCLCXX/method-overload-address-space.cl
  test/SemaOpenCLCXX/method-overload-address-space.cl

Index: test/SemaOpenCLCXX/method-overload-address-space.cl
===
--- /dev/null
+++ test/SemaOpenCLCXX/method-overload-address-space.cl
@@ -0,0 +1,20 @@
+//RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -pedantic -verify
+
+struct C {
+  void m1() __local __local; //expected-warning{{multiple identical address spaces specified for type}}
+  //expected-note@-1{{candidate function}}
+  void m1() __global;
+  //expected-note@-1{{candidate function}}
+  void m2() __global __local; //expected-error{{multiple address spaces specified for type}}
+};
+
+__global C c_glob;
+
+__kernel void bar() {
+  __local C c_loc;
+  C c_priv;
+
+  c_glob.m1();
+  c_loc.m1();
+  c_priv.m1(); //expected-error{{no matching member function for call to 'm1'}}
+}
Index: test/CodeGenOpenCLCXX/method-overload-address-space.cl
===
--- /dev/null
+++ test/CodeGenOpenCLCXX/method-overload-address-space.cl
@@ -0,0 +1,35 @@
+//RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -O0 -o - | FileCheck %s
+
+struct C {
+  void foo() __local;
+  void foo() __global;
+  void foo();
+  void bar();
+};
+
+__global C c1;
+
+__kernel void k() {
+  __local C c2;
+  C c3;
+  __global C &c_ref = c1;
+  __global C *c_ptr;
+
+  // CHECK: call void @_ZNU3AS11C3fooEv(%struct.C addrspace(1)*
+  c1.foo();
+  // CHECK: call void @_ZNU3AS31C3fooEv(%struct.C addrspace(3)*
+  c2.foo();
+  // CHECK: call void @_ZNU3AS41C3fooEv(%struct.C addrspace(4)*
+  c3.foo();
+  // CHECK: call void @_ZNU3AS11C3fooEv(%struct.C addrspace(1)*
+  c_ptr->foo();
+  // CHECK: void @_ZNU3AS11C3fooEv(%struct.C addrspace(1)*
+  c_ref.foo();
+
+  // CHECK: call void @_ZNU3AS41C3barEv(%struct.C addrspace(4)* addrspacecast (%struct.C addrspace(1)* @c1 to %struct.C addrspace(4)*))
+  c1.bar();
+  //FIXME: Doesn't compile yet
+  //c_ptr->bar();
+  // CHECK: call void @_ZNU3AS41C3barEv(%struct.C addrspace(4)* addrspacecast (%struct.C addrspace(1)* @c1 to %struct.C addrspace(4)*))
+  c_ref.bar();
+}
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -3916,6 +3916,25 @@
   llvm_unreachable("unknown NullabilityKind");
 }
 
+// Diagnose whether this is a case with the multiple addr spaces.
+// Returns true if this is an invalid case.
+// ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified
+// by qualifiers for two or more different address spaces."
+static bool DiagnoseMultipleAddrSpaceAttributes(Sema &S, LangAS ASOld,
+LangAS ASNew,
+SourceLocation AttrLoc) {
+  if (ASOld != LangAS::Default) {
+if (ASOld != ASNew) {
+  S.Diag(AttrLoc, diag::err_attribute_address_multiple_qualifiers);
+  return true;
+} else
+  // Emit a warning if they are identical; it's likely unintended.
+  S.Diag(AttrLoc,
+ diag::warn_attribute_address_multiple_identical_qualifiers);
+  }
+  return false;
+}
+
 static TypeSourceInfo *
 GetTypeSourceInfoForDeclarator(TypeProcessingState &State,
QualType T, TypeSourceInfo *ReturnTypeInfo);
@@ -4823,18 +4842,35 @@
   Exceptions,
   EPI.ExceptionSpec);
 
-const auto &Spec = D.getCXXScopeSpec();
+// FIXME: Set address space from attrs for C++ mode here.
 // OpenCLCPlusPlus: A class member function has an address space.
-if (state.getSema().getLangOpts().OpenCLCPlusPlus &&
-((!Spec.isEmpty() &&
-  Spec.getScopeRep()->getKind() == NestedNameSpecifier::TypeSpec) ||
- state.getDeclarator().getContext() ==
- DeclaratorContext::MemberContext)) {
-  LangAS CurAS = EPI.TypeQuals.getAddressSpace();
+auto IsClassMember = [&]() {
+  return (!state.getDeclarator().getCXXScopeSpec().isEmpty() &&
+  state.getDeclarator()
+  .getCXXScopeSpec()
+  .getScopeRep()
+  ->getKind() == NestedNameSpecifier::TypeSpec) ||
+ state.getDeclarator().getContext() ==
+ DeclaratorContext::MemberContext;
+};
+
+if (state.getSema().

[PATCH] D55850: [OpenCL] Allow address spaces as method qualifiers

2019-01-15 Thread Anastasia Stulova via Phabricator via cfe-commits
Anastasia marked 3 inline comments as done.
Anastasia added inline comments.



Comment at: lib/Sema/SemaOverload.cpp:9279
+(CandAS1 != LangAS::opencl_generic && CandAS1 != LangAS::Default))
+  return true;
+  }

rjmccall wrote:
> Anastasia wrote:
> > rjmccall wrote:
> > > rjmccall wrote:
> > > > This at least needs a comment explaining the rule you're trying to 
> > > > implement.
> > > Okay, thanks for the clarification.  I think this should just be part of 
> > > `CompareImplicitConversionSequence`, right?  It seems to me that you 
> > > should prefer e.g. `int __private *` -> `int __private *` over `int 
> > > __generic *`  as a normal argument conversion as well.
> > > 
> > > Also, can this be written in terms of `isAddressSpaceSupersetOf`?  I 
> > > don't remember how `LangAS::Default` works in OpenCL C++ enough to 
> > > understand how it fits in here.
> > That's correct we should implement the same logic for the arguments too. I 
> > will create a helper function or do you think we should just call 
> > `CompareImplicitConversionSequence` on the method type too?
> > 
> > I think `isAddressSpaceSupersetOf` can't be used here because it determines 
> > compatibility of address spaces. However, the logic we are expressing is 
> > for the address space preference instead.
> If I understand correctly, we already call 
> `CompareImplicitConversionSequence` on the object-argument conversion above, 
> as part of the `for (unsigned ArgIdx = StartArg; ArgIdx < NumArgs; ++ArgIdx) 
> ` loop.
> 
> I think the address-space ordering rule can be reasonably based on 
> compatibility.  In fact, I think it already is in our implementation.  The 
> right rule is basically that (1) an exact match is better than a conversion 
> and (2) a conversion to a subspace is better than a conversion to a 
> superspace.  You can think of this as modifying the "proper subset" rule of 
> [over.ics.rank]p3.2.5, which in implementation terms means 
> `Qualifiers::isMoreQualifiedThan`, which already ends up using 
> `isAddressSpaceSupersetOf`.  So if this ranking isn't working right, it's 
> probably because we're incorrectly fast-pathing based on CVR qualifiers 
> somewhere, and in fact I can see a pretty suspicious check like that in 
> `CompareQualificationConversions`.
I created a separate review to fix this: https://reviews.llvm.org/D56735



Comment at: lib/Sema/SemaType.cpp:4877
   T = Context.getFunctionType(T, ParamTys, EPI);
   T = state.getSema().Context.getAddrSpaceQualType(T, AS);
 } else {

brunodf wrote:
> I follow all of the above (from the point "a class member function has an 
> address space"), but then I take issue with this line (already from Mikael).
> 
> You look at the declaration's attributes, to derive the ASIdx relating to the 
> method's this argument. You mark the relevant attributes as invalid, to 
> prevent them from being considered in "processTypeAttrs" after the switch 
> that we break below. The ASIdx is stored in the qualifiers EPI to go to the 
> FunctionProtoType (this will affect getThisType). This all seems fine.
> 
> But then this line adds the address space qualification to T, the type of the 
> declared function itself. This seems unnecessary, and conceptually wrong: 
> while the function may have an address space in syntax, this address space 
> applies to the this argument, not to the function object (and a pointer to 
> the function is not a pointer to this address space etc.). In short, I think 
> this line should be removed.
I think I fixed it in: https://reviews.llvm.org/D56066


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

https://reviews.llvm.org/D55850



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


[PATCH] D56735: [OpenCL] Fix overloading ranking rules to work correctly for address space coversions

2019-01-15 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

Is there a reason not to just do `T1.getQualifiers() == T2.getQualifiers()`?


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

https://reviews.llvm.org/D56735



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


r351222 - [Tooling] Make clang-tool find libc++ dir on mac when running on a file without compilation database.

2019-01-15 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Tue Jan 15 11:05:50 2019
New Revision: 351222

URL: http://llvm.org/viewvc/llvm-project?rev=351222&view=rev
Log:
[Tooling] Make clang-tool find libc++ dir on mac when running on a file without 
compilation database.

Summary:
This is a regression of r348365.

When clang-tools run on a file without a complation database (`clang-check 
/tmp/t.cc`),
we will use fixed compilation database as a fallback. However the actual 
compiler
path in the fallback complation command is just `clang-tool` which is
insufficient to detect the libc++ dir.

Reviewers: ilya-biryukov, EricWF

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

Added:
cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
Modified:
cfe/trunk/lib/Tooling/CompilationDatabase.cpp

Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=351222&r1=351221&r2=351222&view=diff
==
--- cfe/trunk/lib/Tooling/CompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/CompilationDatabase.cpp Tue Jan 15 11:05:50 2019
@@ -227,6 +227,16 @@ struct FilterUnusedFlags {
   }
 };
 
+std::string GetClangToolCommand() {
+  static int Dummy;
+  std::string ClangExecutable =
+  llvm::sys::fs::getMainExecutable("clang", (void *)&Dummy);
+  SmallString<128> ClangToolPath;
+  ClangToolPath = llvm::sys::path::parent_path(ClangExecutable);
+  llvm::sys::path::append(ClangToolPath, "clang-tool");
+  return ClangToolPath.str();
+}
+
 } // namespace
 
 /// Strips any positional args and possible argv[0] from a command-line
@@ -266,9 +276,9 @@ static bool stripPositionalArgs(std::vec
   Diagnostics));
   NewDriver->setCheckInputsExist(false);
 
-  // This becomes the new argv[0]. The value is actually not important as it
-  // isn't used for invoking Tools.
-  Args.insert(Args.begin(), "clang-tool");
+  // This becomes the new argv[0]. The value is used to detect libc++ include
+  // dirs on Mac, it isn't used for other platforms.
+  Args.insert(Args.begin(), GetClangToolCommand().c_str());
 
   // By adding -c, we force the driver to treat compilation as the last phase.
   // It will then issue warnings via Diagnostics about un-used options that
@@ -366,7 +376,7 @@ FixedCompilationDatabase::loadFromFile(S
 
 FixedCompilationDatabase::
 FixedCompilationDatabase(Twine Directory, ArrayRef CommandLine) {
-  std::vector ToolCommandLine(1, "clang-tool");
+  std::vector ToolCommandLine(1, GetClangToolCommand());
   ToolCommandLine.insert(ToolCommandLine.end(),
  CommandLine.begin(), CommandLine.end());
   CompileCommands.emplace_back(Directory, StringRef(),

Added: cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp?rev=351222&view=auto
==
--- cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp 
(added)
+++ cfe/trunk/test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp Tue 
Jan 15 11:05:50 2019
@@ -0,0 +1,16 @@
+// Clang on MacOS can find libc++ living beside the installed compiler.
+// This test makes sure our libTooling-based tools emulate this properly with
+// fixed compilation database.
+//
+// RUN: rm -rf %t
+// RUN: mkdir %t
+//
+// Install the mock libc++ (simulates the libc++ directory structure).
+// RUN: cp -r %S/Inputs/mock-libcxx %t/
+//
+// RUN: cp clang-check %t/mock-libcxx/bin/
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: %t/mock-libcxx/bin/clang-check -p "%t" "%t/test.cpp" -- -stdlib=libc++
+
+#include 
+vector v;


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


[PATCH] D56680: [Tooling] Make clang-tool find libc++ dir on mac when running on a file without compilation database.

2019-01-15 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rC351222: [Tooling] Make clang-tool find libc++ dir on mac 
when running on a file without… (authored by hokein, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56680?vs=181637&id=181827#toc

Repository:
  rC Clang

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

https://reviews.llvm.org/D56680

Files:
  lib/Tooling/CompilationDatabase.cpp
  test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp


Index: test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
===
--- test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
+++ test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
@@ -0,0 +1,16 @@
+// Clang on MacOS can find libc++ living beside the installed compiler.
+// This test makes sure our libTooling-based tools emulate this properly with
+// fixed compilation database.
+//
+// RUN: rm -rf %t
+// RUN: mkdir %t
+//
+// Install the mock libc++ (simulates the libc++ directory structure).
+// RUN: cp -r %S/Inputs/mock-libcxx %t/
+//
+// RUN: cp clang-check %t/mock-libcxx/bin/
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: %t/mock-libcxx/bin/clang-check -p "%t" "%t/test.cpp" -- -stdlib=libc++
+
+#include 
+vector v;
Index: lib/Tooling/CompilationDatabase.cpp
===
--- lib/Tooling/CompilationDatabase.cpp
+++ lib/Tooling/CompilationDatabase.cpp
@@ -227,6 +227,16 @@
   }
 };
 
+std::string GetClangToolCommand() {
+  static int Dummy;
+  std::string ClangExecutable =
+  llvm::sys::fs::getMainExecutable("clang", (void *)&Dummy);
+  SmallString<128> ClangToolPath;
+  ClangToolPath = llvm::sys::path::parent_path(ClangExecutable);
+  llvm::sys::path::append(ClangToolPath, "clang-tool");
+  return ClangToolPath.str();
+}
+
 } // namespace
 
 /// Strips any positional args and possible argv[0] from a command-line
@@ -266,9 +276,9 @@
   Diagnostics));
   NewDriver->setCheckInputsExist(false);
 
-  // This becomes the new argv[0]. The value is actually not important as it
-  // isn't used for invoking Tools.
-  Args.insert(Args.begin(), "clang-tool");
+  // This becomes the new argv[0]. The value is used to detect libc++ include
+  // dirs on Mac, it isn't used for other platforms.
+  Args.insert(Args.begin(), GetClangToolCommand().c_str());
 
   // By adding -c, we force the driver to treat compilation as the last phase.
   // It will then issue warnings via Diagnostics about un-used options that
@@ -366,7 +376,7 @@
 
 FixedCompilationDatabase::
 FixedCompilationDatabase(Twine Directory, ArrayRef CommandLine) {
-  std::vector ToolCommandLine(1, "clang-tool");
+  std::vector ToolCommandLine(1, GetClangToolCommand());
   ToolCommandLine.insert(ToolCommandLine.end(),
  CommandLine.begin(), CommandLine.end());
   CompileCommands.emplace_back(Directory, StringRef(),


Index: test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
===
--- test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
+++ test/Tooling/clang-check-mac-libcxx-fixed-compilation-db.cpp
@@ -0,0 +1,16 @@
+// Clang on MacOS can find libc++ living beside the installed compiler.
+// This test makes sure our libTooling-based tools emulate this properly with
+// fixed compilation database.
+//
+// RUN: rm -rf %t
+// RUN: mkdir %t
+//
+// Install the mock libc++ (simulates the libc++ directory structure).
+// RUN: cp -r %S/Inputs/mock-libcxx %t/
+//
+// RUN: cp clang-check %t/mock-libcxx/bin/
+// RUN: cp "%s" "%t/test.cpp"
+// RUN: %t/mock-libcxx/bin/clang-check -p "%t" "%t/test.cpp" -- -stdlib=libc++
+
+#include 
+vector v;
Index: lib/Tooling/CompilationDatabase.cpp
===
--- lib/Tooling/CompilationDatabase.cpp
+++ lib/Tooling/CompilationDatabase.cpp
@@ -227,6 +227,16 @@
   }
 };
 
+std::string GetClangToolCommand() {
+  static int Dummy;
+  std::string ClangExecutable =
+  llvm::sys::fs::getMainExecutable("clang", (void *)&Dummy);
+  SmallString<128> ClangToolPath;
+  ClangToolPath = llvm::sys::path::parent_path(ClangExecutable);
+  llvm::sys::path::append(ClangToolPath, "clang-tool");
+  return ClangToolPath.str();
+}
+
 } // namespace
 
 /// Strips any positional args and possible argv[0] from a command-line
@@ -266,9 +276,9 @@
   Diagnostics));
   NewDriver->setCheckInputsExist(false);
 
-  // This becomes the new argv[0]. The value is actually not important as it
-  // isn't used for invoking Tools.
-  Args.insert(Args.begin(), "clang-tool");
+  // This becomes the new argv[0]. The value is used to detect libc++ include
+  // dirs on Mac, it isn't used for other platforms.
+  Args.insert(Args.begin(), GetClangToolCommand().c_str());
 
   // By adding -c, we force the driver to treat compilation as the last phase

[PATCH] D56709: Implement BlockDecl::Capture dump in terms of visitors

2019-01-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rC Clang

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

https://reviews.llvm.org/D56709



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


[PATCH] D53738: [Fixed Point Arithmetic] Fixed Point Addition

2019-01-15 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In D53738#172 , @rjmccall wrote:

> In D53738#1333276 , @leonardchan 
> wrote:
>
> > In D53738#1326071 , @rjmccall 
> > wrote:
> >
> > > I'm fine with making this change under the assumption that we've gotten 
> > > the language rule right.  Even if that weren't abstractly reasonable for 
> > > general language work — and I do think it's reasonable when we have a 
> > > good-faith question about the right semantics — this is clearly still an 
> > > experimental implementation and will be for several months yet, and 
> > > hopefully it won't take that long for us to get a response.
> >
> >
> > @rjmccall Have you received a response yet? If not, do you think you have 
> > an estimate on the response time, or also mind sharing the contact 
> > information if that's ok?
>
>
> I just have a coworker who's part of the committee.  I think you might be 
> over-opimistic about how quickly things get answered with the C committee, 
> though.  We should not allow our work to be blocked waiting for a response.


The committee was less helpful than I hoped, but what I decided to take away 
from their response was that we should not artificially lose precision here by 
separating the signedness conversion from the operation.


Repository:
  rC Clang

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

https://reviews.llvm.org/D53738



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


[PATCH] D56731: Add -Wimplicit-ctad warning to diagnose CTAD on types with no user defined deduction guides.

2019-01-15 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF marked 6 inline comments as done.
EricWF added inline comments.



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2129
+def warn_class_template_argument_deduction_no_user_defined_guides : Warning<
+  "class template argument deduction for %0 that has no user defined deduction 
guides" >,
+  InGroup, DefaultIgnore;

lebedev.ri wrote:
> Quuxplusone wrote:
> > `s/user defined/user-defined/`, and perhaps `s/that has/with/` for brevity.
> `class template argument deduction  for %0 that has no 
> user`
> the sentence looks incomplete to me.
How about `using class template argument deduction for %0 that has no 
user-defined deduction guides`?



Comment at: test/SemaCXX/cxx1z-class-template-argument-deduction.cpp:426
+// expected-warning@+1 {{class template argument deduction for 'NoExplicit' 
that has no user defined deduction guides}}
+NoExplicit ne(42);
+

Quuxplusone wrote:
> I suggest that additional (more realistic) motivating examples can be found 
> in STL's CppCon 2018 talk. E.g.
> 
> ```
> template
> struct Pair {
> T first; U second;
> explicit Pair(const T& t, const U& u) : first(t), second(u) {}
> };
> Pair p(42, "hello world");  // constructs a Pair
> 
> template
> struct Pair2 {
> T first; U second;
> explicit Pair2(T t, U u) : first(t), second(u) {}
> };
> Pair2 p(42, "hello world");  // constructs a Pair2
> ```
> 
> I would expect (and, with your patch, receive) diagnostics for both of these.
> 
> But for something like `Vector("a", "b")` your patch gives no diagnostic: 
> https://godbolt.org/z/_9zhav
> And for something like [`std::optional o(x);` in generic 
> context](https://quuxplusone.github.io/blog/2018/12/11/dont-inherit-from-std-types/)
>  your patch gives no diagnostic.
> 
> I do have a patch out for a general-purpose `-Wctad` that would give warnings 
> on those latter cases as well: D54565
> I think `-Wimplicit-ctad` is a good start, but it doesn't solve all the cases 
> I'd like to see solved.
I'll add the tests you described. And indeed, this solution is incomplete.

Can you expand on you `std::optional` example? I don't understand it.



Repository:
  rC Clang

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

https://reviews.llvm.org/D56731



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


[PATCH] D56731: Add -Wimplicit-ctad warning to diagnose CTAD on types with no user defined deduction guides.

2019-01-15 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 181829.
EricWF marked an inline comment as done.
EricWF added a comment.

Address inline comments.


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

https://reviews.llvm.org/D56731

Files:
  include/clang/Basic/DiagnosticGroups.td
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaInit.cpp
  test/SemaCXX/cxx1z-class-template-argument-deduction.cpp

Index: test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
===
--- test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
+++ test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
@@ -409,6 +409,61 @@
 
 }
 
+#pragma clang diagnostic push
+#pragma clang diagnostic warning "-Wimplicit-ctad"
+namespace test_implicit_ctad_warning {
+
+template 
+struct Tag {};
+
+template 
+struct NoExplicit {
+  NoExplicit(T) {}
+  NoExplicit(T, int) {}
+};
+
+// expected-warning@+1 {{using class template argument deduction for 'NoExplicit' that has no user-defined deduction guides}}
+NoExplicit ne(42);
+
+template 
+struct HasExplicit {
+  HasExplicit(U) {}
+  HasExplicit(U, int) {}
+};
+template  HasExplicit(U, int) -> HasExplicit>;
+
+HasExplicit he(42);
+
+// Motivating examples from (taken from Stephan Lavavej's 2018 Cppcon talk)
+template
+struct AmateurPair {
+T first; U second;
+explicit AmateurPair(const T& t, const U& u) {}
+};
+// expected-warning@+1 {{using class template argument deduction for 'AmateurPair' that has no user-defined deduction guides}}
+AmateurPair p1(42, "hello world"); // deduces to Pair
+
+template
+struct AmateurPair2 {
+T first; U second;
+explicit AmateurPair2(T t, U u)  {}
+};
+// expected-warning@+1 {{using class template argument deduction for 'AmateurPair2' that has no user-defined deduction guides}}
+AmateurPair2 p2(42, "hello world"); // deduces to Pair2
+
+template 
+struct ProPair {
+  T first; U second;
+explicit ProPair(T const& t, U  const& u)  {}
+};
+template
+ProPair(T1, T2) -> ProPair;
+ProPair p3(42, "hello world"); // deduces to ProPair
+static_assert(__is_same(decltype(p3), ProPair));
+
+}
+#pragma clang diagnostic pop
+
 #else
 
 // expected-no-diagnostics
Index: lib/Sema/SemaInit.cpp
===
--- lib/Sema/SemaInit.cpp
+++ lib/Sema/SemaInit.cpp
@@ -9264,9 +9264,15 @@
   OverloadCandidateSet Candidates(Kind.getLocation(),
   OverloadCandidateSet::CSK_Normal);
   OverloadCandidateSet::iterator Best;
+
+  // Record if at least one user-defined deduction guide was considered
+  bool HasUserDefinedDeductionGuideCandidate = false;
+
   auto tryToResolveOverload =
   [&](bool OnlyListConstructors) -> OverloadingResult {
 Candidates.clear(OverloadCandidateSet::CSK_Normal);
+HasUserDefinedDeductionGuideCandidate = false;
+
 for (auto I = Guides.begin(), E = Guides.end(); I != E; ++I) {
   NamedDecl *D = (*I)->getUnderlyingDecl();
   if (D->isInvalidDecl())
@@ -9278,6 +9284,9 @@
   if (!GD)
 continue;
 
+  if (!GD->isImplicit())
+HasUserDefinedDeductionGuideCandidate = true;
+
   // C++ [over.match.ctor]p1: (non-list copy-initialization from non-class)
   //   For copy-initialization, the candidate functions are all the
   //   converting constructors (12.3.1) of that class.
@@ -9430,5 +9439,15 @@
   Diag(TSInfo->getTypeLoc().getBeginLoc(),
diag::warn_cxx14_compat_class_template_argument_deduction)
   << TSInfo->getTypeLoc().getSourceRange() << 1 << DeducedType;
+
+
+  // -Wimplicit-ctad: Warn if CTAD was used on a type that does not have any
+  // user-defined deduction guides.
+  if (!HasUserDefinedDeductionGuideCandidate) {
+Diag(TSInfo->getTypeLoc().getBeginLoc(),
+ diag::warn_class_template_argument_deduction_no_user_defined_guides)
+<< TemplateName;
+  }
+
   return DeducedType;
 }
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -2125,6 +2125,9 @@
   "class template argument deduction is incompatible with C++ standards "
   "before C++17%select{|; for compatibility, use explicit type name %1}0">,
   InGroup, DefaultIgnore;
+def warn_class_template_argument_deduction_no_user_defined_guides : Warning<
+  "using class template argument deduction for %0 that has no user-defined deduction guides" >,
+  InGroup, DefaultIgnore;
 
 // C++14 deduced return types
 def err_auto_fn_deduction_failure : Error<
Index: include/clang/Basic/DiagnosticGroups.td
===
--- include/clang/Basic/DiagnosticGroups.td
+++ include/clang/Basic/DiagnosticGroups.td
@@ -1050,3 +1050,5 @@
 
 // A group for cross translation unit static analysis related warnings.
 def CrossTU : DiagGroup<"ctu">;
+
+def Impl

[PATCH] D54428: [clangd] XPC transport layer, framework, test-client

2019-01-15 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman accepted this revision.
arphaman added a comment.
This revision is now accepted and ready to land.

LGTM


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

https://reviews.llvm.org/D54428



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


[PATCH] D56733: [OPENMP] update release note for implemented OMP 5.0 features

2019-01-15 Thread Kelvin Li via Phabricator via cfe-commits
kkwli0 updated this revision to Diff 181834.
kkwli0 added a comment.

Add update in OpenMP support release note.


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

https://reviews.llvm.org/D56733

Files:
  docs/OpenMPSupport.rst
  docs/ReleaseNotes.rst

Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -233,12 +233,15 @@
 OpenMP Support in Clang
 --
 
-- Support relational-op != (not-equal) as one of the canonical forms of random
-  access iterator.
-
-- Added support for mapping of the lambdas in target regions.
-
-- Added parsing/sema analysis for OpenMP 5.0 requires directive.
+- OpenMP 5.0 features
+
+  - Support relational-op != (not-equal) as one of the canonical forms of random
+access iterator.
+  - Added support for mapping of the lambdas in target regions.
+  - Added parsing/sema analysis for the requires directive.
+  - Support nested declare target directives.
+  - Make the `this` pointer implicitly mapped as `map(this[:1])`.
+  - Added the `close` *map-type-modifier*.
 
 - Various bugfixes and improvements.
 
Index: docs/OpenMPSupport.rst
===
--- docs/OpenMPSupport.rst
+++ docs/OpenMPSupport.rst
@@ -17,60 +17,32 @@
 OpenMP Support
 ==
 
-Clang fully supports OpenMP 4.5. Clang supports offloading to X86_64, AArch64,
-PPC64[LE] and has `basic support for Cuda devices`_.
-
-Standalone directives
-=
-
-* #pragma omp [for] simd: :good:`Complete`.
-
-* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
-  analysis + generation of special attributes for X86 target, but still
-  missing the LLVM pass for vectorization.
-
-* #pragma omp taskloop [simd]: :good:`Complete`.
-
-* #pragma omp target [enter|exit] data: :good:`Complete`.
-
-* #pragma omp target update: :good:`Complete`.
-
-* #pragma omp target: :good:`Complete`.
+Clang supports the following OpenMP 5.0 features
 
-* #pragma omp declare target: :good:`Complete`.
+* The `reduction`-based clauses in the `task` and `target`-based directives.
 
-* #pragma omp teams: :good:`Complete`.
+* Support relational-op != (not-equal) as one of the canonical forms of random
+  access iterator.
 
-* #pragma omp distribute [simd]: :good:`Complete`.
+* Support for mapping of the lambdas in target regions.
 
-* #pragma omp distribute parallel for [simd]: :good:`Complete`.
+* Parsing/sema analysis for the requires directive.
 
-Combined directives
-===
+* Nested declare target directives.
 
-* #pragma omp parallel for simd: :good:`Complete`.
+* Make the `this` pointer implicitly mapped as `map(this[:1])`.
 
-* #pragma omp target parallel: :good:`Complete`.
+* The `close` *map-type-modifier*.
 
-* #pragma omp target parallel for [simd]: :good:`Complete`.
-
-* #pragma omp target simd: :good:`Complete`.
-
-* #pragma omp target teams: :good:`Complete`.
-
-* #pragma omp teams distribute [simd]: :good:`Complete`.
-
-* #pragma omp target teams distribute [simd]: :good:`Complete`.
-
-* #pragma omp teams distribute parallel for [simd]: :good:`Complete`.
-
-* #pragma omp target teams distribute parallel for [simd]: :good:`Complete`.
+Clang fully supports OpenMP 4.5. Clang supports offloading to X86_64, AArch64,
+PPC64[LE] and has `basic support for Cuda devices`_.
 
-Clang does not support any constructs/updates from OpenMP 5.0 except
-for `reduction`-based clauses in the `task` and `target`-based directives.
+* #pragma omp declare simd: :partial:`Partial`.  We support parsing/semantic
+  analysis + generation of special attributes for X86 target, but still
+  missing the LLVM pass for vectorization.
 
 In addition, the LLVM OpenMP runtime `libomp` supports the OpenMP Tools
-Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and mac OS.
+Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and macOS.
 
 .. _basic support for Cuda devices:
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D55394: Re-order type param children of ObjC nodes

2019-01-15 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

In D55394#1356941 , @rjmccall wrote:

> This is the AST dumper.  This is not a user feature.


Clang developers are users, too. However, the AST dumping does get used a bit 
by non-Clang developers too (such as people using clang-query, who see AST 
output).

> If I'm debugging a clang bug and calling `D->dump()`, I think it'll be just 
> as clear as it used to be what the `ObjCTypeParamDecl` lines mean.

Fantastic, that's the key bit. Thank you for weighing in!

If John doesn't think the change in output will cause confusion for people more 
familiar with ObjC, then I'm good with these changes.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55394



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


[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

2019-01-15 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added inline comments.



Comment at: include/clang/Basic/DiagnosticASTKinds.td:214
+  def err_asm_invalid_operand_number_for_goto_labels : Error <
+"invalid operand number which isn't point to a goto label in asm string">;
 }

Grammar.

Also, "invalid operand number" isn't really a good explanation. Maybe something 
like "operand with 'l' modifier must refer to a label".



Comment at: lib/Sema/SemaStmtAsm.cpp:470
+if (NS->isGCCAsmGoto() &&
+Exprs[ConstraintIdx]->getStmtClass() == Stmt::AddrLabelExprClass)
+  break;

jyu2 wrote:
> efriedma wrote:
> > jyu2 wrote:
> > > efriedma wrote:
> > > > jyu2 wrote:
> > > > > jyu2 wrote:
> > > > > > efriedma wrote:
> > > > > > > jyu2 wrote:
> > > > > > > > efriedma wrote:
> > > > > > > > > jyu2 wrote:
> > > > > > > > > > efriedma wrote:
> > > > > > > > > > > This looks suspicious; an AddrLabelExpr could be an input 
> > > > > > > > > > > or output, e.g. `"r"(&&foo)`.
> > > > > > > > > > Syntax for asm goto:
> > > > > > > > > >  Syntax:
> > > > > > > > > >asm [volatile] goto ( AssemblerTemplate
> > > > > > > > > >:
> > > > > > > > > >: InputOperands
> > > > > > > > > >: Clobbers
> > > > > > > > > >: GotoLabels)
> > > > > > > > > > 
> > > > > > > > > >  Only input is allowed.  Output is not allowed
> > > > > > > > > > 
> > > > > > > > > That doesn't really address my point here... ignore the "or 
> > > > > > > > > output" part of the comment.
> > > > > > > > Sorry did not realize that.  Thank you so much for catching 
> > > > > > > > that.  Need to add other condition "ConstraintIdx > 
> > > > > > > > NS->getNumInputs() - 1", change to :
> > > > > > > > 
> > > > > > > > if (NS->isGCCAsmGoto() && ConstraintIdx > NS->getNumInputs() - 
> > > > > > > > 1 &&
> > > > > > > > Exprs[ConstraintIdx]->getStmtClass() == 
> > > > > > > > Stmt::AddrLabelExprClass)
> > > > > > > >   break;
> > > > > > > > 
> > > > > > > > Is this ok with you?  Thanks
> > > > > > > That's the right idea. But I still see a few issues at that point:
> > > > > > > 
> > > > > > > 1. The AddrLabelExprClass check is redundant.
> > > > > > > 2. "NS->getNumInputs() - 1" can overflow; probably should use 
> > > > > > > "ConstraintIdx >= NS->getNumInputs()".
> > > > > > > 3. "break" exits the loop completely (so it skips validating all 
> > > > > > > constraints written after the label).
> > > > > > > 4. The code needs to verify that the user correctly specified the 
> > > > > > > "l" constraint modifier.
> > > > > > Sorry not done yet.  
> > > > > For you comment 4:
> > > > > 
> > > > > The code needs to verify that the user correctly specified the "l" 
> > > > > constraint modifier.  We already emit error like following?
> > > > > 
> > > > > Do you mean, we need more checking here?  Thanks. 
> > > > > 
> > > > > n.c:4:35: error: unknown symbolic operand name in inline assembly 
> > > > > string
> > > > >   asm goto ("frob %%r5, %1; jc %l[error]; mov (%2), %%r5"
> > > > > ~~^~~
> > > > > n.c:8:15: error: use of undeclared label 'error1'
> > > > > : error1);
> > > > > 
> > > > > Test is:
> > > > > int frob(int x)
> > > > > {
> > > > >   int y;
> > > > >   asm goto ("frob %%r5, %1; jc %l[error]; mov (%2), %%r5"
> > > > > : /* No outputs. */
> > > > > : "r"(x), "r"(&y)
> > > > > : "memory"
> > > > > : error1);
> > > > >   return y;
> > > > > error:
> > > > >   return -1;
> > > > > }
> > > > > 
> > > > > 
> > > > I mean, there needs to be a diagnostic for the following:
> > > > 
> > > > ```
> > > > asm goto ("jne %h0"x);
> > > > ```
> > > > 
> > > > On a related note, there should also be a diagnostic for the following 
> > > > somewhere:
> > > > 
> > > > ```
> > > > asm ("jne %l0"::"r"(0));
> > > > ```
> > > Hi Eli,
> > > 
> > > Thanks for your review.
> > > 
> > > For case:
> > > asm goto ("jne %h0"x);
> > > 
> > > Without define label x, both clang and my current implementation give 
> > > error of "use of undeclared label"
> > > 
> > > if x is defined: gcc give error 
> > > asm_goto>!gcc
> > > gcc n.c
> > > n.c: Assembler messages:
> > > n.c:4: Error: operand type mismatch for `jne'
> > > 
> > > My current implementation don't emit error.  I think this is need to be 
> > > done in LLVM.  Am I right here?
> > > 
> > > For the case:
> > > asm ("jne %l0"::"r"(0));
> > > 
> > > gcc don't allow any modifier 'l' with  asm stmt but it allows with asm 
> > > goto.  Is that something you are look for?  Thanks.
> > > 
> > > So I add code in AST/Stmt.cpp to emit error.
> > > .
> > >  return diag::err_asm_invalid_escape;
> > >   } else if (!this->isGCCAsmGoto() && EscapedChar == 'l' &&
> > >  isDigit(*CurPtr)) {
> > > DiagOffs = CurPtr-StrStart;
> > > retur

[PATCH] D56563: [clang-tidy] add options documentation to readability-identifier-naming checker

2019-01-15 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

In D56563#1358149 , @JonasToth wrote:

>




> Given its length, what do you think about a short link-list at the beginning 
> that will point to the section in the docs? With that its easier to see whats 
> all handled by the check.

How about the following...

F7820384: image.png 


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

https://reviews.llvm.org/D56563



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


[PATCH] D56563: [clang-tidy] add options documentation to readability-identifier-naming checker

2019-01-15 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay updated this revision to Diff 181836.
MyDeveloperDay marked 3 inline comments as done.
MyDeveloperDay added a comment.

Addressing review comment


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

https://reviews.llvm.org/D56563

Files:
  docs/clang-tidy/checks/readability-identifier-naming.rst

Index: docs/clang-tidy/checks/readability-identifier-naming.rst
===
--- docs/clang-tidy/checks/readability-identifier-naming.rst
+++ docs/clang-tidy/checks/readability-identifier-naming.rst
@@ -5,14 +5,1919 @@
 
 Checks for identifiers naming style mismatch.
 
-This check will try to enforce coding guidelines on the identifiers naming.
-It supports `lower_case`, `UPPER_CASE`, `camelBack` and `CamelCase` casing and
-tries to convert from one to another if a mismatch is detected.
+This check will try to enforce coding guidelines on the identifiers naming. It
+supports one of the following casing types and tries to convert from one to
+another if a mismatch is detected
 
-It also supports a fixed prefix and suffix that will be prepended or
-appended to the identifiers, regardless of the casing.
+Casing types inclde:
+
+ - ``lower_case``,
+ - ``UPPER_CASE``,
+ - ``camelBack``,
+ - ``CamelCase``,
+ - ``camel_Snake_Back``,
+ - ``Camel_Snake_Case``,
+ - ``aNy_CasE``.
+
+It also supports a fixed prefix and suffix that will be prepended or appended
+to the identifiers, regardless of the casing.
 
 Many configuration options are available, in order to be able to create
-different rules for different kind of identifier. In general, the
-rules are falling back to a more generic rule if the specific case is not
-configured.
+different rules for different kinds of identifiers. In general, the rules are
+falling back to a more generic rule if the specific case is not configured.
+
+Options
+---
+
+The following options are describe below:
+
+ - :option:`AbstractClassCase`, :option:`AbstractClassPrefix`, :option:`AbstractClassSuffix`
+ - :option:`ClassCase`, :option:`ClassPrefix`, :option:`ClassSuffix`
+ - :option:`ClassConstantCase`, :option:`ClassConstantPrefix`, :option:`ClassConstantSuffix`
+ - :option:`ClassMemberCase`, :option:`ClassMemberPrefix`, :option:`ClassMemberSuffix`
+ - :option:`ClassMethodCase`, :option:`ClassMethodPrefix`, :option:`ClassMethodSuffix`
+ - :option:`ConstantCase`, :option:`ConstantPrefix`, :option:`ConstantSuffix`
+ - :option:`ConstantMemberCase`, :option:`ConstantMemberPrefix`, :option:`ConstantMemberSuffix`
+ - :option:`ConstantParameterCase`, :option:`ConstantParameterPrefix`, :option:`ConstantParameterSuffix`
+ - :option:`ConstantPointerParameterCase`, :option:`ConstantPointerParameterPrefix`, :option:`ConstantPointerParameterSuffix`
+ - :option:`ConstexprFunctionCase`, :option:`ConstexprFunctionPrefix`, :option:`ConstexprFunctionSuffix`
+ - :option:`ConstexprMethodCase`, :option:`ConstexprMethodPrefix`, :option:`ConstexprMethodSuffix`
+ - :option:`ConstexprVariableCase`, :option:`ConstexprVariablePrefix`, :option:`ConstexprVariableSuffix`
+ - :option:`EnumCase`, :option:`EnumPrefix`, :option:`EnumSuffix`
+ - :option:`EnumConstantCase`, :option:`EnumConstantPrefix`, :option:`EnumConstantSuffix`
+ - :option:`FunctionCase`, :option:`FunctionPrefix`, :option:`FunctionSuffix`
+ - :option:`GlobalConstantCase`, :option:`GlobalConstantPrefix`, :option:`GlobalConstantSuffix`
+ - :option:`GlobalConstantPointerCase`, :option:`GlobalConstantPointerPrefix`, :option:`GlobalConstantPointerSuffix`
+ - :option:`GlobalFunctionCase`, :option:`GlobalFunctionPrefix`, :option:`GlobalFunctionSuffix`
+ - :option:`GlobalPointerCase`, :option:`GlobalPointerPrefix`, :option:`GlobalPointerSuffix`
+ - :option:`GlobalVariableCase`, :option:`GlobalVariablePrefix`, :option:`GlobalVariableSuffix`
+ - :option:`InlineNamespaceCase`, :option:`InlineNamespacePrefix`, :option:`InlineNamespaceSuffix`
+ - :option:`LocalConstantCase`, :option:`LocalConstantPrefix`, :option:`LocalConstantSuffix`
+ - :option:`LocalConstantPointerCase`, :option:`LocalConstantPointerPrefix`, :option:`LocalConstantPointerSuffix`
+ - :option:`LocalPointerCase`, :option:`LocalPointerPrefix`, :option:`LocalPointerSuffix`
+ - :option:`LocalVariableCase`, :option:`LocalVariablePrefix`, :option:`LocalVariableSuffix`
+ - :option:`MemberCase`, :option:`MemberPrefix`, :option:`MemberSuffix`
+ - :option:`MethodCase`, :option:`MethodPrefix`, :option:`MethodSuffix`
+ - :option:`NamespaceCase`, :option:`NamespacePrefix`, :option:`NamespaceSuffix`
+ - :option:`ParameterCase`, :option:`ParameterPrefix`, :option:`ParameterSuffix`
+ - :option:`ParameterPackCase`, :option:`ParameterPackPrefix`, :option:`ParameterPackSuffix`
+ - :option:`PointerParameterCase`, :option:`PointerParameterPrefix`, :option:`PointerParameterSuffix`
+ - :option:`PrivateMemberCase`, :option:`PrivateMemberPrefix`, :option:`PrivateMemberSuffix`
+ - :option:`PrivateMethodCase`, :option:`PrivateMethodPrefi

[PATCH] D53541: [COFF, ARM64] Do not emit x86_seh_recoverfp intrinsic

2019-01-15 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang added a comment.

In D53541#1358210 , @rnk wrote:

> I can't compile the example you gave yet because I haven't applied your 
> patches locally, but this is the "three stack pointer" case that I have in 
> mind:
>
>   struct Foo {
> void (*ptr)();
> int x, y, z;
>   };
>  
>   void escape(void *);
>   void large_align(int a0, int a1, int a2, int a3, int a4, int a5, int a6, 
> int a7,
>int stackarg) {
> struct Foo __declspec(align(32)) alignedlocal;
> alignedlocal.x = 42;
> int vla[a0];
> escape(&alignedlocal);
> vla[0] = stackarg;
> escape(&vla[0]);
>   }
>
>
> This is LLVM's generated code:
>
>   "?large_align@@YAXH@Z": ; @"?large_align@@YAXH@Z"
>   .seh_proc "?large_align@@YAXH@Z"
>   ; %bb.0:; %entry
>   stp x21, x22, [sp, #-48]!   ; 16-byte Folded Spill
>   stp x19, x20, [sp, #16] ; 16-byte Folded Spill
>   stp x29, x30, [sp, #32] ; 16-byte Folded Spill
>   add x29, sp, #32; =32
>   sub x9, sp, #48 ; =48
>   and sp, x9, #0xffe0
>   mov x19, sp
>   mov w8, #42
>   str w8, [x19, #8]
>   mov w8, w0
>   ldr w22, [x29, #16]
>   lsl x8, x8, #2
>   add x8, x8, #15 ; =15
>   lsr x15, x8, #4
>   mov x21, sp
>   bl  __chkstk
>   mov x8, sp
>   sub x20, x8, x15, lsl #4
>   mov sp, x20
>   add x0, x19, #0 ; =0
>   bl  "?escape@@YAXPEAX@Z"
>   mov x0, x20
>   str w22, [x20]
>   bl  "?escape@@YAXPEAX@Z"
>   mov sp, x21
>   sub sp, x29, #32; =32
>   ldp x29, x30, [sp, #32] ; 16-byte Folded Reload
>   ldp x19, x20, [sp, #16] ; 16-byte Folded Reload
>   ldp x21, x22, [sp], #48 ; 16-byte Folded Reload
>   ret
>
>
> I see three pointers used to address the stack:
>
> - sp: to address vla
> - x19: to address locals, the so-called "base" pointer
> - x29: to address parameters on the stack, looks like the traditional FP, 
> points to FP+LR pair as well
>
>   At least for x86, the unwind info doesn't describe X19, it just describes 
> X29, since that's what you need to restore CSRs and find the parent stack 
> frame. We saw that the Windows EH runtime passes in some value based on the 
> unwind info. For x86, it was just whatever EBP held, so recoverfp simply 
> aligns that value forward to recover the base pointer (ESI) and then uses 
> that to recover locals. For x64, the runtime passes in the value of RSP after 
> the prologue ends, so we adjust it by the "parent frame offset" to get back 
> the value we put in RBP. It looks like for x64 we never handled the case I'm 
> asking you about, because this program doesn't print the right value: ``` 
> #include  struct Foo { void (*ptr)(); int x, y, z; }; int filter(int 
> n) { printf("o.x: %d\n", n); return 1; } void may_throw() { __builtin_trap(); 
> } int main() { struct Foo __declspec(align(32)) o; o.x = 42; __try { 
> may_throw(); } __except(filter(o.x)) { } } ```
>
>   I get "o.x: 0" instead of 42. I bet we can find something about that in 
> bugzilla somewhere. =/
>
>   So, hopefully that explains the intended purpose of 
> `llvm.x86.seh.recoverfp`, and why we might need to generalize it into 
> something non-x86 specific. Maybe `llvm.eh.recoverfp`. Let me know if I can 
> clarify anything else.


@rnk Thanks a lot for the clarification. Yes, I see o.x: 0 instead of 42. 
Supporting this case would mean implementing recoverfp as well as support 
generating the correct parent frame offset for arm64 windows. Do you think this 
can be done in a follow-up patch? So this patch and D53540 
 would add the basic support for SEH and we 
can go fix corner/more complex cases in follow-up patches. There are also 
several more comprehensive test cases in 
https://github.com/Microsoft/windows_seh_tests which we plan to address next.


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

https://reviews.llvm.org/D53541



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


[PATCH] D53541: [COFF, ARM64] Do not emit x86_seh_recoverfp intrinsic

2019-01-15 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

In D53541#1358310 , @mgrang wrote:

> @rnk Thanks a lot for the clarification. Yes, I see o.x: 0 instead of 42. 
> Supporting this case would mean implementing recoverfp as well as support 
> generating the correct parent frame offset for arm64 windows. Do you think 
> this can be done in a follow-up patch? So this patch and D53540 
>  would add the basic support for SEH and we 
> can go fix corner/more complex cases in follow-up patches. There are also 
> several more comprehensive test cases in 
> https://github.com/Microsoft/windows_seh_tests which we plan to address next.


Sure, there's no need to handle the case of highly aligned stack objects in the 
initial version. But I would recommend making incremental progress in a way 
that brings us closer to the desired final end state.

I'd recommend renaming llvm.x86.seh.recoverfp to something non-architecture 
specific, and then implementing it as a no-op in the AArch64 backend. It will 
simply return the FP it is given, with FIXME comments about handling 
highly-aligned locals in the future. That'll save us this target check in 
clang, which we don't need in the long run.


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

https://reviews.llvm.org/D53541



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


[PATCH] D56658: [MSP430] Add msp430 toochain

2019-01-15 Thread Anton Korobeynikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL351228: [MSP430] Provide a toolchain description (authored 
by asl, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56658?vs=181531&id=181841#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56658

Files:
  cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
  cfe/trunk/include/clang/Basic/MSP430Target.def
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/include/clang/module.modulemap
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/lib/Driver/CMakeLists.txt
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
  cfe/trunk/lib/Driver/ToolChains/MSP430.cpp
  cfe/trunk/lib/Driver/ToolChains/MSP430.h
  cfe/trunk/test/Driver/Inputs/basic_msp430_tree/bin/msp430-elf-ld
  
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtbegin.o
  
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtend.o
  cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/crt0.o
  cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/crtn.o
  cfe/trunk/test/Driver/msp430-hwmult.c
  cfe/trunk/test/Driver/msp430-mmcu.c
  cfe/trunk/test/Driver/msp430-toolchain.c
  cfe/trunk/test/Driver/no-integrated-as.c

Index: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
@@ -414,4 +414,15 @@
   "-ftrivial-auto-var-init=zero hasn't been enabled. Enable it at your own peril for benchmarking purpose only with "
   "-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">;
 
+def warn_drv_msp430_hwmult_unsupported : Warning<"the given MCU does not "
+  "support hardware multiply, but -mhwmult is set to %0.">,
+   InGroup;
+def warn_drv_msp430_hwmult_mismatch : Warning<"the given MCU supports %0 "
+  "hardware multiply, but -mhwmult is set to %1.">,
+   InGroup;
+def warn_drv_msp430_hwmult_no_device : Warning<"no MCU device specified, but "
+  "'-mhwmult' is set to 'auto', assuming no hardware multiply. Use -mmcu to "
+  "specify a MSP430 device, or -mhwmult to set hardware multiply type "
+  "explicitly.">, InGroup;
+
 }
Index: cfe/trunk/include/clang/Basic/MSP430Target.def
===
--- cfe/trunk/include/clang/Basic/MSP430Target.def
+++ cfe/trunk/include/clang/Basic/MSP430Target.def
@@ -0,0 +1,247 @@
+//===--- MSP430Target.def - MSP430 Feature/Processor Database*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file defines the MSP430 devices and their features.
+//
+//===--===//
+
+#ifndef MSP430_MCU_FEAT
+#define MSP430_MCU_FEAT(NAME, HWMULT) MSP430_MCU(NAME)
+#endif
+
+#ifndef MSP430_MCU
+#define MSP430_MCU(NAME)
+#endif
+
+MSP430_MCU("msp430c111")
+MSP430_MCU("msp430c")
+MSP430_MCU("msp430c112")
+MSP430_MCU("msp430c1121")
+MSP430_MCU("msp430c1331")
+MSP430_MCU("msp430c1351")
+MSP430_MCU("msp430e112")
+MSP430_MCU("msp430f110")
+MSP430_MCU("msp430f1101")
+MSP430_MCU("msp430f1101a")
+MSP430_MCU("msp430f")
+MSP430_MCU("msp430fa")
+MSP430_MCU("msp430f112")
+MSP430_MCU("msp430f1121")
+MSP430_MCU("msp430f1121a")
+MSP430_MCU("msp430f1122")
+MSP430_MCU("msp430f1132")
+MSP430_MCU("msp430f122")
+MSP430_MCU("msp430f1222")
+MSP430_MCU("msp430f123")
+MSP430_MCU("msp430f1232")
+MSP430_MCU("msp430f133")
+MSP430_MCU("msp430f135")
+MSP430_MCU("msp430f155")
+MSP430_MCU("msp430f156")
+MSP430_MCU("msp430f157")
+MSP430_MCU("msp430p112")
+MSP430_MCU("msp430f2001")
+MSP430_MCU("msp430f2011")
+MSP430_MCU("msp430f2002")
+MSP430_MCU("msp430f2012")
+MSP430_MCU("msp430f2003")
+MSP430_MCU("msp430f2013")
+MSP430_MCU("msp430f2101")
+MSP430_MCU("msp430f2111")
+MSP430_MCU("msp430f2121")
+MSP430_MCU("msp430f2131")
+MSP430_MCU("msp430f2112")
+MSP430_MCU("msp430f2122")
+MSP430_MCU("msp430f2132")
+MSP430_MCU("msp430f2232")
+MSP430_MCU("msp430f2252")
+MSP430_MCU("msp430f2272")
+MSP430_MCU("msp430f2234")
+MSP430_MCU("msp430f2254")
+MSP430_MCU("msp430f2274")
+MSP430_MCU("msp430g2211")
+MSP430_MCU("msp430g2201")
+MSP430_MCU("msp430g2111")
+MSP430_MCU("msp430g2101")
+MSP430_MCU("msp430g2001")
+MSP430_MCU("msp430g2231")
+MSP430_MCU("msp430g2221")
+MSP430_MCU("msp430g2131")
+MSP430_MCU("msp430g2121")
+MSP430_MCU("msp430g2102")
+MSP430_MCU("msp430g2202")
+MSP430_MCU("msp430g2302")
+MSP430_MCU("msp430g2402")
+MSP430_MCU("msp430g2132"

r351228 - [MSP430] Provide a toolchain description

2019-01-15 Thread Anton Korobeynikov via cfe-commits
Author: asl
Date: Tue Jan 15 11:44:05 2019
New Revision: 351228

URL: http://llvm.org/viewvc/llvm-project?rev=351228&view=rev
Log:
[MSP430] Provide a toolchain description

This is an initial implementation for msp430 toolchain including
-mmcu option support
-mhwmult options support
-integrated-as by default

The toolchain uses msp430-elf-as as a linker and supports msp430-gcc toolchain 
tree.

Patch by Kristina Bessonova!

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

Added:
cfe/trunk/include/clang/Basic/MSP430Target.def
cfe/trunk/lib/Driver/ToolChains/MSP430.cpp
cfe/trunk/lib/Driver/ToolChains/MSP430.h
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/bin/
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/bin/msp430-elf-ld   (with 
props)
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/

cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtbegin.o

cfe/trunk/test/Driver/Inputs/basic_msp430_tree/lib/gcc/msp430-elf/7.3.1/430/crtend.o
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/crt0.o
cfe/trunk/test/Driver/Inputs/basic_msp430_tree/msp430-elf/lib/430/crtn.o
cfe/trunk/test/Driver/msp430-hwmult.c
cfe/trunk/test/Driver/msp430-mmcu.c
cfe/trunk/test/Driver/msp430-toolchain.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/include/clang/module.modulemap
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/test/Driver/no-integrated-as.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=351228&r1=351227&r2=351228&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Tue Jan 15 11:44:05 
2019
@@ -414,4 +414,15 @@ def err_drv_trivial_auto_var_init_zero_d
   "-ftrivial-auto-var-init=zero hasn't been enabled. Enable it at your own 
peril for benchmarking purpose only with "
   "-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang">;
 
+def warn_drv_msp430_hwmult_unsupported : Warning<"the given MCU does not "
+  "support hardware multiply, but -mhwmult is set to %0.">,
+   InGroup;
+def warn_drv_msp430_hwmult_mismatch : Warning<"the given MCU supports %0 "
+  "hardware multiply, but -mhwmult is set to %1.">,
+   InGroup;
+def warn_drv_msp430_hwmult_no_device : Warning<"no MCU device specified, but "
+  "'-mhwmult' is set to 'auto', assuming no hardware multiply. Use -mmcu to "
+  "specify a MSP430 device, or -mhwmult to set hardware multiply type "
+  "explicitly.">, InGroup;
+
 }

Added: cfe/trunk/include/clang/Basic/MSP430Target.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/MSP430Target.def?rev=351228&view=auto
==
--- cfe/trunk/include/clang/Basic/MSP430Target.def (added)
+++ cfe/trunk/include/clang/Basic/MSP430Target.def Tue Jan 15 11:44:05 2019
@@ -0,0 +1,247 @@
+//===--- MSP430Target.def - MSP430 Feature/Processor Database*- C++ 
-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file defines the MSP430 devices and their features.
+//
+//===--===//
+
+#ifndef MSP430_MCU_FEAT
+#define MSP430_MCU_FEAT(NAME, HWMULT) MSP430_MCU(NAME)
+#endif
+
+#ifndef MSP430_MCU
+#define MSP430_MCU(NAME)
+#endif
+
+MSP430_MCU("msp430c111")
+MSP430_MCU("msp430c")
+MSP430_MCU("msp430c112")
+MSP430_MCU("msp430c1121")
+MSP430_MCU("msp430c1331")
+MSP430_MCU("msp430c1351")
+MSP430_MCU("msp430e112")
+MSP430_MCU("msp430f110")
+MSP430_MCU("msp430f1101")
+MSP430_MCU("msp430f1101a")
+MSP430_MCU("msp430f")
+MSP430_MCU("msp430fa")
+MSP430_MCU("msp430f112")
+MSP430_MCU("msp430f1121")
+MSP430_MCU("msp430f1121a")
+MSP430_MCU("msp430f1122")
+MSP430_MCU(

[PATCH] D56731: Add -Wimplicit-ctad warning to diagnose CTAD on types with no user defined deduction guides.

2019-01-15 Thread Geoffrey Romer via Phabricator via cfe-commits
gromer added inline comments.



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2129
+def warn_class_template_argument_deduction_no_user_defined_guides : Warning<
+  "using class template argument deduction for %0 that has no user-defined 
deduction guides" >,
+  InGroup, DefaultIgnore;

I'd prefer a phrasing more along the lines of "using class template argument 
deduction for %0 that might not intentionally support it". That gives us more 
room to do things like add an attribute later if necessary, and it helps the 
user understand why this warning indicates a potential problem.


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

https://reviews.llvm.org/D56731



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


r351229 - [Tooling] Fix broken compliation databse tests.

2019-01-15 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Tue Jan 15 11:51:39 2019
New Revision: 351229

URL: http://llvm.org/viewvc/llvm-project?rev=351229&view=rev
Log:
[Tooling] Fix broken compliation databse tests.

I forgot to update the unittest in r351222.

Modified:
cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp

Modified: cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp?rev=351229&r1=351228&r2=351229&view=diff
==
--- cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp Tue Jan 15 11:51:39 
2019
@@ -14,11 +14,15 @@
 #include "clang/Tooling/JSONCompilationDatabase.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/Support/Path.h"
+#include "gmock/gmock.h"
 #include "gtest/gtest.h"
 
 namespace clang {
 namespace tooling {
 
+using testing::ElementsAre;
+using testing::EndsWith;
+
 static void expectFailure(StringRef JSONDatabase, StringRef Explanation) {
   std::string ErrorMessage;
   EXPECT_EQ(nullptr,
@@ -467,21 +471,15 @@ TEST(unescapeJsonCommandLine, ParsesSing
 }
 
 TEST(FixedCompilationDatabase, ReturnsFixedCommandLine) {
-  std::vector CommandLine;
-  CommandLine.push_back("one");
-  CommandLine.push_back("two");
-  FixedCompilationDatabase Database(".", CommandLine);
+  FixedCompilationDatabase Database(".", /*CommandLine*/ {"one", "two"});
   StringRef FileName("source");
   std::vector Result =
 Database.getCompileCommands(FileName);
   ASSERT_EQ(1ul, Result.size());
-  std::vector ExpectedCommandLine(1, "clang-tool");
-  ExpectedCommandLine.insert(ExpectedCommandLine.end(),
- CommandLine.begin(), CommandLine.end());
-  ExpectedCommandLine.push_back("source");
   EXPECT_EQ(".", Result[0].Directory);
   EXPECT_EQ(FileName, Result[0].Filename);
-  EXPECT_EQ(ExpectedCommandLine, Result[0].CommandLine);
+  EXPECT_THAT(Result[0].CommandLine,
+  ElementsAre(EndsWith("clang-tool"), "one", "two", "source"));
 }
 
 TEST(FixedCompilationDatabase, GetAllFiles) {
@@ -537,12 +535,8 @@ TEST(ParseFixedCompilationDatabase, Retu
 Database->getCompileCommands("source");
   ASSERT_EQ(1ul, Result.size());
   ASSERT_EQ(".", Result[0].Directory);
-  std::vector CommandLine;
-  CommandLine.push_back("clang-tool");
-  CommandLine.push_back("-DDEF3");
-  CommandLine.push_back("-DDEF4");
-  CommandLine.push_back("source");
-  ASSERT_EQ(CommandLine, Result[0].CommandLine);
+  ASSERT_THAT(Result[0].CommandLine, ElementsAre(EndsWith("clang-tool"),
+ "-DDEF3", "-DDEF4", 
"source"));
   EXPECT_EQ(2, Argc);
 }
 
@@ -558,10 +552,8 @@ TEST(ParseFixedCompilationDatabase, Retu
 Database->getCompileCommands("source");
   ASSERT_EQ(1ul, Result.size());
   ASSERT_EQ(".", Result[0].Directory);
-  std::vector CommandLine;
-  CommandLine.push_back("clang-tool");
-  CommandLine.push_back("source");
-  ASSERT_EQ(CommandLine, Result[0].CommandLine);
+  ASSERT_THAT(Result[0].CommandLine,
+  ElementsAre(EndsWith("clang-tool"), "source"));
   EXPECT_EQ(2, Argc);
 }
 
@@ -577,12 +569,8 @@ TEST(ParseFixedCompilationDatabase, Hand
 Database->getCompileCommands("source");
   ASSERT_EQ(1ul, Result.size());
   ASSERT_EQ(".", Result[0].Directory);
-  std::vector Expected;
-  Expected.push_back("clang-tool");
-  Expected.push_back("-c");
-  Expected.push_back("-DDEF3");
-  Expected.push_back("source");
-  ASSERT_EQ(Expected, Result[0].CommandLine);
+  ASSERT_THAT(Result[0].CommandLine,
+  ElementsAre(EndsWith("clang-tool"), "-c", "-DDEF3", "source"));
   EXPECT_EQ(2, Argc);
 }
 
@@ -599,12 +587,9 @@ TEST(ParseFixedCompilationDatabase, Hand
   std::vector Result = Database->getCompileCommands("source");
   ASSERT_EQ(1ul, Result.size());
   ASSERT_EQ(".", Result[0].Directory);
-  std::vector Expected;
-  Expected.push_back("clang-tool");
-  Expected.push_back("-fsyntax-only");
-  Expected.push_back("-DDEF3");
-  Expected.push_back("source");
-  ASSERT_EQ(Expected, Result[0].CommandLine);
+  ASSERT_THAT(
+  Result[0].CommandLine,
+  ElementsAre(EndsWith("clang-tool"), "-fsyntax-only", "-DDEF3", 
"source"));
 }
 
 TEST(ParseFixedCompilationDatabase, HandlesArgv0) {
@@ -620,9 +605,8 @@ TEST(ParseFixedCompilationDatabase, Hand
   ASSERT_EQ(1ul, Result.size());
   ASSERT_EQ(".", Result[0].Directory);
   std::vector Expected;
-  Expected.push_back("clang-tool");
-  Expected.push_back("source");
-  ASSERT_EQ(Expected, Result[0].CommandLine);
+  ASSERT_THAT(Result[0].CommandLine,
+  ElementsAre(EndsWith("clang-tool"), "source"));
   EXPECT_EQ(2, Argc);
 }
 


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


  1   2   3   >