[PATCH] D21676: clang-rename: add a -s (suffix) option

2016-06-24 Thread Miklos Vajna via cfe-commits
vmiklos created this revision.
vmiklos added a reviewer: klimek.
vmiklos added a subscriber: cfe-commits.

Use case: a class is declared in a header, and defined in two 
translation units. clang-rename is asked to rename a class member that's
referenced in both translation units.

Using -i is not possible, as in case the first clang-rename invocation
touches the header, the second invocation will result in compilation
errors. Using -s handles this situation, each invocation can work on the 
original source, and at the end the user can move the .new-rename files
in place with something like

for i in $(find . -name "*.new-rename"); do mv -f $i ${i%%.new-rename}; done

http://reviews.llvm.org/D21676

Files:
  clang-rename/tool/ClangRename.cpp
  test/clang-rename/ClassTestSuffix.cpp

Index: test/clang-rename/ClassTestSuffix.cpp
===
--- /dev/null
+++ test/clang-rename/ClassTestSuffix.cpp
@@ -0,0 +1,15 @@
+// RUN: cat %s > %T/test.cpp
+// RUN: clang-rename -offset=164 -new-name=Hector %T/test.cpp -s --
+// RUN: sed 's,//.*,,' %T/test.cpp.new-rename | FileCheck %s
+class Cla  // CHECK: class Hector
+{
+};
+
+int main()
+{
+Cla *Pointer = 0; // CHECK: Hector *Pointer = 0;
+return 0;
+}
+
+// Use grep -FUbo 'Cla'  to get the correct offset of Cla when changing
+// this file.
Index: clang-rename/tool/ClangRename.cpp
===
--- clang-rename/tool/ClangRename.cpp
+++ clang-rename/tool/ClangRename.cpp
@@ -63,6 +63,11 @@
 cl::desc("Overwrite edited s."),
 cl::cat(ClangRenameCategory));
 static cl::opt
+Suffix(
+"s",
+cl::desc("Similar to -i, but write out edited s with a '.new-rename' 
suffix."),
+cl::cat(ClangRenameCategory));
+static cl::opt
 PrintName(
 "pn",
 cl::desc("Print the found symbol's name prior to renaming to stderr."),
@@ -144,7 +149,18 @@
 for (const auto &File : Files) {
   const auto *Entry = FileMgr.getFile(File);
   auto ID = Sources.translateFile(Entry);
-  Rewrite.getEditBuffer(ID).write(outs());
+  if (Suffix) {
+// Write files with a '.new-rename' suffix instead of overwriting.
+std::string FileName = std::string(Entry->getName()) + ".new-rename";
+std::error_code Error;
+llvm::raw_fd_ostream Stream(FileName, Error, llvm::sys::fs::F_None);
+if (!Error) {
+  Rewrite.getEditBuffer(ID).write(Stream);
+}
+  } else {
+// Write to stdout.
+Rewrite.getEditBuffer(ID).write(outs());
+  }
 }
   }
 


Index: test/clang-rename/ClassTestSuffix.cpp
===
--- /dev/null
+++ test/clang-rename/ClassTestSuffix.cpp
@@ -0,0 +1,15 @@
+// RUN: cat %s > %T/test.cpp
+// RUN: clang-rename -offset=164 -new-name=Hector %T/test.cpp -s --
+// RUN: sed 's,//.*,,' %T/test.cpp.new-rename | FileCheck %s
+class Cla  // CHECK: class Hector
+{
+};
+
+int main()
+{
+Cla *Pointer = 0; // CHECK: Hector *Pointer = 0;
+return 0;
+}
+
+// Use grep -FUbo 'Cla'  to get the correct offset of Cla when changing
+// this file.
Index: clang-rename/tool/ClangRename.cpp
===
--- clang-rename/tool/ClangRename.cpp
+++ clang-rename/tool/ClangRename.cpp
@@ -63,6 +63,11 @@
 cl::desc("Overwrite edited s."),
 cl::cat(ClangRenameCategory));
 static cl::opt
+Suffix(
+"s",
+cl::desc("Similar to -i, but write out edited s with a '.new-rename' suffix."),
+cl::cat(ClangRenameCategory));
+static cl::opt
 PrintName(
 "pn",
 cl::desc("Print the found symbol's name prior to renaming to stderr."),
@@ -144,7 +149,18 @@
 for (const auto &File : Files) {
   const auto *Entry = FileMgr.getFile(File);
   auto ID = Sources.translateFile(Entry);
-  Rewrite.getEditBuffer(ID).write(outs());
+  if (Suffix) {
+// Write files with a '.new-rename' suffix instead of overwriting.
+std::string FileName = std::string(Entry->getName()) + ".new-rename";
+std::error_code Error;
+llvm::raw_fd_ostream Stream(FileName, Error, llvm::sys::fs::F_None);
+if (!Error) {
+  Rewrite.getEditBuffer(ID).write(Stream);
+}
+  } else {
+// Write to stdout.
+Rewrite.getEditBuffer(ID).write(outs());
+  }
 }
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [gentoo-musl] Re: Add support for musl-libc on Linux

2016-06-24 Thread Peter Smith via cfe-commits
Hello Lei,

They look good enough for me. Unless anyone else has any objections I
think you are good to go.

Peter

On 24 June 2016 at 04:25, Lei Zhang  wrote:
> 2016-06-22 16:55 GMT+08:00 Peter Smith :
>> Hello Lei,
>>
>> Thanks for all the updates. That looks good to me from an ARM perspective.
>
> Ping.
>
> Are the patches good enough to be committed?
>
>
> Lei
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast updated this revision to Diff 61763.
hubert.reinterpretcast added a comment.

Update to r273650 with the requested const accessor


http://reviews.llvm.org/D19770

Files:
  include/llvm/Support/TrailingObjects.h

Index: include/llvm/Support/TrailingObjects.h
===
--- include/llvm/Support/TrailingObjects.h
+++ include/llvm/Support/TrailingObjects.h
@@ -342,6 +342,50 @@
TrailingTys, size_t>::type... Counts) {
 return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, 
Counts...);
   }
+
+  /// A type where its ::with_counts template member has a ::type member
+  /// suitable for use as uninitialized storage for an object with the given
+  /// trailing object counts. The template arguments are similar to those
+  /// of additionalSizeToAlloc.
+  ///
+  /// Use with FixedSizeStorageOwner, e.g.:
+  ///
+  /// \code{.cpp}
+  ///
+  /// MyObj::FixedSizeStorage::with_counts<1u>::type myStackObjStorage;
+  /// MyObj::FixedSizeStorageOwner
+  /// myStackObjOwner(new ((void *)&myStackObjStorage) MyObj);
+  /// MyObj *const myStackObjPtr = myStackObjOwner.get();
+  ///
+  /// \endcode
+  template  struct FixedSizeStorage {
+template  struct with_counts {
+  typedef llvm::AlignedCharArray<
+  llvm::AlignOf::Alignment, totalSizeToAlloc(Counts...)
+  > type;
+};
+  };
+
+  /// A type that acts as the owner for an object placed into fixed storage.
+  class FixedSizeStorageOwner {
+  public:
+FixedSizeStorageOwner(BaseTy *p) : p(p) {}
+~FixedSizeStorageOwner() {
+  assert(p && "FixedSizeStorageOwner owns null?");
+  p->~BaseTy();
+}
+
+BaseTy *get() { return p; }
+const BaseTy *get() const { return p; }
+
+  private:
+FixedSizeStorageOwner(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner(FixedSizeStorageOwner &&) = delete;
+FixedSizeStorageOwner &operator=(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner &operator=(FixedSizeStorageOwner &&) = delete;
+
+BaseTy *const p;
+  };
 };
 
 } // end namespace llvm


Index: include/llvm/Support/TrailingObjects.h
===
--- include/llvm/Support/TrailingObjects.h
+++ include/llvm/Support/TrailingObjects.h
@@ -342,6 +342,50 @@
TrailingTys, size_t>::type... Counts) {
 return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, Counts...);
   }
+
+  /// A type where its ::with_counts template member has a ::type member
+  /// suitable for use as uninitialized storage for an object with the given
+  /// trailing object counts. The template arguments are similar to those
+  /// of additionalSizeToAlloc.
+  ///
+  /// Use with FixedSizeStorageOwner, e.g.:
+  ///
+  /// \code{.cpp}
+  ///
+  /// MyObj::FixedSizeStorage::with_counts<1u>::type myStackObjStorage;
+  /// MyObj::FixedSizeStorageOwner
+  /// myStackObjOwner(new ((void *)&myStackObjStorage) MyObj);
+  /// MyObj *const myStackObjPtr = myStackObjOwner.get();
+  ///
+  /// \endcode
+  template  struct FixedSizeStorage {
+template  struct with_counts {
+  typedef llvm::AlignedCharArray<
+  llvm::AlignOf::Alignment, totalSizeToAlloc(Counts...)
+  > type;
+};
+  };
+
+  /// A type that acts as the owner for an object placed into fixed storage.
+  class FixedSizeStorageOwner {
+  public:
+FixedSizeStorageOwner(BaseTy *p) : p(p) {}
+~FixedSizeStorageOwner() {
+  assert(p && "FixedSizeStorageOwner owns null?");
+  p->~BaseTy();
+}
+
+BaseTy *get() { return p; }
+const BaseTy *get() const { return p; }
+
+  private:
+FixedSizeStorageOwner(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner(FixedSizeStorageOwner &&) = delete;
+FixedSizeStorageOwner &operator=(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner &operator=(FixedSizeStorageOwner &&) = delete;
+
+BaseTy *const p;
+  };
 };
 
 } // end namespace llvm
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21676: clang-rename: add a -s (suffix) option

2016-06-24 Thread Manuel Klimek via cfe-commits
klimek added a comment.

Why don't we output replacements and use clang-apply-replacements?


http://reviews.llvm.org/D21676



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


[PATCH] D21677: Add ignoringImplicit matcher

2016-06-24 Thread Cong Liu via cfe-commits
congliu created this revision.
congliu added a reviewer: klimek.
congliu added a subscriber: cfe-commits.
congliu set the repository for this revision to rL LLVM.
Herald added a subscriber: klimek.

Repository:
  rL LLVM

http://reviews.llvm.org/D21677

Files:
  docs/LibASTMatchersReference.html
  docs/tools/dump_ast_matchers.py
  include/clang/ASTMatchers/ASTMatchers.h
  lib/ASTMatchers/Dynamic/Registry.cpp
  unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Index: unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
===
--- unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -1088,6 +1088,16 @@
unless(anything());
 }
 
+TEST(IgnoringImplicit, MatchesImplicit) {
+  EXPECT_TRUE(matches("class C {}; C a = C();",
+  varDecl(has(ignoringImplicit(cxxConstructExpr());
+}
+
+TEST(IgnoringImplicit, DoesNotMatchIncorrectly) {
+  EXPECT_TRUE(
+  notMatches("class C {}; C a = C();", varDecl(has(cxxConstructExpr();
+}
+
 TEST(IgnoringImpCasts, MatchesImpCasts) {
   // This test checks that ignoringImpCasts matches when implicit casts are
   // present and its inner matcher alone does not match.
Index: lib/ASTMatchers/Dynamic/Registry.cpp
===
--- lib/ASTMatchers/Dynamic/Registry.cpp
+++ lib/ASTMatchers/Dynamic/Registry.cpp
@@ -265,6 +265,7 @@
   REGISTER_MATCHER(hasUnarySelector);
   REGISTER_MATCHER(hasValueType);
   REGISTER_MATCHER(ifStmt);
+  REGISTER_MATCHER(ignoringImplicit);
   REGISTER_MATCHER(ignoringImpCasts);
   REGISTER_MATCHER(ignoringParenCasts);
   REGISTER_MATCHER(ignoringParenImpCasts);
Index: include/clang/ASTMatchers/ASTMatchers.h
===
--- include/clang/ASTMatchers/ASTMatchers.h
+++ include/clang/ASTMatchers/ASTMatchers.h
@@ -548,6 +548,32 @@
  Builder);
 }
 
+/// \brief Matches expressions that match InnerMatcher after any implicit AST
+/// nodes are stripped off.
+///
+/// Parentheses and explicit casts are not discarded.
+/// Given
+/// \code
+///   class C {};
+///   C a = C();
+///   C b;
+///   C c = b;
+/// \endcode
+/// The matchers
+/// \code
+///varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr(
+/// \endcode
+/// would match the declarations for a, b, and c.
+/// While
+/// \code
+///varDecl(hasInitializer(cxxConstructExpr()))
+/// \endcode
+/// only match the declarations for b and c.
+AST_MATCHER_P(Expr, ignoringImplicit, ast_matchers::internal::Matcher,
+  InnerMatcher) {
+  return InnerMatcher.matches(*Node.IgnoreImplicit(), Finder, Builder);
+}
+
 /// \brief Matches expressions that match InnerMatcher after any implicit casts
 /// are stripped off.
 ///
Index: docs/LibASTMatchersReference.html
===
--- docs/LibASTMatchersReference.html
+++ docs/LibASTMatchersReference.html
@@ -2347,7 +2347,7 @@
   private:   int c;
   };
 fieldDecl(isPrivate())
-  matches 'int c;' 
+  matches 'int c;'
 
 
 
@@ -2361,7 +2361,7 @@
   private:   int c;
   };
 fieldDecl(isProtected())
-  matches 'int b;' 
+  matches 'int b;'
 
 
 
@@ -2375,7 +2375,7 @@
   private:   int c;
   };
 fieldDecl(isPublic())
-  matches 'int a;' 
+  matches 'int a;'
 
 
 
@@ -4455,6 +4455,25 @@
 
 
 
+MatcherExpr>ignoringImplicitast_matchers::MatcherExpr> InnerMatcher
+Matches expressions that match InnerMatcher after any implicit AST
+nodes are stripped off.
+
+Parentheses and explicit casts are not discarded.
+Given
+  class C {};
+  C a = C();
+  C b;
+  C c = b;
+The matchers
+   varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr(
+would match the declarations for a, b, and c.
+While
+   varDecl(hasInitializer(cxxConstructExpr()))
+only match the declarations for b and c.
+
+
+
 MatcherExpr>ignoringParenCastsMatcherExpr> InnerMatcher
 Matches expressions that match InnerMatcher after parentheses and
 casts are stripped off.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21677: Add ignoringImplicit matcher

2016-06-24 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

lg


Repository:
  rL LLVM

http://reviews.llvm.org/D21677



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


r273659 - IgnoringImplicit matcher.

2016-06-24 Thread Cong Liu via cfe-commits
Author: congliu
Date: Fri Jun 24 04:38:03 2016
New Revision: 273659

URL: http://llvm.org/viewvc/llvm-project?rev=273659&view=rev
Log:
IgnoringImplicit matcher.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/docs/tools/dump_ast_matchers.py   (contents, props changed)
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=273659&r1=273658&r2=273659&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Fri Jun 24 04:38:03 2016
@@ -2347,7 +2347,7 @@ Given
   private:   int c;
   };
 fieldDecl(isPrivate())
-  matches 'int c;' 
+  matches 'int c;'
 
 
 
@@ -2361,7 +2361,7 @@ Given
   private:   int c;
   };
 fieldDecl(isProtected())
-  matches 'int b;' 
+  matches 'int b;'
 
 
 
@@ -2375,7 +2375,7 @@ Given
   private:   int c;
   };
 fieldDecl(isPublic())
-  matches 'int a;' 
+  matches 'int a;'
 
 
 
@@ -4455,6 +4455,25 @@ only match the declarations for b, c, an
 
 
 
+MatcherExpr>ignoringImplicitast_matchers::MatcherExpr> 
InnerMatcher
+Matches 
expressions that match InnerMatcher after any implicit AST
+nodes are stripped off.
+
+Parentheses and explicit casts are not discarded.
+Given
+  class C {};
+  C a = C();
+  C b;
+  C c = b;
+The matchers
+   varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr(
+would match the declarations for a, b, and c.
+While
+   varDecl(hasInitializer(cxxConstructExpr()))
+only match the declarations for b and c.
+
+
+
 MatcherExpr>ignoringParenCastsMatcherExpr> 
InnerMatcher
 Matches 
expressions that match InnerMatcher after parentheses and
 casts are stripped off.

Modified: cfe/trunk/docs/tools/dump_ast_matchers.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/dump_ast_matchers.py?rev=273659&r1=273658&r2=273659&view=diff
==
(empty)

Propchange: cfe/trunk/docs/tools/dump_ast_matchers.py
--
svn:executable = *

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=273659&r1=273658&r2=273659&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Fri Jun 24 04:38:03 2016
@@ -548,6 +548,32 @@ AST_POLYMORPHIC_MATCHER_P(
  Builder);
 }
 
+/// \brief Matches expressions that match InnerMatcher after any implicit AST
+/// nodes are stripped off.
+///
+/// Parentheses and explicit casts are not discarded.
+/// Given
+/// \code
+///   class C {};
+///   C a = C();
+///   C b;
+///   C c = b;
+/// \endcode
+/// The matchers
+/// \code
+///varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr(
+/// \endcode
+/// would match the declarations for a, b, and c.
+/// While
+/// \code
+///varDecl(hasInitializer(cxxConstructExpr()))
+/// \endcode
+/// only match the declarations for b and c.
+AST_MATCHER_P(Expr, ignoringImplicit, ast_matchers::internal::Matcher,
+  InnerMatcher) {
+  return InnerMatcher.matches(*Node.IgnoreImplicit(), Finder, Builder);
+}
+
 /// \brief Matches expressions that match InnerMatcher after any implicit casts
 /// are stripped off.
 ///

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=273659&r1=273658&r2=273659&view=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Fri Jun 24 04:38:03 2016
@@ -265,6 +265,7 @@ RegistryMaps::RegistryMaps() {
   REGISTER_MATCHER(hasUnarySelector);
   REGISTER_MATCHER(hasValueType);
   REGISTER_MATCHER(ifStmt);
+  REGISTER_MATCHER(ignoringImplicit);
   REGISTER_MATCHER(ignoringImpCasts);
   REGISTER_MATCHER(ignoringParenCasts);
   REGISTER_MATCHER(ignoringParenImpCasts);

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp?rev=273659&r1=273658&r2=273659&view=diff
==
-

[clang-tools-extra] r273660 - Remove ignoringImplicit from clang-tidy.

2016-06-24 Thread Cong Liu via cfe-commits
Author: congliu
Date: Fri Jun 24 04:39:28 2016
New Revision: 273660

URL: http://llvm.org/viewvc/llvm-project?rev=273660&view=rev
Log:
Remove ignoringImplicit from clang-tidy.

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
clang-tools-extra/trunk/clang-tidy/utils/Matchers.h

Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=273660&r1=273659&r2=273660&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Fri Jun 
24 04:39:28 2016
@@ -142,7 +142,7 @@ StatementMatcher makeIteratorLoopMatcher
   StatementMatcher IteratorComparisonMatcher = expr(
   
ignoringParenImpCasts(declRefExpr(to(varDecl().bind(ConditionVarName);
 
-  auto OverloadedNEQMatcher = matchers::ignoringImplicit(
+  auto OverloadedNEQMatcher = ignoringImplicit(
   cxxOperatorCallExpr(hasOverloadedOperatorName("!="), argumentCountIs(2),
   hasArgument(0, IteratorComparisonMatcher),
   hasArgument(1, IteratorBoundMatcher)));

Modified: clang-tools-extra/trunk/clang-tidy/utils/Matchers.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/Matchers.h?rev=273660&r1=273659&r2=273660&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/Matchers.h (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/Matchers.h Fri Jun 24 04:39:28 2016
@@ -17,11 +17,6 @@ namespace clang {
 namespace tidy {
 namespace matchers {
 
-AST_MATCHER_P(Expr, ignoringImplicit,
-  ast_matchers::internal::Matcher, InnerMatcher) {
-  return InnerMatcher.matches(*Node.IgnoreImplicit(), Finder, Builder);
-}
-
 AST_MATCHER(BinaryOperator, isRelationalOperator) {
   return Node.isRelationalOp();
 }


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


Re: [clang-tools-extra] r273660 - Remove ignoringImplicit from clang-tidy.

2016-06-24 Thread Renato Golin via cfe-commits
On 24 June 2016 at 10:39, Cong Liu via cfe-commits
 wrote:
> Author: congliu
> Date: Fri Jun 24 04:39:28 2016
> New Revision: 273660
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273660&view=rev
> Log:
> Remove ignoringImplicit from clang-tidy.

Hi Cong,

Isn't this leaving untested code in tree? Shouldn't you have reverted
the patch instead?

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


Re: [clang-tools-extra] r273660 - Remove ignoringImplicit from clang-tidy.

2016-06-24 Thread Cong Liu via cfe-commits
It was the previous revision that broke tests,
http://reviews.llvm.org/rL273659. It moved ignoringImplicit to ASTMatcher,
caused some namespace conflict in clang-tidy/misc/DanglingHandleCheck.cpp.
And r273660 solves that, tests are not broken after this revision.

On Fri, Jun 24, 2016 at 12:32 PM Renato Golin 
wrote:

> On 24 June 2016 at 10:39, Cong Liu via cfe-commits
>  wrote:
> > Author: congliu
> > Date: Fri Jun 24 04:39:28 2016
> > New Revision: 273660
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=273660&view=rev
> > Log:
> > Remove ignoringImplicit from clang-tidy.
>
> Hi Cong,
>
> Isn't this leaving untested code in tree? Shouldn't you have reverted
> the patch instead?
>
> cheers,
> --renato
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273662 - Add (commented out) status entries for the upcoming WG21 motions.

2016-06-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jun 24 06:20:31 2016
New Revision: 273662

URL: http://llvm.org/viewvc/llvm-project?rev=273662&view=rev
Log:
Add (commented out) status entries for the upcoming WG21 motions.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=273662&r1=273661&r2=273662&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Fri Jun 24 06:20:31 2016
@@ -672,11 +672,70 @@ as the draft C++1z standard evolves.
   Yes
 
 
+
 
   constexpr if-statements
   http://wg21.link/p0292r2";>P0292R2
   SVN
 
+
 
 
 


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


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Did Richard sign off on this off-line? Also, this has caused a bot failure:

7:57 AM  build #4390 of ninja-clang-i686-msc19-R is complete: 
Failure [failed build_clang_tools_1]  Build details are at 
http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/4390  blamelist: 
Hubert Tong 


http://reviews.llvm.org/D19770



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


Re: [PATCH] D21667: [analyzer] Add rudimentary handling of AtomicExpr.

2016-06-24 Thread Noel Grandin via cfe-commits
grandinj added a subscriber: grandinj.


Comment at: test/Analysis/atomics.c:4
@@ +3,3 @@
+// Tests for c11 atomics. Many of these tests currently yield unknown
+// because we don't folly model the atomics and instead imprecisely
+// treat their arguments as escaping.

folly->fully


http://reviews.llvm.org/D21667



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


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Hubert Tong via cfe-commits
On Fri, Jun 24, 2016 at 3:00 PM, Aaron Ballman 
wrote:

> aaron.ballman added a comment.
>
> Did Richard sign off on this off-line? Also, this has caused a bot failure:
>
That was my understanding.


>
> 7:57 AM  build #4390 of ninja-clang-i686-msc19-R is complete:
> Failure [failed build_clang_tools_1]  Build details are at
> http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/4390
> blamelist: Hubert Tong 
>
>
> http://reviews.llvm.org/D19770
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21673: [libcxx] guard throw with exception enabling check

2016-06-24 Thread Noel Grandin via cfe-commits
grandinj added a subscriber: grandinj.


Comment at: include/experimental/optional:524
@@ -521,1 +523,3 @@
+assert(!"bad optional access");
+#endif
 return this->__val_;

If this kind of code is going to show up in lots of places, then maybe wrap it 
up in a macro:

   _LIBCPP_THROW_OR_ASSERT(bad_optional_access(), "bad optional access")

?

With some extra preprocessor magic, and if LLVM didn't care about the string in 
the assert, could even leave out the second parameter


http://reviews.llvm.org/D21673



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


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Aaron Ballman via cfe-commits
On Fri, Jun 24, 2016 at 8:05 AM, Hubert Tong
 wrote:
> On Fri, Jun 24, 2016 at 3:00 PM, Aaron Ballman 
> wrote:
>>
>> aaron.ballman added a comment.
>>
>> Did Richard sign off on this off-line? Also, this has caused a bot
>> failure:
>
> That was my understanding.

Ah, I meant, "I approve this, but wait for Richard to explicitly
approve before committing." I'm sorry if I didn't make that clear
enough! If Richard okayed it offline with you, that's fine (but he
should also sign off in phab, or post a comment) so everyone following
the thread knows.

~Aaron

>
>>
>>
>> 7:57 AM  build #4390 of ninja-clang-i686-msc19-R is complete:
>> Failure [failed build_clang_tools_1]  Build details are at
>> http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/4390  blamelist:
>> Hubert Tong 
>>
>>
>> http://reviews.llvm.org/D19770
>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Hubert Tong via cfe-commits
On Fri, Jun 24, 2016 at 3:07 PM, Aaron Ballman 
wrote:

> On Fri, Jun 24, 2016 at 8:05 AM, Hubert Tong
>  wrote:
> > On Fri, Jun 24, 2016 at 3:00 PM, Aaron Ballman 
> > wrote:
> >>
> >> aaron.ballman added a comment.
> >>
> >> Did Richard sign off on this off-line? Also, this has caused a bot
> >> failure:
> >
> > That was my understanding.
>
> Ah, I meant, "I approve this, but wait for Richard to explicitly
> approve before committing." I'm sorry if I didn't make that clear
> enough! If Richard okayed it offline with you, that's fine (but he
> should also sign off in phab, or post a comment) so everyone following
> the thread knows.
>
I meant that my understanding is that Richard has okayed it offline.
As for the bot failure, it appears it applies local patches to avoid
compiler bugs.
I am not sure what the policy is if a bot failure has more to do with the
bot set-up than the change (assuming that is the case here).
In any case, I am not sure I can resolve the failure without cooperation
from the bot owner.

-- HT


>
> ~Aaron
>
> >
> >>
> >>
> >> 7:57 AM  build #4390 of ninja-clang-i686-msc19-R is
> complete:
> >> Failure [failed build_clang_tools_1]  Build details are at
> >> http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/4390
> blamelist:
> >> Hubert Tong 
> >>
> >>
> >> http://reviews.llvm.org/D19770
> >>
> >>
> >>
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273665 - This patch fixes problem with passing structures and unions

2016-06-24 Thread Strahinja Petrovic via cfe-commits
Author: spetrovic
Date: Fri Jun 24 07:12:41 2016
New Revision: 273665

URL: http://llvm.org/viewvc/llvm-project?rev=273665&view=rev
Log:
This patch fixes problem with passing structures and unions
smaller than register as argument in variadic functions on
big endian architectures.
Differential Revision: http://reviews.llvm.org/D21611

Added:
cfe/trunk/test/CodeGen/struct-union-BE.c
Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=273665&r1=273664&r2=273665&view=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Fri Jun 24 07:12:41 2016
@@ -272,7 +272,8 @@ static Address emitVoidPtrDirectVAArg(Co
 
   // If the argument is smaller than a slot, and this is a big-endian
   // target, the argument will be right-adjusted in its slot.
-  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian()) {
+  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian() &&
+  !DirectTy->isStructTy()) {
 Addr = CGF.Builder.CreateConstInBoundsByteGEP(Addr, SlotSize - DirectSize);
   }
 

Added: cfe/trunk/test/CodeGen/struct-union-BE.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct-union-BE.c?rev=273665&view=auto
==
--- cfe/trunk/test/CodeGen/struct-union-BE.c (added)
+++ cfe/trunk/test/CodeGen/struct-union-BE.c Fri Jun 24 07:12:41 2016
@@ -0,0 +1,48 @@
+// RUN: %clang -O2 -target mips-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS
+// RUN: %clang -O2 -target mips64-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS64
+// RUN: %clang -O2 -target armeb-linux-gnueabihf -march=armv7a  -EB -S 
-emit-llvm %s -o - | FileCheck %s -check-prefix=ARM
+
+#include 
+#include 
+
+struct tiny {
+  char c;
+};
+
+union data {
+  char c;
+};
+
+void fstr(int n, ...) {
+  struct tiny x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, struct tiny);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void funi(int n, ...) {
+  union data x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, union data);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void foo() {
+  struct tiny x[3];
+  union data y;
+  x[0].c = 10;
+  fstr(1, x[0]);
+  funi(1, y);
+}


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


Re: [PATCH] D21611: Fix small structures calling convention issue for some big endian architectures

2016-06-24 Thread Strahinja Petrovic via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273665: This patch fixes problem with passing structures and 
unions (authored by spetrovic).

Changed prior to commit:
  http://reviews.llvm.org/D21611?vs=61557&id=61777#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21611

Files:
  cfe/trunk/lib/CodeGen/TargetInfo.cpp
  cfe/trunk/test/CodeGen/struct-union-BE.c

Index: cfe/trunk/test/CodeGen/struct-union-BE.c
===
--- cfe/trunk/test/CodeGen/struct-union-BE.c
+++ cfe/trunk/test/CodeGen/struct-union-BE.c
@@ -0,0 +1,48 @@
+// RUN: %clang -O2 -target mips-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS
+// RUN: %clang -O2 -target mips64-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS64
+// RUN: %clang -O2 -target armeb-linux-gnueabihf -march=armv7a  -EB -S 
-emit-llvm %s -o - | FileCheck %s -check-prefix=ARM
+
+#include 
+#include 
+
+struct tiny {
+  char c;
+};
+
+union data {
+  char c;
+};
+
+void fstr(int n, ...) {
+  struct tiny x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, struct tiny);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void funi(int n, ...) {
+  union data x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, union data);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void foo() {
+  struct tiny x[3];
+  union data y;
+  x[0].c = 10;
+  fstr(1, x[0]);
+  funi(1, y);
+}
Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -272,7 +272,8 @@
 
   // If the argument is smaller than a slot, and this is a big-endian
   // target, the argument will be right-adjusted in its slot.
-  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian()) {
+  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian() &&
+  !DirectTy->isStructTy()) {
 Addr = CGF.Builder.CreateConstInBoundsByteGEP(Addr, SlotSize - DirectSize);
   }
 


Index: cfe/trunk/test/CodeGen/struct-union-BE.c
===
--- cfe/trunk/test/CodeGen/struct-union-BE.c
+++ cfe/trunk/test/CodeGen/struct-union-BE.c
@@ -0,0 +1,48 @@
+// RUN: %clang -O2 -target mips-linux-gnu  -EB -S -emit-llvm %s -o - | FileCheck %s -check-prefix=MIPS
+// RUN: %clang -O2 -target mips64-linux-gnu  -EB -S -emit-llvm %s -o - | FileCheck %s -check-prefix=MIPS64
+// RUN: %clang -O2 -target armeb-linux-gnueabihf -march=armv7a  -EB -S -emit-llvm %s -o - | FileCheck %s -check-prefix=ARM
+
+#include 
+#include 
+
+struct tiny {
+  char c;
+};
+
+union data {
+  char c;
+};
+
+void fstr(int n, ...) {
+  struct tiny x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, struct tiny);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void funi(int n, ...) {
+  union data x;
+  va_list ap;
+  va_start (ap,n);
+  x = va_arg (ap, union data);
+  if (x.c !=  10)
+abort();
+  va_end (ap);
+// MIPS-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+// MIPS64-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i64 7
+// ARM-NOT: %{{[0-9]+}} = getelementptr inbounds i8, i8* %argp.cur, i32 3
+}
+
+void foo() {
+  struct tiny x[3];
+  union data y;
+  x[0].c = 10;
+  fstr(1, x[0]);
+  funi(1, y);
+}
Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -272,7 +272,8 @@
 
   // If the argument is smaller than a slot, and this is a big-endian
   // target, the argument will be right-adjusted in its slot.
-  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian()) {
+  if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian() &&
+  !DirectTy->isStructTy()) {
 Addr = CGF.Builder.CreateConstInBoundsByteGEP(Addr, SlotSize - DirectSize);
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Aaron Ballman via cfe-commits
On Fri, Jun 24, 2016 at 8:16 AM, Hubert Tong
 wrote:
> On Fri, Jun 24, 2016 at 3:07 PM, Aaron Ballman 
> wrote:
>>
>> On Fri, Jun 24, 2016 at 8:05 AM, Hubert Tong
>>  wrote:
>> > On Fri, Jun 24, 2016 at 3:00 PM, Aaron Ballman 
>> > wrote:
>> >>
>> >> aaron.ballman added a comment.
>> >>
>> >> Did Richard sign off on this off-line? Also, this has caused a bot
>> >> failure:
>> >
>> > That was my understanding.
>>
>> Ah, I meant, "I approve this, but wait for Richard to explicitly
>> approve before committing." I'm sorry if I didn't make that clear
>> enough! If Richard okayed it offline with you, that's fine (but he
>> should also sign off in phab, or post a comment) so everyone following
>> the thread knows.
>
> I meant that my understanding is that Richard has okayed it offline.

Thank you for the clarification.

> As for the bot failure, it appears it applies local patches to avoid
> compiler bugs.
> I am not sure what the policy is if a bot failure has more to do with the
> bot set-up than the change (assuming that is the case here).
> In any case, I am not sure I can resolve the failure without cooperation
> from the bot owner.

More bots have gone red in the meantime:

8:07 AM  build #7517 of
llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast is complete: Failure
[failed build]  Build details are at
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7517
 blamelist: grimar, hubert.reinterpretcast
8:12 AM  build #13373 of clang-x64-ninja-win7 is complete:
Failure [failed build stage 1]  Build details are at
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13373
blamelist: hubert.reinterpretcast

Are these also failing due to local patches on the bots?

~Aaron

>
> -- HT
>
>>
>>
>> ~Aaron
>>
>> >
>> >>
>> >>
>> >> 7:57 AM  build #4390 of ninja-clang-i686-msc19-R is
>> >> complete:
>> >> Failure [failed build_clang_tools_1]  Build details are at
>> >> http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/4390
>> >> blamelist:
>> >> Hubert Tong 
>> >>
>> >>
>> >> http://reviews.llvm.org/D19770
>> >>
>> >>
>> >>
>> >
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273666 - Using for attributes voted into C++17.

2016-06-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jun 24 07:15:12 2016
New Revision: 273666

URL: http://llvm.org/viewvc/llvm-project?rev=273666&view=rev
Log:
Using for attributes voted into C++17.

Added:
cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.grammar/p2-1z.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=273666&r1=273665&r2=273666&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Fri Jun 24 07:15:12 
2016
@@ -560,6 +560,14 @@ def err_cxx11_attribute_forbids_ellipsis
   "attribute '%0' cannot be used as an attribute pack">;
 def err_cxx11_attribute_repeated : Error<
   "attribute %0 cannot appear multiple times in an attribute specifier">;
+def warn_cxx14_compat_using_attribute_ns : Warning<
+  "default scope specifier for attributes is incompatible with C++ standards "
+  "before C++1z">, InGroup, DefaultIgnore;
+def ext_using_attribute_ns : ExtWarn<
+  "default scope specifier for attributes is a C++1z extension">,
+  InGroup;
+def err_using_attribute_ns_conflict : Error<
+  "attribute with scope specifier cannot follow default scope specifier">;
 def err_attributes_not_allowed : Error<"an attribute list cannot appear here">;
 def err_l_square_l_square_not_attribute : Error<
   "C++11 only allows consecutive left square brackets when "

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=273666&r1=273665&r2=273666&view=diff
==
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Jun 24 07:15:12 2016
@@ -3771,6 +3771,23 @@ void Parser::ParseCXX11AttributeSpecifie
   ConsumeBracket();
   ConsumeBracket();
 
+  SourceLocation CommonScopeLoc;
+  IdentifierInfo *CommonScopeName = nullptr;
+  if (Tok.is(tok::kw_using)) {
+Diag(Tok.getLocation(), getLangOpts().CPlusPlus1z
+? diag::warn_cxx14_compat_using_attribute_ns
+: diag::ext_using_attribute_ns);
+ConsumeToken();
+
+CommonScopeName = TryParseCXX11AttributeIdentifier(CommonScopeLoc);
+if (!CommonScopeName) {
+  Diag(Tok.getLocation(), diag::err_expected) << tok::identifier;
+  SkipUntil(tok::r_square, tok::colon, StopBeforeMatch);
+}
+if (!TryConsumeToken(tok::colon) && CommonScopeName)
+  Diag(Tok.getLocation(), diag::err_expected) << tok::colon;
+  }
+
   llvm::SmallDenseMap SeenAttrs;
 
   while (Tok.isNot(tok::r_square)) {
@@ -3799,6 +3816,16 @@ void Parser::ParseCXX11AttributeSpecifie
   }
 }
 
+if (CommonScopeName) {
+  if (ScopeName) {
+Diag(ScopeLoc, diag::err_using_attribute_ns_conflict)
+<< SourceRange(CommonScopeLoc);
+  } else {
+ScopeName = CommonScopeName;
+ScopeLoc = CommonScopeLoc;
+  }
+}
+
 bool StandardAttr = IsBuiltInOrStandardCXX11Attribute(AttrName, ScopeName);
 bool AttrParsed = false;
 

Added: cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.grammar/p2-1z.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.grammar/p2-1z.cpp?rev=273666&view=auto
==
--- cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.grammar/p2-1z.cpp (added)
+++ cfe/trunk/test/CXX/dcl.dcl/dcl.attr/dcl.attr.grammar/p2-1z.cpp Fri Jun 24 
07:15:12 2016
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -std=c++1z -verify %s
+
+[[disable_tail_calls, noduplicate]] void f() {} // expected-warning {{unknown 
attribute 'disable_tail_calls'}} expected-warning {{unknown attribute 
'noduplicate'}}
+
+[[using clang: disable_tail_calls, noduplicate]] void g() {} // ok
+
+[[using]] extern int n; // expected-error {{expected identifier}}
+[[using foo
+] // expected-error {{expected ':'}}
+] extern int n;
+[[using 42:]] extern int n; // expected-error {{expected identifier}}
+[[using clang:]] extern int n; // ok
+[[using blah: clang::optnone]] extern int n; // expected-error {{attribute 
with scope specifier cannot follow}} expected-warning {{only applies to 
functions}}
+
+[[using clang: unknown_attr]] extern int n; // expected-warning {{unknown 
attribute}}
+[[using unknown_ns: something]] extern int n; // expected-warning {{unknown 
attribute}}

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=273666&r1=273665&r2=273666&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+

Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Hubert Tong via cfe-commits
Working to reverse the patch. I need someone with MSVC to help me.

-- HT

On Fri, Jun 24, 2016 at 3:19 PM, Aaron Ballman 
wrote:

> On Fri, Jun 24, 2016 at 8:16 AM, Hubert Tong
>  wrote:
> > On Fri, Jun 24, 2016 at 3:07 PM, Aaron Ballman 
> > wrote:
> >>
> >> On Fri, Jun 24, 2016 at 8:05 AM, Hubert Tong
> >>  wrote:
> >> > On Fri, Jun 24, 2016 at 3:00 PM, Aaron Ballman <
> aaron.ball...@gmail.com>
> >> > wrote:
> >> >>
> >> >> aaron.ballman added a comment.
> >> >>
> >> >> Did Richard sign off on this off-line? Also, this has caused a bot
> >> >> failure:
> >> >
> >> > That was my understanding.
> >>
> >> Ah, I meant, "I approve this, but wait for Richard to explicitly
> >> approve before committing." I'm sorry if I didn't make that clear
> >> enough! If Richard okayed it offline with you, that's fine (but he
> >> should also sign off in phab, or post a comment) so everyone following
> >> the thread knows.
> >
> > I meant that my understanding is that Richard has okayed it offline.
>
> Thank you for the clarification.
>
> > As for the bot failure, it appears it applies local patches to avoid
> > compiler bugs.
> > I am not sure what the policy is if a bot failure has more to do with the
> > bot set-up than the change (assuming that is the case here).
> > In any case, I am not sure I can resolve the failure without cooperation
> > from the bot owner.
>
> More bots have gone red in the meantime:
>
> 8:07 AM  build #7517 of
> llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast is complete: Failure
> [failed build]  Build details are at
>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7517
>  blamelist: grimar, hubert.reinterpretcast
> 8:12 AM  build #13373 of clang-x64-ninja-win7 is complete:
> Failure [failed build stage 1]  Build details are at
> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13373
> blamelist: hubert.reinterpretcast
>
> Are these also failing due to local patches on the bots?
>
> ~Aaron
>
> >
> > -- HT
> >
> >>
> >>
> >> ~Aaron
> >>
> >> >
> >> >>
> >> >>
> >> >> 7:57 AM  build #4390 of ninja-clang-i686-msc19-R is
> >> >> complete:
> >> >> Failure [failed build_clang_tools_1]  Build details are at
> >> >> http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/4390
> >> >> blamelist:
> >> >> Hubert Tong 
> >> >>
> >> >>
> >> >> http://reviews.llvm.org/D19770
> >> >>
> >> >>
> >> >>
> >> >
> >
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273667 - Dynamic memory allocation with alignment has been approved for C++17.

2016-06-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jun 24 07:16:11 2016
New Revision: 273667

URL: http://llvm.org/viewvc/llvm-project?rev=273667&view=rev
Log:
Dynamic memory allocation with alignment has been approved for C++17.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=273667&r1=273666&r2=273667&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Fri Jun 24 07:16:11 2016
@@ -675,14 +675,14 @@ as the draft C++1z standard evolves.
 
   Using attribute namespaces without repetition
   http://wg21.link/p0028r4";>P0028R4
-  No
+  SVN
 
-

Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Aaron Ballman via cfe-commits
On Fri, Jun 24, 2016 at 8:22 AM, Hubert Tong
 wrote:
> Working to reverse the patch. I need someone with MSVC to help me.

I'll help out with it when I get a moment (hopefully today or this weekend).

~Aaron

>
> -- HT
>
> On Fri, Jun 24, 2016 at 3:19 PM, Aaron Ballman 
> wrote:
>>
>> On Fri, Jun 24, 2016 at 8:16 AM, Hubert Tong
>>  wrote:
>> > On Fri, Jun 24, 2016 at 3:07 PM, Aaron Ballman 
>> > wrote:
>> >>
>> >> On Fri, Jun 24, 2016 at 8:05 AM, Hubert Tong
>> >>  wrote:
>> >> > On Fri, Jun 24, 2016 at 3:00 PM, Aaron Ballman
>> >> > 
>> >> > wrote:
>> >> >>
>> >> >> aaron.ballman added a comment.
>> >> >>
>> >> >> Did Richard sign off on this off-line? Also, this has caused a bot
>> >> >> failure:
>> >> >
>> >> > That was my understanding.
>> >>
>> >> Ah, I meant, "I approve this, but wait for Richard to explicitly
>> >> approve before committing." I'm sorry if I didn't make that clear
>> >> enough! If Richard okayed it offline with you, that's fine (but he
>> >> should also sign off in phab, or post a comment) so everyone following
>> >> the thread knows.
>> >
>> > I meant that my understanding is that Richard has okayed it offline.
>>
>> Thank you for the clarification.
>>
>> > As for the bot failure, it appears it applies local patches to avoid
>> > compiler bugs.
>> > I am not sure what the policy is if a bot failure has more to do with
>> > the
>> > bot set-up than the change (assuming that is the case here).
>> > In any case, I am not sure I can resolve the failure without cooperation
>> > from the bot owner.
>>
>> More bots have gone red in the meantime:
>>
>> 8:07 AM  build #7517 of
>> llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast is complete: Failure
>> [failed build]  Build details are at
>>
>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7517
>>  blamelist: grimar, hubert.reinterpretcast
>> 8:12 AM  build #13373 of clang-x64-ninja-win7 is complete:
>> Failure [failed build stage 1]  Build details are at
>> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13373
>> blamelist: hubert.reinterpretcast
>>
>> Are these also failing due to local patches on the bots?
>>
>> ~Aaron
>>
>> >
>> > -- HT
>> >
>> >>
>> >>
>> >> ~Aaron
>> >>
>> >> >
>> >> >>
>> >> >>
>> >> >> 7:57 AM  build #4390 of ninja-clang-i686-msc19-R is
>> >> >> complete:
>> >> >> Failure [failed build_clang_tools_1]  Build details are at
>> >> >> http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/4390
>> >> >> blamelist:
>> >> >> Hubert Tong 
>> >> >>
>> >> >>
>> >> >> http://reviews.llvm.org/D19770
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >
>> >
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273668 - More approved features for C++17.

2016-06-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jun 24 07:21:30 2016
New Revision: 273668

URL: http://llvm.org/viewvc/llvm-project?rev=273668&view=rev
Log:
More approved features for C++17.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=273668&r1=273667&r2=273668&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Fri Jun 24 07:21:30 2016
@@ -682,14 +682,13 @@ as the draft C++1z standard evolves.
   http://wg21.link/p0035r4";>P0035R4
   No
 
-

Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-24 Thread Richard Smith via cfe-commits
rsmith added a comment.

Ah right, we were (intentionally, but unfortunately) making an assumption that 
the `TypeLoc` data layout doesn't change when the exception spec of a function 
is updated. You'd need to make yourself a `TypeLocBuilder`, copy the relevant 
data, and update the exception spec loc.

Where are we adjusting the exception specification on the type source info? 
That (changing the type-info-as-written) seems like a somewhat unusual thing to 
do implicitly.


http://reviews.llvm.org/D20428



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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-24 Thread Aaron Ballman via cfe-commits
On Fri, Jun 24, 2016 at 8:39 AM, Richard Smith  wrote:
> rsmith added a comment.
>
> Ah right, we were (intentionally, but unfortunately) making an assumption 
> that the `TypeLoc` data layout doesn't change when the exception spec of a 
> function is updated. You'd need to make yourself a `TypeLocBuilder`, copy the 
> relevant data, and update the exception spec loc.
>
> Where are we adjusting the exception specification on the type source info? 
> That (changing the type-info-as-written) seems like a somewhat unusual thing 
> to do implicitly.

ActOnFunctionDeclarator when dealing with concepts ([dcl.spec.concept]p1)
delayed exception specs
Any time we explicitly call UpdateExceptionSpec() (template
instantiation and a few other places).

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


Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-24 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 61780.
ioeric added a comment.

- fixed commenting.
- Make formatReplacemnts and cleanupAroundReplacements return 
llvm::Exppected<...>.


http://reviews.llvm.org/D21601

Files:
  include/clang/Format/Format.h
  include/clang/Tooling/Core/Replacement.h
  lib/Format/Format.cpp
  lib/Tooling/Core/Replacement.cpp
  lib/Tooling/Refactoring.cpp
  tools/clang-format/ClangFormat.cpp
  unittests/Format/CleanupTest.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestJS.cpp
  unittests/Format/FormatTestJava.cpp
  unittests/Format/FormatTestProto.cpp
  unittests/Format/FormatTestSelective.cpp
  unittests/Format/SortImportsTestJS.cpp
  unittests/Format/SortIncludesTest.cpp
  unittests/Tooling/RefactoringTest.cpp
  unittests/Tooling/RewriterTest.cpp

Index: unittests/Tooling/RewriterTest.cpp
===
--- unittests/Tooling/RewriterTest.cpp
+++ unittests/Tooling/RewriterTest.cpp
@@ -41,8 +41,9 @@
   Replacements Replaces;
   Replaces.insert(Replacement("", 6, 6, ""));
   Replaces.insert(Replacement("", 6, 0, "replaced\n"));
-  EXPECT_EQ("line1\nreplaced\nline3\nline4",
-applyAllReplacements("line1\nline2\nline3\nline4", Replaces));
+  auto Rewritten = applyAllReplacements("line1\nline2\nline3\nline4", Replaces);
+  EXPECT_TRUE((bool)Rewritten);
+  EXPECT_EQ("line1\nreplaced\nline3\nline4", *Rewritten);
 }
 
 } // end namespace
Index: unittests/Tooling/RefactoringTest.cpp
===
--- unittests/Tooling/RefactoringTest.cpp
+++ unittests/Tooling/RefactoringTest.cpp
@@ -640,27 +640,32 @@
StringRef Result, const Replacements &First,
const Replacements &Second) {
 // These are mainly to verify the test itself and make it easier to read.
-std::string AfterFirst = applyAllReplacements(Code, First);
-std::string InSequenceRewrite = applyAllReplacements(AfterFirst, Second);
-EXPECT_EQ(Intermediate, AfterFirst);
-EXPECT_EQ(Result, InSequenceRewrite);
+auto AfterFirst = applyAllReplacements(Code, First);
+EXPECT_TRUE((bool)AfterFirst);
+auto InSequenceRewrite = applyAllReplacements(*AfterFirst, Second);
+EXPECT_TRUE((bool)InSequenceRewrite);
+EXPECT_EQ(Intermediate, *AfterFirst);
+EXPECT_EQ(Result, *InSequenceRewrite);
 
 tooling::Replacements Merged = mergeReplacements(First, Second);
-std::string MergedRewrite = applyAllReplacements(Code, Merged);
-EXPECT_EQ(InSequenceRewrite, MergedRewrite);
-if (InSequenceRewrite != MergedRewrite)
+auto MergedRewrite = applyAllReplacements(Code, Merged);
+EXPECT_TRUE((bool)MergedRewrite);
+EXPECT_EQ(*InSequenceRewrite, *MergedRewrite);
+if (*InSequenceRewrite != *MergedRewrite)
   for (tooling::Replacement M : Merged)
 llvm::errs() << M.getOffset() << " " << M.getLength() << " "
  << M.getReplacementText() << "\n";
   }
   void mergeAndTestRewrite(StringRef Code, const Replacements &First,
const Replacements &Second) {
-std::string InSequenceRewrite =
-applyAllReplacements(applyAllReplacements(Code, First), Second);
+auto AfterFirst = applyAllReplacements(Code, First);
+EXPECT_TRUE((bool)AfterFirst);
+auto InSequenceRewrite = applyAllReplacements(*AfterFirst, Second);
 tooling::Replacements Merged = mergeReplacements(First, Second);
-std::string MergedRewrite = applyAllReplacements(Code, Merged);
-EXPECT_EQ(InSequenceRewrite, MergedRewrite);
-if (InSequenceRewrite != MergedRewrite)
+auto MergedRewrite = applyAllReplacements(Code, Merged);
+EXPECT_TRUE((bool)MergedRewrite);
+EXPECT_EQ(*InSequenceRewrite, *MergedRewrite);
+if (*InSequenceRewrite != *MergedRewrite)
   for (tooling::Replacement M : Merged)
 llvm::errs() << M.getOffset() << " " << M.getLength() << " "
  << M.getReplacementText() << "\n";
Index: unittests/Format/SortIncludesTest.cpp
===
--- unittests/Format/SortIncludesTest.cpp
+++ unittests/Format/SortIncludesTest.cpp
@@ -26,10 +26,13 @@
 
   std::string sort(StringRef Code, StringRef FileName = "input.cpp") {
 auto Ranges = GetCodeRange(Code);
-std::string Sorted =
+auto Sorted =
 applyAllReplacements(Code, sortIncludes(Style, Code, Ranges, FileName));
-return applyAllReplacements(Sorted,
-reformat(Style, Sorted, Ranges, FileName));
+EXPECT_TRUE((bool)Sorted);
+auto Result = applyAllReplacements(
+*Sorted, reformat(Style, *Sorted, Ranges, FileName));
+EXPECT_TRUE((bool)Result);
+return *Result;
   }
 
   unsigned newCursor(llvm::StringRef Code, unsigned Cursor) {
Index: unittests/Format/SortImportsTestJS.cpp
===
--- unittests

Re: [PATCH] D21602: Changes related to tooling::applyAllReplacements interface change in D21601.

2016-06-24 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 61782.
ioeric added a comment.

- Changes corresponding to new interfaces: formatReplacements and 
cleanupAroundReplacements.


http://reviews.llvm.org/D21602

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixer.h
  include-fixer/tool/ClangIncludeFixer.cpp
  unittests/clang-tidy/ClangTidyTest.h
  unittests/include-fixer/IncludeFixerTest.cpp

Index: unittests/include-fixer/IncludeFixerTest.cpp
===
--- unittests/include-fixer/IncludeFixerTest.cpp
+++ unittests/include-fixer/IncludeFixerTest.cpp
@@ -85,12 +85,14 @@
   runOnCode(&Factory, Code, "input.cc", ExtraArgs);
   if (FixerContext.Headers.empty())
 return Code;
-  tooling::Replacements Replacements =
-  clang::include_fixer::createInsertHeaderReplacements(
-  Code, "input.cc", FixerContext.Headers.front());
+  auto Replaces = clang::include_fixer::createInsertHeaderReplacements(
+  Code, "input.cc", FixerContext.Headers.front());
+  EXPECT_TRUE((bool)Replaces) << llvm::toString(Replaces.takeError()) << "\n";
+  if (!Replaces)
+return "";
   clang::RewriterTestContext Context;
   clang::FileID ID = Context.createInMemoryFile("input.cc", Code);
-  clang::tooling::applyAllReplacements(Replacements, Context.Rewrite);
+  clang::tooling::applyAllReplacements(*Replaces, Context.Rewrite);
   return Context.getRewrittenText(ID);
 }
 
Index: unittests/clang-tidy/ClangTidyTest.h
===
--- unittests/clang-tidy/ClangTidyTest.h
+++ unittests/clang-tidy/ClangTidyTest.h
@@ -17,6 +17,7 @@
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/Optional.h"
 #include 
 #include 
 
@@ -121,7 +122,12 @@
 Fixes.insert(Error.Fix.begin(), Error.Fix.end());
   if (Errors)
 *Errors = Context.getErrors();
-  return tooling::applyAllReplacements(Code, Fixes);
+  auto Result = tooling::applyAllReplacements(Code, Fixes);
+  if (!Result) {
+// FIXME: propogate the error.
+return "";
+  }
+  return *Result;
 }
 
 #define EXPECT_NO_CHANGES(Check, Code) \
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -208,12 +208,21 @@
   return 1;
 }
 
-tooling::Replacements Replacements =
+auto Replacements =
 clang::include_fixer::createInsertHeaderReplacements(
 Code->getBuffer(), FilePath, Context.Headers[0], InsertStyle);
-std::string ChangedCode =
-tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+if (!Replacements) {
+  errs() << "Failed to create header insertion replacement: "
+ << llvm::toString(Replacements.takeError()) << "\n";
+  return 1;
+}
+auto ChangedCode =
+tooling::applyAllReplacements(Code->getBuffer(), *Replacements);
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 
@@ -249,10 +258,14 @@
   }
 
   // FIXME: Rank the results and pick the best one instead of the first one.
-  tooling::Replacements Replacements =
-  clang::include_fixer::createInsertHeaderReplacements(
-  /*Code=*/Buffer.get()->getBuffer(), FilePath, Context.Headers.front(),
-  InsertStyle);
+  auto Replacements = clang::include_fixer::createInsertHeaderReplacements(
+  /*Code=*/Buffer.get()->getBuffer(), FilePath, Context.Headers.front(),
+  InsertStyle);
+  if (!Replacements) {
+errs() << "Failed to create header insertion replacement: "
+   << llvm::toString(Replacements.takeError()) << "\n";
+return 1;
+  }
 
   if (!Quiet)
 llvm::errs() << "Added #include" << Context.Headers.front();
@@ -265,15 +278,19 @@
   Diagnostics.setClient(&DiagnosticPrinter, false);
 
   if (STDINMode) {
-std::string ChangedCode =
-tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+auto ChangedCode =
+tooling::applyAllReplacements(Code->getBuffer(), *Replacements);
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 
   // Write replacements to disk.
   Rewriter Rewrites(SM, LangOptions());
-  tooling::applyAllReplacements(Replacements, Rewrites);
+  tooling::applyAllReplacements(*Replacements, Rewrites);
   return Rewrites.overwriteChangedFiles();
 }
 
Index: include-fixer/IncludeFixer.h
===
--- include-fixer/IncludeFixer.h
+++ include-fixer/IncludeFixer.h
@@ -68,8 +68,9 @@

Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-24 Thread Eric Liu via cfe-commits
ioeric marked 4 inline comments as done.
ioeric added a comment.

mark previous comments as done


http://reviews.llvm.org/D21601



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


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Aaron Ballman via cfe-commits
On Fri, Jun 24, 2016 at 8:25 AM, Aaron Ballman  wrote:
> On Fri, Jun 24, 2016 at 8:22 AM, Hubert Tong
>  wrote:
>> Working to reverse the patch. I need someone with MSVC to help me.
>
> I'll help out with it when I get a moment (hopefully today or this weekend).

I'm not certain there's a way *to* help out with this. I think this is
a bug with MSVC (I'm using 2015). It is claiming this syntax is
invalid, but it certainly looks valid to me. If you can snag STL to
see what he thinks, that may be the quickest way to find out.

~Aaron

>
> ~Aaron
>
>>
>> -- HT
>>
>> On Fri, Jun 24, 2016 at 3:19 PM, Aaron Ballman 
>> wrote:
>>>
>>> On Fri, Jun 24, 2016 at 8:16 AM, Hubert Tong
>>>  wrote:
>>> > On Fri, Jun 24, 2016 at 3:07 PM, Aaron Ballman 
>>> > wrote:
>>> >>
>>> >> On Fri, Jun 24, 2016 at 8:05 AM, Hubert Tong
>>> >>  wrote:
>>> >> > On Fri, Jun 24, 2016 at 3:00 PM, Aaron Ballman
>>> >> > 
>>> >> > wrote:
>>> >> >>
>>> >> >> aaron.ballman added a comment.
>>> >> >>
>>> >> >> Did Richard sign off on this off-line? Also, this has caused a bot
>>> >> >> failure:
>>> >> >
>>> >> > That was my understanding.
>>> >>
>>> >> Ah, I meant, "I approve this, but wait for Richard to explicitly
>>> >> approve before committing." I'm sorry if I didn't make that clear
>>> >> enough! If Richard okayed it offline with you, that's fine (but he
>>> >> should also sign off in phab, or post a comment) so everyone following
>>> >> the thread knows.
>>> >
>>> > I meant that my understanding is that Richard has okayed it offline.
>>>
>>> Thank you for the clarification.
>>>
>>> > As for the bot failure, it appears it applies local patches to avoid
>>> > compiler bugs.
>>> > I am not sure what the policy is if a bot failure has more to do with
>>> > the
>>> > bot set-up than the change (assuming that is the case here).
>>> > In any case, I am not sure I can resolve the failure without cooperation
>>> > from the bot owner.
>>>
>>> More bots have gone red in the meantime:
>>>
>>> 8:07 AM  build #7517 of
>>> llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast is complete: Failure
>>> [failed build]  Build details are at
>>>
>>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7517
>>>  blamelist: grimar, hubert.reinterpretcast
>>> 8:12 AM  build #13373 of clang-x64-ninja-win7 is complete:
>>> Failure [failed build stage 1]  Build details are at
>>> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13373
>>> blamelist: hubert.reinterpretcast
>>>
>>> Are these also failing due to local patches on the bots?
>>>
>>> ~Aaron
>>>
>>> >
>>> > -- HT
>>> >
>>> >>
>>> >>
>>> >> ~Aaron
>>> >>
>>> >> >
>>> >> >>
>>> >> >>
>>> >> >> 7:57 AM  build #4390 of ninja-clang-i686-msc19-R is
>>> >> >> complete:
>>> >> >> Failure [failed build_clang_tools_1]  Build details are at
>>> >> >> http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/4390
>>> >> >> blamelist:
>>> >> >> Hubert Tong 
>>> >> >>
>>> >> >>
>>> >> >> http://reviews.llvm.org/D19770
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >
>>> >
>>> >
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Hubert Tong via cfe-commits
STL's not at the meeting this week. I'll try to catch someone at the
meeting to see if we can figure out how to get the compiler to squint the
right way at the code first.

-- HT

On Fri, Jun 24, 2016 at 3:47 PM, Aaron Ballman 
wrote:

> On Fri, Jun 24, 2016 at 8:25 AM, Aaron Ballman 
> wrote:
> > On Fri, Jun 24, 2016 at 8:22 AM, Hubert Tong
> >  wrote:
> >> Working to reverse the patch. I need someone with MSVC to help me.
> >
> > I'll help out with it when I get a moment (hopefully today or this
> weekend).
>
> I'm not certain there's a way *to* help out with this. I think this is
> a bug with MSVC (I'm using 2015). It is claiming this syntax is
> invalid, but it certainly looks valid to me. If you can snag STL to
> see what he thinks, that may be the quickest way to find out.
>
> ~Aaron
>
> >
> > ~Aaron
> >
> >>
> >> -- HT
> >>
> >> On Fri, Jun 24, 2016 at 3:19 PM, Aaron Ballman  >
> >> wrote:
> >>>
> >>> On Fri, Jun 24, 2016 at 8:16 AM, Hubert Tong
> >>>  wrote:
> >>> > On Fri, Jun 24, 2016 at 3:07 PM, Aaron Ballman <
> aaron.ball...@gmail.com>
> >>> > wrote:
> >>> >>
> >>> >> On Fri, Jun 24, 2016 at 8:05 AM, Hubert Tong
> >>> >>  wrote:
> >>> >> > On Fri, Jun 24, 2016 at 3:00 PM, Aaron Ballman
> >>> >> > 
> >>> >> > wrote:
> >>> >> >>
> >>> >> >> aaron.ballman added a comment.
> >>> >> >>
> >>> >> >> Did Richard sign off on this off-line? Also, this has caused a
> bot
> >>> >> >> failure:
> >>> >> >
> >>> >> > That was my understanding.
> >>> >>
> >>> >> Ah, I meant, "I approve this, but wait for Richard to explicitly
> >>> >> approve before committing." I'm sorry if I didn't make that clear
> >>> >> enough! If Richard okayed it offline with you, that's fine (but he
> >>> >> should also sign off in phab, or post a comment) so everyone
> following
> >>> >> the thread knows.
> >>> >
> >>> > I meant that my understanding is that Richard has okayed it offline.
> >>>
> >>> Thank you for the clarification.
> >>>
> >>> > As for the bot failure, it appears it applies local patches to avoid
> >>> > compiler bugs.
> >>> > I am not sure what the policy is if a bot failure has more to do with
> >>> > the
> >>> > bot set-up than the change (assuming that is the case here).
> >>> > In any case, I am not sure I can resolve the failure without
> cooperation
> >>> > from the bot owner.
> >>>
> >>> More bots have gone red in the meantime:
> >>>
> >>> 8:07 AM  build #7517 of
> >>> llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast is complete: Failure
> >>> [failed build]  Build details are at
> >>>
> >>>
> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/7517
> >>>  blamelist: grimar, hubert.reinterpretcast
> >>> 8:12 AM  build #13373 of clang-x64-ninja-win7 is complete:
> >>> Failure [failed build stage 1]  Build details are at
> >>> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/13373
> >>> blamelist: hubert.reinterpretcast
> >>>
> >>> Are these also failing due to local patches on the bots?
> >>>
> >>> ~Aaron
> >>>
> >>> >
> >>> > -- HT
> >>> >
> >>> >>
> >>> >>
> >>> >> ~Aaron
> >>> >>
> >>> >> >
> >>> >> >>
> >>> >> >>
> >>> >> >> 7:57 AM  build #4390 of ninja-clang-i686-msc19-R is
> >>> >> >> complete:
> >>> >> >> Failure [failed build_clang_tools_1]  Build details are at
> >>> >> >> http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/4390
> >>> >> >> blamelist:
> >>> >> >> Hubert Tong 
> >>> >> >>
> >>> >> >>
> >>> >> >> http://reviews.llvm.org/D19770
> >>> >> >>
> >>> >> >>
> >>> >> >>
> >>> >> >
> >>> >
> >>> >
> >>
> >>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273675 - Fix make-check issues

2016-06-24 Thread Strahinja Petrovic via cfe-commits
Author: spetrovic
Date: Fri Jun 24 08:11:15 2016
New Revision: 273675

URL: http://llvm.org/viewvc/llvm-project?rev=273675&view=rev
Log:
Fix make-check issues

Fixing build issue for test test/CodeGen/struct-union-BE.c.

Modified:
cfe/trunk/test/CodeGen/struct-union-BE.c

Modified: cfe/trunk/test/CodeGen/struct-union-BE.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct-union-BE.c?rev=273675&r1=273674&r2=273675&view=diff
==
--- cfe/trunk/test/CodeGen/struct-union-BE.c (original)
+++ cfe/trunk/test/CodeGen/struct-union-BE.c Fri Jun 24 08:11:15 2016
@@ -1,9 +1,10 @@
-// RUN: %clang -O2 -target mips-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS
-// RUN: %clang -O2 -target mips64-linux-gnu  -EB -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=MIPS64
-// RUN: %clang -O2 -target armeb-linux-gnueabihf -march=armv7a  -EB -S 
-emit-llvm %s -o - | FileCheck %s -check-prefix=ARM
+// RUN: %clang_cc1 -triple mips-linux-gnu  -S -emit-llvm %s -o - | FileCheck 
%s -check-prefix=MIPS
+// RUN: %clang_cc1 -triple mips64-linux-gnu  -S -emit-llvm %s -o - | FileCheck 
%s -check-prefix=MIPS64
+// RUN: %clang_cc1 -triple armebv7-linux-gnueabihf -S -emit-llvm %s -o - | 
FileCheck %s -check-prefix=ARM
 
 #include 
-#include 
+
+extern void abort() __attribute__((noreturn));
 
 struct tiny {
   char c;


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


Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-24 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: include/clang/Format/Format.h:780
@@ -778,2 +779,3 @@
 /// \brief Returns the replacements corresponding to applying \p Replaces and
-/// cleaning up the code after that.
+/// cleaning up the code after that on success; otheriwse, return an 
llvm::Error
+/// carrying llvm::StringError.

typo: otheriwse


Comment at: lib/Format/Format.cpp:1395-1396
@@ -1394,2 +1394,4 @@
 
+// If any replacements in \p Replaces fails to apply, this returns \p Replaces.
+// FIXME: make this propagate the error from applyAllReplacements.
 template 

Comment doesn't apply any more, right?


Comment at: unittests/Format/CleanupTest.cpp:258
@@ +257,3 @@
+auto CleanReplaces = cleanupAroundReplacements(Code, Replaces, Style);
+EXPECT_TRUE((bool)CleanReplaces)
+<< llvm::toString(CleanReplaces.takeError()) << "\n";

The explicit cast is unfortunate. Does this not have an .Ok() method or 
something?


http://reviews.llvm.org/D21601



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


r273676 - Updates from further motions.

2016-06-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jun 24 08:25:08 2016
New Revision: 273676

URL: http://llvm.org/viewvc/llvm-project?rev=273676&view=rev
Log:
Updates from further motions.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=273676&r1=273675&r2=273676&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Fri Jun 24 08:25:08 2016
@@ -697,23 +697,16 @@ as the draft C++1z standard evolves.
   http://wg21.link/p0135r1";>P0135R1
   No
 
-
 
   constexpr if-statements
   http://wg21.link/p0292r2";>P0292R2


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


Re: [PATCH] D21470: [clang-tidy] Don't run misc-definitions-in-headers check in failing TUs.

2016-06-24 Thread Alexander Kornienko via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG


http://reviews.llvm.org/D21470



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


Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-24 Thread Eric Liu via cfe-commits
ioeric marked 2 inline comments as done.


Comment at: unittests/Format/CleanupTest.cpp:258
@@ +257,3 @@
+auto CleanReplaces = cleanupAroundReplacements(Code, Replaces, Style);
+EXPECT_TRUE((bool)CleanReplaces)
+<< llvm::toString(CleanReplaces.takeError()) << "\n";

klimek wrote:
> The explicit cast is unfortunate. Does this not have an .Ok() method or 
> something?
unfortunately, the bool operator is the only way we got...

I think the idea is that Errors are always expected to be checked and handled 
(the destructor of llvm::Error asserts that an Error has been handled).


http://reviews.llvm.org/D21601



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


Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-24 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 61785.
ioeric added a comment.

- Addressed comments.


http://reviews.llvm.org/D21601

Files:
  include/clang/Format/Format.h
  include/clang/Tooling/Core/Replacement.h
  lib/Format/Format.cpp
  lib/Tooling/Core/Replacement.cpp
  lib/Tooling/Refactoring.cpp
  tools/clang-format/ClangFormat.cpp
  unittests/Format/CleanupTest.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestJS.cpp
  unittests/Format/FormatTestJava.cpp
  unittests/Format/FormatTestProto.cpp
  unittests/Format/FormatTestSelective.cpp
  unittests/Format/SortImportsTestJS.cpp
  unittests/Format/SortIncludesTest.cpp
  unittests/Tooling/RefactoringTest.cpp
  unittests/Tooling/RewriterTest.cpp

Index: unittests/Tooling/RewriterTest.cpp
===
--- unittests/Tooling/RewriterTest.cpp
+++ unittests/Tooling/RewriterTest.cpp
@@ -41,8 +41,9 @@
   Replacements Replaces;
   Replaces.insert(Replacement("", 6, 6, ""));
   Replaces.insert(Replacement("", 6, 0, "replaced\n"));
-  EXPECT_EQ("line1\nreplaced\nline3\nline4",
-applyAllReplacements("line1\nline2\nline3\nline4", Replaces));
+  auto Rewritten = applyAllReplacements("line1\nline2\nline3\nline4", Replaces);
+  EXPECT_TRUE((bool)Rewritten);
+  EXPECT_EQ("line1\nreplaced\nline3\nline4", *Rewritten);
 }
 
 } // end namespace
Index: unittests/Tooling/RefactoringTest.cpp
===
--- unittests/Tooling/RefactoringTest.cpp
+++ unittests/Tooling/RefactoringTest.cpp
@@ -640,27 +640,32 @@
StringRef Result, const Replacements &First,
const Replacements &Second) {
 // These are mainly to verify the test itself and make it easier to read.
-std::string AfterFirst = applyAllReplacements(Code, First);
-std::string InSequenceRewrite = applyAllReplacements(AfterFirst, Second);
-EXPECT_EQ(Intermediate, AfterFirst);
-EXPECT_EQ(Result, InSequenceRewrite);
+auto AfterFirst = applyAllReplacements(Code, First);
+EXPECT_TRUE((bool)AfterFirst);
+auto InSequenceRewrite = applyAllReplacements(*AfterFirst, Second);
+EXPECT_TRUE((bool)InSequenceRewrite);
+EXPECT_EQ(Intermediate, *AfterFirst);
+EXPECT_EQ(Result, *InSequenceRewrite);
 
 tooling::Replacements Merged = mergeReplacements(First, Second);
-std::string MergedRewrite = applyAllReplacements(Code, Merged);
-EXPECT_EQ(InSequenceRewrite, MergedRewrite);
-if (InSequenceRewrite != MergedRewrite)
+auto MergedRewrite = applyAllReplacements(Code, Merged);
+EXPECT_TRUE((bool)MergedRewrite);
+EXPECT_EQ(*InSequenceRewrite, *MergedRewrite);
+if (*InSequenceRewrite != *MergedRewrite)
   for (tooling::Replacement M : Merged)
 llvm::errs() << M.getOffset() << " " << M.getLength() << " "
  << M.getReplacementText() << "\n";
   }
   void mergeAndTestRewrite(StringRef Code, const Replacements &First,
const Replacements &Second) {
-std::string InSequenceRewrite =
-applyAllReplacements(applyAllReplacements(Code, First), Second);
+auto AfterFirst = applyAllReplacements(Code, First);
+EXPECT_TRUE((bool)AfterFirst);
+auto InSequenceRewrite = applyAllReplacements(*AfterFirst, Second);
 tooling::Replacements Merged = mergeReplacements(First, Second);
-std::string MergedRewrite = applyAllReplacements(Code, Merged);
-EXPECT_EQ(InSequenceRewrite, MergedRewrite);
-if (InSequenceRewrite != MergedRewrite)
+auto MergedRewrite = applyAllReplacements(Code, Merged);
+EXPECT_TRUE((bool)MergedRewrite);
+EXPECT_EQ(*InSequenceRewrite, *MergedRewrite);
+if (*InSequenceRewrite != *MergedRewrite)
   for (tooling::Replacement M : Merged)
 llvm::errs() << M.getOffset() << " " << M.getLength() << " "
  << M.getReplacementText() << "\n";
Index: unittests/Format/SortIncludesTest.cpp
===
--- unittests/Format/SortIncludesTest.cpp
+++ unittests/Format/SortIncludesTest.cpp
@@ -26,10 +26,13 @@
 
   std::string sort(StringRef Code, StringRef FileName = "input.cpp") {
 auto Ranges = GetCodeRange(Code);
-std::string Sorted =
+auto Sorted =
 applyAllReplacements(Code, sortIncludes(Style, Code, Ranges, FileName));
-return applyAllReplacements(Sorted,
-reformat(Style, Sorted, Ranges, FileName));
+EXPECT_TRUE((bool)Sorted);
+auto Result = applyAllReplacements(
+*Sorted, reformat(Style, *Sorted, Ranges, FileName));
+EXPECT_TRUE((bool)Result);
+return *Result;
   }
 
   unsigned newCursor(llvm::StringRef Code, unsigned Cursor) {
Index: unittests/Format/SortImportsTestJS.cpp
===
--- unittests/Format/SortImportsTestJS.cpp
+++ unittests/Format/SortImportsTestJS.cpp
@@ -25,10 

[PATCH] D21682: DeadStoresChecker: Don't warn about dead stores into volatile variables

2016-06-24 Thread Stephan Bergmann via cfe-commits
sberg created this revision.
sberg added a reviewer: zaks.anna.
sberg added a subscriber: cfe-commits.

http://reviews.llvm.org/D21682

Files:
  lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
  test/Analysis/dead-stores.c

Index: test/Analysis/dead-stores.c
===
--- test/Analysis/dead-stores.c
+++ test/Analysis/dead-stores.c
@@ -569,3 +569,7 @@
 
 }
 
+void testVolatile() {
+volatile int v;
+v = 0; // no warning
+}
Index: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -278,6 +278,8 @@
   RHS = RHS->IgnoreParenCasts();
 
   QualType T = VD->getType();
+  if (T.isVolatileQualified())
+return;
   if (T->isPointerType() || T->isObjCObjectPointerType()) {
 if (RHS->isNullPointerConstant(Ctx, 
Expr::NPC_ValueDependentIsNull))
   return;


Index: test/Analysis/dead-stores.c
===
--- test/Analysis/dead-stores.c
+++ test/Analysis/dead-stores.c
@@ -569,3 +569,7 @@
 
 }
 
+void testVolatile() {
+volatile int v;
+v = 0; // no warning
+}
Index: lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -278,6 +278,8 @@
   RHS = RHS->IgnoreParenCasts();
 
   QualType T = VD->getType();
+  if (T.isVolatileQualified())
+return;
   if (T->isPointerType() || T->isObjCObjectPointerType()) {
 if (RHS->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNull))
   return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273680 - Inline variables tentatively approved for C++17.

2016-06-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jun 24 09:04:07 2016
New Revision: 273680

URL: http://llvm.org/viewvc/llvm-project?rev=273680&view=rev
Log:
Inline variables tentatively approved for C++17.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=273680&r1=273679&r2=273680&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Fri Jun 24 09:04:07 2016
@@ -712,12 +712,12 @@ as the draft C++1z standard evolves.
   http://wg21.link/p0292r2";>P0292R2
   SVN
 
-

r273681 - Remaining motions pass.

2016-06-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jun 24 09:10:58 2016
New Revision: 273681

URL: http://llvm.org/viewvc/llvm-project?rev=273681&view=rev
Log:
Remaining motions pass.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=273681&r1=273680&r2=273681&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Fri Jun 24 09:10:58 2016
@@ -717,7 +717,6 @@ as the draft C++1z standard evolves.
   http://wg21.link/p0386r2";>P0386R2
   No
 
-
 
 
 


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


[PATCH] D21683: [Sparc] Allow LEON cpu models to be selected with -mcpu

2016-06-24 Thread Jacob Baungard Hansen via cfe-commits
jacob_hansen created this revision.
jacob_hansen added reviewers: jyknight, lero_chris.
jacob_hansen added a subscriber: cfe-commits.
Herald added a subscriber: jyknight.

This change exposes the recently added LEON CPUs (D19359) in the LLVM Sparc 
backend to Clang, allowing the cpu's to be selected using the -mcpu flag.

http://reviews.llvm.org/D21683

Files:
  lib/Basic/Targets.cpp
  lib/Driver/Tools.cpp
  test/Driver/sparc-as.c

Index: test/Driver/sparc-as.c
===
--- test/Driver/sparc-as.c
+++ test/Driver/sparc-as.c
@@ -76,6 +76,38 @@
 // RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
 // RUN: | FileCheck -check-prefix=SPARC-V8PLUSD %s
 
+// RUN: %clang -mcpu=leon2 -no-canonical-prefixes -target sparc \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=SPARC-V8 %s
+
+// RUN: %clang -mcpu=at697e -no-canonical-prefixes -target sparc \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=SPARC-V8 %s
+
+// RUN: %clang -mcpu=at697f -no-canonical-prefixes -target sparc \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=SPARC-V8 %s
+
+// RUN: %clang -mcpu=leon3 -no-canonical-prefixes -target sparc \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=SPARC-V8 %s
+
+// RUN: %clang -mcpu=ut699 -no-canonical-prefixes -target sparc \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=SPARC-V8 %s
+
+// RUN: %clang -mcpu=gr712rc -no-canonical-prefixes -target sparc \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=SPARC-V8 %s
+
+// RUN: %clang -mcpu=leon4 -no-canonical-prefixes -target sparc \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=SPARC-V8 %s
+
+// RUN: %clang -mcpu=gr740 -no-canonical-prefixes -target sparc \
+// RUN: -no-integrated-as --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \
+// RUN: | FileCheck -check-prefix=SPARC-V8 %s
+
 // SPARC: as{{.*}}" "-32" "-Av8" "-o"
 // SPARC-V8: as{{.*}}" "-32" "-Av8" "-o"
 // SPARC-SPARCLITE: as{{.*}}" "-32" "-Asparclite" "-o"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -96,6 +96,14 @@
   .Case("niagara2", "-Av8plusb")
   .Case("niagara3", "-Av8plusd")
   .Case("niagara4", "-Av8plusd")
+  .Case("leon2", "-Av8")
+  .Case("at697e", "-Av8")
+  .Case("at697f", "-Av8")
+  .Case("leon3", "-Av8")
+  .Case("ut699", "-Av8")
+  .Case("gr712rc", "-Av8")
+  .Case("leon4", "-Av8")
+  .Case("gr740", "-Av8")
   .Default("-Av8");
   }
 }
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -6459,7 +6459,15 @@
 CK_NIAGARA3,
 CK_NIAGARA4,
 CK_MYRIAD2_1,
-CK_MYRIAD2_2
+CK_MYRIAD2_2,
+CK_LEON2,
+CK_LEON2_AT697E,
+CK_LEON2_AT697F,
+CK_LEON3,
+CK_LEON3_UT699,
+CK_LEON3_GR712RC,
+CK_LEON4,
+CK_LEON4_GR740
   } CPU = CK_GENERIC;
 
   enum CPUGeneration {
@@ -6480,6 +6488,14 @@
 case CK_TSC701:
 case CK_MYRIAD2_1:
 case CK_MYRIAD2_2:
+case CK_LEON2:
+case CK_LEON2_AT697E:
+case CK_LEON2_AT697F:
+case CK_LEON3:
+case CK_LEON3_UT699:
+case CK_LEON3_GR712RC:
+case CK_LEON4:
+case CK_LEON4_GR740:
   return CG_V8;
 case CK_V9:
 case CK_ULTRASPARC:
@@ -6513,6 +6529,14 @@
 .Case("myriad2", CK_MYRIAD2_1)
 .Case("myriad2.1", CK_MYRIAD2_1)
 .Case("myriad2.2", CK_MYRIAD2_2)
+.Case("leon2", CK_LEON2)
+.Case("at697e", CK_LEON2_AT697E)
+.Case("at697f", CK_LEON2_AT697F)
+.Case("leon3", CK_LEON3)
+.Case("ut699", CK_LEON3_UT699)
+.Case("gr712rc", CK_LEON3_GR712RC)
+.Case("leon4", CK_LEON4)
+.Case("gr740", CK_LEON4_GR740)
 .Default(CK_GENERIC);
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r273683 - Correct error in change description.

2016-06-24 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Fri Jun 24 09:23:32 2016
New Revision: 273683

URL: http://llvm.org/viewvc/llvm-project?rev=273683&view=rev
Log:
Correct error in change description.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=273683&r1=273682&r2=273683&view=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Fri Jun 24 09:23:32 2016
@@ -723,7 +723,7 @@ as the draft C++1z standard evolves.
   No
 
 
-  Separate variable and condition for if, while, and 
switch
+  Separate variable and condition for if and 
switch
   http://wg21.link/p0305r1";>P0305R1
   No
 


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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-24 Thread Aaron Ballman via cfe-commits
On Fri, Jun 24, 2016 at 8:39 AM, Richard Smith  wrote:
> rsmith added a comment.
>
> Ah right, we were (intentionally, but unfortunately) making an assumption 
> that the `TypeLoc` data layout doesn't change when the exception spec of a 
> function is updated. You'd need to make yourself a `TypeLocBuilder`, copy the 
> relevant data, and update the exception spec loc.

Would that look something like what we do in SemaType.cpp
GetFullTypeForDeclarator()? i.e.,

if (TInfo) {
  TypeLocBuilder TLB;
  TLB.pushFullCopy(TInfo->getTypeLoc());
  ObjCObjectPointerTypeLoc TLoc = TLB.push(T);
  TLoc.setStarLoc(FixitLoc);
  TInfo = TLB.getTypeSourceInfo(Context, T);
}

~Aaron

>
> Where are we adjusting the exception specification on the type source info? 
> That (changing the type-info-as-written) seems like a somewhat unusual thing 
> to do implicitly.
>
>
> http://reviews.llvm.org/D20428
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21564: [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'

2016-06-24 Thread Carlo Bertolli via cfe-commits
carlo.bertolli added a comment.

Thanks for the hint - I have updated the diff to use Context.getSizeType(). 
Please let me know if this is what you meant.


Repository:
  rL LLVM

http://reviews.llvm.org/D21564



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


Re: [PATCH] D21564: [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'

2016-06-24 Thread Alexey Bataev via cfe-commits
Carlo, yes this is what I meant. 

Best regards,
Alexey Bataev

Отправлено с iPhone

> 24 июня 2016 г., в 18:16, Carlo Bertolli  написал(а):
> 
> carlo.bertolli added a comment.
> 
> Thanks for the hint - I have updated the diff to use Context.getSizeType(). 
> Please let me know if this is what you meant.
> 
> 
> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D21564
> 
> 
> 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-24 Thread Manuel Klimek via cfe-commits
klimek added inline comments.


Comment at: unittests/Format/CleanupTest.cpp:258
@@ +257,3 @@
+auto CleanReplaces = cleanupAroundReplacements(Code, Replaces, Style);
+EXPECT_TRUE((bool)CleanReplaces)
+<< llvm::toString(CleanReplaces.takeError()) << "\n";

Hm. Can we make it work with EXPECT_TRUE somehow?


http://reviews.llvm.org/D21601



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


Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-24 Thread Eric Liu via cfe-commits
Would EXPECTED_FALSE(!Code) be better?

On Fri, Jun 24, 2016, 17:42 Manuel Klimek  wrote:

> klimek added inline comments.
>
> 
> Comment at: unittests/Format/CleanupTest.cpp:258
> @@ +257,3 @@
> +auto CleanReplaces = cleanupAroundReplacements(Code, Replaces, Style);
> +EXPECT_TRUE((bool)CleanReplaces)
> +<< llvm::toString(CleanReplaces.takeError()) << "\n";
> 
> Hm. Can we make it work with EXPECT_TRUE somehow?
>
>
> http://reviews.llvm.org/D21601
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-24 Thread Manuel Klimek via cfe-commits
klimek added a comment.

In http://reviews.llvm.org/D21601#466513, @ioeric wrote:

> Would EXPECTED_FALSE(!Code) be better?


Not really. Can we at least use static_cast(...)?


http://reviews.llvm.org/D21601



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


r273689 - DeadStoresChecker: Don't warn about dead stores into volatile variables

2016-06-24 Thread Stephan Bergmann via cfe-commits
Author: sberg
Date: Fri Jun 24 11:26:43 2016
New Revision: 273689

URL: http://llvm.org/viewvc/llvm-project?rev=273689&view=rev
Log:
DeadStoresChecker: Don't warn about dead stores into volatile variables

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
cfe/trunk/test/Analysis/dead-stores.c

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp?rev=273689&r1=273688&r2=273689&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp Fri Jun 24 
11:26:43 2016
@@ -278,6 +278,8 @@ public:
   RHS = RHS->IgnoreParenCasts();
 
   QualType T = VD->getType();
+  if (T.isVolatileQualified())
+return;
   if (T->isPointerType() || T->isObjCObjectPointerType()) {
 if (RHS->isNullPointerConstant(Ctx, 
Expr::NPC_ValueDependentIsNull))
   return;

Modified: cfe/trunk/test/Analysis/dead-stores.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/dead-stores.c?rev=273689&r1=273688&r2=273689&view=diff
==
--- cfe/trunk/test/Analysis/dead-stores.c (original)
+++ cfe/trunk/test/Analysis/dead-stores.c Fri Jun 24 11:26:43 2016
@@ -569,3 +569,7 @@ void testBOComma() {
 
 }
 
+void testVolatile() {
+volatile int v;
+v = 0; // no warning
+}


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


Re: [PATCH] D21682: DeadStoresChecker: Don't warn about dead stores into volatile variables

2016-06-24 Thread Stephan Bergmann via cfe-commits
sberg closed this revision.
sberg added a comment.

Committed revision 273689.


http://reviews.llvm.org/D21682



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


Re: [PATCH] D21673: [libcxx] guard throw with exception enabling check

2016-06-24 Thread Zhao, Weiming via cfe-commits
It's a good idea. Currently, there are about 600+  "throws" being 
guarded by _LIBCPP_NO_EXCEPTIONS macro.


How about let's merge the patch now and I can do the conversion of 
existing code to the wrapper in background?


Weiming

On 6/24/2016 1:25 AM, Noel Grandin wrote:

grandinj added a subscriber: grandinj.


Comment at: include/experimental/optional:524
@@ -521,1 +523,3 @@
+assert(!"bad optional access");
+#endif
  return this->__val_;

If this kind of code is going to show up in lots of places, then maybe wrap it 
up in a macro:

_LIBCPP_THROW_OR_ASSERT(bad_optional_access(), "bad optional access")

?

With some extra preprocessor magic, and if LLVM didn't care about the string in 
the assert, could even leave out the second parameter


http://reviews.llvm.org/D21673





--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by 
The Linux Foundation

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


Re: [PATCH] D21673: [libcxx] guard throw with exception enabling check

2016-06-24 Thread Weiming Zhao via cfe-commits
weimingz added a subscriber: weimingz.
weimingz added a comment.

It's a good idea. Currently, there are about 600+  "throws" being 
guarded by _LIBCPP_NO_EXCEPTIONS macro.

How about let's merge the patch now and I can do the conversion of 
existing code to the wrapper in background?

Weiming


http://reviews.llvm.org/D21673



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


Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-24 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 added a comment.

Ping? Any further comments, thoughts?

Thank you very much.


http://reviews.llvm.org/D20561



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


Re: [PATCH] D21295: Add a negative TBAA test

2016-06-24 Thread Roger Ferrer Ibanez via cfe-commits
rogfer01 added a comment.

Ping?

Thank you very much!


http://reviews.llvm.org/D21295



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


Re: [PATCH] D21673: [libcxx] guard throw with exception enabling check

2016-06-24 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D21673#466544, @weimingz wrote:

> It's a good idea. Currently, there are about 600+  "throws" being 
>  guarded by _LIBCPP_NO_EXCEPTIONS macro.
>
> How about let's merge the patch now and I can do the conversion of 
>  existing code to the wrapper in background?
>
> Weiming


Sounds good to me.

Thanks!


http://reviews.llvm.org/D21673



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


Re: [PATCH] D21682: DeadStoresChecker: Don't warn about dead stores into volatile variables

2016-06-24 Thread Anna Zaks via cfe-commits
zaks.anna added a comment.

Thanks!!!


http://reviews.llvm.org/D21682



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


Re: [PATCH] D20561: Warn when taking address of packed member

2016-06-24 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

In http://reviews.llvm.org/D20561#466545, @rogfer01 wrote:

> Ping? Any further comments, thoughts?
>
> Thank you very much.


The usual practice is to ping after a week has gone by, btw. There were 
standards meetings this week, so that may be delaying some of the comments on 
this thread.


http://reviews.llvm.org/D20561



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


LLVM buildmaster is not working currently

2016-06-24 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster is not working currently for not clear reason.
I try to restore it ASAP.

Builders owners could use our public silent master as temporally solution.

Silent buildbot is currently copy of llvm buildbot, but does not sent any
notifications.
The both have the same set of builders and it's easy to switch a slave
between them.
To do this please point your slave to silent master:
use lab.llvm.org:9994 instead of lab.llvm.org:9990

It's address:
http://lab.llvm.org:8014

Thanks

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


r273694 - clang-format: [JS] Fix build breakage.

2016-06-24 Thread Martin Probst via cfe-commits
Author: mprobst
Date: Fri Jun 24 12:45:13 2016
New Revision: 273694

URL: http://llvm.org/viewvc/llvm-project?rev=273694&view=rev
Log:
clang-format: [JS] Fix build breakage.

Checking Line.MustBeDeclaration does actually break the field and param 
initializer use case.

Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=273694&r1=273693&r2=273694&view=diff
==
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Jun 24 12:45:13 2016
@@ -639,7 +639,7 @@ private:
   }
   // Declarations cannot be conditional expressions, this can only be part
   // of a type declaration.
-  if (Line.MustBeDeclaration && !Contexts.back().IsExpression &&
+  if (!Contexts.back().IsExpression &&
   Style.Language == FormatStyle::LK_JavaScript)
 break;
   parseConditional();

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=273694&r1=273693&r2=273694&view=diff
==
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Fri Jun 24 12:45:13 2016
@@ -1351,7 +1351,7 @@ TEST_F(FormatTestJS, NonNullAssertionOpe
 
 TEST_F(FormatTestJS, Conditional) {
   verifyFormat("y = x ? 1 : 2;");
-  verifyFormat("x ? 1 : 2;");
+  verifyFormat("x ? 1: 2;"); // Known issue with top level conditionals.
   verifyFormat("class Foo {\n"
"  field = true ? 1 : 2;\n"
"  method(a = true ? 1 : 2) {}\n"


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


[PATCH] D21691: clang-format: [JS] Fix build breakage.

2016-06-24 Thread Martin Probst via cfe-commits
mprobst created this revision.
mprobst added a reviewer: djasper.
mprobst added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

Checking Line.MustBeDeclaration does actually break the field and param 
initializer use case.

http://reviews.llvm.org/D21691

Files:
  lib/Format/TokenAnnotator.cpp
  unittests/Format/FormatTestJS.cpp

Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1351,7 +1351,7 @@
 
 TEST_F(FormatTestJS, Conditional) {
   verifyFormat("y = x ? 1 : 2;");
-  verifyFormat("x ? 1 : 2;");
+  verifyFormat("x ? 1: 2;"); // Known issue with top level conditionals.
   verifyFormat("class Foo {\n"
"  field = true ? 1 : 2;\n"
"  method(a = true ? 1 : 2) {}\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -639,7 +639,7 @@
   }
   // Declarations cannot be conditional expressions, this can only be part
   // of a type declaration.
-  if (Line.MustBeDeclaration && !Contexts.back().IsExpression &&
+  if (!Contexts.back().IsExpression &&
   Style.Language == FormatStyle::LK_JavaScript)
 break;
   parseConditional();


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1351,7 +1351,7 @@
 
 TEST_F(FormatTestJS, Conditional) {
   verifyFormat("y = x ? 1 : 2;");
-  verifyFormat("x ? 1 : 2;");
+  verifyFormat("x ? 1: 2;"); // Known issue with top level conditionals.
   verifyFormat("class Foo {\n"
"  field = true ? 1 : 2;\n"
"  method(a = true ? 1 : 2) {}\n"
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -639,7 +639,7 @@
   }
   // Declarations cannot be conditional expressions, this can only be part
   // of a type declaration.
-  if (Line.MustBeDeclaration && !Contexts.back().IsExpression &&
+  if (!Contexts.back().IsExpression &&
   Style.Language == FormatStyle::LK_JavaScript)
 break;
   parseConditional();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21691: clang-format: [JS] Fix build breakage.

2016-06-24 Thread Martin Probst via cfe-commits
mprobst added a comment.

Sorry, my automated test run somehow didn't fail, and so I implemented your 
suggestion which actually did break formatting.

Could you post-commit review this? It's already committed to fix the build.


http://reviews.llvm.org/D21691



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


Re: [PATCH] D21666: [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".

2016-06-24 Thread Sterling Augustine via cfe-commits
saugustine accepted this revision.
saugustine added a comment.
This revision is now accepted and ready to land.

This looks good and useful to me on the Tooling/Core side, but someone more 
familiar with the internals of NestedNamesSpecifiers should sign off on that 
portion.

Also, I would probably add a test case for _Bool, which is a case that has 
confused other logic like this. I think it will work, but may as well include 
the proof.


http://reviews.llvm.org/D21666



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


Re: [PATCH] D21673: [libcxx] guard throw with exception enabling check

2016-06-24 Thread Weiming Zhao via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273697: [libcxx] guard throw with exception enabling check 
(authored by weimingz).

Changed prior to commit:
  http://reviews.llvm.org/D21673?vs=61755&id=61813#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21673

Files:
  libcxx/trunk/include/experimental/optional

Index: libcxx/trunk/include/experimental/optional
===
--- libcxx/trunk/include/experimental/optional
+++ libcxx/trunk/include/experimental/optional
@@ -517,15 +517,23 @@
 constexpr value_type const& value() const
 {
 if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 throw bad_optional_access();
+#else
+assert(!"bad optional access");
+#endif
 return this->__val_;
 }
 
 _LIBCPP_INLINE_VISIBILITY
 value_type& value()
 {
 if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 throw bad_optional_access();
+#else
+assert(!"bad optional access");
+#endif
 return this->__val_;
 }
 


Index: libcxx/trunk/include/experimental/optional
===
--- libcxx/trunk/include/experimental/optional
+++ libcxx/trunk/include/experimental/optional
@@ -517,15 +517,23 @@
 constexpr value_type const& value() const
 {
 if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 throw bad_optional_access();
+#else
+assert(!"bad optional access");
+#endif
 return this->__val_;
 }
 
 _LIBCPP_INLINE_VISIBILITY
 value_type& value()
 {
 if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 throw bad_optional_access();
+#else
+assert(!"bad optional access");
+#endif
 return this->__val_;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r273697 - [libcxx] guard throw with exception enabling check

2016-06-24 Thread Weiming Zhao via cfe-commits
Author: weimingz
Date: Fri Jun 24 13:02:27 2016
New Revision: 273697

URL: http://llvm.org/viewvc/llvm-project?rev=273697&view=rev
Log:
[libcxx] guard throw with exception enabling check

Summary: this fixes build error when built with c++14 and no exceptions

Reviewers: rmaprath

Subscribers: weimingz, grandinj, rmaprath, cfe-commits

Differential Revision: http://reviews.llvm.org/D21673

Modified:
libcxx/trunk/include/experimental/optional

Modified: libcxx/trunk/include/experimental/optional
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/optional?rev=273697&r1=273696&r2=273697&view=diff
==
--- libcxx/trunk/include/experimental/optional (original)
+++ libcxx/trunk/include/experimental/optional Fri Jun 24 13:02:27 2016
@@ -517,7 +517,11 @@ public:
 constexpr value_type const& value() const
 {
 if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 throw bad_optional_access();
+#else
+assert(!"bad optional access");
+#endif
 return this->__val_;
 }
 
@@ -525,7 +529,11 @@ public:
 value_type& value()
 {
 if (!this->__engaged_)
+#ifndef _LIBCPP_NO_EXCEPTIONS
 throw bad_optional_access();
+#else
+assert(!"bad optional access");
+#endif
 return this->__val_;
 }
 


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


Re: [PATCH] D21666: [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".

2016-06-24 Thread Reid Kleckner via cfe-commits
rnk added inline comments.


Comment at: lib/AST/NestedNameSpecifier.cpp:50
@@ +49,3 @@
+
+  NestedNameSpecifier *P = const_cast(Specifier);
+  while (P->getPrefix() != nullptr) {

Doesn't this mutate the AST in place? We shouldn't be doing that.


Comment at: lib/Tooling/Core/QualTypeNames.cpp:405
@@ -398,3 +404,3 @@
   // is not the global scope.
   Prefix = createNestedNameSpecifierForScopeOf(Ctx, QT.getTypePtr(),
true /*FullyQualified*/);

Rather than building the NNS here and mutating it after the fact, why not pass 
WithGlobalNsPrefix down to createNestedNameSpecifierForScopeOf?


http://reviews.llvm.org/D21666



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


Re: [llvm-dev] [RFC] Embedded bitcode and related upstream (Part II)

2016-06-24 Thread Steven Wu via cfe-commits

> On Jun 14, 2016, at 3:27 PM, Eric Christopher  wrote:
> 
> 
> 
> On Mon, Jun 13, 2016 at 9:37 AM Steven Wu  > wrote:
> Thanks for the feedback! Replies inline. 
> 
>> On Jun 12, 2016, at 11:44 PM, Eric Christopher > > wrote:
>> 
>> Hi Steven,
>> 
>> Great to see the commentary and updates here. I've got a few questions about 
>> some of this work. It might be nice to see some separate RFCs for a couple 
>> of things, but we'll figure that out after you send out patches probably :)
>> 
>> What needs to be improved:
>> 1. Whitelist for command line options that can be used with bitcode:
>> Current trunk implementation embeds all the cc1 command line options (that 
>> includes header include paths, warning flags and other front-end options) in 
>> the command line section. That is lot of redundant information. To re-create 
>> the object file from the embedded optimized bitcode, most of these options 
>> are useless. On the other hand, they can leak information of the source 
>> code. One solution will be keeping a list of all the options that can affect 
>> code generation but not encoded in the bitcode. I have internally prototyped 
>> with disallowing these options explicitly and allowed only the reminder of 
>> the  options to be embedded (http://reviews.llvm.org/D17394 
>> ). A better solution might be encoding that 
>> information in "Options.td" as specific group.
>> 
>> This is really interesting. I'm not a particularly security minded person so 
>> I don't have a lot of commentary there. An explicit whitelist sounds a bit 
>> painful to keep maintained, explicitly having a group in Options.td sounds 
>> pretty nice. You'll need to add them to multiple groups, but it seems pretty 
>> nice.
> 
> I have already implemented the new approach in http://reviews.llvm.org/D21230 
> . It creates a new group for all the cc1 
> options that can affect codegen but not having a corresponding attribute in 
> the bitcode. When I wrote up this patch, I think it is also a good idea to 
> extend the group to driver flags so clang driver can issue warnings when 
> using these flags with LTO because they are likely to be dropped in the 
> process. That is my next thing to do if someone reviews my patch and agrees 
> that is right thing to do.
> 
> 
> Honestly I think it's better if we implement almost everything in the bitcode 
> that doesn't involve a pass manager configuration - and then make that more 
> explicit as far as library calls. Same with TargetMachine configuration etc. 
> What do you think?

I believe that is always the ultimate goal but it is not an short-term task and 
every time I go through the lists of TargetMachine configuration, there are new 
flags added. 
The easiest solution might be add all of them to the module flags but we 
probably need to go through them one by one to see if that is appropriate and 
will not conflict with function multiversioning. We also need tests to make 
sure flags are properly encoded in the bitcode. 

>  
>>  
>> 2. Assembly input handling:
>> This is a workaround to allow source code written in assembly to work with 
>> "-fembed-bitcode" options. When compiling assembly source code with 
>> "-fembed-bitcode", clang-as creates an empty section "__LLVM, __asm" in the 
>> object file. That is just a way to distinguish object files compiled from 
>> assembly source from those compiled from higher level source code but forgot 
>> to use "-fembed-bitcode" options. Linker can use this section to diagnose if 
>> "-fembed-bitcode" is consistently used on all the object files participated 
>> in the linking.
>> 
>> I'm surprised you want a separate and empty section and not a header flag as 
>> those are easier to keep around and won't take up a precious mach-o section. 
>> There are probably other options here as well. There are probably other 
>> options or concerns that someone shipping bitcode might have here as well, 
>> but I'm sure those are being talked about - doesn't have too much affect on 
>> the community though.
> 
> I suppose you mean the alternative is to burn a macho command for that. Well, 
> that is a limited resource and we don't have much left. Plus, using empty 
> section will make this accessible to other binary format, not only macho 
> files. I also have an interesting thought about handle the assembly, that is 
> to wrap it in module assembly in a bitcode file. I am not sure it would 
> preserve the all semantics of the original assembly and that would mean I 
> need to somehow teach the assembler about bitcode (which might make this not 
> very attractive). Yes, you might be right this doesn't affect the community, 
> if no one else is interesting in a solution for the problem we have, then 
> this might not be suitable for contributing. I am happy to keep it downstream.
> 
> 
> You could use a section for ELF. I'm not sure what the 

Re: LLVM buildmaster is not working currently

2016-06-24 Thread Galina Kistanova via cfe-commits
Hello,

Master was down per hardware issues. Back to work now.

Thanks

Galina

On Fri, Jun 24, 2016 at 10:35 AM, Galina Kistanova 
wrote:

> Hello everyone,
>
> LLVM buildmaster is not working currently for not clear reason.
> I try to restore it ASAP.
>
> Builders owners could use our public silent master as temporally solution.
>
> Silent buildbot is currently copy of llvm buildbot, but does not sent any
> notifications.
> The both have the same set of builders and it's easy to switch a slave
> between them.
> To do this please point your slave to silent master:
> use lab.llvm.org:9994 instead of lab.llvm.org:9990
>
> It's address:
> http://lab.llvm.org:8014
>
> Thanks
>
> Galina
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-06-24 Thread Anastasia Stulova via cfe-commits
Anastasia updated this revision to Diff 61816.
Anastasia added a comment.

Addressed Alexey's comments:

- Removed redundant checks;
- Improved diagnostics of parameters to blocks and sizes of block parameters;
- Handled casting of integer types for specifying sizes of block parameters;


http://reviews.llvm.org/D20249

Files:
  include/clang/AST/Type.h
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Basic/Builtins.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/opencl-c.h
  lib/Sema/SemaChecking.cpp
  lib/Sema/SemaInit.cpp
  test/CodeGenOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/cl20-device-side-enqueue.cl
  test/SemaOpenCL/clang-builtin-version.cl
  test/SemaOpenCL/to_addr_builtin.cl

Index: test/SemaOpenCL/to_addr_builtin.cl
===
--- test/SemaOpenCL/to_addr_builtin.cl
+++ test/SemaOpenCL/to_addr_builtin.cl
@@ -10,43 +10,44 @@
 
   glob = to_global(glob, loc);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{implicit declaration of function 'to_global' is invalid in C99}}
+  // expected-warning@-3{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
-  // expected-error@-4{{invalid number of arguments to function: 'to_global'}}
+  // expected-error@-5{{invalid number of arguments to function: 'to_global'}}
 #endif
 
   int x;
   glob = to_global(x);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument x to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   glob = to_global(con);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument con to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   glob = to_global(con_typedef);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__global int *' from 'int'}}
 #else
   // expected-error@-4{{invalid argument con_typedef to function: 'to_global', expecting a generic pointer argument}}
 #endif
 
   loc = to_global(glob);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion assigning to '__local int *' from 'int'}}
 #else
   // expected-error@-4{{assigning '__global int *' to '__local int *' changes address space of pointer}}
 #endif
 
   global char *glob_c = to_global(loc);
 #if __OPENCL_C_VERSION__ < CL_VERSION_2_0
-  // expected-error@-2{{'to_global' requires OpenCL version 2.0 or above}}
+  // expected-warning@-2{{incompatible integer to pointer conversion initializing '__global char *' with an expression of type 'int'}}
 #else
   // expected-warning@-4{{incompatible pointer types initializing '__global char *' with an expression of type '__global int *'}}
 #endif
Index: test/SemaOpenCL/clang-builtin-version.cl
===
--- /dev/null
+++ test/SemaOpenCL/clang-builtin-version.cl
@@ -0,0 +1,44 @@
+// RUN: %clang_cc1 %s -fblocks -verify -pedantic -fsyntax-only -ferror-limit 100
+
+// Confirm CL2.0 Clang builtins are not available in earlier versions
+
+kernel void dse_builtins() {
+  int tmp;
+  enqueue_kernel(tmp, tmp, tmp, ^(void) { // expected-warning{{implicit declaration of function 'enqueue_kernel' is invalid in C99}}
+return;
+  });
+  unsigned size = get_kernel_work_group_size(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_work_group_size' is invalid in C99}}
+return;
+  });
+  size = get_kernel_preferred_work_group_size_multiple(^(void) { // expected-warning{{implicit declaration of function 'get_kernel_preferred_work_group_size_multiple' is invalid in C99}}
+return;
+  });
+}
+
+void pipe_builtins() {
+  int tmp;
+
+  read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'read_pipe' is invalid in C99}}
+  write_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'write_pipe' is invalid in C99}}
+
+  reserve_read_pipe(tmp, tmp);  // expected-warning{{implicit declaration of function 'reserve_read_pipe' is invalid in C99}}
+  reserve_write_pipe(tmp, tmp); // expected-warning{{implicit declaration of function 'reserve_write_pipe' is invalid in C99}}
+
+  work_group_reserve_

Re: [PATCH] D21564: [OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'

2016-06-24 Thread Carlo Bertolli via cfe-commits
carlo.bertolli closed this revision.
carlo.bertolli added a comment.

Committed revision 273705.


Repository:
  rL LLVM

http://reviews.llvm.org/D21564



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


[PATCH] D21695: [clang] Version support for UBSan handlers

2016-06-24 Thread Filipe Cabecinhas via cfe-commits
filcab created this revision.
filcab added reviewers: kcc, samsonov, rsmith.
filcab added a subscriber: cfe-commits.

This adds a way for us to version any UBSan handler by itself.
The patch overrides D21289 for a better implementation (we're able to
rev up a single handler).

After this, then we can land a slight modification of D19667+D19668.

We probably don't want to keep all the versions in compiler-rt (maybe we
want to deprecate on one release and remove the old handler on the next
one?), but with this patch we will loudly fail to compile when mixing
incompatible handler calls, instead of silently compiling and then
providing bad error messages.

http://reviews.llvm.org/D21695

Files:
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h

Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -100,6 +100,32 @@
   TEK_Aggregate
 };
 
+#define LIST_SANITIZER_CHECKS  \
+  SANITIZER_CHECK(AddOverflow, add_overflow, 0)\
+  SANITIZER_CHECK(BuiltinUnreachable, builtin_unreachable, 0)  \
+  SANITIZER_CHECK(CFICheckFail, cfi_check_fail, 0) \
+  SANITIZER_CHECK(DivremOverflow, divrem_overflow, 0)  \
+  SANITIZER_CHECK(DynamicTypeCacheMiss, dynamic_type_cache_miss, 0)\
+  SANITIZER_CHECK(FloatCastOverflow, float_cast_overflow, 0)   \
+  SANITIZER_CHECK(FunctionTypeMismatch, function_type_mismatch, 0) \
+  SANITIZER_CHECK(LoadInvalidValue, load_invalid_value, 0) \
+  SANITIZER_CHECK(MissingReturn, missing_return, 0)\
+  SANITIZER_CHECK(MulOverflow, mul_overflow, 0)\
+  SANITIZER_CHECK(NegateOverflow, negate_overflow, 0)  \
+  SANITIZER_CHECK(NonnullArg, nonnull_arg, 0)  \
+  SANITIZER_CHECK(NonnullReturn, nonnull_return, 0)\
+  SANITIZER_CHECK(OutOfBounds, out_of_bounds, 0)   \
+  SANITIZER_CHECK(ShiftOutOfBounds, shift_out_of_bounds, 0)\
+  SANITIZER_CHECK(SubOverflow, sub_overflow, 0)\
+  SANITIZER_CHECK(TypeMismatch, type_mismatch, 0)  \
+  SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0)
+
+enum SanitizerHandler {
+#define SANITIZER_CHECK(Enum, Name, Version) Enum,
+  LIST_SANITIZER_CHECKS
+#undef SANITIZER_CHECK
+};
+
 /// CodeGenFunction - This class organizes the per-function state that is used
 /// while generating LLVM code.
 class CodeGenFunction : public CodeGenTypeCache {
@@ -3083,7 +3109,7 @@
   /// sanitizer runtime with the provided arguments, and create a conditional
   /// branch to it.
   void EmitCheck(ArrayRef> Checked,
- StringRef CheckName, ArrayRef StaticArgs,
+ SanitizerHandler Check, ArrayRef StaticArgs,
  ArrayRef DynamicArgs);
 
   /// \brief Emit a slow path cross-DSO CFI check which calls __cfi_slowpath
Index: lib/CodeGen/CodeGenFunction.cpp
===
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -1036,8 +1036,8 @@
   SanitizerScope SanScope(this);
   llvm::Value *IsFalse = Builder.getFalse();
   EmitCheck(std::make_pair(IsFalse, SanitizerKind::Return),
-"missing_return", EmitCheckSourceLocation(FD->getLocation()),
-None);
+SanitizerHandler::MissingReturn,
+EmitCheckSourceLocation(FD->getLocation()), None);
 } else if (CGM.getCodeGenOpts().OptimizationLevel == 0) {
   EmitTrapCall(llvm::Intrinsic::trap);
 }
@@ -1720,7 +1720,7 @@
 };
 EmitCheck(std::make_pair(Builder.CreateICmpSGT(Size, Zero),
  SanitizerKind::VLABound),
-  "vla_bound_not_positive", StaticArgs, Size);
+  SanitizerHandler::VLABoundNotPositive, StaticArgs, Size);
   }
 
   // Always zexting here would be wrong if it weren't
Index: lib/CodeGen/CGExprScalar.cpp
===
--- lib/CodeGen/CGExprScalar.cpp
+++ lib/CodeGen/CGExprScalar.cpp
@@ -724,7 +724,7 @@
   CGF.EmitCheckTypeDescriptor(OrigSrcType),
   CGF.EmitCheckTypeDescriptor(DstType)};
   CGF.EmitCheck(std::make_pair(Check, SanitizerKind::FloatCastOverflow),
-"float_cast_overflow", StaticArgs, OrigSrc);
+SanitizerHandler::FloatCastOverflow, StaticArgs, Or

Re: [PATCH] D21289: [ubsan] Version names of handlers

2016-06-24 Thread Filipe Cabecinhas via cfe-commits
filcab abandoned this revision.
filcab added a comment.

Replaced by http://reviews.llvm.org/D21695


http://reviews.llvm.org/D21289



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


Re: [PATCH] D20249: [OpenCL] Hierarchical/dynamic parallelism - enqueue kernel in OpenCL 2.0

2016-06-24 Thread Anastasia Stulova via cfe-commits
Anastasia marked 4 inline comments as done.


Comment at: lib/Sema/SemaChecking.cpp:145
@@ +144,3 @@
+}
+
+/// OpenCL v2.0, s6.13.17.1 - Check that sizes are provided for all

I think the problem is that in C99 there are implicit casts among integer 
types, therefore making this check more restrictive would imply the cast has to 
be done explicitly instead.

Thus, this would have to be modified as follows:

  enqueue_kernel(...,  64); -> enqueue_kernel(...,  (uint)64); or 
enqueue_kernel(...,  64U);

which in my opinion is undesirable and also a bit unexpected because by analogy 
to C99 you can compile the following successfully:
  
  void g(unsigned);

  void f() {
char i;
g(i);
  }

I have added a check for a size however not to be larger than 32 bits and 
handled type cast in CodeGen. The test cases are added too.

What's your opinion about it?


Comment at: lib/Sema/SemaChecking.cpp:302
@@ +301,3 @@
+
+  // None of the specific case has been detected, give generic error
+  S.Diag(TheCall->getLocStart(),

This error is when we can't deduce exactly which overload is meant to be and we 
are giving more general error (like it's ambiguous). You can see some examples 
in tests. We could of course go further and specify possible candidates, but it 
would complicate the story even more.


http://reviews.llvm.org/D20249



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


Re: [PATCH] D21567: [OpenCL] Generate struct type for sampler_t and function call for the initializer

2016-06-24 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: include/clang/AST/BuiltinTypes.def:164
@@ +163,3 @@
+// Internal OpenCL sampler initializer type.
+BUILTIN_TYPE(OCLSamplerInit, OCLSamplerInitTy)
+

yaxunl wrote:
> Anastasia wrote:
> > I can't get why is this necessary to represent initializer as a special 
> > Clang type? Could we avoid this additional complexity?
> If we don't change the type in AST, we need to translate the sampler type in 
> AST to different types based on whether the entry is a variable or a function 
> argument. This needs some ugly hacking of the codegen.
I don't understand why this is needed. Surely, sampler type is just a sampler 
type independently from the context it's being used. Could you elaborate or 
give me an example please.


Comment at: include/clang/AST/OperationKinds.def:328
@@ +327,3 @@
+// Convert an integer initializer to an OpenCL sampler initializer.
+CAST_OPERATION(IntToOCLSamplerInitializer)
+

yaxunl wrote:
> Anastasia wrote:
> > Could we just have only int->sampler conversion? Without having an extra 
> > type for initializer?
> If we don't insert the sampler initializer to sampler cast in AST, when we 
> want to insert the function call __translate_sampler_initializer in codegen, 
> we have to hacking the generic translation of function call instruction and 
> other instructions which may have a sampler variable as operand to insert the 
> function call, which would be ugly.
> 
> Or we could do a post-processing of the llvm module at the end of codegen to 
> insert the function calls, if this approach is acceptable.
I don't understand why this is needed? The initialization function only 
replaces the initializer of a sampler type. So this call only has to be emitted 
on the conversion int->sampler.


Comment at: include/clang/Basic/DiagnosticGroups.td:876
@@ +875,3 @@
+// A warning group for warnings about code that clang accepts when
+// compiling OpenCL C/C++ but which is not compatible with the SPIR spec.
+def SpirCompat : DiagGroup<"spir-compat">;

yaxunl wrote:
> Anastasia wrote:
> > I don't understand the description really? Why not compatible?
> e.g. the sampler constant may take some literal value which is not compatible 
> with SPIR/SPIR-V spec. A warning will be emitted. Such warning msg belongs to 
> this category.
Could we avoid having SPIR incompatible code instead?


Comment at: include/clang/Driver/CC1Options.td:690
@@ -689,1 +689,3 @@
   HelpText<"OpenCL only. Allow denormals to be flushed to zero">;
+def cl_sampler_type : Separate<["-"], "cl-sampler-type">,
+  HelpText<"OpenCL only. Specify type of sampler to emit. Valid values: 
\"opaque\"(default), \"i32\"">;

yaxunl wrote:
> Anastasia wrote:
> > Any reason to have this flag and support different sampler representations 
> > in Clang?
> Give user some time for transition.
It doesn't look such a big and risky change to add special flag and maintain 
two different representations. I would rather go for cleanup of old code here.


Comment at: lib/CodeGen/CGOpenCLRuntime.cpp:52
@@ +51,3 @@
+  return llvm::PointerType::get(llvm::StructType::create(
+   Ctx, "__sampler"),
+   CGM.getContext().getTargetAddressSpace(

yaxunl wrote:
> Anastasia wrote:
> > Could you please keep coherency in type naming i.e. add "opencl." prefix.
> We need to be able to implement function 
> 
>   __sampler* __translate_sampler_initializer(__sampler_initializer*);
> 
> in library, where `__sampler` and `__sampler_initializer` are concrete struct 
> types defined in the library source code. Therefore we cannot have dot in the 
> struct type name.
Would it work if this function uses OpenCL original types and get compiled with 
Clang too?


http://reviews.llvm.org/D21567



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


Re: [PATCH] D20428: Tracking exception specification source locations

2016-06-24 Thread Aaron Ballman via cfe-commits
On Fri, Jun 24, 2016 at 10:30 AM, Aaron Ballman  wrote:
> On Fri, Jun 24, 2016 at 8:39 AM, Richard Smith  wrote:
>> rsmith added a comment.
>>
>> Ah right, we were (intentionally, but unfortunately) making an assumption 
>> that the `TypeLoc` data layout doesn't change when the exception spec of a 
>> function is updated. You'd need to make yourself a `TypeLocBuilder`, copy 
>> the relevant data, and update the exception spec loc.
>
> Would that look something like what we do in SemaType.cpp
> GetFullTypeForDeclarator()? i.e.,
>
> if (TInfo) {
>   TypeLocBuilder TLB;
>   TLB.pushFullCopy(TInfo->getTypeLoc());
>   ObjCObjectPointerTypeLoc TLoc = TLB.push(T);
>   TLoc.setStarLoc(FixitLoc);
>   TInfo = TLB.getTypeSourceInfo(Context, T);
> }

I just realized that TypeLocBuilder is part of Sema and this
functionality is needed from ASTContext, which is a laying violation.
I think ASTContext::adjustExceptionSpec() needs to go away, and we
need to expose this functionality from Sema::UpdateExceptionSpec() (or
expose a new Sema method), and make places that call
adjustExceptionSpec() instead call UpdateExceptionSpec() (or the new
function). Thankfully, there are only four places
adjustExceptionSpec() is called from: UpdateExceptionSpec(),
ActOnFunctionDeclarator(), actOnDelayedExceptionSpecific(), and the
AST reader -- all of which are either in Sema or have access to a Sema
object.

Thoughts?

~Aaron

>
> ~Aaron
>
>>
>> Where are we adjusting the exception specification on the type source info? 
>> That (changing the type-info-as-written) seems like a somewhat unusual thing 
>> to do implicitly.
>>
>>
>> http://reviews.llvm.org/D20428
>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21666: [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".

2016-06-24 Thread Siva Chandra via cfe-commits
sivachandra updated this revision to Diff 61821.
sivachandra added a comment.

A little adjustment.


http://reviews.llvm.org/D21666

Files:
  include/clang/AST/NestedNameSpecifier.h
  include/clang/Tooling/Core/QualTypeNames.h
  lib/AST/NestedNameSpecifier.cpp
  lib/Tooling/Core/QualTypeNames.cpp
  unittests/Tooling/QualTypeNamesTest.cpp

Index: unittests/Tooling/QualTypeNamesTest.cpp
===
--- unittests/Tooling/QualTypeNamesTest.cpp
+++ unittests/Tooling/QualTypeNamesTest.cpp
@@ -14,6 +14,7 @@
 namespace {
 struct TypeNameVisitor : TestVisitor {
   llvm::StringMap ExpectedQualTypeNames;
+  bool WithGlobalNsPrefix = false;
 
   // ValueDecls are the least-derived decl with both a qualtype and a
   // name.
@@ -26,7 +27,8 @@
 ExpectedQualTypeNames.lookup(VD->getNameAsString());
 if (ExpectedName != "") {
   std::string ActualName =
-  TypeName::getFullyQualifiedName(VD->getType(), *Context);
+  TypeName::getFullyQualifiedName(VD->getType(), *Context,
+  WithGlobalNsPrefix);
   if (ExpectedName != ActualName) {
 // A custom message makes it much easier to see what declaration
 // failed compared to EXPECT_EQ.
@@ -179,6 +181,30 @@
   "  TX CheckTX;"
   "  struct A { typedef int X; };"
   "}");
+
+  TypeNameVisitor GlobalNsPrefix;
+  GlobalNsPrefix.WithGlobalNsPrefix = true;
+  GlobalNsPrefix.ExpectedQualTypeNames["IntVal"] = "int";
+  GlobalNsPrefix.ExpectedQualTypeNames["BoolVal"] = "bool";
+  GlobalNsPrefix.ExpectedQualTypeNames["XVal"] = "::A::B::X";
+  GlobalNsPrefix.ExpectedQualTypeNames["IntAliasVal"] = "::A::B::Alias";
+  GlobalNsPrefix.ExpectedQualTypeNames["ZVal"] = "::A::B::Y::Z";
+  GlobalNsPrefix.runOver(
+  "namespace A {\n"
+  "  namespace B {\n"
+  "int IntVal;\n"
+  "bool BoolVal;\n"
+  "struct X {};\n"
+  "X XVal;\n"
+  "template  class CCC { };\n"
+  "template \n"
+  "using Alias = CCC;\n"
+  "Alias IntAliasVal;\n"
+  "struct Y { struct Z {}; };\n"
+  "Y::Z ZVal;\n"
+  "  }"
+  "}"
+  );
 }
 
 }  // end anonymous namespace
Index: lib/Tooling/Core/QualTypeNames.cpp
===
--- lib/Tooling/Core/QualTypeNames.cpp
+++ lib/Tooling/Core/QualTypeNames.cpp
@@ -30,7 +30,8 @@
 /// \param[in] QT - the type for which the fully qualified type will be
 /// returned.
 /// \param[in] Ctx - the ASTContext to be used.
-static QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx);
+static QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx,
+  bool WithGlobalNsPrefix);
 
 /// \brief Create a NestedNameSpecifier for Namesp and its enclosing
 /// scopes.
@@ -90,7 +91,8 @@
 }
 
 static bool getFullyQualifiedTemplateArgument(const ASTContext &Ctx,
-  TemplateArgument &Arg) {
+  TemplateArgument &Arg,
+  bool WithGlobalNsPrefix) {
   bool Changed = false;
 
   // Note: we do not handle TemplateArgument::Expression, to replace it
@@ -105,7 +107,7 @@
   } else if (Arg.getKind() == TemplateArgument::Type) {
 QualType SubTy = Arg.getAsType();
 // Check if the type needs more desugaring and recurse.
-QualType QTFQ = getFullyQualifiedType(SubTy, Ctx);
+QualType QTFQ = getFullyQualifiedType(SubTy, Ctx, WithGlobalNsPrefix);
 if (QTFQ != SubTy) {
   Arg = TemplateArgument(QTFQ);
   Changed = true;
@@ -115,7 +117,8 @@
 }
 
 static const Type *getFullyQualifiedTemplateType(const ASTContext &Ctx,
- const Type *TypePtr) {
+ const Type *TypePtr,
+ bool WithGlobalNsPrefix) {
   // DependentTemplateTypes exist within template declarations and
   // definitions. Therefore we shouldn't encounter them at the end of
   // a translation unit. If we do, the caller has made an error.
@@ -130,7 +133,8 @@
   // Cheap to copy and potentially modified by
   // getFullyQualifedTemplateArgument.
   TemplateArgument Arg(*I);
-  MightHaveChanged |= getFullyQualifiedTemplateArgument(Ctx, Arg);
+  MightHaveChanged |= getFullyQualifiedTemplateArgument(
+  Ctx, Arg, WithGlobalNsPrefix);
   FQArgs.push_back(Arg);
 }
 
@@ -160,7 +164,8 @@
 // cheap to copy and potentially modified by
 // getFullyQualifedTemplateArgument
 TemplateArgument Arg(TemplateArgs[I]);
-MightHaveChanged |= getFullyQualifiedTemplateArgument(Ctx, Arg);
+MightHaveChanged |= getFullyQualifiedTemplateArgument(
+Ctx, Arg, WithGlobalNsPrefix);
 FQArgs.push_back(Arg);
   }
 
@@ -337,13 +342,14 @@
 
 /// \brief 

Re: [PATCH] D21602: Changes related to tooling::applyAllReplacements interface change in D21601.

2016-06-24 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 61824.
ioeric added a comment.

- Addressed reviewer's recomments in the other patch.


http://reviews.llvm.org/D21602

Files:
  include-fixer/IncludeFixer.cpp
  include-fixer/IncludeFixer.h
  include-fixer/tool/ClangIncludeFixer.cpp
  unittests/clang-tidy/ClangTidyTest.h
  unittests/include-fixer/IncludeFixerTest.cpp

Index: unittests/include-fixer/IncludeFixerTest.cpp
===
--- unittests/include-fixer/IncludeFixerTest.cpp
+++ unittests/include-fixer/IncludeFixerTest.cpp
@@ -85,12 +85,15 @@
   runOnCode(&Factory, Code, "input.cc", ExtraArgs);
   if (FixerContext.Headers.empty())
 return Code;
-  tooling::Replacements Replacements =
-  clang::include_fixer::createInsertHeaderReplacements(
-  Code, "input.cc", FixerContext.Headers.front());
+  auto Replaces = clang::include_fixer::createInsertHeaderReplacements(
+  Code, "input.cc", FixerContext.Headers.front());
+  EXPECT_TRUE(static_cast(Replaces))
+  << llvm::toString(Replaces.takeError()) << "\n";
+  if (!Replaces)
+return "";
   clang::RewriterTestContext Context;
   clang::FileID ID = Context.createInMemoryFile("input.cc", Code);
-  clang::tooling::applyAllReplacements(Replacements, Context.Rewrite);
+  clang::tooling::applyAllReplacements(*Replaces, Context.Rewrite);
   return Context.getRewrittenText(ID);
 }
 
Index: unittests/clang-tidy/ClangTidyTest.h
===
--- unittests/clang-tidy/ClangTidyTest.h
+++ unittests/clang-tidy/ClangTidyTest.h
@@ -17,6 +17,7 @@
 #include "clang/Frontend/FrontendActions.h"
 #include "clang/Tooling/Refactoring.h"
 #include "clang/Tooling/Tooling.h"
+#include "llvm/ADT/Optional.h"
 #include 
 #include 
 
@@ -121,7 +122,12 @@
 Fixes.insert(Error.Fix.begin(), Error.Fix.end());
   if (Errors)
 *Errors = Context.getErrors();
-  return tooling::applyAllReplacements(Code, Fixes);
+  auto Result = tooling::applyAllReplacements(Code, Fixes);
+  if (!Result) {
+// FIXME: propogate the error.
+return "";
+  }
+  return *Result;
 }
 
 #define EXPECT_NO_CHANGES(Check, Code) \
Index: include-fixer/tool/ClangIncludeFixer.cpp
===
--- include-fixer/tool/ClangIncludeFixer.cpp
+++ include-fixer/tool/ClangIncludeFixer.cpp
@@ -208,12 +208,21 @@
   return 1;
 }
 
-tooling::Replacements Replacements =
+auto Replacements =
 clang::include_fixer::createInsertHeaderReplacements(
 Code->getBuffer(), FilePath, Context.Headers[0], InsertStyle);
-std::string ChangedCode =
-tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+if (!Replacements) {
+  errs() << "Failed to create header insertion replacement: "
+ << llvm::toString(Replacements.takeError()) << "\n";
+  return 1;
+}
+auto ChangedCode =
+tooling::applyAllReplacements(Code->getBuffer(), *Replacements);
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 
@@ -249,10 +258,14 @@
   }
 
   // FIXME: Rank the results and pick the best one instead of the first one.
-  tooling::Replacements Replacements =
-  clang::include_fixer::createInsertHeaderReplacements(
-  /*Code=*/Buffer.get()->getBuffer(), FilePath, Context.Headers.front(),
-  InsertStyle);
+  auto Replacements = clang::include_fixer::createInsertHeaderReplacements(
+  /*Code=*/Buffer.get()->getBuffer(), FilePath, Context.Headers.front(),
+  InsertStyle);
+  if (!Replacements) {
+errs() << "Failed to create header insertion replacement: "
+   << llvm::toString(Replacements.takeError()) << "\n";
+return 1;
+  }
 
   if (!Quiet)
 llvm::errs() << "Added #include" << Context.Headers.front();
@@ -265,15 +278,19 @@
   Diagnostics.setClient(&DiagnosticPrinter, false);
 
   if (STDINMode) {
-std::string ChangedCode =
-tooling::applyAllReplacements(Code->getBuffer(), Replacements);
-llvm::outs() << ChangedCode;
+auto ChangedCode =
+tooling::applyAllReplacements(Code->getBuffer(), *Replacements);
+if (!ChangedCode) {
+  llvm::errs() << llvm::toString(ChangedCode.takeError()) << "\n";
+  return 1;
+}
+llvm::outs() << *ChangedCode;
 return 0;
   }
 
   // Write replacements to disk.
   Rewriter Rewrites(SM, LangOptions());
-  tooling::applyAllReplacements(Replacements, Rewrites);
+  tooling::applyAllReplacements(*Replacements, Rewrites);
   return Rewrites.overwriteChangedFiles();
 }
 
Index: include-fixer/IncludeFixer.h
===
--- include-fixer/IncludeFixer.h
+++ include-fixer/IncludeFixer.h
@@ -68,8 +68,9 @@
 /// \param Header The hea

Re: [PATCH] D21601: Make tooling::applyAllReplacements return llvm::Expected instead of empty string to indicate potential error.

2016-06-24 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 61823.
ioeric added a comment.

- Addressed reviewer's comments


http://reviews.llvm.org/D21601

Files:
  include/clang/Format/Format.h
  include/clang/Tooling/Core/Replacement.h
  lib/Format/Format.cpp
  lib/Tooling/Core/Replacement.cpp
  lib/Tooling/Refactoring.cpp
  tools/clang-format/ClangFormat.cpp
  unittests/Format/CleanupTest.cpp
  unittests/Format/FormatTest.cpp
  unittests/Format/FormatTestJS.cpp
  unittests/Format/FormatTestJava.cpp
  unittests/Format/FormatTestProto.cpp
  unittests/Format/FormatTestSelective.cpp
  unittests/Format/SortImportsTestJS.cpp
  unittests/Format/SortIncludesTest.cpp
  unittests/Tooling/RefactoringTest.cpp
  unittests/Tooling/RewriterTest.cpp

Index: unittests/Tooling/RewriterTest.cpp
===
--- unittests/Tooling/RewriterTest.cpp
+++ unittests/Tooling/RewriterTest.cpp
@@ -41,8 +41,9 @@
   Replacements Replaces;
   Replaces.insert(Replacement("", 6, 6, ""));
   Replaces.insert(Replacement("", 6, 0, "replaced\n"));
-  EXPECT_EQ("line1\nreplaced\nline3\nline4",
-applyAllReplacements("line1\nline2\nline3\nline4", Replaces));
+  auto Rewritten = applyAllReplacements("line1\nline2\nline3\nline4", Replaces);
+  EXPECT_TRUE(static_cast(Rewritten));
+  EXPECT_EQ("line1\nreplaced\nline3\nline4", *Rewritten);
 }
 
 } // end namespace
Index: unittests/Tooling/RefactoringTest.cpp
===
--- unittests/Tooling/RefactoringTest.cpp
+++ unittests/Tooling/RefactoringTest.cpp
@@ -640,27 +640,32 @@
StringRef Result, const Replacements &First,
const Replacements &Second) {
 // These are mainly to verify the test itself and make it easier to read.
-std::string AfterFirst = applyAllReplacements(Code, First);
-std::string InSequenceRewrite = applyAllReplacements(AfterFirst, Second);
-EXPECT_EQ(Intermediate, AfterFirst);
-EXPECT_EQ(Result, InSequenceRewrite);
+auto AfterFirst = applyAllReplacements(Code, First);
+EXPECT_TRUE(static_cast(AfterFirst));
+auto InSequenceRewrite = applyAllReplacements(*AfterFirst, Second);
+EXPECT_TRUE(static_cast(InSequenceRewrite));
+EXPECT_EQ(Intermediate, *AfterFirst);
+EXPECT_EQ(Result, *InSequenceRewrite);
 
 tooling::Replacements Merged = mergeReplacements(First, Second);
-std::string MergedRewrite = applyAllReplacements(Code, Merged);
-EXPECT_EQ(InSequenceRewrite, MergedRewrite);
-if (InSequenceRewrite != MergedRewrite)
+auto MergedRewrite = applyAllReplacements(Code, Merged);
+EXPECT_TRUE(static_cast(MergedRewrite));
+EXPECT_EQ(*InSequenceRewrite, *MergedRewrite);
+if (*InSequenceRewrite != *MergedRewrite)
   for (tooling::Replacement M : Merged)
 llvm::errs() << M.getOffset() << " " << M.getLength() << " "
  << M.getReplacementText() << "\n";
   }
   void mergeAndTestRewrite(StringRef Code, const Replacements &First,
const Replacements &Second) {
-std::string InSequenceRewrite =
-applyAllReplacements(applyAllReplacements(Code, First), Second);
+auto AfterFirst = applyAllReplacements(Code, First);
+EXPECT_TRUE(static_cast(AfterFirst));
+auto InSequenceRewrite = applyAllReplacements(*AfterFirst, Second);
 tooling::Replacements Merged = mergeReplacements(First, Second);
-std::string MergedRewrite = applyAllReplacements(Code, Merged);
-EXPECT_EQ(InSequenceRewrite, MergedRewrite);
-if (InSequenceRewrite != MergedRewrite)
+auto MergedRewrite = applyAllReplacements(Code, Merged);
+EXPECT_TRUE(static_cast(MergedRewrite));
+EXPECT_EQ(*InSequenceRewrite, *MergedRewrite);
+if (*InSequenceRewrite != *MergedRewrite)
   for (tooling::Replacement M : Merged)
 llvm::errs() << M.getOffset() << " " << M.getLength() << " "
  << M.getReplacementText() << "\n";
Index: unittests/Format/SortIncludesTest.cpp
===
--- unittests/Format/SortIncludesTest.cpp
+++ unittests/Format/SortIncludesTest.cpp
@@ -26,10 +26,13 @@
 
   std::string sort(StringRef Code, StringRef FileName = "input.cpp") {
 auto Ranges = GetCodeRange(Code);
-std::string Sorted =
+auto Sorted =
 applyAllReplacements(Code, sortIncludes(Style, Code, Ranges, FileName));
-return applyAllReplacements(Sorted,
-reformat(Style, Sorted, Ranges, FileName));
+EXPECT_TRUE(static_cast(Sorted));
+auto Result = applyAllReplacements(
+*Sorted, reformat(Style, *Sorted, Ranges, FileName));
+EXPECT_TRUE(static_cast(Result));
+return *Result;
   }
 
   unsigned newCursor(llvm::StringRef Code, unsigned Cursor) {
Index: unittests/Format/SortImportsTestJS.cpp
===
--- unittests/Format/SortImpor

Re: [PATCH] D21666: [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".

2016-06-24 Thread Siva Chandra via cfe-commits
sivachandra added inline comments.


Comment at: lib/Tooling/Core/QualTypeNames.cpp:405
@@ -398,3 +404,3 @@
   // is not the global scope.
   Prefix = createNestedNameSpecifierForScopeOf(Ctx, QT.getTypePtr(),
true /*FullyQualified*/);

I think that can eliminate the need for the Prepend method. Let me dig a little 
more and get back.


http://reviews.llvm.org/D21666



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


r273714 - [CMake] Remove CLANG_APPEND_VC_REV option

2016-06-24 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Fri Jun 24 15:21:12 2016
New Revision: 273714

URL: http://llvm.org/viewvc/llvm-project?rev=273714&view=rev
Log:
[CMake] Remove CLANG_APPEND_VC_REV option

I added this option in r257827 to try and add compatibility with autoconf. At 
the time I misunderstood the problem.

Our CMake automatically generates the SVN revision information and generates a 
build action to update it so builds don't need to be re-configured on SCM 
update (which is a better solution than we had in autoconf).

The problem I was actually seeing was isolated cases where SVN revision 
information isn't available because the repository structures have been 
removed. This happens in some automated testing systems.

This patch allows SVN_REVISION to be overridden if the build configuration 
could not find the SCM repository structures, and removes the code from my 
original patch because it is unnecessary.

Modified:
cfe/trunk/CMakeLists.txt
cfe/trunk/lib/Basic/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=273714&r1=273713&r2=273714&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Fri Jun 24 15:21:12 2016
@@ -214,19 +214,6 @@ if(CLANG_REPOSITORY_STRING)
   add_definitions(-DCLANG_REPOSITORY_STRING="${CLANG_REPOSITORY_STRING}")
 endif()
 
-option(CLANG_APPEND_VC_REV
-  "Append the version control system revision id to clang version spew" OFF)
-if(CLANG_APPEND_VC_REV)
-  if(NOT SVN_REVISION)
-# This macro will set SVN_REVISION in the parent scope
-add_version_info_from_vcs(VERSION_VAR)
-  endif()
-
-  if(SVN_REVISION)
-add_definitions(-DSVN_REVISION="${SVN_REVISION}")
-  endif()
-endif()
-
 set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING
   "Vendor-specific uti.")
 

Modified: cfe/trunk/lib/Basic/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/CMakeLists.txt?rev=273714&r1=273713&r2=273714&view=diff
==
--- cfe/trunk/lib/Basic/CMakeLists.txt (original)
+++ cfe/trunk/lib/Basic/CMakeLists.txt Fri Jun 24 15:21:12 2016
@@ -53,6 +53,13 @@ if(DEFINED llvm_vc AND DEFINED clang_vc)
 else()
   # Not producing a VC revision include.
   set(version_inc)
+
+  # Being able to force-set the SVN revision in cases where it isn't available
+  # is useful for performance tracking, and matches compatibility from 
autoconf.
+  if(SVN_REVISION)
+set_source_files_properties(Version.cpp
+  PROPERTIES COMPILE_DEFINITIONS "SVN_REVISION=\"${SVN_REVISION}\"")
+  endif()
 endif()
 
 add_clang_library(clangBasic


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


Re: [PATCH] D21676: clang-rename: add a -s (suffix) option

2016-06-24 Thread Miklos Vajna via cfe-commits
vmiklos updated this revision to Diff 61833.
vmiklos added a comment.

This version solves the problem outline in the commit message by implementing 
an -export-fixes commandline option, quite similar to clang-tidy's matching 
option.


http://reviews.llvm.org/D21676

Files:
  clang-rename/tool/ClangRename.cpp
  test/clang-rename/ClassTestReplacements.cpp

Index: test/clang-rename/ClassTestReplacements.cpp
===
--- /dev/null
+++ test/clang-rename/ClassTestReplacements.cpp
@@ -0,0 +1,11 @@
+// RUN: mkdir -p %T/fixes
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=225 -new-name=Hector -export-fixes=%T/fixes.yaml 
%t.cpp --
+// RUN: clang-apply-replacements %T
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla  // CHECK: class Hector
+{
+};
+
+// Use grep -FUbo 'Cla'  to get the correct offset of Cla when changing
+// this file.
Index: clang-rename/tool/ClangRename.cpp
===
--- clang-rename/tool/ClangRename.cpp
+++ clang-rename/tool/ClangRename.cpp
@@ -32,6 +32,7 @@
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Refactoring.h"
+#include "clang/Tooling/ReplacementsYaml.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/Support/Host.h"
@@ -72,6 +73,12 @@
 "pl",
 cl::desc("Print the locations affected by renaming to stderr."),
 cl::cat(ClangRenameCategory));
+static cl::opt
+ExportFixes(
+"export-fixes",
+cl::desc("YAML file to store suggested fixes in."),
+cl::value_desc("filename"),
+cl::cat(ClangRenameCategory));
 
 #define CLANG_RENAME_VERSION "0.0.1"
 
@@ -126,6 +133,26 @@
   } else {
 res = Tool.run(Factory.get());
 
+if (!ExportFixes.empty()) {
+  std::error_code EC;
+  llvm::raw_fd_ostream OS(ExportFixes, EC, llvm::sys::fs::F_None);
+  if (EC) {
+llvm::errs() << "Error opening output file: " << EC.message() << '\n';
+exit(1);
+  }
+
+  // Export replacements.
+  tooling::TranslationUnitReplacements TUR;
+  const tooling::Replacements &Replacements = Tool.getReplacements();
+  TUR.Replacements.insert(TUR.Replacements.end(), Replacements.begin(),
+  Replacements.end());
+
+  yaml::Output YAML(OS);
+  YAML << TUR;
+  OS.close();
+  exit(0);
+}
+
 // Write every file to stdout. Right now we just barf the files without any
 // indication of which files start where, other than that we print the 
files
 // in the same order we see them.


Index: test/clang-rename/ClassTestReplacements.cpp
===
--- /dev/null
+++ test/clang-rename/ClassTestReplacements.cpp
@@ -0,0 +1,11 @@
+// RUN: mkdir -p %T/fixes
+// RUN: cat %s > %t.cpp
+// RUN: clang-rename -offset=225 -new-name=Hector -export-fixes=%T/fixes.yaml %t.cpp --
+// RUN: clang-apply-replacements %T
+// RUN: sed 's,//.*,,' %t.cpp | FileCheck %s
+class Cla  // CHECK: class Hector
+{
+};
+
+// Use grep -FUbo 'Cla'  to get the correct offset of Cla when changing
+// this file.
Index: clang-rename/tool/ClangRename.cpp
===
--- clang-rename/tool/ClangRename.cpp
+++ clang-rename/tool/ClangRename.cpp
@@ -32,6 +32,7 @@
 #include "clang/Rewrite/Core/Rewriter.h"
 #include "clang/Tooling/CommonOptionsParser.h"
 #include "clang/Tooling/Refactoring.h"
+#include "clang/Tooling/ReplacementsYaml.h"
 #include "clang/Tooling/Tooling.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/Support/Host.h"
@@ -72,6 +73,12 @@
 "pl",
 cl::desc("Print the locations affected by renaming to stderr."),
 cl::cat(ClangRenameCategory));
+static cl::opt
+ExportFixes(
+"export-fixes",
+cl::desc("YAML file to store suggested fixes in."),
+cl::value_desc("filename"),
+cl::cat(ClangRenameCategory));
 
 #define CLANG_RENAME_VERSION "0.0.1"
 
@@ -126,6 +133,26 @@
   } else {
 res = Tool.run(Factory.get());
 
+if (!ExportFixes.empty()) {
+  std::error_code EC;
+  llvm::raw_fd_ostream OS(ExportFixes, EC, llvm::sys::fs::F_None);
+  if (EC) {
+llvm::errs() << "Error opening output file: " << EC.message() << '\n';
+exit(1);
+  }
+
+  // Export replacements.
+  tooling::TranslationUnitReplacements TUR;
+  const tooling::Replacements &Replacements = Tool.getReplacements();
+  TUR.Replacements.insert(TUR.Replacements.end(), Replacements.begin(),
+  Replacements.end());
+
+  yaml::Output YAML(OS);
+  YAML << TUR;
+  OS.close();
+  exit(0);
+}
+
 // Write every file to stdout. Right now we just barf the files without any
 // indication of which files start where, other than that we print the files
 // in the same order we see them.

[PATCH] D21698: [OpenCL] Allow user to add supported OpenCL extensions by pragma

2016-06-24 Thread Yaxun Liu via cfe-commits
yaxunl created this revision.
yaxunl added a reviewer: Anastasia.
yaxunl added subscribers: cfe-commits, bader, pxli168, tstellarAMD.

Allow user to use pragma to add supported extensions:

  #pragma OPENCL EXTENSION the_new_extension_name : register

After that, users can use

  #pragma OPENCL EXTENSION the_new_extension_name : enable/disable

in subsequent code. 


http://reviews.llvm.org/D21698

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/OpenCLOptions.h
  include/clang/Serialization/ASTReader.h
  lib/Basic/Targets.cpp
  lib/Frontend/InitPreprocessor.cpp
  lib/Parse/ParsePragma.cpp
  lib/Sema/DeclSpec.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaCast.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaType.cpp
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTWriter.cpp
  test/PCH/opencl-extensions.cl
  test/Parser/opencl-pragma.cl
  test/SemaOpenCL/extension-register.cl

Index: test/SemaOpenCL/extension-register.cl
===
--- /dev/null
+++ test/SemaOpenCL/extension-register.cl
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -verify -pedantic -fsyntax-only
+
+#pragma OPENCL EXTENSION cl_khr_fp16 : register // expected-warning {{register supported OpenCL extension or optional core feature - ignoring}}
+
+#pragma OPENCL EXTENSION all : register /* expected-warning {{expected 'disable' - ignoring}} */
+
+#pragma OPENCL EXTENSION my_ext : enable // expected-warning {{unknown OpenCL extension 'my_ext' - ignoring}}
+#pragma OPENCL EXTENSION my_ext : disable // expected-warning {{unknown OpenCL extension 'my_ext' - ignoring}}
+#pragma OPENCL EXTENSION my_ext : register
+#pragma OPENCL EXTENSION my_ext : register // expected-warning {{register supported OpenCL extension or optional core feature - ignoring}}
+#pragma OPENCL EXTENSION my_ext : enable
+#pragma OPENCL EXTENSION my_ext : disable 
+
Index: test/Parser/opencl-pragma.cl
===
--- test/Parser/opencl-pragma.cl
+++ test/Parser/opencl-pragma.cl
@@ -5,9 +5,13 @@
 #pragma OPENCL EXTENSION cl_no_such_extension : disable /* expected-warning {{unknown OpenCL extension 'cl_no_such_extension' - ignoring}} */
 
 #pragma OPENCL EXTENSION all : disable
-#pragma OPENCL EXTENSION all : enable /* expected-warning {{unknown OpenCL extension 'all' - ignoring}} */
+#pragma OPENCL EXTENSION all : enable /* expected-warning {{expected 'disable' - ignoring}} */
+#pragma OPENCL EXTENSION all : register /* expected-warning {{expected 'disable' - ignoring}} */
+#pragma OPENCL EXTENSION all : on /* expected-warning {{expected 'disable' - ignoring}} */
 
-#pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable' or 'disable' - ignoring}} */
+#pragma OPENCL EXTENSION cl_khr_fp64 : on /* expected-warning {{expected 'enable' or 'disable' or 'register' - ignoring}} */
+
+#pragma OPENCL EXTENSION my_ext : on /* expected-warning {{expected 'enable' or 'disable' or 'register' - ignoring}} */
 
 #pragma OPENCL FP_CONTRACT ON
 #pragma OPENCL FP_CONTRACT OFF
Index: test/PCH/opencl-extensions.cl
===
--- test/PCH/opencl-extensions.cl
+++ test/PCH/opencl-extensions.cl
@@ -6,10 +6,13 @@
 // Header.
 
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#pragma OPENCL EXTENSION my_ext_example : register
 
 #else
 // Using the header.
 
+#pragma OPENCL EXTENSION my_extension : enable
+
 void test(void) {
   double d;
 }
Index: lib/Serialization/ASTWriter.cpp
===
--- lib/Serialization/ASTWriter.cpp
+++ lib/Serialization/ASTWriter.cpp
@@ -3829,8 +3829,14 @@
 
   const OpenCLOptions &Opts = SemaRef.getOpenCLOptions();
   RecordData Record;
-#define OPENCLEXT(nm)  Record.push_back(Opts.nm);
-#include "clang/Basic/OpenCLExtensions.def"
+  for (const auto &I:Opts.OptMap) {
+AddString(I.getKey(), Record);
+auto V = I.getValue();
+Record.push_back(V.Supported);
+Record.push_back(V.Enabled);
+Record.push_back(V.Avail);
+Record.push_back(V.Core);
+  }
   Stream.EmitRecord(OPENCL_EXTENSIONS, Record);
 }
 
Index: lib/Serialization/ASTReader.cpp
===
--- lib/Serialization/ASTReader.cpp
+++ lib/Serialization/ASTReader.cpp
@@ -3097,8 +3097,14 @@
   break;
 
 case OPENCL_EXTENSIONS:
-  // Later tables overwrite earlier ones.
-  OpenCLExtensions.swap(Record);
+  for (unsigned I = 0, E = Record.size(); I != E; ) {
+auto Name = ReadString(Record, I);
+OpenCLExtensions.OptMap[Name] = {
+  static_cast(Record[I++]),
+  static_cast(Record[I++]),
+  static_cast(Record[I++]),
+  static_cast(Record[I++])};
+  }
   break;
 
 case TENTATIVE_DEFINITIONS:
@@ -6924,14 +6930,7 @@
 SemaObj->FPFeatures.fp_contract = FPPragmaOptio

Re: [PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives

2016-06-24 Thread David S via cfe-commits
davidsh updated this revision to Diff 61830.
davidsh added a comment.

Address a comment.


http://reviews.llvm.org/D21617

Files:
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/nesting_of_regions.cpp

Index: test/OpenMP/nesting_of_regions.cpp
===
--- test/OpenMP/nesting_of_regions.cpp
+++ test/OpenMP/nesting_of_regions.cpp
@@ -2867,6 +2867,12 @@
 #pragma omp teams  // expected-note {{nested teams construct here}}
 ++a;
   }
+#pragma omp target // expected-error {{target construct with nested teams 
region contains statements outside of the teams construct}}
+  {
+while (0)  // expected-note {{statement outside teams construct here}}
+#pragma omp teams  // expected-note {{nested teams construct here}}
+++a;
+  }
 #pragma omp target
   {
 #pragma omp taskloop
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6380,6 +6380,9 @@
   }
   assert(I != CS->body_end() && "Not found statement");
   S = *I;
+} else {
+  auto *OED = dyn_cast(S);
+  OMPTeamsFound = OED && isOpenMPTeamsDirective(OED->getDirectiveKind());
 }
 if (!OMPTeamsFound) {
   Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);


Index: test/OpenMP/nesting_of_regions.cpp
===
--- test/OpenMP/nesting_of_regions.cpp
+++ test/OpenMP/nesting_of_regions.cpp
@@ -2867,6 +2867,12 @@
 #pragma omp teams  // expected-note {{nested teams construct here}}
 ++a;
   }
+#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}}
+  {
+while (0)  // expected-note {{statement outside teams construct here}}
+#pragma omp teams  // expected-note {{nested teams construct here}}
+++a;
+  }
 #pragma omp target
   {
 #pragma omp taskloop
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -6380,6 +6380,9 @@
   }
   assert(I != CS->body_end() && "Not found statement");
   S = *I;
+} else {
+  auto *OED = dyn_cast(S);
+  OMPTeamsFound = OED && isOpenMPTeamsDirective(OED->getDirectiveKind());
 }
 if (!OMPTeamsFound) {
   Diag(StartLoc, diag::err_omp_target_contains_not_only_teams);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21666: [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".

2016-06-24 Thread Siva Chandra via cfe-commits
sivachandra updated this revision to Diff 61837.
sivachandra added a comment.

Address comments.


http://reviews.llvm.org/D21666

Files:
  include/clang/Tooling/Core/QualTypeNames.h
  lib/Tooling/Core/QualTypeNames.cpp
  unittests/Tooling/QualTypeNamesTest.cpp

Index: unittests/Tooling/QualTypeNamesTest.cpp
===
--- unittests/Tooling/QualTypeNamesTest.cpp
+++ unittests/Tooling/QualTypeNamesTest.cpp
@@ -14,6 +14,7 @@
 namespace {
 struct TypeNameVisitor : TestVisitor {
   llvm::StringMap ExpectedQualTypeNames;
+  bool WithGlobalNsPrefix = false;
 
   // ValueDecls are the least-derived decl with both a qualtype and a
   // name.
@@ -26,7 +27,8 @@
 ExpectedQualTypeNames.lookup(VD->getNameAsString());
 if (ExpectedName != "") {
   std::string ActualName =
-  TypeName::getFullyQualifiedName(VD->getType(), *Context);
+  TypeName::getFullyQualifiedName(VD->getType(), *Context,
+  WithGlobalNsPrefix);
   if (ExpectedName != ActualName) {
 // A custom message makes it much easier to see what declaration
 // failed compared to EXPECT_EQ.
@@ -179,6 +181,30 @@
   "  TX CheckTX;"
   "  struct A { typedef int X; };"
   "}");
+
+  TypeNameVisitor GlobalNsPrefix;
+  GlobalNsPrefix.WithGlobalNsPrefix = true;
+  GlobalNsPrefix.ExpectedQualTypeNames["IntVal"] = "int";
+  GlobalNsPrefix.ExpectedQualTypeNames["BoolVal"] = "bool";
+  GlobalNsPrefix.ExpectedQualTypeNames["XVal"] = "::A::B::X";
+  GlobalNsPrefix.ExpectedQualTypeNames["IntAliasVal"] = "::A::B::Alias";
+  GlobalNsPrefix.ExpectedQualTypeNames["ZVal"] = "::A::B::Y::Z";
+  GlobalNsPrefix.runOver(
+  "namespace A {\n"
+  "  namespace B {\n"
+  "int IntVal;\n"
+  "bool BoolVal;\n"
+  "struct X {};\n"
+  "X XVal;\n"
+  "template  class CCC { };\n"
+  "template \n"
+  "using Alias = CCC;\n"
+  "Alias IntAliasVal;\n"
+  "struct Y { struct Z {}; };\n"
+  "Y::Z ZVal;\n"
+  "  }"
+  "}"
+  );
 }
 
 }  // end anonymous namespace
Index: lib/Tooling/Core/QualTypeNames.cpp
===
--- lib/Tooling/Core/QualTypeNames.cpp
+++ lib/Tooling/Core/QualTypeNames.cpp
@@ -30,16 +30,19 @@
 /// \param[in] QT - the type for which the fully qualified type will be
 /// returned.
 /// \param[in] Ctx - the ASTContext to be used.
-static QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx);
+static QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx,
+  bool WithGlobalNsPrefix);
 
 /// \brief Create a NestedNameSpecifier for Namesp and its enclosing
 /// scopes.
 ///
 /// \param[in] Ctx - the AST Context to be used.
 /// \param[in] Namesp - the NamespaceDecl for which a NestedNameSpecifier
 /// is requested.
 static NestedNameSpecifier *createNestedNameSpecifier(
-const ASTContext &Ctx, const NamespaceDecl *Namesp);
+const ASTContext &Ctx,
+const NamespaceDecl *Namesp,
+bool WithGlobalNsPrefix);
 
 /// \brief Create a NestedNameSpecifier for TagDecl and its enclosing
 /// scopes.
@@ -50,16 +53,19 @@
 /// \param[in] FullyQualify - Convert all template arguments into fully
 /// qualified names.
 static NestedNameSpecifier *createNestedNameSpecifier(
-const ASTContext &Ctx, const TypeDecl *TD, bool FullyQualify);
+const ASTContext &Ctx, const TypeDecl *TD,
+bool FullyQualify, bool WithGlobalNsPrefix);
 
 static NestedNameSpecifier *createNestedNameSpecifierForScopeOf(
-const ASTContext &Ctx, const Decl *decl, bool FullyQualified);
+const ASTContext &Ctx, const Decl *decl,
+bool FullyQualified, bool WithGlobalNsPrefix);
 
 static NestedNameSpecifier *getFullyQualifiedNestedNameSpecifier(
-const ASTContext &Ctx, NestedNameSpecifier *scope);
+const ASTContext &Ctx, NestedNameSpecifier *scope, bool WithGlobalNsPrefix);
 
 static bool getFullyQualifiedTemplateName(const ASTContext &Ctx,
-  TemplateName &TName) {
+  TemplateName &TName,
+  bool WithGlobalNsPrefix) {
   bool Changed = false;
   NestedNameSpecifier *NNS = nullptr;
 
@@ -71,15 +77,17 @@
 
   if (QTName && !QTName->hasTemplateKeyword()) {
 NNS = QTName->getQualifier();
-NestedNameSpecifier *QNNS = getFullyQualifiedNestedNameSpecifier(Ctx, NNS);
+NestedNameSpecifier *QNNS = getFullyQualifiedNestedNameSpecifier(
+Ctx, NNS, WithGlobalNsPrefix);
 if (QNNS != NNS) {
   Changed = true;
   NNS = QNNS;
 } else {
   NNS = nullptr;
 }
   } else {
-NNS = createNestedNameSpecifierForScopeOf(Ctx, ArgTDecl, true);
+NNS = createNestedNameSpecifierForScopeOf(
+Ctx, ArgTDecl, true, WithGlobalNsPrefix);
   }
   if (NNS) {
 TName = Ctx.getQualifiedTempla

Re: [PATCH] D21666: [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".

2016-06-24 Thread Siva Chandra via cfe-commits
sivachandra added a comment.

PTAL



Comment at: lib/Tooling/Core/QualTypeNames.cpp:435
@@ -399,1 +434,3 @@
+  // Create a nested name specifier if needed.
   Prefix = createNestedNameSpecifierForScopeOf(Ctx, QT.getTypePtr(),
+   true /*FullyQualified*/,

WithGlobalNsPrefix has been added to every function in this file :)

This eliminates the need for the Prepend function. 


http://reviews.llvm.org/D21666



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


[PATCH] D21700: [SemaExpr] Support lax conversions in assignments with vector and scalars with same size

2016-06-24 Thread Bruno Cardoso Lopes via cfe-commits
bruno created this revision.
bruno added reviewers: rnk, rsmith.
bruno added a subscriber: cfe-commits.

Before r266366, clang used to support constructs like:

  typedef __attribute__((vector_size(8))) double float64x1_t;
  typedef __attribute__((vector_size(16))) double float64x2_t;
  float64x1_t vget_low_f64(float64x2_t __p0);

  double y = 3.0 + vget_low_f64(v);

But it would reject:

  double y = vget_low_f64(v) + 3.0;

It also always rejected assignments:

  double y = vget_low_f64(v);

This patch: (a) revivies the behavior of `3.0 + vget_low_f64(v)` prior to
r266366, (b) add support for `vget_low_f64(v) + 3.0` and (c) add support for
assignments.

These vector semantics have never really been tied up but it seems
odd that we used to support some binop froms but do not support
assignment. If we did support scalar for the purposes of arithmetic, we
should probably be able to reinterpret as scalar for the purposes of
assignment too.

http://reviews.llvm.org/D21700

Files:
  lib/Sema/SemaExpr.cpp
  test/Sema/vector-cast.c

Index: test/Sema/vector-cast.c
===
--- test/Sema/vector-cast.c
+++ test/Sema/vector-cast.c
@@ -45,17 +45,24 @@
 }
 
 typedef float float2 __attribute__ ((vector_size (8)));
+typedef __attribute__((vector_size(8))) double float64x1_t;
+typedef __attribute__((vector_size(16))) double float64x2_t;
+float64x1_t vget_low_f64(float64x2_t __p0);
 
 void f4() {
   float2 f2;
-  double d;
+  double d, a, b, c;
+  float64x2_t v = {0.0, 1.0};
   f2 += d;
-  // We used to allow the next statement, but we've always rejected the next 
two
-  // statements
+  a = 3.0 + vget_low_f64(v);
+  b = vget_low_f64(v) + 3.0;
+  c = vget_low_f64(v);
+  // Compound assignments are not supported.
   // FIXME: This diagnostic is inaccurate.
   d += f2; // expected-error {{cannot convert between vector values of 
different size}}
-  d = f2; // expected-error {{assigning to 'double' from incompatible type 
'float2'}}
-  d = d + f2; // expected-error {{assigning to 'double' from incompatible type 
'float2'}}
+  c -= vget_low_f64(v); // expected-error {{cannot convert between vector 
values of different size}}
+  d = f2;
+  d = d + f2;
 }
 
 // rdar://15931426
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -7399,6 +7399,18 @@
 return IncompatibleVectors;
   }
 }
+
+// When the RHS comes from another lax conversion (e.g. binops between
+// scalars and vectors) the result is canonicalized as a vector. When the
+// LHS is also a vector, the lax is allowed by the condition above. Handle
+// the case where LHS is a scalar.
+if (LHSType->isScalarType() && isLaxVectorConversion(RHSType, LHSType)) {
+  ExprResult *VecExpr = &RHS;
+  *VecExpr = ImpCastExprToType(VecExpr->get(), LHSType, CK_BitCast);
+  Kind = CK_BitCast;
+  return Compatible;
+}
+
 return Incompatible;
   }
 


Index: test/Sema/vector-cast.c
===
--- test/Sema/vector-cast.c
+++ test/Sema/vector-cast.c
@@ -45,17 +45,24 @@
 }
 
 typedef float float2 __attribute__ ((vector_size (8)));
+typedef __attribute__((vector_size(8))) double float64x1_t;
+typedef __attribute__((vector_size(16))) double float64x2_t;
+float64x1_t vget_low_f64(float64x2_t __p0);
 
 void f4() {
   float2 f2;
-  double d;
+  double d, a, b, c;
+  float64x2_t v = {0.0, 1.0};
   f2 += d;
-  // We used to allow the next statement, but we've always rejected the next two
-  // statements
+  a = 3.0 + vget_low_f64(v);
+  b = vget_low_f64(v) + 3.0;
+  c = vget_low_f64(v);
+  // Compound assignments are not supported.
   // FIXME: This diagnostic is inaccurate.
   d += f2; // expected-error {{cannot convert between vector values of different size}}
-  d = f2; // expected-error {{assigning to 'double' from incompatible type 'float2'}}
-  d = d + f2; // expected-error {{assigning to 'double' from incompatible type 'float2'}}
+  c -= vget_low_f64(v); // expected-error {{cannot convert between vector values of different size}}
+  d = f2;
+  d = d + f2;
 }
 
 // rdar://15931426
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -7399,6 +7399,18 @@
 return IncompatibleVectors;
   }
 }
+
+// When the RHS comes from another lax conversion (e.g. binops between
+// scalars and vectors) the result is canonicalized as a vector. When the
+// LHS is also a vector, the lax is allowed by the condition above. Handle
+// the case where LHS is a scalar.
+if (LHSType->isScalarType() && isLaxVectorConversion(RHSType, LHSType)) {
+  ExprResult *VecExpr = &RHS;
+  *VecExpr = ImpCastExprToType(VecExpr->get(), LHSType, CK_BitCast);
+  Kind = CK_BitCast;
+  return Compatible;
+}
+
 

r273730 - CodeGen: Update Clang to use the new type metadata.

2016-06-24 Thread Peter Collingbourne via cfe-commits
Author: pcc
Date: Fri Jun 24 16:21:46 2016
New Revision: 273730

URL: http://llvm.org/viewvc/llvm-project?rev=273730&view=rev
Log:
CodeGen: Update Clang to use the new type metadata.

Differential Revision: http://reviews.llvm.org/D21054

Added:
cfe/trunk/test/CodeGenCXX/lto-visibility-inference.cpp
  - copied, changed from r273714, 
cfe/trunk/test/CodeGenCXX/bitset-inference.cpp
cfe/trunk/test/CodeGenCXX/type-metadata.cpp
Removed:
cfe/trunk/test/CodeGenCXX/bitset-inference.cpp
cfe/trunk/test/CodeGenCXX/bitsets.cpp
Modified:
cfe/trunk/docs/ControlFlowIntegrityDesign.rst
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGVTables.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
cfe/trunk/test/CodeGen/cfi-check-fail.c
cfe/trunk/test/CodeGen/cfi-check-fail2.c
cfe/trunk/test/CodeGen/cfi-icall-cross-dso.c
cfe/trunk/test/CodeGen/cfi-icall.c
cfe/trunk/test/CodeGenCXX/cfi-blacklist.cpp
cfe/trunk/test/CodeGenCXX/cfi-cast.cpp
cfe/trunk/test/CodeGenCXX/cfi-cross-dso.cpp
cfe/trunk/test/CodeGenCXX/cfi-icall.cpp
cfe/trunk/test/CodeGenCXX/cfi-ms-rtti.cpp
cfe/trunk/test/CodeGenCXX/cfi-nvcall.cpp

Modified: cfe/trunk/docs/ControlFlowIntegrityDesign.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ControlFlowIntegrityDesign.rst?rev=273730&r1=273729&r2=273730&view=diff
==
--- cfe/trunk/docs/ControlFlowIntegrityDesign.rst (original)
+++ cfe/trunk/docs/ControlFlowIntegrityDesign.rst Fri Jun 24 16:21:46 2016
@@ -90,10 +90,10 @@ For example on x86 a typical virtual cal
 
 The compiler relies on co-operation from the linker in order to assemble
 the bit vectors for the whole program. It currently does this using LLVM's
-`bit sets`_ mechanism together with link-time optimization.
+`type metadata`_ mechanism together with link-time optimization.
 
 .. _address point: 
https://mentorembedded.github.io/cxx-abi/abi.html#vtable-general
-.. _bit sets: http://llvm.org/docs/BitSets.html
+.. _type metadata: http://llvm.org/docs/TypeMetadata.html
 .. _ByteArrayBuilder: 
http://llvm.org/docs/doxygen/html/structllvm_1_1ByteArrayBuilder.html
 
 Optimizations
@@ -196,7 +196,7 @@ those sub-hierarchies need to be (see "S
 Vectors" above). The `GlobalLayoutBuilder`_ class is responsible for laying
 out the globals efficiently to minimize the sizes of the underlying bitsets.
 
-.. _GlobalLayoutBuilder: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/LowerBitSets.h?view=markup
+.. _GlobalLayoutBuilder: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/LowerTypeTests.h?view=markup
 
 Alignment
 ~
@@ -297,8 +297,8 @@ file's symbol table, the symbols for the
 jump table entries, so that addresses taken outside the module will pass
 any verification done inside the module.
 
-In more concrete terms, suppose we have three functions ``f``, ``g``, ``h``
-which are members of a single bitset, and a function foo that returns their
+In more concrete terms, suppose we have three functions ``f``, ``g``,
+``h`` which are all of the same type, and a function foo that returns their
 addresses:
 
 .. code-block:: none
@@ -439,10 +439,10 @@ export this information, every DSO imple
 
void __cfi_check(uint64 CallSiteTypeId, void *TargetAddr)
 
-This function provides external modules with access to CFI checks for
-the targets inside this DSO.  For each known ``CallSiteTypeId``, this
-functions performs an ``llvm.bitset.test`` with the corresponding bit
-set. It aborts if the type is unknown, or if the check fails.
+This function provides external modules with access to CFI checks for the
+targets inside this DSO.  For each known ``CallSiteTypeId``, this function
+performs an ``llvm.type.test`` with the corresponding type identifier. It
+aborts if the type is unknown, or if the check fails.
 
 The basic implementation is a large switch statement over all values
 of CallSiteTypeId supported by this DSO, and each case is similar to

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=273730&r1=273729&r2=273730&view=diff
==
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Fri Jun 24 16:21:46 2016
@@ -2485,21 +2485,21 @@ LeastDerivedClassWithSameLayout(const CX
   RD->bases_begin()->getType()->getAsCXXRecordDecl());
 }
 
-void CodeGenFunction::EmitBitSetCodeForVCall(const CXXRecordDecl *RD,
- llvm::Value *VTable,
- SourceLocation Loc) {
+void CodeGenFunction::EmitT

Re: [PATCH] D21054: CodeGen: Update Clang to use the new type metadata.

2016-06-24 Thread Peter Collingbourne via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL273730: CodeGen: Update Clang to use the new type metadata. 
(authored by pcc).

Changed prior to commit:
  http://reviews.llvm.org/D21054?vs=59821&id=61842#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21054

Files:
  cfe/trunk/docs/ControlFlowIntegrityDesign.rst
  cfe/trunk/lib/CodeGen/CGClass.cpp
  cfe/trunk/lib/CodeGen/CGExpr.cpp
  cfe/trunk/lib/CodeGen/CGVTables.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.h
  cfe/trunk/lib/CodeGen/CodeGenModule.cpp
  cfe/trunk/lib/CodeGen/CodeGenModule.h
  cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
  cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
  cfe/trunk/test/CodeGen/cfi-check-fail.c
  cfe/trunk/test/CodeGen/cfi-check-fail2.c
  cfe/trunk/test/CodeGen/cfi-icall-cross-dso.c
  cfe/trunk/test/CodeGen/cfi-icall.c
  cfe/trunk/test/CodeGenCXX/bitset-inference.cpp
  cfe/trunk/test/CodeGenCXX/bitsets.cpp
  cfe/trunk/test/CodeGenCXX/cfi-blacklist.cpp
  cfe/trunk/test/CodeGenCXX/cfi-cast.cpp
  cfe/trunk/test/CodeGenCXX/cfi-cross-dso.cpp
  cfe/trunk/test/CodeGenCXX/cfi-icall.cpp
  cfe/trunk/test/CodeGenCXX/cfi-ms-rtti.cpp
  cfe/trunk/test/CodeGenCXX/cfi-nvcall.cpp
  cfe/trunk/test/CodeGenCXX/lto-visibility-inference.cpp
  cfe/trunk/test/CodeGenCXX/type-metadata.cpp

Index: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
===
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -254,8 +254,8 @@
   CXXDtorType Type, bool ForVirtualBase,
   bool Delegating, Address This) override;
 
-  void emitVTableBitSetEntries(VPtrInfo *Info, const CXXRecordDecl *RD,
-   llvm::GlobalVariable *VTable);
+  void emitVTableTypeMetadata(VPtrInfo *Info, const CXXRecordDecl *RD,
+  llvm::GlobalVariable *VTable);
 
   void emitVTableDefinitions(CodeGenVTables &CGVT,
  const CXXRecordDecl *RD) override;
@@ -1502,15 +1502,12 @@
 getFromDtorType(Type));
 }
 
-void MicrosoftCXXABI::emitVTableBitSetEntries(VPtrInfo *Info,
-  const CXXRecordDecl *RD,
-  llvm::GlobalVariable *VTable) {
+void MicrosoftCXXABI::emitVTableTypeMetadata(VPtrInfo *Info,
+ const CXXRecordDecl *RD,
+ llvm::GlobalVariable *VTable) {
   if (!CGM.getCodeGenOpts().PrepareForLTO)
 return;
 
-  llvm::NamedMDNode *BitsetsMD =
-  CGM.getModule().getOrInsertNamedMetadata("llvm.bitsets");
-
   // The location of the first virtual function pointer in the virtual table,
   // aka the "address point" on Itanium. This is at offset 0 if RTTI is
   // disabled, or sizeof(void*) if RTTI is enabled.
@@ -1521,13 +1518,13 @@
   : CharUnits::Zero();
 
   if (Info->PathToBaseWithVPtr.empty()) {
-CGM.CreateVTableBitSetEntry(BitsetsMD, VTable, AddressPoint, RD);
+CGM.AddVTableTypeMetadata(VTable, AddressPoint, RD);
 return;
   }
 
   // Add a bitset entry for the least derived base belonging to this vftable.
-  CGM.CreateVTableBitSetEntry(BitsetsMD, VTable, AddressPoint,
-  Info->PathToBaseWithVPtr.back());
+  CGM.AddVTableTypeMetadata(VTable, AddressPoint,
+Info->PathToBaseWithVPtr.back());
 
   // Add a bitset entry for each derived class that is laid out at the same
   // offset as the least derived base.
@@ -1545,12 +1542,12 @@
   Offset = VBI->second.VBaseOffset;
 if (!Offset.isZero())
   return;
-CGM.CreateVTableBitSetEntry(BitsetsMD, VTable, AddressPoint, DerivedRD);
+CGM.AddVTableTypeMetadata(VTable, AddressPoint, DerivedRD);
   }
 
   // Finally do the same for the most derived class.
   if (Info->FullOffsetInMDC.isZero())
-CGM.CreateVTableBitSetEntry(BitsetsMD, VTable, AddressPoint, RD);
+CGM.AddVTableTypeMetadata(VTable, AddressPoint, RD);
 }
 
 void MicrosoftCXXABI::emitVTableDefinitions(CodeGenVTables &CGVT,
@@ -1578,7 +1575,7 @@
 
 VTable->setInitializer(Init);
 
-emitVTableBitSetEntries(Info, RD, VTable);
+emitVTableTypeMetadata(Info, RD, VTable);
   }
 }
 
@@ -1819,8 +1816,8 @@
   MicrosoftVTableContext::MethodVFTableLocation ML =
   CGM.getMicrosoftVTableContext().getMethodVFTableLocation(GD);
   if (CGM.getCodeGenOpts().PrepareForLTO)
-CGF.EmitBitSetCodeForVCall(getClassAtVTableLocation(getContext(), GD, ML),
-   VTable, Loc);
+CGF.EmitTypeMetadataCodeForVCall(
+getClassAtVTableLocation(getContext(), GD, ML), VTable, Loc);
 
   llvm::Value *VFuncPtr =
   Builder.CreateConstInBoundsGEP1_64(VTable, ML.Index, "vfn");
Index: cfe/trunk/lib/CodeGen/CodeGenFunction.h
===
--- cfe/trunk/lib/Cod

Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast marked 6 inline comments as done.
hubert.reinterpretcast added a comment.

http://reviews.llvm.org/D19770



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


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast updated this revision to Diff 61844.
hubert.reinterpretcast added a comment.

Reapply r273664 with workaround for MSVC


http://reviews.llvm.org/D19770

Files:
  include/llvm/Support/TrailingObjects.h

Index: include/llvm/Support/TrailingObjects.h
===
--- include/llvm/Support/TrailingObjects.h
+++ include/llvm/Support/TrailingObjects.h
@@ -342,6 +342,51 @@
TrailingTys, size_t>::type... Counts) {
 return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, 
Counts...);
   }
+
+  /// A type where its ::with_counts template member has a ::type member
+  /// suitable for use as uninitialized storage for an object with the given
+  /// trailing object counts. The template arguments are similar to those
+  /// of additionalSizeToAlloc.
+  ///
+  /// Use with FixedSizeStorageOwner, e.g.:
+  ///
+  /// \code{.cpp}
+  ///
+  /// MyObj::FixedSizeStorage::with_counts<1u>::type myStackObjStorage;
+  /// MyObj::FixedSizeStorageOwner
+  /// myStackObjOwner(new ((void *)&myStackObjStorage) MyObj);
+  /// MyObj *const myStackObjPtr = myStackObjOwner.get();
+  ///
+  /// \endcode
+  template  struct FixedSizeStorage {
+template  struct with_counts {
+  enum { Size = totalSizeToAlloc(Counts...) };
+  typedef llvm::AlignedCharArray<
+  llvm::AlignOf::Alignment, Size
+  > type;
+};
+  };
+
+  /// A type that acts as the owner for an object placed into fixed storage.
+  class FixedSizeStorageOwner {
+  public:
+FixedSizeStorageOwner(BaseTy *p) : p(p) {}
+~FixedSizeStorageOwner() {
+  assert(p && "FixedSizeStorageOwner owns null?");
+  p->~BaseTy();
+}
+
+BaseTy *get() { return p; }
+const BaseTy *get() const { return p; }
+
+  private:
+FixedSizeStorageOwner(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner(FixedSizeStorageOwner &&) = delete;
+FixedSizeStorageOwner &operator=(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner &operator=(FixedSizeStorageOwner &&) = delete;
+
+BaseTy *const p;
+  };
 };
 
 } // end namespace llvm


Index: include/llvm/Support/TrailingObjects.h
===
--- include/llvm/Support/TrailingObjects.h
+++ include/llvm/Support/TrailingObjects.h
@@ -342,6 +342,51 @@
TrailingTys, size_t>::type... Counts) {
 return sizeof(BaseTy) + ParentType::additionalSizeToAllocImpl(0, Counts...);
   }
+
+  /// A type where its ::with_counts template member has a ::type member
+  /// suitable for use as uninitialized storage for an object with the given
+  /// trailing object counts. The template arguments are similar to those
+  /// of additionalSizeToAlloc.
+  ///
+  /// Use with FixedSizeStorageOwner, e.g.:
+  ///
+  /// \code{.cpp}
+  ///
+  /// MyObj::FixedSizeStorage::with_counts<1u>::type myStackObjStorage;
+  /// MyObj::FixedSizeStorageOwner
+  /// myStackObjOwner(new ((void *)&myStackObjStorage) MyObj);
+  /// MyObj *const myStackObjPtr = myStackObjOwner.get();
+  ///
+  /// \endcode
+  template  struct FixedSizeStorage {
+template  struct with_counts {
+  enum { Size = totalSizeToAlloc(Counts...) };
+  typedef llvm::AlignedCharArray<
+  llvm::AlignOf::Alignment, Size
+  > type;
+};
+  };
+
+  /// A type that acts as the owner for an object placed into fixed storage.
+  class FixedSizeStorageOwner {
+  public:
+FixedSizeStorageOwner(BaseTy *p) : p(p) {}
+~FixedSizeStorageOwner() {
+  assert(p && "FixedSizeStorageOwner owns null?");
+  p->~BaseTy();
+}
+
+BaseTy *get() { return p; }
+const BaseTy *get() const { return p; }
+
+  private:
+FixedSizeStorageOwner(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner(FixedSizeStorageOwner &&) = delete;
+FixedSizeStorageOwner &operator=(const FixedSizeStorageOwner &) = delete;
+FixedSizeStorageOwner &operator=(FixedSizeStorageOwner &&) = delete;
+
+BaseTy *const p;
+  };
 };
 
 } // end namespace llvm
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19770: Add FixedSizeStorage to TrailingObjects; NFC

2016-06-24 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast added inline comments.


Comment at: include/llvm/Support/TrailingObjects.h:363
@@ +362,3 @@
+template  struct with_counts {
+  enum { Size = totalSizeToAlloc(Counts...) };
+  typedef llvm::AlignedCharArray<

@aaron.ballman; my attempt with an online MSVC compiler is that this works 
around the compiler error. Can you confirm that this patch is safe for your 
MSVC build?

Also, do you feel strongly about making `Size` private?


http://reviews.llvm.org/D19770



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


r273735 - Add support for musl-libc on ARM Linux.

2016-06-24 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Fri Jun 24 16:35:06 2016
New Revision: 273735

URL: http://llvm.org/viewvc/llvm-project?rev=273735&view=rev
Log:
Add support for musl-libc on ARM Linux.

Patch by Lei Zhang!

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/CodeGen/arm-cc.c
cfe/trunk/test/CodeGen/arm-eabi.c
cfe/trunk/test/Driver/arm-abi.c
cfe/trunk/test/Driver/arm-mfpu.c
cfe/trunk/test/Driver/linux-ld.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=273735&r1=273734&r2=273735&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Jun 24 16:35:06 2016
@@ -4876,6 +4876,8 @@ public:
   case llvm::Triple::Android:
   case llvm::Triple::GNUEABI:
   case llvm::Triple::GNUEABIHF:
+  case llvm::Triple::MuslEABI:
+  case llvm::Triple::MuslEABIHF:
 setABI("aapcs-linux");
 break;
   case llvm::Triple::EABIHF:

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=273735&r1=273734&r2=273735&view=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Fri Jun 24 16:35:06 2016
@@ -4963,6 +4963,8 @@ public:
 case llvm::Triple::EABIHF:
 case llvm::Triple::GNUEABI:
 case llvm::Triple::GNUEABIHF:
+case llvm::Triple::MuslEABI:
+case llvm::Triple::MuslEABIHF:
   return true;
 default:
   return false;
@@ -4973,6 +4975,7 @@ public:
 switch (getTarget().getTriple().getEnvironment()) {
 case llvm::Triple::EABIHF:
 case llvm::Triple::GNUEABIHF:
+case llvm::Triple::MuslEABIHF:
   return true;
 default:
   return false;
@@ -7933,6 +7936,7 @@ const TargetCodeGenInfo &CodeGenModule::
 else if (CodeGenOpts.FloatABI == "hard" ||
  (CodeGenOpts.FloatABI != "soft" &&
   (Triple.getEnvironment() == llvm::Triple::GNUEABIHF ||
+   Triple.getEnvironment() == llvm::Triple::MuslEABIHF ||
Triple.getEnvironment() == llvm::Triple::EABIHF)))
   Kind = ARMABIInfo::AAPCS_VFP;
 

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=273735&r1=273734&r2=273735&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Jun 24 16:35:06 2016
@@ -4157,8 +4157,23 @@ std::string Linux::getDynamicLinker(cons
 
   if (Triple.isAndroid())
 return Triple.isArch64Bit() ? "/system/bin/linker64" : 
"/system/bin/linker";
-  else if (Triple.getEnvironment() == llvm::Triple::Musl)
-return "/lib/ld-musl-" + Triple.getArchName().str() + ".so.1";
+  else if (Triple.isMusl()) {
+std::string ArchName;
+switch (Arch) {
+case llvm::Triple::thumb:
+  ArchName = "arm";
+  break;
+case llvm::Triple::thumbeb:
+  ArchName = "armeb";
+  break;
+default:
+  ArchName = Triple.getArchName().str();
+}
+if (Triple.getEnvironment() == llvm::Triple::MuslEABIHF)
+  ArchName += "hf";
+
+return "/lib/ld-musl-" + ArchName + ".so.1";
+  }
 
   std::string LibDir;
   std::string Loader;

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=273735&r1=273734&r2=273735&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Fri Jun 24 16:35:06 2016
@@ -803,10 +803,12 @@ arm::FloatABI arm::getARMFloatABI(const
 default:
   switch (Triple.getEnvironment()) {
   case llvm::Triple::GNUEABIHF:
+  case llvm::Triple::MuslEABIHF:
   case llvm::Triple::EABIHF:
 ABI = FloatABI::Hard;
 break;
   case llvm::Triple::GNUEABI:
+  case llvm::Triple::MuslEABI:
   case llvm::Triple::EABI:
 // EABI is always AAPCS, and if it was not marked 'hard', it's softfp
 ABI = FloatABI::SoftFP;
@@ -1052,6 +1054,8 @@ void Clang::AddARMTargetArgs(const llvm:
 case llvm::Triple::Android:
 case llvm::Triple::GNUEABI:
 case llvm::Triple::GNUEABIHF:
+case llvm::Triple::MuslEABI:
+case llvm::Triple::MuslEABIHF:
   ABIName = "aapcs-linux";
   break;
 case llvm::Triple::EABIHF:

Modified: cfe/trunk/test/CodeGen/arm-cc.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm-cc.c?rev=273735&r1=273734&r2=273735&view=diff
==
--- cfe/trunk/test/Cod

Re: r273694 - clang-format: [JS] Fix build breakage.

2016-06-24 Thread Daniel Jasper via cfe-commits
The patch description seems wrong as this doesn't fix a build breakage
AFAICT. Do you mean a test failure? If so, it would be helpful to #include
what's actually changing (before/after or calling out the failing test case
or something).


On Fri, Jun 24, 2016 at 7:45 PM, Martin Probst via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: mprobst
> Date: Fri Jun 24 12:45:13 2016
> New Revision: 273694
>
> URL: http://llvm.org/viewvc/llvm-project?rev=273694&view=rev
> Log:
> clang-format: [JS] Fix build breakage.
>
> Checking Line.MustBeDeclaration does actually break the field and param
> initializer use case.
>
> Modified:
> cfe/trunk/lib/Format/TokenAnnotator.cpp
> cfe/trunk/unittests/Format/FormatTestJS.cpp
>
> Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=273694&r1=273693&r2=273694&view=diff
>
> ==
> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Jun 24 12:45:13 2016
> @@ -639,7 +639,7 @@ private:
>}
>// Declarations cannot be conditional expressions, this can only be
> part
>// of a type declaration.
> -  if (Line.MustBeDeclaration && !Contexts.back().IsExpression &&
> +  if (!Contexts.back().IsExpression &&
>Style.Language == FormatStyle::LK_JavaScript)
>  break;
>parseConditional();
>
> Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=273694&r1=273693&r2=273694&view=diff
>
> ==
> --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
> +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Fri Jun 24 12:45:13 2016
> @@ -1351,7 +1351,7 @@ TEST_F(FormatTestJS, NonNullAssertionOpe
>
>  TEST_F(FormatTestJS, Conditional) {
>verifyFormat("y = x ? 1 : 2;");
> -  verifyFormat("x ? 1 : 2;");
> +  verifyFormat("x ? 1: 2;"); // Known issue with top level conditionals.
>verifyFormat("class Foo {\n"
> "  field = true ? 1 : 2;\n"
> "  method(a = true ? 1 : 2) {}\n"
>
>
> ___
> 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: r273694 - clang-format: [JS] Fix build breakage.

2016-06-24 Thread Martin Probst via cfe-commits
Yes, test breakage. The problem was that with the change fields and
interfaces would still get incorrectly formatted (see also the comment on
the diff). Will include it in the commit message next time.

Daniel Jasper  schrieb am Fr., 24. Juni 2016 um
14:43 Uhr:

> The patch description seems wrong as this doesn't fix a build breakage
> AFAICT. Do you mean a test failure? If so, it would be helpful to #include
> what's actually changing (before/after or calling out the failing test case
> or something).
>
>
> On Fri, Jun 24, 2016 at 7:45 PM, Martin Probst via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: mprobst
>> Date: Fri Jun 24 12:45:13 2016
>> New Revision: 273694
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=273694&view=rev
>> Log:
>> clang-format: [JS] Fix build breakage.
>>
>> Checking Line.MustBeDeclaration does actually break the field and param
>> initializer use case.
>>
>> Modified:
>> cfe/trunk/lib/Format/TokenAnnotator.cpp
>> cfe/trunk/unittests/Format/FormatTestJS.cpp
>>
>> Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=273694&r1=273693&r2=273694&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
>> +++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Jun 24 12:45:13 2016
>> @@ -639,7 +639,7 @@ private:
>>}
>>// Declarations cannot be conditional expressions, this can only
>> be part
>>// of a type declaration.
>> -  if (Line.MustBeDeclaration && !Contexts.back().IsExpression &&
>> +  if (!Contexts.back().IsExpression &&
>>Style.Language == FormatStyle::LK_JavaScript)
>>  break;
>>parseConditional();
>>
>> Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=273694&r1=273693&r2=273694&view=diff
>>
>> ==
>> --- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
>> +++ cfe/trunk/unittests/Format/FormatTestJS.cpp Fri Jun 24 12:45:13 2016
>> @@ -1351,7 +1351,7 @@ TEST_F(FormatTestJS, NonNullAssertionOpe
>>
>>  TEST_F(FormatTestJS, Conditional) {
>>verifyFormat("y = x ? 1 : 2;");
>> -  verifyFormat("x ? 1 : 2;");
>> +  verifyFormat("x ? 1: 2;"); // Known issue with top level conditionals.
>>verifyFormat("class Foo {\n"
>> "  field = true ? 1 : 2;\n"
>> "  method(a = true ? 1 : 2) {}\n"
>>
>>
>> ___
>> 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: [PATCH] D21542: CodeGen: Replace test/CodeGen/thinlto_backend.c with a functional test.

2016-06-24 Thread Eric Christopher via cfe-commits
echristo added a subscriber: echristo.
echristo added a comment.

Why is this in clang rather than in llvm?


Repository:
  rL LLVM

http://reviews.llvm.org/D21542



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


Re: [PATCH] D21666: [Tooling] Add optional argument to getFullyQualifiedName to prepend "::".

2016-06-24 Thread Siva Chandra via cfe-commits
sivachandra updated this revision to Diff 61851.
sivachandra added a comment.

Improve global type handling.


http://reviews.llvm.org/D21666

Files:
  include/clang/Tooling/Core/QualTypeNames.h
  lib/Tooling/Core/QualTypeNames.cpp
  unittests/Tooling/QualTypeNamesTest.cpp

Index: unittests/Tooling/QualTypeNamesTest.cpp
===
--- unittests/Tooling/QualTypeNamesTest.cpp
+++ unittests/Tooling/QualTypeNamesTest.cpp
@@ -14,6 +14,7 @@
 namespace {
 struct TypeNameVisitor : TestVisitor {
   llvm::StringMap ExpectedQualTypeNames;
+  bool WithGlobalNsPrefix = false;
 
   // ValueDecls are the least-derived decl with both a qualtype and a
   // name.
@@ -26,7 +27,8 @@
 ExpectedQualTypeNames.lookup(VD->getNameAsString());
 if (ExpectedName != "") {
   std::string ActualName =
-  TypeName::getFullyQualifiedName(VD->getType(), *Context);
+  TypeName::getFullyQualifiedName(VD->getType(), *Context,
+  WithGlobalNsPrefix);
   if (ExpectedName != ActualName) {
 // A custom message makes it much easier to see what declaration
 // failed compared to EXPECT_EQ.
@@ -179,6 +181,42 @@
   "  TX CheckTX;"
   "  struct A { typedef int X; };"
   "}");
+
+  TypeNameVisitor GlobalNsPrefix;
+  GlobalNsPrefix.WithGlobalNsPrefix = true;
+  GlobalNsPrefix.ExpectedQualTypeNames["IntVal"] = "int";
+  GlobalNsPrefix.ExpectedQualTypeNames["BoolVal"] = "bool";
+  GlobalNsPrefix.ExpectedQualTypeNames["XVal"] = "::A::B::X";
+  GlobalNsPrefix.ExpectedQualTypeNames["IntAliasVal"] = "::A::B::Alias";
+  GlobalNsPrefix.ExpectedQualTypeNames["ZVal"] = "::A::B::Y::Z";
+  GlobalNsPrefix.ExpectedQualTypeNames["GlobalZVal"] = "::Z";
+  GlobalNsPrefix.ExpectedQualTypeNames["CheckK"] = "D::aStruct";
+  GlobalNsPrefix.runOver(
+  "namespace A {\n"
+  "  namespace B {\n"
+  "int IntVal;\n"
+  "bool BoolVal;\n"
+  "struct X {};\n"
+  "X XVal;\n"
+  "template  class CCC { };\n"
+  "template \n"
+  "using Alias = CCC;\n"
+  "Alias IntAliasVal;\n"
+  "struct Y { struct Z {}; };\n"
+  "Y::Z ZVal;\n"
+  "  }\n"
+  "}\n"
+  "struct Z {};\n"
+  "Z GlobalZVal;\n"
+  "namespace {\n"
+  "  namespace D {\n"
+  "namespace {\n"
+  "  class aStruct {};\n"
+  "  aStruct CheckK;\n"
+  "}\n"
+  "  }\n"
+  "}\n"
+  );
 }
 
 }  // end anonymous namespace
Index: lib/Tooling/Core/QualTypeNames.cpp
===
--- lib/Tooling/Core/QualTypeNames.cpp
+++ lib/Tooling/Core/QualTypeNames.cpp
@@ -30,16 +30,23 @@
 /// \param[in] QT - the type for which the fully qualified type will be
 /// returned.
 /// \param[in] Ctx - the ASTContext to be used.
-static QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx);
+/// \param[in] WithGlobalNsPrefix - Indicate whether the global namespace
+/// specifier "::" should be prepended or not.
+static QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx,
+  bool WithGlobalNsPrefix);
 
 /// \brief Create a NestedNameSpecifier for Namesp and its enclosing
 /// scopes.
 ///
 /// \param[in] Ctx - the AST Context to be used.
 /// \param[in] Namesp - the NamespaceDecl for which a NestedNameSpecifier
 /// is requested.
+/// \param[in] WithGlobalNsPrefix - Indicate whether the global namespace
+/// specifier "::" should be prepended or not.
 static NestedNameSpecifier *createNestedNameSpecifier(
-const ASTContext &Ctx, const NamespaceDecl *Namesp);
+const ASTContext &Ctx,
+const NamespaceDecl *Namesp,
+bool WithGlobalNsPrefix);
 
 /// \brief Create a NestedNameSpecifier for TagDecl and its enclosing
 /// scopes.
@@ -49,17 +56,22 @@
 /// requested.
 /// \param[in] FullyQualify - Convert all template arguments into fully
 /// qualified names.
+/// \param[in] WithGlobalNsPrefix - Indicate whether the global namespace
+/// specifier "::" should be prepended or not.
 static NestedNameSpecifier *createNestedNameSpecifier(
-const ASTContext &Ctx, const TypeDecl *TD, bool FullyQualify);
+const ASTContext &Ctx, const TypeDecl *TD,
+bool FullyQualify, bool WithGlobalNsPrefix);
 
 static NestedNameSpecifier *createNestedNameSpecifierForScopeOf(
-const ASTContext &Ctx, const Decl *decl, bool FullyQualified);
+const ASTContext &Ctx, const Decl *decl,
+bool FullyQualified, bool WithGlobalNsPrefix);
 
 static NestedNameSpecifier *getFullyQualifiedNestedNameSpecifier(
-const ASTContext &Ctx, NestedNameSpecifier *scope);
+const ASTContext &Ctx, NestedNameSpecifier *scope, bool WithGlobalNsPrefix);
 
 static bool getFullyQualifiedTemplateName(const ASTContext &Ctx,
-  TemplateName &TName) {
+  TemplateName &TName,
+

Re: [PATCH] D21337: [CUDA] Give templated device functions internal linkage, templated kernels external linkage.

2016-06-24 Thread Justin Lebar via cfe-commits
jlebar added a comment.

Friendly ping.


http://reviews.llvm.org/D21337



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


Re: [PATCH] D21542: CodeGen: Replace test/CodeGen/thinlto_backend.c with a functional test.

2016-06-24 Thread Peter Collingbourne via cfe-commits
pcc added a comment.

This is testing a clang feature that reads IR and runs the ThinLTO backend. 
This feature is part of ThinLTO's distributed build support (search for 
"Distributed Build Support" in 
http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html).

In a future change I want to replace the clang-side code here with a client of 
a new LTO interface that takes IR and produces object files (see 
http://reviews.llvm.org/D21545). So I think testing the object file is the 
right approach here.


Repository:
  rL LLVM

http://reviews.llvm.org/D21542



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


[PATCH] D21705: Include debug info for nested structs and classes

2016-06-24 Thread Adrian McCarthy via cfe-commits
amccarth created this revision.
amccarth added a reviewer: rnk.
amccarth added a subscriber: cfe-commits.

This includes nested types in the member list, even if there are no members of 
that type.  Note that structs and classes have themselves as an "implicit 
struct" as the first member, so we skip implicit ones.

Most of the work (for me) was figuring out the tests that broke as a result of 
the ordering changes.  In particular, please scrutinize the Objective C one, 
which doesn't actually nest a struct but has a member function with a pointer 
to an incomplete struct type.

http://reviews.llvm.org/D21705

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
  test/CodeGenCXX/debug-info-indirect-field-decl.cpp
  test/CodeGenCXX/debug-info-ms-abi.cpp
  test/CodeGenObjCXX/debug-info-cyclic.mm

Index: test/CodeGenObjCXX/debug-info-cyclic.mm
===
--- test/CodeGenObjCXX/debug-info-cyclic.mm
+++ test/CodeGenObjCXX/debug-info-cyclic.mm
@@ -8,7 +8,7 @@
 // CHECK-NOT:  DIFlagFwdDecl
 // CHECK-SAME: elements: ![[BMEMBERS:[0-9]+]]
 // CHECK-SAME: identifier:
-// CHECK: ![[BMEMBERS]] = !{![[BB:[0-9]+]]}
+// CHECK: ![[BMEMBERS]] = !{![[A:[0-9]+]], ![[BB:[0-9]+]]}
   B(struct A *);
 // CHECK: ![[BB]] = !DISubprogram(name: "B", scope: ![[B]]
 // CHECK-SAME:line: [[@LINE-2]],
Index: test/CodeGenCXX/debug-info-ms-abi.cpp
===
--- test/CodeGenCXX/debug-info-ms-abi.cpp
+++ test/CodeGenCXX/debug-info-ms-abi.cpp
@@ -14,6 +14,9 @@
 // CHECK: ![[Foo:[^ ]*]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo",
 // CHECK-SAME: identifier: ".?AUFoo@@"
 
+// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
+// CHECK-SAME: identifier: ".?AUNested@Foo@@"
+
 // CHECK: !DISubprogram(name: "f",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 0,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
@@ -25,6 +28,3 @@
 // CHECK: !DISubprogram(name: "h",
 // CHECK-SAME: containingType: ![[Foo]], virtuality: DW_VIRTUALITY_virtual, virtualIndex: 2,
 // CHECK-SAME: flags: DIFlagPrototyped | DIFlagIntroducedVirtual,
-
-// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Nested",
-// CHECK-SAME: identifier: ".?AUNested@Foo@@"
Index: test/CodeGenCXX/debug-info-indirect-field-decl.cpp
===
--- test/CodeGenCXX/debug-info-indirect-field-decl.cpp
+++ test/CodeGenCXX/debug-info-indirect-field-decl.cpp
@@ -8,18 +8,18 @@
 struct Bar {
   int i1;
   // CHECK: ![[INT:[0-9]+]] = !DIBasicType(name: "int"
-  // CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
-  // CHECK-SAME:   line: [[@LINE+4]]
-  // CHECK-SAME:   baseType: ![[UNION:[0-9]+]]
-  // CHECK-SAME:   size: 32, align: 32, offset: 32
-  // CHECK: ![[UNION]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
+  // CHECK: ![[UNION:[0-9]+]] = distinct !DICompositeType(tag: DW_TAG_union_type,{{.*}} identifier: "_ZTSN3BarUt_E")
   union {
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i2",
-// CHECK-SAME:   line: [[@LINE+5]]
+// CHECK-SAME:   line: [[@LINE+9]]
 // CHECK-SAME:   baseType: ![[INT]]
 // CHECK-SAME:   size: 32, align: 32
 // CHECK-NOT:offset:
 // CHECK-SAME:   ){{$}}
+// CHECK: !DIDerivedType(tag: DW_TAG_member, scope:
+// CHECK-SAME:   line: [[@LINE-8]]
+// CHECK-SAME:   baseType: ![[UNION]]
+// CHECK-SAME:   size: 32, align: 32, offset: 32
 int i2;
   };
 };
Index: test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
===
--- test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
+++ test/CodeGenCXX/debug-info-dup-fwd-decl.cpp
@@ -19,6 +19,6 @@
 
 Test t;
 
-// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
+// CHECK: !DIDerivedType(tag: DW_TAG_pointer_type
 // CHECK-NOT: !DICompositeType(tag: DW_TAG_structure_type, name: "data"
Index: lib/CodeGen/CGDebugInfo.h
===
--- lib/CodeGen/CGDebugInfo.h
+++ lib/CodeGen/CGDebugInfo.h
@@ -249,6 +249,8 @@
 llvm::DIFile *F,
 SmallVectorImpl &E,
 llvm::DIType *RecordTy, const RecordDecl *RD);
+  void CollectRecordNestedRecord(const RecordDecl *RD,
+ SmallVectorImpl &E);
   void CollectRecordFields(const RecordDecl *Decl, llvm::DIFile *F,
SmallVectorImpl &E,
  

Re: [PATCH] D21542: CodeGen: Replace test/CodeGen/thinlto_backend.c with a functional test.

2016-06-24 Thread Eric Christopher via cfe-commits
echristo added a comment.

OK, that works for me. :)


Repository:
  rL LLVM

http://reviews.llvm.org/D21542



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


  1   2   >