[PATCH] D25263: [Driver] Allow setting the default linker during build

2016-10-17 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld added a comment.

Have you run all tests with `CLANG_DEFAULT_LINKER` not being the platform 
default? I imagine there might be some tests that expect `ld` to be used...




Comment at: CMakeLists.txt:198
 
+set(CLANG_DEFAULT_LINKER "" CACHE STRING
+  "Default linker to use (\"bfd\" or \"gold\" or \"lld\", empty for platform 
default")

bruno wrote:
> mgorny wrote:
> > Is there a reason not to allow using the absolute path here, like for the 
> > command-line option?
> I agree here, if we're adding a cmake options for this, it should accept full 
> paths to the linker to be used (without any need for its type like gold, bfd, 
> etc) as well.
> 
> Additionally, if "" maps to "ld", plain CLANG_DEFAULT_LINKER="ld" should also 
> work here.
I agree with both points here.



Comment at: lib/Driver/ToolChain.cpp:352
+  return UseLinker;
+  } else if (A && (UseLinker.empty() || UseLinker == "ld")) {
+// If we're passed -fuse-ld= with no argument, or with the argument ld,

I wonder whether this is really correct: If `DefaultLinker` is not `ld` (it is 
`lld` for some ToolChains), `-fuse-ld=` with an empty argument should probably 
not use `ld` but rather whatever `DefaultLinker` says...


Repository:
  rL LLVM

https://reviews.llvm.org/D25263



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


[PATCH] D25669: [Driver] Simplify ToolChain::GetCXXStdlibType (NFC)

2016-10-17 Thread Jonas Hahnfeld via cfe-commits
Hahnfeld created this revision.
Hahnfeld added reviewers: mgorny, ddunbar, phosek.
Hahnfeld added subscribers: cfe-commits, zlei.

I made the wrong assumption that execution would continue after an error Diag 
which led to unneeded complex code.
This patch aligns with the better implementation of 
`ToolChain::GetRuntimeLibType`.


https://reviews.llvm.org/D25669

Files:
  lib/Driver/ToolChain.cpp


Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -546,43 +546,22 @@
   return GetDefaultRuntimeLibType();
 }
 
-static bool ParseCXXStdlibType(const StringRef& Name,
-   ToolChain::CXXStdlibType& Type) {
-  if (Name == "libc++")
-Type = ToolChain::CST_Libcxx;
-  else if (Name == "libstdc++")
-Type = ToolChain::CST_Libstdcxx;
-  else
-return false;
-
-  return true;
-}
-
 ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) 
const{
-  ToolChain::CXXStdlibType Type;
-  bool HasValidType = false;
-  bool ForcePlatformDefault = false;
-
   const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);
-  if (A) {
-StringRef Value = A->getValue();
-HasValidType = ParseCXXStdlibType(Value, Type);
-
-// Only use in tests to override CLANG_DEFAULT_CXX_STDLIB!
-if (Value == "platform")
-  ForcePlatformDefault = true;
-else if (!HasValidType)
-  getDriver().Diag(diag::err_drv_invalid_stdlib_name)
-<< A->getAsString(Args);
-  }
+  StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB;
 
-  // If no argument was provided or its value was invalid, look for the
-  // default unless forced or configured to take the platform default.
-  if (!HasValidType && (ForcePlatformDefault ||
-  !ParseCXXStdlibType(CLANG_DEFAULT_CXX_STDLIB, Type)))
-Type = GetDefaultCXXStdlibType();
+  // "platform" is only used in tests to override CLANG_DEFAULT_CXX_STDLIB
+  if (LibName == "libc++")
+return ToolChain::CST_Libcxx;
+  else if (LibName == "libstdc++")
+return ToolChain::CST_Libstdcxx;
+  else if (LibName == "platform")
+return GetDefaultCXXStdlibType();
+
+  if (A)
+getDriver().Diag(diag::err_drv_invalid_stdlib_name) << 
A->getAsString(Args);
 
-  return Type;
+  return GetDefaultCXXStdlibType();
 }
 
 /// \brief Utility function to add a system include directory to CC1 arguments.


Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -546,43 +546,22 @@
   return GetDefaultRuntimeLibType();
 }
 
-static bool ParseCXXStdlibType(const StringRef& Name,
-   ToolChain::CXXStdlibType& Type) {
-  if (Name == "libc++")
-Type = ToolChain::CST_Libcxx;
-  else if (Name == "libstdc++")
-Type = ToolChain::CST_Libstdcxx;
-  else
-return false;
-
-  return true;
-}
-
 ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
-  ToolChain::CXXStdlibType Type;
-  bool HasValidType = false;
-  bool ForcePlatformDefault = false;
-
   const Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);
-  if (A) {
-StringRef Value = A->getValue();
-HasValidType = ParseCXXStdlibType(Value, Type);
-
-// Only use in tests to override CLANG_DEFAULT_CXX_STDLIB!
-if (Value == "platform")
-  ForcePlatformDefault = true;
-else if (!HasValidType)
-  getDriver().Diag(diag::err_drv_invalid_stdlib_name)
-<< A->getAsString(Args);
-  }
+  StringRef LibName = A ? A->getValue() : CLANG_DEFAULT_CXX_STDLIB;
 
-  // If no argument was provided or its value was invalid, look for the
-  // default unless forced or configured to take the platform default.
-  if (!HasValidType && (ForcePlatformDefault ||
-  !ParseCXXStdlibType(CLANG_DEFAULT_CXX_STDLIB, Type)))
-Type = GetDefaultCXXStdlibType();
+  // "platform" is only used in tests to override CLANG_DEFAULT_CXX_STDLIB
+  if (LibName == "libc++")
+return ToolChain::CST_Libcxx;
+  else if (LibName == "libstdc++")
+return ToolChain::CST_Libstdcxx;
+  else if (LibName == "platform")
+return GetDefaultCXXStdlibType();
+
+  if (A)
+getDriver().Diag(diag::err_drv_invalid_stdlib_name) << A->getAsString(Args);
 
-  return Type;
+  return GetDefaultCXXStdlibType();
 }
 
 /// \brief Utility function to add a system include directory to CC1 arguments.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r284368 - Recommit "[ClangTidy] Add UsingInserter and NamespaceAliaser"

2016-10-17 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Mon Oct 17 03:33:59 2016
New Revision: 284368

URL: http://llvm.org/viewvc/llvm-project?rev=284368&view=rev
Log:
Recommit "[ClangTidy] Add UsingInserter and NamespaceAliaser"

Summary: This adds helper classes to add using declaractions and namespace 
aliases to function bodies. These help making function calls to deeply nested 
functions concise (e.g. when calling helpers in a refactoring)

Patch by Julian Bangert!

Reviewers: alexfh, hokein

Subscribers: beanz, mgorny, cfe-commits

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

Added:
clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp
clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h
clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp
clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.h
clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.cpp
clang-tools-extra/trunk/clang-tidy/utils/UsingInserter.h
clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp
clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/utils/CMakeLists.txt
clang-tools-extra/trunk/unittests/clang-tidy/CMakeLists.txt

Added: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp?rev=284368&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.cpp Mon Oct 17 03:33:59 
2016
@@ -0,0 +1,28 @@
+//===-- ASTUtils.cpp - clang-tidy 
-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "ASTUtils.h"
+
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+
+namespace clang {
+namespace tidy {
+namespace utils {
+using namespace ast_matchers;
+
+const FunctionDecl *getSurroundingFunction(ASTContext &Context,
+   const Stmt &Statement) {
+  return selectFirst(
+  "function", match(stmt(hasAncestor(functionDecl().bind("function"))),
+Statement, Context));
+}
+} // namespace utils
+} // namespace tidy
+} // namespace clang

Added: clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h?rev=284368&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h (added)
+++ clang-tools-extra/trunk/clang-tidy/utils/ASTUtils.h Mon Oct 17 03:33:59 2016
@@ -0,0 +1,25 @@
+//===-- ASTUtils.h - clang-tidy 
---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H
+
+#include "clang/AST/AST.h"
+
+namespace clang {
+namespace tidy {
+namespace utils {
+// Returns the (closest) Function declaration surrounding |Statement| or NULL.
+const FunctionDecl *getSurroundingFunction(ASTContext &Context,
+   const Stmt &Statement);
+} // namespace utils
+} // namespace tidy
+} // namespace clang
+
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ASTUTILS_H

Modified: clang-tools-extra/trunk/clang-tidy/utils/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/CMakeLists.txt?rev=284368&r1=284367&r2=284368&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/utils/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/utils/CMakeLists.txt Mon Oct 17 03:33:59 
2016
@@ -1,6 +1,7 @@
 set(LLVM_LINK_COMPONENTS support)
 
 add_clang_library(clangTidyUtils
+  ASTUtils.cpp
   DeclRefExprUtils.cpp
   FixItHintUtils.cpp
   HeaderFileExtensionsUtils.cpp
@@ -8,8 +9,10 @@ add_clang_library(clangTidyUtils
   IncludeInserter.cpp
   IncludeSorter.cpp
   LexerUtils.cpp
+  NamespaceAliaser.cpp
   OptionsUtils.cpp
   TypeTraits.cpp
+  UsingInserter.cpp
 
   LINK_LIBS
   clangAST

Added: clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/utils/NamespaceAliaser.cpp?rev=284368&view=auto
==
--- clang-tools-extra/trun

Re: [PATCH] D24997: [ClangTidy] Add UsingInserter and NamespaceAliaser

2016-10-17 Thread Haojian Wu via cfe-commits
Yeah, "make -j 32" won't compile binaries in clang-tools-extra repo.

"make check-clang-tools" should work though I don't use make. I usually run
`ninja check-clang-tools` command to build all binaries and run all
lint-tests/unittest in clang-extra-tools. There is a remaining build error
in the unittests, I fixed it and recommitted this patch in r284368.

On Fri, Oct 14, 2016 at 10:26 PM, Julian Bangert  wrote:

> I figured out make clang-tidy. Compiles now (the typedef was the wrong way
> around, and i never noticed because make with the default target continued
> to work).
>
>
> Updated the diff.
>
> On Fri, Oct 14, 2016 at 12:49 PM Julian Bangert 
> wrote:
>
>> Apologies for the breakage. I investigated and it turns out my
>> open-source checkout does not build clang-tidy. I have checked out llvm
>> into ~/llvm, clang into ~/llvm/tools/clang and clang-extra-tools into
>> ~/llvm/tools/clang/tools/extra.
>> In ~/llvm-build I run cmake ../llvm && make -j 32 and it doesn't compile
>> clang tidy. I also tried  cmake -DCLANG_ENABLE_STATIC_ANALYZER=true
>> ../llvm/ but that doesn't make a difference. Any ideas?
>>
>>
>> On Wed, Oct 12, 2016 at 1:34 AM Haojian Wu  wrote:
>>
>> hokein added a comment.
>>
>> @jbangert, your patch broke the buildbot, and I reverted it in r283985.
>> You need to add the new source files to the CMakefile. (I saw other
>> compilation errors after I updated the cmake files, Could you take a look
>> on it? )
>>
>>
>> Repository:
>>   rL LLVM
>>
>> https://reviews.llvm.org/D24997
>>
>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25600: [ASTMatcher] Add isStaticDataMember matcher for varDecl.

2016-10-17 Thread Haojian Wu via cfe-commits
hokein abandoned this revision.
hokein added inline comments.



Comment at: include/clang/ASTMatchers/ASTMatchers.h:3005
+/// \endcode
+AST_MATCHER(VarDecl, isStaticDataMember) {
+  return Node.isStaticDataMember();

aaron.ballman wrote:
> hokein wrote:
> > aaron.ballman wrote:
> > > How does this differ from the existing matcher 
> > > `hasStaticStorageDuration()` over a `fieldDecl()`?
> > `fieldDecl` document says that fieldDecl is "an instance of this class is 
> > created by Sema::ActOnField to
> > represent a member of a struct/union/class.". So for static class members, 
> > they should not belong to `fieldDecl` as they are not bound to class 
> > instances.
> >  
> > Technically, we can't apply `hasStaticStorageDuration()` and 
> > `isStaticStorageClass` over a `fieldDecl`.
> >  
> That's a really good point, but the question still remains: since we have 
> `hasStaticStorageDuration()` already, can we find a way to use that same 
> matcher rather than introduce a new matcher under a new name that does the 
> same thing?
> 
> This time I tested a matcher, and found that you get the correct behavior 
> from `varDecl(hasStaticStorageDuration(), hasParent(recordDecl()))`.
> 
> I think this is especially important to try to do because we have 
> `hasStaticStorageDuration()` and `isStaticStorageClass()`, so adding 
> `isStaticDataMember()` adds a third option to possibly confuse users.
Thanks for the explanations, I think it makes sense.

Previously I thought `isStaticDataMember` is an more obvious ast matcher.
`varDecl(hasStaticStorageDuration(), hasParent(cxxRecordDecl()))` and 
`varDecl(hasStaticStorageDuration(), hasDeclContext(cxxRecordDecl()), 
isDefinition())` can do the same thing. 


https://reviews.llvm.org/D25600



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


[clang-tools-extra] r284370 - Fix windows buildbot error.

2016-10-17 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Mon Oct 17 05:05:25 2016
New Revision: 284370

URL: http://llvm.org/viewvc/llvm-project?rev=284370&view=rev
Log:
Fix windows buildbot error.

Modified:
clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp
clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp

Modified: clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp?rev=284370&r1=284369&r2=284370&view=diff
==
--- clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp 
(original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/NamespaceAliaserTest.cpp Mon 
Oct 17 05:05:25 2016
@@ -22,12 +22,12 @@ namespace utils {
 // (e.g. with one SourceManager).
 class InsertAliasCheck : public ClangTidyCheck {
 public:
-  using ClangTidyCheck::ClangTidyCheck;
+  InsertAliasCheck(StringRef Name, ClangTidyContext *Context)
+  :ClangTidyCheck(Name, Context) {}
   void registerMatchers(ast_matchers::MatchFinder *Finder) override {
 Finder->addMatcher(ast_matchers::callExpr().bind("foo"), this);
   }
-  void
-  check(const ast_matchers::MatchFinder::MatchResult &Result) override {
+  void check(const ast_matchers::MatchFinder::MatchResult &Result) override {
 if (!Aliaser)
   Aliaser.reset(new NamespaceAliaser(*Result.SourceManager));
 

Modified: clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp?rev=284370&r1=284369&r2=284370&view=diff
==
--- clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp 
(original)
+++ clang-tools-extra/trunk/unittests/clang-tidy/UsingInserterTest.cpp Mon Oct 
17 05:05:25 2016
@@ -23,7 +23,8 @@ namespace utils {
 // can only run on one test case (e.g. wih one SourceManager).
 class InsertUsingCheck : public clang::tidy::ClangTidyCheck {
 public:
-  using clang::tidy::ClangTidyCheck::ClangTidyCheck;
+  InsertUsingCheck(StringRef Name, ClangTidyContext *Context)
+  :ClangTidyCheck(Name, Context) {}
   void registerMatchers(clang::ast_matchers::MatchFinder *Finder) override {
 Finder->addMatcher(clang::ast_matchers::callExpr().bind("foo"), this);
   }


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


r284372 - Do not reset TUScope when we are in incremental processing mode.

2016-10-17 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Mon Oct 17 05:15:25 2016
New Revision: 284372

URL: http://llvm.org/viewvc/llvm-project?rev=284372&view=rev
Log:
Do not reset TUScope when we are in incremental processing mode.

Patch by Axel Naumann!

Reviewed by Richard Smith and me.

Modified:
cfe/trunk/lib/Sema/Sema.cpp

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=284372&r1=284371&r2=284372&view=diff
==
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Mon Oct 17 05:15:25 2016
@@ -708,7 +708,8 @@ void Sema::ActOnEndOfTranslationUnit() {
 
   if (TUKind == TU_Prefix) {
 // Translation unit prefixes don't need any of the checking below.
-TUScope = nullptr;
+if (!PP.isIncrementalProcessingEnabled())
+  TUScope = nullptr;
 return;
   }
 
@@ -908,7 +909,8 @@ void Sema::ActOnEndOfTranslationUnit() {
   assert(ParsingInitForAutoVars.empty() &&
  "Didn't unmark var as having its initializer parsed");
 
-  TUScope = nullptr;
+  if (!PP.isIncrementalProcessingEnabled())
+TUScope = nullptr;
 }
 
 


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


[PATCH] D25602: Do not reset TUScope when we are in incremental processing mode.

2016-10-17 Thread Vassil Vassilev via cfe-commits
v.g.vassilev closed this revision.
v.g.vassilev added a comment.

Landed in r284372.


https://reviews.llvm.org/D25602



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


[PATCH] D25621: DebugInfo: use DIAlignment type.

2016-10-17 Thread Victor Leschuk via cfe-commits
vleschuk marked an inline comment as done.
vleschuk added inline comments.



Comment at: include/clang/AST/ASTContext.h:83
 uint64_t Width;
-unsigned Align;
+llvm::DIAlignment Align;
 bool AlignIsRequired : 1;

aprantl wrote:
> I'm not sure we want to use a debug info type inside the AST. I think we only 
> want to use them in CGDebugInfo.cpp.
We use TypeInfo and related functions heavily in CGDebugInfo.cpp, leaving this 
field as "unsigned" will make us to perform conversions from "unsigned" to 
llvm::DIAlignment, I think having this changed will result in simpler code.


https://reviews.llvm.org/D25621



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


[PATCH] D25669: [Driver] Simplify ToolChain::GetCXXStdlibType (NFC)

2016-10-17 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.



Comment at: lib/Driver/ToolChain.cpp:553-559
+  // "platform" is only used in tests to override CLANG_DEFAULT_CXX_STDLIB
+  if (LibName == "libc++")
+return ToolChain::CST_Libcxx;
+  else if (LibName == "libstdc++")
+return ToolChain::CST_Libstdcxx;
+  else if (LibName == "platform")
+return GetDefaultCXXStdlibType();

I believe you can use StringSwitch here


https://reviews.llvm.org/D25669



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


Re: r284137 - [ThinLTO] Update doc to include lld (now supported).

2016-10-17 Thread Rafael Espíndola via cfe-commits
On 16 October 2016 at 22:13, Davide Italiano  wrote:
> On Sun, Oct 16, 2016 at 6:43 PM, Sean Silva  wrote:
>> Nice to see this land!
>>
>> One nit:
>> Currently, doesn't LLD/ELF ignore -plugin-opt? That will mean that if a user
>> uses the "gold syntax" then LLD will silently ignore it, which isn't good.
>> At the very least, can we issue an error if we see `-plugin-opt jobs=N` and
>> suggest the LLD spelling?
>>
>> Or maybe just accept the gold syntax? Our current handling of `-plugin` and
>> `-plugin-opt` is intended to make LLD transparently Do The Right Thing when
>> LLD is invoked as if it were gold, so clearly gold compatibility is
>> important enough for that. This suggests it is important enough to be
>> compatible from a ThinLTO perspective too.
>>
>
> I agree with what you're suggesting.  My initial vote would be for
> error'ing out on anything we can't understand that's passed via
> `-plugin-opt` and see what breaks (and add incremental support for
> every feature needed).
> Teresa, Rafael, any opinions about it?

I agree. Having clang known if it is using gold or lld is probably not worth it.

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


[PATCH] D25661: [Driver] Support obtaining active toolchain from gcc-config on Gentoo

2016-10-17 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1438
+  if (GCCToolchainDir == "" || GCCToolchainDir == D.SysRoot + "/usr") {
+for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) {
+  llvm::ErrorOr> File =

Use range-based `for` here



Comment at: lib/Driver/ToolChains.cpp:1446-1463
+  // CURRENT=triple-version
+  if (Line.startswith("CURRENT=")) {
+const std::pair ActiveVersion =
+  Line.substr(8).rsplit('-');
+// Note: Strictly speaking, we should be reading
+// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
+// contain anything new or especially useful to us.

I think it is better to use `llvm::Triple` class here for parsing 
`ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT` string rather than 
`StringRef::split()`


https://reviews.llvm.org/D25661



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


[PATCH] D24799: [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

2016-10-17 Thread Serge Rogatch via cfe-commits
rSerge updated this revision to Diff 74829.

https://reviews.llvm.org/D24799

Files:
  lib/Driver/Tools.cpp


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4804,7 +4804,16 @@
 
   if (Args.hasFlag(options::OPT_fxray_instrument,
options::OPT_fnoxray_instrument, false)) {
-CmdArgs.push_back("-fxray-instrument");
+const std::string XRayInstrumentOption("-fxray-instrument");
+if (Triple.getOS() == llvm::Triple::Linux &&
+(Triple.getArch() == llvm::Triple::arm ||
+ Triple.getArch() == llvm::Triple::x86_64)) {
+  // Supported.
+} else {
+  D.Diag(diag::err_drv_clang_unsupported) << (XRayInstrumentOption + " on "
++ Triple.str());
+}
+CmdArgs.push_back(XRayInstrumentOption.c_str());
 if (const Arg *A =
 Args.getLastArg(options::OPT_fxray_instruction_threshold_,
 options::OPT_fxray_instruction_threshold_EQ)) {


Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4804,7 +4804,16 @@
 
   if (Args.hasFlag(options::OPT_fxray_instrument,
options::OPT_fnoxray_instrument, false)) {
-CmdArgs.push_back("-fxray-instrument");
+const std::string XRayInstrumentOption("-fxray-instrument");
+if (Triple.getOS() == llvm::Triple::Linux &&
+(Triple.getArch() == llvm::Triple::arm ||
+ Triple.getArch() == llvm::Triple::x86_64)) {
+  // Supported.
+} else {
+  D.Diag(diag::err_drv_clang_unsupported) << (XRayInstrumentOption + " on "
++ Triple.str());
+}
+CmdArgs.push_back(XRayInstrumentOption.c_str());
 if (const Arg *A =
 Args.getLastArg(options::OPT_fxray_instruction_threshold_,
 options::OPT_fxray_instruction_threshold_EQ)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24799: [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

2016-10-17 Thread Serge Rogatch via cfe-commits
rSerge added a comment.

Ping? (please, see the question about the test)


https://reviews.llvm.org/D24799



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


[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-17 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

This change

  bool FileManager::getStatValue(StringRef Path, FileData &Data, bool isFile,
 std::unique_ptr *F) {
// FIXME: FileSystemOpts shouldn't be passed in here, all paths should be
// absolute!
  llvm::dbgs() << "FileSystemOpts.WorkingDir: '" << FileSystemOpts.WorkingDir 
<< "'\n";
if (FileSystemOpts.WorkingDir.empty())
  return FileSystemStatCache::get(Path, Data, isFile, F,StatCache.get(), 
*FS);

prints
`FileSystemOpts.WorkingDir: ''`


https://reviews.llvm.org/D25597



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


[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-17 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

In https://reviews.llvm.org/D25597#571532, @kparzysz wrote:

> `FileSystemOpts.WorkingDir: ''`


There is no space between the single quotes.


https://reviews.llvm.org/D25597



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


[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-17 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

Printing Path shows
`/../target/hexagon/include`


https://reviews.llvm.org/D25597



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


[PATCH] D25363: Store a SourceRange for multi-token builtin types

2016-10-17 Thread Malcolm Parsons via cfe-commits
malcolm.parsons added a comment.

ping.


https://reviews.llvm.org/D25363



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


r284382 - Revert "Reinstate r281429, reverted in r281452, with a fix for its mishandling of"

2016-10-17 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Mon Oct 17 08:00:44 2016
New Revision: 284382

URL: http://llvm.org/viewvc/llvm-project?rev=284382&view=rev
Log:
Revert "Reinstate r281429, reverted in r281452, with a fix for its mishandling 
of"

This reverts commit r284176. It still marks some modules as invisible
that should be visible. Will follow up with the author with a test case.

Removed:
cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h
cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h
cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h
cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap
cfe/trunk/test/Modules/merge-var-template-def.cpp
Modified:
cfe/trunk/include/clang/AST/ASTContext.h
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/a.h
cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/b.h
cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/c.h
cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/d.h
cfe/trunk/test/Modules/merge-template-pattern-visibility.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=284382&r1=284381&r2=284382&view=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Oct 17 08:00:44 2016
@@ -308,18 +308,10 @@ class ASTContext : public RefCountedBase
   /// merged into.
   llvm::DenseMap MergedDecls;
 
-  /// The modules into which a definition has been merged, or a map from a
-  /// merged definition to its canonical definition. This is really a union of
-  /// a NamedDecl* and a vector of Module*.
-  struct MergedModulesOrCanonicalDef {
-llvm::TinyPtrVector MergedModules;
-NamedDecl *CanonicalDef = nullptr;
-  };
-
   /// \brief A mapping from a defining declaration to a list of modules (other
   /// than the owning module of the declaration) that contain merged
   /// definitions of that entity.
-  llvm::DenseMap MergedDefModules;
+  llvm::DenseMap> MergedDefModules;
 
   /// \brief Initializers for a module, in order. Each Decl will be either
   /// something that has a semantic effect on startup (such as a variable with
@@ -891,7 +883,6 @@ public:
   /// and should be visible whenever \p M is visible.
   void mergeDefinitionIntoModule(NamedDecl *ND, Module *M,
  bool NotifyListeners = true);
-  void mergeDefinitionIntoModulesOf(NamedDecl *ND, NamedDecl *Other);
   /// \brief Clean up the merged definition list. Call this if you might have
   /// added duplicates into the list.
   void deduplicateMergedDefinitonsFor(NamedDecl *ND);
@@ -902,9 +893,7 @@ public:
 auto MergedIt = MergedDefModules.find(Def);
 if (MergedIt == MergedDefModules.end())
   return None;
-if (auto *CanonDef = MergedIt->second.CanonicalDef)
-  return getModulesWithMergedDefinition(CanonDef);
-return MergedIt->second.MergedModules;
+return MergedIt->second;
   }
 
   /// Add a declaration to the list of declarations that are initialized

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=284382&r1=284381&r2=284382&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Oct 17 08:00:44 2016
@@ -888,74 +888,18 @@ void ASTContext::mergeDefinitionIntoModu
 if (auto *Listener = getASTMutationListener())
   Listener->RedefinedHiddenDefinition(ND, M);
 
-  auto *Merged = &MergedDefModules[ND];
-  if (auto *CanonDef = Merged->CanonicalDef) {
-ND = CanonDef;
-Merged = &MergedDefModules[ND];
-  }
-  assert(!Merged->CanonicalDef && "canonical def not canonical");
-
-  Merged->MergedModules.push_back(M);
-
-  if (!getLangOpts().ModulesLocalVisibility)
+  if (getLangOpts().ModulesLocalVisibility)
+MergedDefModules[ND].push_back(M);
+  else
 ND->setHidden(false);
 }
 
-void ASTContext::mergeDefinitionIntoModulesOf(NamedDecl *Def,
-  NamedDecl *Other) {
-  // We need to know the owning module of the merge source.
-  assert(Other->isFromASTFile() && "merge of non-imported decl not supported");
-  assert(Def != Other && "merging definition into itself");
-
-  if (!Other->isHidden()) {
-Def->setHidden(false);
-return;
-  }
-
-  assert(Other->getImportedOwningModule() &&
- "hidden, imported declaration has no owning module");
-
-  // Mark Def as the canonical definition of merged definition Other.
-  {
-auto &OtherMerged = MergedDefModules[Other];
-assert((!OtherMerged.CanonicalDef || OtherMerged.CanonicalDef == Def) &&
-   "mismatched canonical definitions 

[PATCH] D25153: preprocessor supports `-dI` flag

2016-10-17 Thread Steve O'Brien via cfe-commits
elsteveogrande added a comment.

I'll need help landing this...  I also tried `git svn dcommit` but command hung 
there forever.

Thanks!


https://reviews.llvm.org/D25153



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


Re: r284137 - [ThinLTO] Update doc to include lld (now supported).

2016-10-17 Thread Teresa Johnson via cfe-commits
On Mon, Oct 17, 2016 at 5:13 AM, Rafael Espíndola <
rafael.espind...@gmail.com> wrote:

> On 16 October 2016 at 22:13, Davide Italiano  wrote:
> > On Sun, Oct 16, 2016 at 6:43 PM, Sean Silva 
> wrote:
> >> Nice to see this land!
> >>
> >> One nit:
> >> Currently, doesn't LLD/ELF ignore -plugin-opt? That will mean that if a
> user
> >> uses the "gold syntax" then LLD will silently ignore it, which isn't
> good.
> >> At the very least, can we issue an error if we see `-plugin-opt jobs=N`
> and
> >> suggest the LLD spelling?
> >>
> >> Or maybe just accept the gold syntax? Our current handling of `-plugin`
> and
> >> `-plugin-opt` is intended to make LLD transparently Do The Right Thing
> when
> >> LLD is invoked as if it were gold, so clearly gold compatibility is
> >> important enough for that. This suggests it is important enough to be
> >> compatible from a ThinLTO perspective too.
> >>
> >
> > I agree with what you're suggesting.  My initial vote would be for
> > error'ing out on anything we can't understand that's passed via
> > `-plugin-opt` and see what breaks (and add incremental support for
> > every feature needed).
> > Teresa, Rafael, any opinions about it?
>
> I agree. Having clang known if it is using gold or lld is probably not
> worth it.
>

Sure, that seems reasonable to me as well. For example, there is now a
clang option-flto-jobs=N that hooks up to the gold plugin option jobs=N
option, and you would get that automatically without having to wire it in.
Erroring on any unrecognized options would be good too.

Teresa


> Cheers,
> Rafael
>



-- 
Teresa Johnson |  Software Engineer |  tejohn...@google.com |  408-460-2413
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25673: [libclang] Add missing cursor kinds to python bindings.

2016-10-17 Thread Igor Kudrin via cfe-commits
ikudrin created this revision.
ikudrin added reviewers: compnerd, ABataev, erik.pilkington, ogoffart.
ikudrin added a subscriber: cfe-commits.

https://reviews.llvm.org/D25673

Files:
  bindings/python/clang/cindex.py

Index: bindings/python/clang/cindex.py
===
--- bindings/python/clang/cindex.py
+++ bindings/python/clang/cindex.py
@@ -1008,6 +1008,12 @@
 # Represents the "self" expression in a ObjC method.
 CursorKind.OBJ_SELF_EXPR = CursorKind(146)
 
+# OpenMP 4.0 [2.4, Array Section].
+CursorKind.OMP_ARRAY_SECTION_EXPR = CursorKind(147)
+
+# Represents an @available(...) check.
+CursorKind.OBJC_AVAILABILITY_CHECK_EXPR = CursorKind(148)
+
 
 # A statement whose specific kind is not exposed via this interface.
 #
@@ -1109,6 +1115,126 @@
 # Adaptor class for mixing declarations with statements and expressions.
 CursorKind.DECL_STMT = CursorKind(231)
 
+# OpenMP parallel directive.
+CursorKind.OMP_PARALLEL_DIRECTIVE = CursorKind(232)
+
+# OpenMP SIMD directive.
+CursorKind.OMP_SIMD_DIRECTIVE = CursorKind(233)
+
+# OpenMP for directive.
+CursorKind.OMP_FOR_DIRECTIVE = CursorKind(234)
+
+# OpenMP sections directive.
+CursorKind.OMP_SECTIONS_DIRECTIVE = CursorKind(235)
+
+# OpenMP section directive.
+CursorKind.OMP_SECTION_DIRECTIVE = CursorKind(236)
+
+# OpenMP single directive.
+CursorKind.OMP_SINGLE_DIRECTIVE = CursorKind(237)
+
+# OpenMP parallel for directive.
+CursorKind.OMP_PARALLEL_FOR_DIRECTIVE = CursorKind(238)
+
+# OpenMP parallel sections directive.
+CursorKind.OMP_PARALLEL_SECTIONS_DIRECTIVE = CursorKind(239)
+
+# OpenMP task directive.
+CursorKind.OMP_TASK_DIRECTIVE = CursorKind(240)
+
+# OpenMP master directive.
+CursorKind.OMP_MASTER_DIRECTIVE = CursorKind(241)
+
+# OpenMP critical directive.
+CursorKind.OMP_CRITICAL_DIRECTIVE = CursorKind(242)
+
+# OpenMP taskyield directive.
+CursorKind.OMP_TASKYIELD_DIRECTIVE = CursorKind(243)
+
+# OpenMP barrier directive.
+CursorKind.OMP_BARRIER_DIRECTIVE = CursorKind(244)
+
+# OpenMP taskwait directive.
+CursorKind.OMP_TASKWAIT_DIRECTIVE = CursorKind(245)
+
+# OpenMP flush directive.
+CursorKind.OMP_FLUSH_DIRECTIVE = CursorKind(246)
+
+# Windows Structured Exception Handling's leave statement.
+CursorKind.SEH_LEAVE_STMT = CursorKind(247)
+
+# OpenMP ordered directive.
+CursorKind.OMP_ORDERED_DIRECTIVE = CursorKind(248)
+
+# OpenMP atomic directive.
+CursorKind.OMP_ATOMIC_DIRECTIVE = CursorKind(249)
+
+# OpenMP for SIMD directive.
+CursorKind.OMP_FOR_SIMD_DIRECTIVE = CursorKind(250)
+
+# OpenMP parallel for SIMD directive.
+CursorKind.OMP_PARALLELFORSIMD_DIRECTIVE = CursorKind(251)
+
+# OpenMP target directive.
+CursorKind.OMP_TARGET_DIRECTIVE = CursorKind(252)
+
+# OpenMP teams directive.
+CursorKind.OMP_TEAMS_DIRECTIVE = CursorKind(253)
+
+# OpenMP taskgroup directive.
+CursorKind.OMP_TASKGROUP_DIRECTIVE = CursorKind(254)
+
+# OpenMP cancellation point directive.
+CursorKind.OMP_CANCELLATION_POINT_DIRECTIVE = CursorKind(255)
+
+# OpenMP cancel directive.
+CursorKind.OMP_CANCEL_DIRECTIVE = CursorKind(256)
+
+# OpenMP target data directive.
+CursorKind.OMP_TARGET_DATA_DIRECTIVE = CursorKind(257)
+
+# OpenMP taskloop directive.
+CursorKind.OMP_TASK_LOOP_DIRECTIVE = CursorKind(258)
+
+# OpenMP taskloop simd directive.
+CursorKind.OMP_TASK_LOOP_SIMD_DIRECTIVE = CursorKind(259)
+
+# OpenMP distribute directive.
+CursorKind.OMP_DISTRIBUTE_DIRECTIVE = CursorKind(260)
+
+# OpenMP target enter data directive.
+CursorKind.OMP_TARGET_ENTER_DATA_DIRECTIVE = CursorKind(261)
+
+# OpenMP target exit data directive.
+CursorKind.OMP_TARGET_EXIT_DATA_DIRECTIVE = CursorKind(262)
+
+# OpenMP target parallel directive.
+CursorKind.OMP_TARGET_PARALLEL_DIRECTIVE = CursorKind(263)
+
+# OpenMP target parallel for directive.
+CursorKind.OMP_TARGET_PARALLELFOR_DIRECTIVE = CursorKind(264)
+
+# OpenMP target update directive.
+CursorKind.OMP_TARGET_UPDATE_DIRECTIVE = CursorKind(265)
+
+# OpenMP distribute parallel for directive.
+CursorKind.OMP_DISTRIBUTE_PARALLELFOR_DIRECTIVE = CursorKind(266)
+
+# OpenMP distribute parallel for simd directive.
+CursorKind.OMP_DISTRIBUTE_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(267)
+
+# OpenMP distribute simd directive.
+CursorKind.OMP_DISTRIBUTE_SIMD_DIRECTIVE = CursorKind(268)
+
+# OpenMP target parallel for simd directive.
+CursorKind.OMP_TARGET_PARALLEL_FOR_SIMD_DIRECTIVE = CursorKind(269)
+
+# OpenMP target simd directive.
+CursorKind.OMP_TARGET_SIMD_DIRECTIVE = CursorKind(270)
+
+# OpenMP teams distribute directive.
+CursorKind.OMP_TEAMS_DISTRIBUTE_DIRECTIVE = CursorKind(271)
+
 ###
 # Other Kinds
 
@@ -1161,6 +1287,8 @@
 CursorKind.MODULE_IMPORT_DECL = CursorKind(600)
 # A type alias template declaration
 CursorKind.TYPE_ALIAS_TEMPLATE_DECL = CursorKind(601)
+# A static_assert or _Static_assert node
+CursorKind.STATIC_ASSERT = CursorKind(602)
 
 # A code completion overload candidate.
 CursorKind.OVERLOAD_CANDIDATE = CursorKind(700)
__

[PATCH] D25595: [libcxx] Support std::regex_constants::match_not_null

2016-10-17 Thread Marshall Clow via cfe-commits
mclow.lists added inline comments.



Comment at: libcxx/test/std/re/re.alg/re.alg.search/pr21597.pass.cpp:12
+
+// template 
+// bool

Rather than this comment about `regex_search`, there should be a comment about 
`match_not_null`, which is really what we're testing here.

Something like:
// match_not_null:
// The expression shall not match an empty sequence.



https://reviews.llvm.org/D25595



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


r284383 - Return correct path from HexagonToolChain::getHexagonTargetDir

2016-10-17 Thread Krzysztof Parzyszek via cfe-commits
Author: kparzysz
Date: Mon Oct 17 08:23:41 2016
New Revision: 284383

URL: http://llvm.org/viewvc/llvm-project?rev=284383&view=rev
Log:
Return correct path from HexagonToolChain::getHexagonTargetDir

This problem was exposed by r284129, causing clang-hexagon-elf to fail
clang tests.

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284383&r1=284382&r2=284383&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 08:23:41 2016
@@ -2970,7 +2970,7 @@ std::string HexagonToolChain::getHexagon
   if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
 return InstallRelDir;
 
-  return InstallRelDir;
+  return InstalledDir;
 }
 
 Optional HexagonToolChain::getSmallDataThreshold(


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


[PATCH] D25674: [Concepts] Class template associated constraints

2016-10-17 Thread Hubert Tong via cfe-commits
hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: rsmith, faisalv, aaron.ballman.
hubert.reinterpretcast added subscribers: nwilson, cfe-commits.

This adds associated constraints as a property of class templates.
An error is produced if redeclarations are not similarly constrained.


https://reviews.llvm.org/D25674

Files:
  include/clang/AST/DeclTemplate.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/DeclTemplate.cpp
  lib/Sema/SemaTemplate.cpp
  test/CXX/concepts-ts/temp/
  test/CXX/concepts-ts/temp/temp.constr/
  test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/
  test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp

Index: test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
===
--- /dev/null
+++ test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/class-template-decl.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s
+
+namespace nodiag {
+
+using MyBool = bool;
+
+template  requires !!sizeof(bool)
+struct A;
+template  requires !!sizeof(MyBool)
+struct A;
+
+} // end namespace nodiag
+
+namespace diag {
+
+template  requires true // expected-note{{previous template declaration is here}}
+struct A;
+template  struct A; // expected-error{{associated constraints differ in template redeclaration}}
+
+template  struct B; // expected-note{{previous template declaration is here}}
+template  requires true // expected-error{{associated constraints differ in template redeclaration}}
+struct B;
+
+template  requires true // expected-note{{previous template declaration is here}}
+struct C;
+template  requires !0 // expected-error{{associated constraints differ in template redeclaration}}
+struct C;
+
+} // end namespace diag
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -45,6 +45,26 @@
   return SourceRange(Ps[0]->getTemplateLoc(), Ps[N-1]->getRAngleLoc());
 }
 
+namespace clang {
+/// \brief [temp.constr.decl]p2: A template's associated constraints are
+/// defined as a single constraint-expression derived from the introduced
+/// constraint-expressions [ ... ].
+///
+/// \param Params The template parameter list and optional requires-clause.
+///
+/// \param FD The underlying templated function declaration for a function
+/// template.
+static Expr *formAssociatedConstraints(TemplateParameterList *Params,
+   FunctionDecl *FD);
+}
+
+static Expr *clang::formAssociatedConstraints(TemplateParameterList *Params,
+  FunctionDecl *FD) {
+  // FIXME: Concepts: collect additional introduced constraint-expressions
+  assert(!FD && "Cannot collect constraints from function declaration yet.");
+  return Params->getRequiresClause();
+}
+
 /// \brief Determine whether the declaration found is acceptable as the name
 /// of a template and, if so, return that template declaration. Otherwise,
 /// returns NULL.
@@ -1117,6 +1137,9 @@
 }
   }
 
+  // TODO Memory management; associated constraints are not always stored.
+  Expr *const CurAC = formAssociatedConstraints(TemplateParams, nullptr);
+
   if (PrevClassTemplate) {
 // Ensure that the template parameter lists are compatible. Skip this check
 // for a friend in a dependent context: the template parameter list itself
@@ -1128,6 +1151,26 @@
 TPL_TemplateMatch))
   return true;
 
+// Check for matching associated constraints on redeclarations.
+do {
+  const Expr *const PrevAC = PrevClassTemplate->getAssociatedConstraints();
+  if (!(CurAC || PrevAC))
+continue; // nothing to check
+  if (CurAC && PrevAC) {
+llvm::FoldingSetNodeID CurACInfo, PrevACInfo;
+CurAC->Profile(CurACInfo, Context, /*Canonical=*/true);
+PrevAC->Profile(PrevACInfo, Context, /*Canonical=*/true);
+if (CurACInfo == PrevACInfo)
+  continue; // all good
+  }
+
+  Diag(CurAC ? CurAC->getLocStart() : NameLoc,
+   diag::err_template_different_associated_constraints);
+  Diag(PrevAC ? PrevAC->getLocStart() : PrevClassTemplate->getLocation(),
+   diag::note_template_prev_declaration) << /*declaration*/0;
+  return true;
+} while (0);
+
 // C++ [temp.class]p4:
 //   In a redeclaration, partial specialization, explicit
 //   specialization or explicit instantiation of a class template,
@@ -1225,7 +1268,8 @@
   ClassTemplateDecl *NewTemplate
 = ClassTemplateDecl::Create(Context, SemanticContext, NameLoc,
 DeclarationName(Name), TemplateParams,
-NewClass, PrevClassTemplate);
+NewClass, PrevClassTemplate,
+PrevClassTemplate

Re: r284137 - [ThinLTO] Update doc to include lld (now supported).

2016-10-17 Thread Teresa Johnson via cfe-commits
On Mon, Oct 17, 2016 at 6:15 AM, Teresa Johnson 
wrote:

>
>
> On Mon, Oct 17, 2016 at 5:13 AM, Rafael Espíndola <
> rafael.espind...@gmail.com> wrote:
>
>> On 16 October 2016 at 22:13, Davide Italiano  wrote:
>> > On Sun, Oct 16, 2016 at 6:43 PM, Sean Silva 
>> wrote:
>> >> Nice to see this land!
>> >>
>> >> One nit:
>> >> Currently, doesn't LLD/ELF ignore -plugin-opt? That will mean that if
>> a user
>> >> uses the "gold syntax" then LLD will silently ignore it, which isn't
>> good.
>> >> At the very least, can we issue an error if we see `-plugin-opt
>> jobs=N` and
>> >> suggest the LLD spelling?
>> >>
>> >> Or maybe just accept the gold syntax? Our current handling of
>> `-plugin` and
>> >> `-plugin-opt` is intended to make LLD transparently Do The Right Thing
>> when
>> >> LLD is invoked as if it were gold, so clearly gold compatibility is
>> >> important enough for that. This suggests it is important enough to be
>> >> compatible from a ThinLTO perspective too.
>> >>
>> >
>> > I agree with what you're suggesting.  My initial vote would be for
>> > error'ing out on anything we can't understand that's passed via
>> > `-plugin-opt` and see what breaks (and add incremental support for
>> > every feature needed).
>> > Teresa, Rafael, any opinions about it?
>>
>> I agree. Having clang known if it is using gold or lld is probably not
>> worth it.
>>
>
> Sure, that seems reasonable to me as well. For example, there is now a
> clang option-flto-jobs=N that hooks up to the gold plugin option jobs=N
> option, and you would get that automatically without having to wire it in.
> Erroring on any unrecognized options would be good too.
>

(In fact, since -flto-jobs=N is already hooked up to ld64's -mllvm -threads
option, once lld accepts the -plugin-opt version I can update this
documentation just to list the single clang option.

Teresa


> Teresa
>
>
>> Cheers,
>> Rafael
>>
>
>
>
> --
> Teresa Johnson |  Software Engineer |  tejohn...@google.com |
> 408-460-2413
>



-- 
Teresa Johnson |  Software Engineer |  tejohn...@google.com |  408-460-2413
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25675: clang-format: [JS] Fix template string ASI.

2016-10-17 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.

Previously, automatic semicolon insertion would add an unwrapped line
when a template string contained a line break.

  var x = `foo${
  bar}`;

Would be formatted with `bar...` on a separate line and no indent.


https://reviews.llvm.org/D25675

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


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1276,6 +1276,12 @@
   verifyFormat("var x = ` \\${foo}`;\n");
 }
 
+TEST_F(FormatTestJS, TemplateStringASI) {
+  verifyFormat("var x = `hello${world}`;", "var x = `hello${\n"
+   "world\n"
+   "}`;");
+}
+
 TEST_F(FormatTestJS, NestedTemplateStrings) {
   verifyFormat(
   "var x = `${xs.map(x => `${x}`).join('\\n')}`;");
Index: lib/Format/UnwrappedLineParser.cpp
===
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -727,6 +727,8 @@
 return;
 
   bool PreviousMustBeValue = mustBeJSIdentOrValue(Keywords, Previous);
+  bool PreviousStartsTemplateExpr =
+  Previous->is(TT_TemplateString) && Previous->TokenText.endswith("${");
   if (PreviousMustBeValue && Line && Line->Tokens.size() > 1) {
 // If the token before the previous one is an '@', the previous token is an
 // annotation and can precede another identifier/value.
@@ -737,9 +739,12 @@
   if (Next->is(tok::exclaim) && PreviousMustBeValue)
 addUnwrappedLine();
   bool NextMustBeValue = mustBeJSIdentOrValue(Keywords, Next);
-  if (NextMustBeValue && (PreviousMustBeValue ||
-  Previous->isOneOf(tok::r_square, tok::r_paren,
-tok::plusplus, tok::minusminus)))
+  bool NextEndsTemplateExpr =
+  Next->is(TT_TemplateString) && Next->TokenText.startswith("}");
+  if (NextMustBeValue && !NextEndsTemplateExpr && !PreviousStartsTemplateExpr 
&&
+  (PreviousMustBeValue ||
+   Previous->isOneOf(tok::r_square, tok::r_paren, tok::plusplus,
+ tok::minusminus)))
 addUnwrappedLine();
   if (PreviousMustBeValue && isJSDeclOrStmt(Keywords, Next))
 addUnwrappedLine();


Index: unittests/Format/FormatTestJS.cpp
===
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -1276,6 +1276,12 @@
   verifyFormat("var x = ` \\${foo}`;\n");
 }
 
+TEST_F(FormatTestJS, TemplateStringASI) {
+  verifyFormat("var x = `hello${world}`;", "var x = `hello${\n"
+   "world\n"
+   "}`;");
+}
+
 TEST_F(FormatTestJS, NestedTemplateStrings) {
   verifyFormat(
   "var x = `${xs.map(x => `${x}`).join('\\n')}`;");
Index: lib/Format/UnwrappedLineParser.cpp
===
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -727,6 +727,8 @@
 return;
 
   bool PreviousMustBeValue = mustBeJSIdentOrValue(Keywords, Previous);
+  bool PreviousStartsTemplateExpr =
+  Previous->is(TT_TemplateString) && Previous->TokenText.endswith("${");
   if (PreviousMustBeValue && Line && Line->Tokens.size() > 1) {
 // If the token before the previous one is an '@', the previous token is an
 // annotation and can precede another identifier/value.
@@ -737,9 +739,12 @@
   if (Next->is(tok::exclaim) && PreviousMustBeValue)
 addUnwrappedLine();
   bool NextMustBeValue = mustBeJSIdentOrValue(Keywords, Next);
-  if (NextMustBeValue && (PreviousMustBeValue ||
-  Previous->isOneOf(tok::r_square, tok::r_paren,
-tok::plusplus, tok::minusminus)))
+  bool NextEndsTemplateExpr =
+  Next->is(TT_TemplateString) && Next->TokenText.startswith("}");
+  if (NextMustBeValue && !NextEndsTemplateExpr && !PreviousStartsTemplateExpr &&
+  (PreviousMustBeValue ||
+   Previous->isOneOf(tok::r_square, tok::r_paren, tok::plusplus,
+ tok::minusminus)))
 addUnwrappedLine();
   if (PreviousMustBeValue && isJSDeclOrStmt(Keywords, Next))
 addUnwrappedLine();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r284233 - [clang-move] Add header guard for the new header.

2016-10-17 Thread Tim Northover via cfe-commits
On 14 October 2016 at 13:33, Tim Northover  wrote:
> On 14 October 2016 at 06:01, Haojian Wu via cfe-commits
>  wrote:
>> +  std::string GuardName(FileName);
>> +  if (IsHeader) {
>> +std::replace(GuardName.begin(), GuardName.end(), '/', '_');
>> +std::replace(GuardName.begin(), GuardName.end(), '.', '_');
>> +std::replace(GuardName.begin(), GuardName.end(), '-', '_');
>
> I think this is causing problems with one of our bots that has an '@'
> in a path it uses. In general it seems like a whitelist based on what
> a C token is would be better than a blacklist of characters.
>
> Could you take a look?

Ping.

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


[PATCH] D25311: Add FixItHint for missing #include (err_module_unimported_use_header)

2016-10-17 Thread Sam McCall via cfe-commits
sammccall added a comment.

Ping - let me know if there's a more appropriate reviewer!


https://reviews.llvm.org/D25311



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


[PATCH] D25661: [Driver] Support obtaining active toolchain from gcc-config on Gentoo

2016-10-17 Thread Michał Górny via cfe-commits
mgorny added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1446-1463
+  // CURRENT=triple-version
+  if (Line.startswith("CURRENT=")) {
+const std::pair ActiveVersion =
+  Line.substr(8).rsplit('-');
+// Note: Strictly speaking, we should be reading
+// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
+// contain anything new or especially useful to us.

ABataev wrote:
> I think it is better to use `llvm::Triple` class here for parsing 
> `ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT` string rather than 
> `StringRef::split()`
This is not parsing the triple but detaching the version appended to it.


https://reviews.llvm.org/D25661



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


Re: r284383 - Return correct path from HexagonToolChain::getHexagonTargetDir

2016-10-17 Thread Benjamin Kramer via cfe-commits
And now the test fails everywhere, including the hexagon bot. Please fix.

On Mon, Oct 17, 2016 at 3:23 PM, Krzysztof Parzyszek via cfe-commits
 wrote:
> Author: kparzysz
> Date: Mon Oct 17 08:23:41 2016
> New Revision: 284383
>
> URL: http://llvm.org/viewvc/llvm-project?rev=284383&view=rev
> Log:
> Return correct path from HexagonToolChain::getHexagonTargetDir
>
> This problem was exposed by r284129, causing clang-hexagon-elf to fail
> clang tests.
>
> Modified:
> cfe/trunk/lib/Driver/ToolChains.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284383&r1=284382&r2=284383&view=diff
> ==
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 08:23:41 2016
> @@ -2970,7 +2970,7 @@ std::string HexagonToolChain::getHexagon
>if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
>  return InstallRelDir;
>
> -  return InstallRelDir;
> +  return InstalledDir;
>  }
>
>  Optional HexagonToolChain::getSmallDataThreshold(
>
>
> ___
> 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: r284382 - Revert "Reinstate r281429, reverted in r281452, with a fix for its mishandling of"

2016-10-17 Thread Vassil Vassilev via cfe-commits

I was just to commit a fix :(
On 17/10/16 15:00, Benjamin Kramer via cfe-commits wrote:

Author: d0k
Date: Mon Oct 17 08:00:44 2016
New Revision: 284382

URL: http://llvm.org/viewvc/llvm-project?rev=284382&view=rev
Log:
Revert "Reinstate r281429, reverted in r281452, with a fix for its mishandling 
of"

This reverts commit r284176. It still marks some modules as invisible
that should be visible. Will follow up with the author with a test case.

Removed:
 cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h
 cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h
 cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h
 cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap
 cfe/trunk/test/Modules/merge-var-template-def.cpp
Modified:
 cfe/trunk/include/clang/AST/ASTContext.h
 cfe/trunk/lib/AST/ASTContext.cpp
 cfe/trunk/lib/Serialization/ASTReader.cpp
 cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/a.h
 cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/b.h
 cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/c.h
 cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/d.h
 cfe/trunk/test/Modules/merge-template-pattern-visibility.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=284382&r1=284381&r2=284382&view=diff
==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Oct 17 08:00:44 2016
@@ -308,18 +308,10 @@ class ASTContext : public RefCountedBase
/// merged into.
llvm::DenseMap MergedDecls;
  
-  /// The modules into which a definition has been merged, or a map from a

-  /// merged definition to its canonical definition. This is really a union of
-  /// a NamedDecl* and a vector of Module*.
-  struct MergedModulesOrCanonicalDef {
-llvm::TinyPtrVector MergedModules;
-NamedDecl *CanonicalDef = nullptr;
-  };
-
/// \brief A mapping from a defining declaration to a list of modules (other
/// than the owning module of the declaration) that contain merged
/// definitions of that entity.
-  llvm::DenseMap MergedDefModules;
+  llvm::DenseMap> MergedDefModules;
  
/// \brief Initializers for a module, in order. Each Decl will be either

/// something that has a semantic effect on startup (such as a variable with
@@ -891,7 +883,6 @@ public:
/// and should be visible whenever \p M is visible.
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M,
   bool NotifyListeners = true);
-  void mergeDefinitionIntoModulesOf(NamedDecl *ND, NamedDecl *Other);
/// \brief Clean up the merged definition list. Call this if you might have
/// added duplicates into the list.
void deduplicateMergedDefinitonsFor(NamedDecl *ND);
@@ -902,9 +893,7 @@ public:
  auto MergedIt = MergedDefModules.find(Def);
  if (MergedIt == MergedDefModules.end())
return None;
-if (auto *CanonDef = MergedIt->second.CanonicalDef)
-  return getModulesWithMergedDefinition(CanonDef);
-return MergedIt->second.MergedModules;
+return MergedIt->second;
}
  
/// Add a declaration to the list of declarations that are initialized


Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=284382&r1=284381&r2=284382&view=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Oct 17 08:00:44 2016
@@ -888,74 +888,18 @@ void ASTContext::mergeDefinitionIntoModu
  if (auto *Listener = getASTMutationListener())
Listener->RedefinedHiddenDefinition(ND, M);
  
-  auto *Merged = &MergedDefModules[ND];

-  if (auto *CanonDef = Merged->CanonicalDef) {
-ND = CanonDef;
-Merged = &MergedDefModules[ND];
-  }
-  assert(!Merged->CanonicalDef && "canonical def not canonical");
-
-  Merged->MergedModules.push_back(M);
-
-  if (!getLangOpts().ModulesLocalVisibility)
+  if (getLangOpts().ModulesLocalVisibility)
+MergedDefModules[ND].push_back(M);
+  else
  ND->setHidden(false);
  }
  
-void ASTContext::mergeDefinitionIntoModulesOf(NamedDecl *Def,

-  NamedDecl *Other) {
-  // We need to know the owning module of the merge source.
-  assert(Other->isFromASTFile() && "merge of non-imported decl not supported");
-  assert(Def != Other && "merging definition into itself");
-
-  if (!Other->isHidden()) {
-Def->setHidden(false);
-return;
-  }
-
-  assert(Other->getImportedOwningModule() &&
- "hidden, imported declaration has no owning module");
-
-  // Mark Def as the canonical definition of merged definition Other.
-  {
-auto &OtherMerged = MergedDefModul

Re: r284382 - Revert "Reinstate r281429, reverted in r281452, with a fix for its mishandling of"

2016-10-17 Thread Benjamin Kramer via cfe-commits
Too slow ;)

Do you have the fix somewhere, so I can try it?

On Mon, Oct 17, 2016 at 4:38 PM, Vassil Vassilev  wrote:
> I was just to commit a fix :(
>
> On 17/10/16 15:00, Benjamin Kramer via cfe-commits wrote:
>>
>> Author: d0k
>> Date: Mon Oct 17 08:00:44 2016
>> New Revision: 284382
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=284382&view=rev
>> Log:
>> Revert "Reinstate r281429, reverted in r281452, with a fix for its
>> mishandling of"
>>
>> This reverts commit r284176. It still marks some modules as invisible
>> that should be visible. Will follow up with the author with a test case.
>>
>> Removed:
>>  cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h
>>  cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h
>>  cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h
>>  cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap
>>  cfe/trunk/test/Modules/merge-var-template-def.cpp
>> Modified:
>>  cfe/trunk/include/clang/AST/ASTContext.h
>>  cfe/trunk/lib/AST/ASTContext.cpp
>>  cfe/trunk/lib/Serialization/ASTReader.cpp
>>  cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/a.h
>>  cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/b.h
>>  cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/c.h
>>  cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/d.h
>>  cfe/trunk/test/Modules/merge-template-pattern-visibility.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/ASTContext.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=284382&r1=284381&r2=284382&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/AST/ASTContext.h (original)
>> +++ cfe/trunk/include/clang/AST/ASTContext.h Mon Oct 17 08:00:44 2016
>> @@ -308,18 +308,10 @@ class ASTContext : public RefCountedBase
>> /// merged into.
>> llvm::DenseMap MergedDecls;
>>   -  /// The modules into which a definition has been merged, or a map
>> from a
>> -  /// merged definition to its canonical definition. This is really a
>> union of
>> -  /// a NamedDecl* and a vector of Module*.
>> -  struct MergedModulesOrCanonicalDef {
>> -llvm::TinyPtrVector MergedModules;
>> -NamedDecl *CanonicalDef = nullptr;
>> -  };
>> -
>> /// \brief A mapping from a defining declaration to a list of modules
>> (other
>> /// than the owning module of the declaration) that contain merged
>> /// definitions of that entity.
>> -  llvm::DenseMap
>> MergedDefModules;
>> +  llvm::DenseMap>
>> MergedDefModules;
>>   /// \brief Initializers for a module, in order. Each Decl will be
>> either
>> /// something that has a semantic effect on startup (such as a
>> variable with
>> @@ -891,7 +883,6 @@ public:
>> /// and should be visible whenever \p M is visible.
>> void mergeDefinitionIntoModule(NamedDecl *ND, Module *M,
>>bool NotifyListeners = true);
>> -  void mergeDefinitionIntoModulesOf(NamedDecl *ND, NamedDecl *Other);
>> /// \brief Clean up the merged definition list. Call this if you might
>> have
>> /// added duplicates into the list.
>> void deduplicateMergedDefinitonsFor(NamedDecl *ND);
>> @@ -902,9 +893,7 @@ public:
>>   auto MergedIt = MergedDefModules.find(Def);
>>   if (MergedIt == MergedDefModules.end())
>> return None;
>> -if (auto *CanonDef = MergedIt->second.CanonicalDef)
>> -  return getModulesWithMergedDefinition(CanonDef);
>> -return MergedIt->second.MergedModules;
>> +return MergedIt->second;
>> }
>>   /// Add a declaration to the list of declarations that are
>> initialized
>>
>> Modified: cfe/trunk/lib/AST/ASTContext.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=284382&r1=284381&r2=284382&view=diff
>>
>> ==
>> --- cfe/trunk/lib/AST/ASTContext.cpp (original)
>> +++ cfe/trunk/lib/AST/ASTContext.cpp Mon Oct 17 08:00:44 2016
>> @@ -888,74 +888,18 @@ void ASTContext::mergeDefinitionIntoModu
>>   if (auto *Listener = getASTMutationListener())
>> Listener->RedefinedHiddenDefinition(ND, M);
>>   -  auto *Merged = &MergedDefModules[ND];
>> -  if (auto *CanonDef = Merged->CanonicalDef) {
>> -ND = CanonDef;
>> -Merged = &MergedDefModules[ND];
>> -  }
>> -  assert(!Merged->CanonicalDef && "canonical def not canonical");
>> -
>> -  Merged->MergedModules.push_back(M);
>> -
>> -  if (!getLangOpts().ModulesLocalVisibility)
>> +  if (getLangOpts().ModulesLocalVisibility)
>> +MergedDefModules[ND].push_back(M);
>> +  else
>>   ND->setHidden(false);
>>   }
>>   -void ASTContext::mergeDefinitionIntoModulesOf(NamedDecl *Def,
>> -  NamedDecl *Other) {
>> -  // We need to know the owning module of the merge source.
>> -  assert(

Re: r284382 - Revert "Reinstate r281429, reverted in r281452, with a fix for its mishandling of"

2016-10-17 Thread Vassil Vassilev via cfe-commits

On 17/10/16 16:40, Benjamin Kramer wrote:

Too slow ;)

Do you have the fix somewhere, so I can try it?

That would be https://reviews.llvm.org/D25678

Do you run into something else than what I have as a test case (merging 
templated constexpr variables)?


On Mon, Oct 17, 2016 at 4:38 PM, Vassil Vassilev  wrote:

I was just to commit a fix :(

On 17/10/16 15:00, Benjamin Kramer via cfe-commits wrote:

Author: d0k
Date: Mon Oct 17 08:00:44 2016
New Revision: 284382

URL: http://llvm.org/viewvc/llvm-project?rev=284382&view=rev
Log:
Revert "Reinstate r281429, reverted in r281452, with a fix for its
mishandling of"

This reverts commit r284176. It still marks some modules as invisible
that should be visible. Will follow up with the author with a test case.

Removed:
  cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h
  cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h
  cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h
  cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap
  cfe/trunk/test/Modules/merge-var-template-def.cpp
Modified:
  cfe/trunk/include/clang/AST/ASTContext.h
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/lib/Serialization/ASTReader.cpp
  cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/a.h
  cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/b.h
  cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/c.h
  cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/d.h
  cfe/trunk/test/Modules/merge-template-pattern-visibility.cpp

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=284382&r1=284381&r2=284382&view=diff

==
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Oct 17 08:00:44 2016
@@ -308,18 +308,10 @@ class ASTContext : public RefCountedBase
 /// merged into.
 llvm::DenseMap MergedDecls;
   -  /// The modules into which a definition has been merged, or a map
from a
-  /// merged definition to its canonical definition. This is really a
union of
-  /// a NamedDecl* and a vector of Module*.
-  struct MergedModulesOrCanonicalDef {
-llvm::TinyPtrVector MergedModules;
-NamedDecl *CanonicalDef = nullptr;
-  };
-
 /// \brief A mapping from a defining declaration to a list of modules
(other
 /// than the owning module of the declaration) that contain merged
 /// definitions of that entity.
-  llvm::DenseMap
MergedDefModules;
+  llvm::DenseMap>
MergedDefModules;
   /// \brief Initializers for a module, in order. Each Decl will be
either
 /// something that has a semantic effect on startup (such as a
variable with
@@ -891,7 +883,6 @@ public:
 /// and should be visible whenever \p M is visible.
 void mergeDefinitionIntoModule(NamedDecl *ND, Module *M,
bool NotifyListeners = true);
-  void mergeDefinitionIntoModulesOf(NamedDecl *ND, NamedDecl *Other);
 /// \brief Clean up the merged definition list. Call this if you might
have
 /// added duplicates into the list.
 void deduplicateMergedDefinitonsFor(NamedDecl *ND);
@@ -902,9 +893,7 @@ public:
   auto MergedIt = MergedDefModules.find(Def);
   if (MergedIt == MergedDefModules.end())
 return None;
-if (auto *CanonDef = MergedIt->second.CanonicalDef)
-  return getModulesWithMergedDefinition(CanonDef);
-return MergedIt->second.MergedModules;
+return MergedIt->second;
 }
   /// Add a declaration to the list of declarations that are
initialized

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=284382&r1=284381&r2=284382&view=diff

==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Oct 17 08:00:44 2016
@@ -888,74 +888,18 @@ void ASTContext::mergeDefinitionIntoModu
   if (auto *Listener = getASTMutationListener())
 Listener->RedefinedHiddenDefinition(ND, M);
   -  auto *Merged = &MergedDefModules[ND];
-  if (auto *CanonDef = Merged->CanonicalDef) {
-ND = CanonDef;
-Merged = &MergedDefModules[ND];
-  }
-  assert(!Merged->CanonicalDef && "canonical def not canonical");
-
-  Merged->MergedModules.push_back(M);
-
-  if (!getLangOpts().ModulesLocalVisibility)
+  if (getLangOpts().ModulesLocalVisibility)
+MergedDefModules[ND].push_back(M);
+  else
   ND->setHidden(false);
   }
   -void ASTContext::mergeDefinitionIntoModulesOf(NamedDecl *Def,
-  NamedDecl *Other) {
-  // We need to know the owning module of the merge source.
-  assert(Other->isFromASTFile() && "merge of non-imported decl not
supported");
-  assert(Def != Other

[PATCH] D25678: [modules] Do not report missing definitions of demoted constexpr variable templates.This is a followup to regression introduced in r284284.This should fix our libstdc++ modules builds.

2016-10-17 Thread Vassil Vassilev via cfe-commits
v.g.vassilev created this revision.
v.g.vassilev added reviewers: rsmith, bkramer.
v.g.vassilev added a subscriber: cfe-commits.
v.g.vassilev set the repository for this revision to rL LLVM.

Repository:
  rL LLVM

https://reviews.llvm.org/D25678

Files:
  lib/Sema/SemaDecl.cpp
  test/Modules/Inputs/merge-var-template-def/a.h
  test/Modules/Inputs/merge-var-template-def/b1.h
  test/Modules/Inputs/merge-var-template-def/b2.h
  test/Modules/merge-var-template-def.cpp


Index: test/Modules/merge-var-template-def.cpp
===
--- test/Modules/merge-var-template-def.cpp
+++ test/Modules/merge-var-template-def.cpp
@@ -1,7 +1,10 @@
 // RUN: rm -rf %t
-// RUN: %clang_cc1 -I%S/Inputs/merge-var-template-def -verify -fmodules 
-Werror=undefined-internal -fmodules-local-submodule-visibility 
-fmodules-cache-path=%t -fimplicit-module-maps %s
+// RUN: %clang_cc1 -I%S/Inputs/merge-var-template-def -std=c++11 -verify %s
+// RUN: %clang_cc1 -I%S/Inputs/merge-var-template-def -std=c++11 -verify 
-fmodules -Werror=undefined-internal -fmodules-local-submodule-visibility 
-fmodules-cache-path=%t -fimplicit-module-maps %s
 // expected-no-diagnostics
 
 #include "b2.h"
 namespace { struct X; }
 void *x = get();
+
+const bool *y = &S::value;
Index: test/Modules/Inputs/merge-var-template-def/b2.h
===
--- test/Modules/Inputs/merge-var-template-def/b2.h
+++ test/Modules/Inputs/merge-var-template-def/b2.h
@@ -3,4 +3,10 @@
 template struct A { static bool b; };
 template bool A::b = false;
 template void *get() { return &(A::b); }
+
+template
+struct S { static constexpr T value = v; };
+template
+constexpr T S::value;
+
 #endif
Index: test/Modules/Inputs/merge-var-template-def/b1.h
===
--- test/Modules/Inputs/merge-var-template-def/b1.h
+++ test/Modules/Inputs/merge-var-template-def/b1.h
@@ -3,5 +3,11 @@
 template struct A { static bool b; };
 template bool A::b = false;
 template void *get() { return &(A::b); }
+
+template
+struct S { static constexpr T value = v; };
+template
+constexpr T S::value;
+
 #include "a.h"
 #endif
Index: test/Modules/Inputs/merge-var-template-def/a.h
===
--- test/Modules/Inputs/merge-var-template-def/a.h
+++ test/Modules/Inputs/merge-var-template-def/a.h
@@ -3,4 +3,10 @@
 template struct A { static bool b; };
 template bool A::b = false;
 template void *get() { return &(A::b); }
+
+template
+struct S { static constexpr T value = v; };
+template
+constexpr T S::value;
+
 #endif
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -10124,7 +10124,10 @@
 // C++11 [dcl.constexpr]p1: The constexpr specifier shall be applied only 
to
 // the definition of a variable [...] or the declaration of a static data
 // member.
-if (Var->isConstexpr() && !Var->isThisDeclarationADefinition()) {
+if (Var->isConstexpr() && !Var->isThisDeclarationADefinition() &&
+!Var->isThisDeclarationADemotedDefinition()) {
+  assert(Var->isThisDeclarationADemotedDefinition() && 
getLangOpts().Modules
+ && "Demoting decls is only in the contest of modules!");
   if (Var->isStaticDataMember()) {
 // C++1z removes the relevant rule; the in-class declaration is always
 // a definition there.


Index: test/Modules/merge-var-template-def.cpp
===
--- test/Modules/merge-var-template-def.cpp
+++ test/Modules/merge-var-template-def.cpp
@@ -1,7 +1,10 @@
 // RUN: rm -rf %t
-// RUN: %clang_cc1 -I%S/Inputs/merge-var-template-def -verify -fmodules -Werror=undefined-internal -fmodules-local-submodule-visibility -fmodules-cache-path=%t -fimplicit-module-maps %s
+// RUN: %clang_cc1 -I%S/Inputs/merge-var-template-def -std=c++11 -verify %s
+// RUN: %clang_cc1 -I%S/Inputs/merge-var-template-def -std=c++11 -verify -fmodules -Werror=undefined-internal -fmodules-local-submodule-visibility -fmodules-cache-path=%t -fimplicit-module-maps %s
 // expected-no-diagnostics
 
 #include "b2.h"
 namespace { struct X; }
 void *x = get();
+
+const bool *y = &S::value;
Index: test/Modules/Inputs/merge-var-template-def/b2.h
===
--- test/Modules/Inputs/merge-var-template-def/b2.h
+++ test/Modules/Inputs/merge-var-template-def/b2.h
@@ -3,4 +3,10 @@
 template struct A { static bool b; };
 template bool A::b = false;
 template void *get() { return &(A::b); }
+
+template
+struct S { static constexpr T value = v; };
+template
+constexpr T S::value;
+
 #endif
Index: test/Modules/Inputs/merge-var-template-def/b1.h
===
--- test/Modules/Inputs/merge-var-template-def/b1.h
+++ test/Modules/In

r284389 - Revert r284383, while I figure out how to reproduce the failures locally

2016-10-17 Thread Krzysztof Parzyszek via cfe-commits
Author: kparzysz
Date: Mon Oct 17 09:47:29 2016
New Revision: 284389

URL: http://llvm.org/viewvc/llvm-project?rev=284389&view=rev
Log:
Revert r284383, while I figure out how to reproduce the failures locally

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284389&r1=284388&r2=284389&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 09:47:29 2016
@@ -2970,7 +2970,7 @@ std::string HexagonToolChain::getHexagon
   if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
 return InstallRelDir;
 
-  return InstalledDir;
+  return InstallRelDir;
 }
 
 Optional HexagonToolChain::getSmallDataThreshold(


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


[PATCH] D25606: alpha.core.UnreachableCode - don't warn about unreachable code inside macro

2016-10-17 Thread Daniel Marjamäki via cfe-commits
danielmarjamaki updated this revision to Diff 74849.
danielmarjamaki added a comment.

make pattern to avoid warnings more specific


Repository:
  rL LLVM

https://reviews.llvm.org/D25606

Files:
  lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
  test/Analysis/unreachable-code-path.c


Index: test/Analysis/unreachable-code-path.c
===
--- test/Analysis/unreachable-code-path.c
+++ test/Analysis/unreachable-code-path.c
@@ -206,3 +206,10 @@
   int x = inlineFunction(i);
   x && x < 10; // no-warning
 }
+
+// Don't warn in a macro
+#define RETURN(X)  do { return; } while (0)
+void macro(void) {
+  RETURN(1); // no-warning
+}
+
Index: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
@@ -147,6 +147,14 @@
 PathDiagnosticLocation DL;
 SourceLocation SL;
 if (const Stmt *S = getUnreachableStmt(CB)) {
+  // In macros, 'do {...} while (0)' is often used. Don't warn about the
+  // condition 0 when it is unreachable.
+  if (S->getLocStart().isMacroID())
+if (const auto *I = dyn_cast(S))
+  if (I->getValue() == 0ULL)
+if (const Stmt *Parent = PM->getParent(S))
+  if (isa(Parent))
+continue;
   SR = S->getSourceRange();
   DL = PathDiagnosticLocation::createBegin(S, B.getSourceManager(), LC);
   SL = DL.asLocation();


Index: test/Analysis/unreachable-code-path.c
===
--- test/Analysis/unreachable-code-path.c
+++ test/Analysis/unreachable-code-path.c
@@ -206,3 +206,10 @@
   int x = inlineFunction(i);
   x && x < 10; // no-warning
 }
+
+// Don't warn in a macro
+#define RETURN(X)  do { return; } while (0)
+void macro(void) {
+  RETURN(1); // no-warning
+}
+
Index: lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
+++ lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
@@ -147,6 +147,14 @@
 PathDiagnosticLocation DL;
 SourceLocation SL;
 if (const Stmt *S = getUnreachableStmt(CB)) {
+  // In macros, 'do {...} while (0)' is often used. Don't warn about the
+  // condition 0 when it is unreachable.
+  if (S->getLocStart().isMacroID())
+if (const auto *I = dyn_cast(S))
+  if (I->getValue() == 0ULL)
+if (const Stmt *Parent = PM->getParent(S))
+  if (isa(Parent))
+continue;
   SR = S->getSourceRange();
   DL = PathDiagnosticLocation::createBegin(S, B.getSourceManager(), LC);
   SL = DL.asLocation();
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D25621: DebugInfo: use DIAlignment type.

2016-10-17 Thread David Blaikie via cfe-commits
On Mon, Oct 17, 2016 at 4:37 AM Victor Leschuk 
wrote:

> vleschuk marked an inline comment as done.
> vleschuk added inline comments.
>
>
> 
> Comment at: include/clang/AST/ASTContext.h:83
>  uint64_t Width;
> -unsigned Align;
> +llvm::DIAlignment Align;
>  bool AlignIsRequired : 1;
> 
> aprantl wrote:
> > I'm not sure we want to use a debug info type inside the AST. I think we
> only want to use them in CGDebugInfo.cpp.
> We use TypeInfo and related functions heavily in CGDebugInfo.cpp, leaving
> this field as "unsigned" will make us to perform conversions from
> "unsigned" to llvm::DIAlignment, I think having this changed will result in
> simpler code.
>

It'd still be a layering violation to have AST depend on debug info
types/concepts. If it makes sense to change it to uint32_t in AST, that'd
probably be reasonable.

- Dave


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


Re: r284382 - Revert "Reinstate r281429, reverted in r281452, with a fix for its mishandling of"

2016-10-17 Thread Benjamin Kramer via cfe-commits
I'm running into something else and your patch doesn't fix it. It
boils down to 'std::is_nothrow_move_constructible' from libstdc++
not compiling because Foo is not visible inside the noexcept
specification of that template. I failed to come up with a small test
case so far as it involves at least 2 modules :[

On Mon, Oct 17, 2016 at 4:44 PM, Vassil Vassilev  wrote:
> On 17/10/16 16:40, Benjamin Kramer wrote:
>>
>> Too slow ;)
>>
>> Do you have the fix somewhere, so I can try it?
>
> That would be https://reviews.llvm.org/D25678
>
> Do you run into something else than what I have as a test case (merging
> templated constexpr variables)?
>
>>
>> On Mon, Oct 17, 2016 at 4:38 PM, Vassil Vassilev 
>> wrote:
>>>
>>> I was just to commit a fix :(
>>>
>>> On 17/10/16 15:00, Benjamin Kramer via cfe-commits wrote:

 Author: d0k
 Date: Mon Oct 17 08:00:44 2016
 New Revision: 284382

 URL: http://llvm.org/viewvc/llvm-project?rev=284382&view=rev
 Log:
 Revert "Reinstate r281429, reverted in r281452, with a fix for its
 mishandling of"

 This reverts commit r284176. It still marks some modules as invisible
 that should be visible. Will follow up with the author with a test case.

 Removed:
   cfe/trunk/test/Modules/Inputs/merge-var-template-def/a.h
   cfe/trunk/test/Modules/Inputs/merge-var-template-def/b1.h
   cfe/trunk/test/Modules/Inputs/merge-var-template-def/b2.h

 cfe/trunk/test/Modules/Inputs/merge-var-template-def/module.modulemap
   cfe/trunk/test/Modules/merge-var-template-def.cpp
 Modified:
   cfe/trunk/include/clang/AST/ASTContext.h
   cfe/trunk/lib/AST/ASTContext.cpp
   cfe/trunk/lib/Serialization/ASTReader.cpp

 cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/a.h

 cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/b.h

 cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/c.h

 cfe/trunk/test/Modules/Inputs/merge-template-pattern-visibility/d.h
   cfe/trunk/test/Modules/merge-template-pattern-visibility.cpp

 Modified: cfe/trunk/include/clang/AST/ASTContext.h
 URL:

 http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=284382&r1=284381&r2=284382&view=diff


 ==
 --- cfe/trunk/include/clang/AST/ASTContext.h (original)
 +++ cfe/trunk/include/clang/AST/ASTContext.h Mon Oct 17 08:00:44 2016
 @@ -308,18 +308,10 @@ class ASTContext : public RefCountedBase
  /// merged into.
  llvm::DenseMap MergedDecls;
-  /// The modules into which a definition has been merged, or a map
 from a
 -  /// merged definition to its canonical definition. This is really a
 union of
 -  /// a NamedDecl* and a vector of Module*.
 -  struct MergedModulesOrCanonicalDef {
 -llvm::TinyPtrVector MergedModules;
 -NamedDecl *CanonicalDef = nullptr;
 -  };
 -
  /// \brief A mapping from a defining declaration to a list of
 modules
 (other
  /// than the owning module of the declaration) that contain merged
  /// definitions of that entity.
 -  llvm::DenseMap
 MergedDefModules;
 +  llvm::DenseMap>
 MergedDefModules;
/// \brief Initializers for a module, in order. Each Decl will be
 either
  /// something that has a semantic effect on startup (such as a
 variable with
 @@ -891,7 +883,6 @@ public:
  /// and should be visible whenever \p M is visible.
  void mergeDefinitionIntoModule(NamedDecl *ND, Module *M,
 bool NotifyListeners = true);
 -  void mergeDefinitionIntoModulesOf(NamedDecl *ND, NamedDecl *Other);
  /// \brief Clean up the merged definition list. Call this if you
 might
 have
  /// added duplicates into the list.
  void deduplicateMergedDefinitonsFor(NamedDecl *ND);
 @@ -902,9 +893,7 @@ public:
auto MergedIt = MergedDefModules.find(Def);
if (MergedIt == MergedDefModules.end())
  return None;
 -if (auto *CanonDef = MergedIt->second.CanonicalDef)
 -  return getModulesWithMergedDefinition(CanonDef);
 -return MergedIt->second.MergedModules;
 +return MergedIt->second;
  }
/// Add a declaration to the list of declarations that are
 initialized

 Modified: cfe/trunk/lib/AST/ASTContext.cpp
 URL:

 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=284382&r1=284381&r2=284382&view=diff


 ==
 --- cfe/trunk/lib/AST/ASTContext.cpp (original)
 +++ cfe/trunk/lib/AST/ASTContext.cpp Mon Oct 17 08:00:44 2016
 @@ -888,74 +888,18 @@ void

Re: [clang-tools-extra] r284233 - [clang-move] Add header guard for the new header.

2016-10-17 Thread Haojian Wu via cfe-commits
Hello Tim,

Sorry for the trouble and delay (I missed this email previously).

I'm looking into it. Could you give me a link to the problematic buildbot?

On Mon, Oct 17, 2016 at 3:44 PM, Tim Northover 
wrote:

> On 14 October 2016 at 13:33, Tim Northover 
> wrote:
> > On 14 October 2016 at 06:01, Haojian Wu via cfe-commits
> >  wrote:
> >> +  std::string GuardName(FileName);
> >> +  if (IsHeader) {
> >> +std::replace(GuardName.begin(), GuardName.end(), '/', '_');
> >> +std::replace(GuardName.begin(), GuardName.end(), '.', '_');
> >> +std::replace(GuardName.begin(), GuardName.end(), '-', '_');
> >
> > I think this is causing problems with one of our bots that has an '@'
> > in a path it uses. In general it seems like a whitelist based on what
> > a C token is would be better than a blacklist of characters.
> >
> > Could you take a look?
>
> Ping.
>
> Tim.
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25547: [CodeGen][ObjC] Do not emit objc_storeStrong to initialize a constexpr variable

2016-10-17 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 74851.
ahatanak added a comment.

Simplify the code a bit more.


https://reviews.llvm.org/D25547

Files:
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGenObjCXX/arc-constexpr.mm

Index: test/CodeGenObjCXX/arc-constexpr.mm
===
--- /dev/null
+++ test/CodeGenObjCXX/arc-constexpr.mm
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -o - -std=c++11 %s | FileCheck %s
+
+// CHECK: %[[TYPE:[a-z0-9]+]] = type opaque
+// CHECK: @[[CFSTRING:[a-z0-9_]+]] = private global %struct.__NSConstantString_tag
+
+// CHECK: define void @_Z5test1v
+// CHECK:   %[[ALLOCA:[A-Z]+]] = alloca %[[TYPE]]*
+// CHECK:   %[[V0:[0-9]+]] = call i8* @objc_retain(i8* bitcast (%struct.__NSConstantString_tag* @[[CFSTRING]]
+// CHECK:   %[[V1:[0-9]+]] = bitcast i8* %[[V0]] to %[[TYPE]]*
+// CHECK:   store %[[TYPE]]* %[[V1]], %[[TYPE]]** %[[ALLOCA]]
+// CHECK:   %[[V2:[0-9]+]] = bitcast %[[TYPE]]** %[[ALLOCA]]
+// CHECK:   call void @objc_storeStrong(i8** %[[V2]], i8* null)
+
+@class NSString;
+
+void test1() {
+  constexpr NSString *S = @"abc";
+}
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -2118,7 +2118,6 @@
 
   void EmitScalarInit(const Expr *init, const ValueDecl *D, LValue lvalue,
   bool capturedByInit);
-  void EmitScalarInit(llvm::Value *init, LValue lvalue);
 
   typedef void SpecialInitFn(CodeGenFunction &Init, const VarDecl &D,
  llvm::Value *Address);
Index: lib/CodeGen/CGStmtOpenMP.cpp
===
--- lib/CodeGen/CGStmtOpenMP.cpp
+++ lib/CodeGen/CGStmtOpenMP.cpp
@@ -188,7 +188,7 @@
 auto *RefVal = TmpAddr.getPointer();
 TmpAddr = CGF.CreateMemTemp(RefType, Twine(Name) + ".ref");
 auto TmpLVal = CGF.MakeAddrLValue(TmpAddr, RefType);
-CGF.EmitScalarInit(RefVal, TmpLVal);
+CGF.EmitStoreThroughLValue(RValue::get(RefVal), TmpLVal, true);
   }
 
   return TmpAddr;
@@ -2179,7 +2179,7 @@
 llvm::Value *Init = nullptr) {
   auto LVal = CGF.MakeAddrLValue(CGF.CreateMemTemp(Ty, Name), Ty);
   if (Init)
-CGF.EmitScalarInit(Init, LVal);
+CGF.EmitStoreThroughLValue(RValue::get(Init), LVal, true);
   return LVal;
 }
 
Index: lib/CodeGen/CGObjC.cpp
===
--- lib/CodeGen/CGObjC.cpp
+++ lib/CodeGen/CGObjC.cpp
@@ -1662,7 +1662,7 @@
 elementLValue = EmitLValue(cast(S.getElement()));
 EmitStoreThroughLValue(RValue::get(CurrentItem), elementLValue);
   } else {
-EmitScalarInit(CurrentItem, elementLValue);
+EmitStoreThroughLValue(RValue::get(CurrentItem), elementLValue, true);
   }
 
   // If we do have an element variable, this assignment is the end of
Index: lib/CodeGen/CGExpr.cpp
===
--- lib/CodeGen/CGExpr.cpp
+++ lib/CodeGen/CGExpr.cpp
@@ -1629,16 +1629,27 @@
   break;
 
 case Qualifiers::OCL_Strong:
+  if (isInit) {
+Src = RValue::get(EmitARCRetain(Dst.getType(), Src.getScalarVal()));
+break;
+  }
   EmitARCStoreStrong(Dst, Src.getScalarVal(), /*ignore*/ true);
   return;
 
 case Qualifiers::OCL_Weak:
-  EmitARCStoreWeak(Dst.getAddress(), Src.getScalarVal(), /*ignore*/ true);
+  if (isInit)
+// Initialize and then skip the primitive store.
+EmitARCInitWeak(Dst.getAddress(), Src.getScalarVal());
+  else
+EmitARCStoreWeak(Dst.getAddress(), Src.getScalarVal(), /*ignore*/ true);
   return;
 
 case Qualifiers::OCL_Autoreleasing:
-  Src = RValue::get(EmitObjCExtendObjectLifetime(Dst.getType(),
- Src.getScalarVal()));
+  if (isInit)
+Src = RValue::get(EmitARCRetainAutorelease(Dst.getType(), Src.getScalarVal()));
+  else
+Src = RValue::get(EmitObjCExtendObjectLifetime(Dst.getType(),
+   Src.getScalarVal()));
   // fall into the normal path
   break;
 }
Index: lib/CodeGen/CGDecl.cpp
===
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -774,37 +774,6 @@
   EmitStoreOfScalar(value, lvalue, /* isInitialization */ true);
 }
 
-/// EmitScalarInit - Initialize the given lvalue with the given object.
-void CodeGenFunction::EmitScalarInit(llvm::Value *init, LValue lvalue) {
-  Qualifiers::ObjCLifetime lifetime = lvalue.getObjCLifetime();
-  if (!lifetime)
-return EmitStoreThroughLValue(RValue::get(init), lvalue, true);
-
-  switch (lifetime) {
-  case Qualifiers::OCL_None:
-llvm_unreachable(

Re: r284187 - Fix bogus assert breaking modules self-host.

2016-10-17 Thread David Blaikie via cfe-commits
Not worth/reasonable to have a test case?

On Thu, Oct 13, 2016 at 7:44 PM Richard Smith via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: rsmith
> Date: Thu Oct 13 21:35:11 2016
> New Revision: 284187
>
> URL: http://llvm.org/viewvc/llvm-project?rev=284187&view=rev
> Log:
> Fix bogus assert breaking modules self-host.
>
> Modified:
> cfe/trunk/lib/AST/ASTContext.cpp
>
> Modified: cfe/trunk/lib/AST/ASTContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=284187&r1=284186&r2=284187&view=diff
>
> ==
> --- cfe/trunk/lib/AST/ASTContext.cpp (original)
> +++ cfe/trunk/lib/AST/ASTContext.cpp Thu Oct 13 21:35:11 2016
> @@ -907,11 +907,13 @@ void ASTContext::mergeDefinitionIntoModu
>assert(Other->isFromASTFile() && "merge of non-imported decl not
> supported");
>assert(Def != Other && "merging definition into itself");
>
> -  if (!getLangOpts().ModulesLocalVisibility && !Other->isHidden())
> +  if (!Other->isHidden()) {
>  Def->setHidden(false);
> -  else
> -assert(Other->getImportedOwningModule() &&
> -   "hidden, imported declaration has no owning module");
> +return;
> +  }
> +
> +  assert(Other->getImportedOwningModule() &&
> + "hidden, imported declaration has no owning module");
>
>// Mark Def as the canonical definition of merged definition Other.
>{
>
>
> ___
> 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


[clang-tools-extra] r284391 - [clang-move] Fix generating illegal header guard.

2016-10-17 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Mon Oct 17 10:26:34 2016
New Revision: 284391

URL: http://llvm.org/viewvc/llvm-project?rev=284391&view=rev
Log:
[clang-move] Fix generating illegal header guard.

The filepath might contain some characters (i.e. '@') which are not
illegal in c identifiers. This patch changes all non-alphanumeric characters
to '_'.

Modified:
clang-tools-extra/trunk/clang-move/ClangMove.cpp

Modified: clang-tools-extra/trunk/clang-move/ClangMove.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-move/ClangMove.cpp?rev=284391&r1=284390&r2=284391&view=diff
==
--- clang-tools-extra/trunk/clang-move/ClangMove.cpp (original)
+++ clang-tools-extra/trunk/clang-move/ClangMove.cpp Mon Oct 17 10:26:34 2016
@@ -233,10 +233,10 @@ createInsertedReplacements(const std::ve
   std::string NewCode;
   std::string GuardName(FileName);
   if (IsHeader) {
-std::replace(GuardName.begin(), GuardName.end(), '/', '_');
-std::replace(GuardName.begin(), GuardName.end(), '.', '_');
-std::replace(GuardName.begin(), GuardName.end(), '-', '_');
-
+for (size_t i = 0; i < GuardName.size(); ++i) {
+  if (!isAlphanumeric(GuardName[i]))
+GuardName[i] = '_';
+}
 GuardName = StringRef(GuardName).upper();
 NewCode += "#ifndef " + GuardName + "\n";
 NewCode += "#define " + GuardName + "\n";


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


r284392 - Reapply r284383. The test failures were due to a missing dir in test/

2016-10-17 Thread Krzysztof Parzyszek via cfe-commits
Author: kparzysz
Date: Mon Oct 17 10:30:10 2016
New Revision: 284392

URL: http://llvm.org/viewvc/llvm-project?rev=284392&view=rev
Log:
Reapply r284383. The test failures were due to a missing dir in test/

Added:
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284392&r1=284391&r2=284392&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 10:30:10 2016
@@ -2970,7 +2970,7 @@ std::string HexagonToolChain::getHexagon
   if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
 return InstallRelDir;
 
-  return InstallRelDir;
+  return InstalledDir;
 }
 
 Optional HexagonToolChain::getSmallDataThreshold(


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


Re: [clang-tools-extra] r284233 - [clang-move] Add header guard for the new header.

2016-10-17 Thread Haojian Wu via cfe-commits
Should be fixed in r284391.

On Mon, Oct 17, 2016 at 4:59 PM, Haojian Wu  wrote:

> Hello Tim,
>
> Sorry for the trouble and delay (I missed this email previously).
>
> I'm looking into it. Could you give me a link to the problematic buildbot?
>
> On Mon, Oct 17, 2016 at 3:44 PM, Tim Northover 
> wrote:
>
>> On 14 October 2016 at 13:33, Tim Northover 
>> wrote:
>> > On 14 October 2016 at 06:01, Haojian Wu via cfe-commits
>> >  wrote:
>> >> +  std::string GuardName(FileName);
>> >> +  if (IsHeader) {
>> >> +std::replace(GuardName.begin(), GuardName.end(), '/', '_');
>> >> +std::replace(GuardName.begin(), GuardName.end(), '.', '_');
>> >> +std::replace(GuardName.begin(), GuardName.end(), '-', '_');
>> >
>> > I think this is causing problems with one of our bots that has an '@'
>> > in a path it uses. In general it seems like a whitelist based on what
>> > a C token is would be better than a blacklist of characters.
>> >
>> > Could you take a look?
>>
>> Ping.
>>
>> Tim.
>>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25669: [Driver] Simplify ToolChain::GetCXXStdlibType (NFC)

2016-10-17 Thread Michał Górny via cfe-commits
mgorny added a comment.

Thanks for working on this. Your code is much cleaner ;-).




Comment at: lib/Driver/ToolChain.cpp:553
 
-  // If no argument was provided or its value was invalid, look for the
-  // default unless forced or configured to take the platform default.
-  if (!HasValidType && (ForcePlatformDefault ||
-  !ParseCXXStdlibType(CLANG_DEFAULT_CXX_STDLIB, Type)))
-Type = GetDefaultCXXStdlibType();
+  // "platform" is only used in tests to override CLANG_DEFAULT_CXX_STDLIB
+  if (LibName == "libc++")

ABataev wrote:
> I believe you can use StringSwitch here
I think you are changing the meaning of this comment. The original sounded like 
a request not to use this type anywhere else. Your version only explains where 
it's used (right now).


https://reviews.llvm.org/D25669



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


[PATCH] D25661: [Driver] Support obtaining active toolchain from gcc-config on Gentoo

2016-10-17 Thread Michał Górny via cfe-commits
mgorny updated this revision to Diff 74855.
mgorny added a comment.

Updated to use range-based for loop as suggested by @ABataev.


https://reviews.llvm.org/D25661

Files:
  lib/Driver/ToolChains.cpp
  
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/gcc/config-x86_64-pc-linux-gnu
  
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/gcc/x86_64-pc-linux-gnu-4.9.3
  test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/gentoo-release
  test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/include/.keep
  
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbegin.o
  
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/include/g++-v4.9.3/.keep
  
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/crtbegin.o
  
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/include/g++-v5.4.0/.keep
  
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/usr/x86_64-pc-linux-gnu/lib/.keep
  test/Driver/linux-header-search.cpp


Index: test/Driver/linux-header-search.cpp
===
--- test/Driver/linux-header-search.cpp
+++ test/Driver/linux-header-search.cpp
@@ -301,6 +301,15 @@
 // CHECK-GENTOO-4-9-3: "-internal-externc-isystem" "[[SYSROOT]]/include"
 // CHECK-GENTOO-4-9-3: "-internal-externc-isystem" "[[SYSROOT]]/usr/include"
 //
+// Test support for Gentoo's gcc-config -- clang should prefer the older
+// (4.9.3) version over the newer (5.4.0) due to preference specified
+// in /etc/env.d/gcc/x86_64-pc-linux-gnu.
+// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
+// RUN: -target x86_64-unknown-linux-gnu -stdlib=libstdc++ \
+// RUN: --sysroot=%S/Inputs/gentoo_linux_gcc_multi_version_tree \
+// RUN: --gcc-toolchain="" \
+// RUN:   | FileCheck --check-prefix=CHECK-GENTOO-4-9-3 %s
+//
 // Check header search on Debian 6 / MIPS64
 // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \
 // RUN: -target mips64-unknown-linux-gnuabi64 -stdlib=libstdc++ \
Index: test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/gentoo-release
===
--- /dev/null
+++ test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/gentoo-release
@@ -0,0 +1 @@
+Gentoo Base System release 2.3
Index: 
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/gcc/x86_64-pc-linux-gnu-4.9.3
===
--- /dev/null
+++ 
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/gcc/x86_64-pc-linux-gnu-4.9.3
@@ -0,0 +1,10 @@
+PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.3"
+ROOTPATH="/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.3"
+GCC_PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.3"
+LDPATH="/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3:/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32"
+MANPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.3/man"
+INFOPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/4.9.3/info"
+STDCXX_INCDIR="g++-v4"
+CTARGET="x86_64-pc-linux-gnu"
+GCC_SPECS=""
+MULTIOSDIRS="../lib64:../lib32"
Index: 
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/gcc/config-x86_64-pc-linux-gnu
===
--- /dev/null
+++ 
test/Driver/Inputs/gentoo_linux_gcc_multi_version_tree/etc/env.d/gcc/config-x86_64-pc-linux-gnu
@@ -0,0 +1 @@
+CURRENT=x86_64-pc-linux-gnu-4.9.3
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1430,6 +1430,43 @@
 }
   }
 
+  // Try to respect gcc-config on Gentoo. However, do that only
+  // if --gcc-toolchain is not provided or equal to the Gentoo install
+  // in /usr. This avoids accidentally enforcing the system GCC version
+  // when using a custom toolchain.
+  if (GCCToolchainDir == "" || GCCToolchainDir == D.SysRoot + "/usr") {
+for (const StringRef& CandidateTriple : CandidateTripleAliases) {
+  llvm::ErrorOr> File =
+  D.getVFS().getBufferForFile(D.SysRoot + "/etc/env.d/gcc/config-" +
+  CandidateTriple.str());
+  if (File) {
+SmallVector Lines;
+File.get()->getBuffer().split(Lines, "\n");
+for (const StringRef& Line : Lines) {
+  // CURRENT=triple-version
+  if (Line.startswith("CURRENT=")) {
+const std::pair ActiveVersion =
+  Line.substr(8).rsplit('-');
+// Note: Strictly speaking, we should be reading
+// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
+// contain anything new or especially useful to us.
+const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" +
+   ActiveVersion.first.str() + "/" +

[PATCH] D25661: [Driver] Support obtaining active toolchain from gcc-config on Gentoo

2016-10-17 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1446-1463
+  // CURRENT=triple-version
+  if (Line.startswith("CURRENT=")) {
+const std::pair ActiveVersion =
+  Line.substr(8).rsplit('-');
+// Note: Strictly speaking, we should be reading
+// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
+// contain anything new or especially useful to us.

mgorny wrote:
> ABataev wrote:
> > I think it is better to use `llvm::Triple` class here for parsing 
> > `ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT` string rather than 
> > `StringRef::split()`
> This is not parsing the triple but detaching the version appended to it.
But still it is better to use some standard infrastructure rather than 
inventing a new one (with possible bugs, incompatibilities etc.) 


https://reviews.llvm.org/D25661



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


Re: [clang-tools-extra] r284233 - [clang-move] Add header guard for the new header.

2016-10-17 Thread Tim Northover via cfe-commits
On 17 October 2016 at 08:36, Haojian Wu  wrote:
> Sorry for the trouble and delay (I missed this email previously).

No worries. I thought that might be what had happened, the weekend
deluge can hide anything.

> Should be fixed in r284391.

Thanks.

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


Re: r284137 - [ThinLTO] Update doc to include lld (now supported).

2016-10-17 Thread Rui Ueyama via cfe-commits
Agreed. We should define them as aliases to existing options without
-plugin-opt.

On Sun, Oct 16, 2016 at 6:43 PM, Sean Silva via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Nice to see this land!
>
> One nit:
> Currently, doesn't LLD/ELF ignore -plugin-opt? That will mean that if a
> user uses the "gold syntax" then LLD will silently ignore it, which isn't
> good. At the very least, can we issue an error if we see `-plugin-opt
> jobs=N` and suggest the LLD spelling?
>
> Or maybe just accept the gold syntax? Our current handling of `-plugin`
> and `-plugin-opt` is intended to make LLD transparently Do The Right Thing
> when LLD is invoked as if it were gold, so clearly gold compatibility is
> important enough for that. This suggests it is important enough to be
> compatible from a ThinLTO perspective too.
>
> -- Sean Silva
>
> On Thu, Oct 13, 2016 at 10:42 AM, Davide Italiano via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: davide
>> Date: Thu Oct 13 12:42:38 2016
>> New Revision: 284137
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=284137&view=rev
>> Log:
>> [ThinLTO] Update doc to include lld (now supported).
>>
>> Differential Revision:  https://reviews.llvm.org/D25537
>>
>> Modified:
>> cfe/trunk/docs/ThinLTO.rst
>>
>> Modified: cfe/trunk/docs/ThinLTO.rst
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ThinLTO.
>> rst?rev=284137&r1=284136&r2=284137&view=diff
>> 
>> ==
>> --- cfe/trunk/docs/ThinLTO.rst (original)
>> +++ cfe/trunk/docs/ThinLTO.rst Thu Oct 13 12:42:38 2016
>> @@ -62,8 +62,8 @@ ThinLTO is currently supported for the f
>>`_.
>>  - **ld64**:
>>Starting with `Xcode 8 `_.
>> -
>> -Additionally, support is being added to the *lld* linker.
>> +- **lld**:
>> +  Starting with r284050 (ELF only).
>>
>>  Usage
>>  =
>> @@ -109,6 +109,8 @@ be reduced to ``N`` via:
>>``-Wl,-plugin-opt,jobs=N``
>>  - ld64:
>>``-Wl,-mllvm,-threads=N``
>> +- lld:
>> +  ``-Wl,--thinlto-jobs=N``
>>
>>  Incremental
>>  ---
>>
>>
>> ___
>> 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
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-17 Thread Krzysztof Parzyszek via cfe-commits
kparzysz added a comment.

I committed https://reviews.llvm.org/rL284383 and the Hexagon bot is passing 
now. (The patch was reverted, but then it was recommitted.)


https://reviews.llvm.org/D25597



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


Re: [libcxx] r284214 - XFAIL aligned allocation tests for older Clang versions

2016-10-17 Thread Nico Weber via cfe-commits
Looks like things are still unexpectedly passing at r284389 on macOS (but
we currently only build and test libc++ on macOS, so maybe it's broken
elsewhere too).

https://codereview.chromium.org/2429533002/
https://build.chromium.org/p/tryserver.chromium.mac/builders/mac_upload_clang/builds/106/steps/package%20clang/logs/stdio

Unexpected Passing Tests (4):
libc++ ::
std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
libc++ ::
std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
libc++ ::
std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
libc++ ::
std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp

On Sun, Oct 16, 2016 at 9:42 PM, Nico Weber  wrote:

> See the Mac bot here: https://codereview.chromium.org/2416293003/ ->
> https://build.chromium.org/p/tryserver.chromium.mac/
> builders/mac_upload_clang/builds/105/steps/package%20clang/logs/stdio
> I think that bot uses Xcode 8's compiler. I haven't tried again since 2
> days ago.
>
> On Sat, Oct 15, 2016 at 4:08 PM, Eric Fiselier  wrote:
>
>> Hi Nico,
>>
>> Are these tests still broken for you?
>>
>> /Eric
>>
>> On Fri, Oct 14, 2016 at 3:21 PM, Eric Fiselier  wrote:
>>
>>> Hi Nico,
>>>
>>> Could you give me more information about the compiler your using?
>>>
>>> /Eric
>>>
>>> On Fri, Oct 14, 2016 at 1:21 PM, Nico Weber  wrote:
>>>
 This is breaking tests for me:

 Unexpected Passing Tests (4):
 libc++ :: std/language.support/support.d
 ynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
 libc++ :: std/language.support/support.d
 ynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
 libc++ :: std/language.support/support.d
 ynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
 libc++ :: std/language.support/support.d
 ynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp

 Am I holding something wrong, or are these XFAILs wrong?

 On Fri, Oct 14, 2016 at 4:47 AM, Eric Fiselier via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Author: ericwf
> Date: Fri Oct 14 03:47:09 2016
> New Revision: 284214
>
> URL: http://llvm.org/viewvc/llvm-project?rev=284214&view=rev
> Log:
> XFAIL aligned allocation tests for older Clang versions
>
> Modified:
> libcxx/trunk/test/libcxx/test/config.py
> libcxx/trunk/test/std/language.support/support.dynamic/new.d
> elete/new.delete.array/new_align_val_t.pass.cpp
> libcxx/trunk/test/std/language.support/support.dynamic/new.d
> elete/new.delete.array/new_align_val_t_nothrow.pass.cpp
> libcxx/trunk/test/std/language.support/support.dynamic/new.d
> elete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
> libcxx/trunk/test/std/language.support/support.dynamic/new.d
> elete/new.delete.array/new_align_val_t_replace.pass.cpp
> libcxx/trunk/test/std/language.support/support.dynamic/new.d
> elete/new.delete.single/new_align_val_t.pass.cpp
> libcxx/trunk/test/std/language.support/support.dynamic/new.d
> elete/new.delete.single/new_align_val_t_nothrow.pass.cpp
> libcxx/trunk/test/std/language.support/support.dynamic/new.d
> elete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
> libcxx/trunk/test/std/language.support/support.dynamic/new.d
> elete/new.delete.single/new_align_val_t_replace.pass.cpp
>
> Modified: libcxx/trunk/test/libcxx/test/config.py
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx
> /test/config.py?rev=284214&r1=284213&r2=284214&view=diff
> 
> ==
> --- libcxx/trunk/test/libcxx/test/config.py (original)
> +++ libcxx/trunk/test/libcxx/test/config.py Fri Oct 14 03:47:09 2016
> @@ -315,6 +315,10 @@ class Configuration(object):
>
>  if self.cxx.hasCompileFlag('-faligned-allocation'):
>  self.config.available_feature
> s.add('-faligned-allocation')
> +else:
> +# FIXME remove this once more than just clang-4.0 support
> +# C++17 aligned allocation.
> +self.config.available_features
> .add('no-aligned-allocation')
>
>  if self.get_lit_bool('has_libatomic', False):
>  self.config.available_features.add('libatomic')
>
> Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.d
> elete/new.delete.array/new_align_val_t.pass.cpp
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/la
> nguage.support/support.dynamic/new.delete/new.delete.array/n
> ew_align_val_t.pass.cpp?rev=284214&r1=284213&r2=284214&view=diff
> =

[PATCH] D25661: [Driver] Support obtaining active toolchain from gcc-config on Gentoo

2016-10-17 Thread Michał Górny via cfe-commits
mgorny added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1446-1463
+  // CURRENT=triple-version
+  if (Line.startswith("CURRENT=")) {
+const std::pair ActiveVersion =
+  Line.substr(8).rsplit('-');
+// Note: Strictly speaking, we should be reading
+// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
+// contain anything new or especially useful to us.

ABataev wrote:
> mgorny wrote:
> > ABataev wrote:
> > > I think it is better to use `llvm::Triple` class here for parsing 
> > > `ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT` string rather than 
> > > `StringRef::split()`
> > This is not parsing the triple but detaching the version appended to it.
> But still it is better to use some standard infrastructure rather than 
> inventing a new one (with possible bugs, incompatibilities etc.) 
I still don't understand what you want me to do. `llvm::Triple` does not 
support triple + version thingy that is the case here. I don't need to parse 
the triple, just split the version out of it.


https://reviews.llvm.org/D25661



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


[PATCH] D25661: [Driver] Support obtaining active toolchain from gcc-config on Gentoo

2016-10-17 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1446-1463
+  // CURRENT=triple-version
+  if (Line.startswith("CURRENT=")) {
+const std::pair ActiveVersion =
+  Line.substr(8).rsplit('-');
+// Note: Strictly speaking, we should be reading
+// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
+// contain anything new or especially useful to us.

mgorny wrote:
> ABataev wrote:
> > mgorny wrote:
> > > ABataev wrote:
> > > > I think it is better to use `llvm::Triple` class here for parsing 
> > > > `ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT` string rather than 
> > > > `StringRef::split()`
> > > This is not parsing the triple but detaching the version appended to it.
> > But still it is better to use some standard infrastructure rather than 
> > inventing a new one (with possible bugs, incompatibilities etc.) 
> I still don't understand what you want me to do. `llvm::Triple` does not 
> support triple + version thingy that is the case here. I don't need to parse 
> the triple, just split the version out of it.
Can you use Triple::getEnvironmentVersion()?


https://reviews.llvm.org/D25661



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


[PATCH] D23745: [cmake] Update lit search to match the one in LLVM

2016-10-17 Thread Michał Górny via cfe-commits
mgorny added a reviewer: beanz.
mgorny added a comment.

A gentle ping here.


https://reviews.llvm.org/D23745



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


[PATCH] D25621: DebugInfo: use DIAlignment type.

2016-10-17 Thread Victor Leschuk via cfe-commits
vleschuk marked an inline comment as done.
vleschuk added inline comments.



Comment at: include/clang/AST/ASTContext.h:83
 uint64_t Width;
-unsigned Align;
+llvm::DIAlignment Align;
 bool AlignIsRequired : 1;

vleschuk wrote:
> aprantl wrote:
> > I'm not sure we want to use a debug info type inside the AST. I think we 
> > only want to use them in CGDebugInfo.cpp.
> We use TypeInfo and related functions heavily in CGDebugInfo.cpp, leaving 
> this field as "unsigned" will make us to perform conversions from "unsigned" 
> to llvm::DIAlignment, I think having this changed will result in simpler code.
@dblaikie wrote:
> It'd still be a layering violation to have AST depend on debug info 
> types/concepts. If it makes sense to change it to uint32_t in AST, that'd 
> probably be reasonable.

We are discussing the possibility of changing this to "unsigned" in 
https://reviews.llvm.org/D25620, after we come to consensus I'll update both 
patches. Thanks for the advice, I agree that using DebugInfo types in AST was a 
bad idea. 



https://reviews.llvm.org/D25621



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


[PATCH] D25661: [Driver] Support obtaining active toolchain from gcc-config on Gentoo

2016-10-17 Thread Michał Górny via cfe-commits
mgorny added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1446-1463
+  // CURRENT=triple-version
+  if (Line.startswith("CURRENT=")) {
+const std::pair ActiveVersion =
+  Line.substr(8).rsplit('-');
+// Note: Strictly speaking, we should be reading
+// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
+// contain anything new or especially useful to us.

ABataev wrote:
> mgorny wrote:
> > ABataev wrote:
> > > mgorny wrote:
> > > > ABataev wrote:
> > > > > I think it is better to use `llvm::Triple` class here for parsing 
> > > > > `ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT` string rather than 
> > > > > `StringRef::split()`
> > > > This is not parsing the triple but detaching the version appended to it.
> > > But still it is better to use some standard infrastructure rather than 
> > > inventing a new one (with possible bugs, incompatibilities etc.) 
> > I still don't understand what you want me to do. `llvm::Triple` does not 
> > support triple + version thingy that is the case here. I don't need to 
> > parse the triple, just split the version out of it.
> Can you use Triple::getEnvironmentVersion()?
No. This is not embedded in environment field but used as a separate component 
following it. Triple class doesn't cover it at all.


https://reviews.llvm.org/D25661



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


Re: [libcxx] r284214 - XFAIL aligned allocation tests for older Clang versions

2016-10-17 Thread Tim Northover via cfe-commits
On 17 October 2016 at 09:11, Nico Weber via cfe-commits
 wrote:
> Looks like things are still unexpectedly passing at r284389 on macOS (but we
> currently only build and test libc++ on macOS, so maybe it's broken
> elsewhere too).

Green dragon is showing similar failures:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-globalisel_check/4423/console,
though it claims to be using Xcode 7. I'll check how accurate that is
and run tests with libcxx locally too.

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


[PATCH] D25258: [coroutines] Create allocation and deallocation sub-statements.

2016-10-17 Thread Gor Nishanov via cfe-commits
GorNishanov added a comment.

friendly ping


https://reviews.llvm.org/D25258



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


[PATCH] D25349: [coroutines] Build fallthrough and set_exception statements.

2016-10-17 Thread Gor Nishanov via cfe-commits
GorNishanov added a comment.

@rsmith, I am wondering what were your thoughts on where to generate try { body 
} catch (...) { p.set_exception(std::exception()); }

Would it be in SemaCoroutine.cpp? Essentially, add something like this:

  `
bool makeBody() {
  if (!OnException)
return true;
  
  StmtResult CatchBlock = S.ActOnCXXCatchBlock(Loc, nullptr, OnException);
  if (CatchBlock.isInvalid())
return false;
  
  StmtResult TryBlock = S.ActOnCXXTryBlock(Loc, Body, {CatchBlock.get()});
  if (TryBlock.isInvalid())
return false;
  
  Body = TryBlock.get();
  
  return true;
}
  `


https://reviews.llvm.org/D25349



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


[PATCH] D25661: [Driver] Support obtaining active toolchain from gcc-config on Gentoo

2016-10-17 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.



Comment at: lib/Driver/ToolChains.cpp:1446-1463
+  // CURRENT=triple-version
+  if (Line.startswith("CURRENT=")) {
+const std::pair ActiveVersion =
+  Line.substr(8).rsplit('-');
+// Note: Strictly speaking, we should be reading
+// /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
+// contain anything new or especially useful to us.

mgorny wrote:
> ABataev wrote:
> > mgorny wrote:
> > > ABataev wrote:
> > > > mgorny wrote:
> > > > > ABataev wrote:
> > > > > > I think it is better to use `llvm::Triple` class here for parsing 
> > > > > > `ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT` string rather 
> > > > > > than `StringRef::split()`
> > > > > This is not parsing the triple but detaching the version appended to 
> > > > > it.
> > > > But still it is better to use some standard infrastructure rather than 
> > > > inventing a new one (with possible bugs, incompatibilities etc.) 
> > > I still don't understand what you want me to do. `llvm::Triple` does not 
> > > support triple + version thingy that is the case here. I don't need to 
> > > parse the triple, just split the version out of it.
> > Can you use Triple::getEnvironmentVersion()?
> No. This is not embedded in environment field but used as a separate 
> component following it. Triple class doesn't cover it at all.
Ok


https://reviews.llvm.org/D25661



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


Re: [PATCH] D21508: Make friend function template definition available if class is instantiated.

2016-10-17 Thread Serge Pavlov via cfe-commits
Ping.

Thanks,
--Serge

2016-10-13 11:51 GMT+07:00 Serge Pavlov :

> sepavloff updated the summary for this revision.
>
> https://reviews.llvm.org/D21508
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25597: Try to fix buildbot failure in VirtualFileSystem caused by r284129.

2016-10-17 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.

Nice! Thanks


https://reviews.llvm.org/D25597



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


[PATCH] D25450: [clang-tidy] Fix identifier naming in macro args.

2016-10-17 Thread Jason Henline via cfe-commits
jhen added a comment.

Adding arron.ballman as a reviewer as alexfh seems to be on leave for a few 
weeks.


https://reviews.llvm.org/D25450



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


[clang-tools-extra] r284399 - [clang-tidy] Clean up code after applying replacements.

2016-10-17 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Mon Oct 17 12:25:02 2016
New Revision: 284399

URL: http://llvm.org/viewvc/llvm-project?rev=284399&view=rev
Log:
[clang-tidy] Clean up code after applying replacements.

Summary:
Remove empty namespaces and initializer list commas / colons in
affected ranges. Initial patch: proper options for enabling the cleanup and
specifying the format style are needed.

Reviewers: hokein, ioeric

Subscribers: beanz, mgorny, cfe-commits

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

Added:
clang-tools-extra/trunk/test/clang-tidy/clean-up-code.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
clang-tools-extra/trunk/test/clang-tidy/fix.cpp

clang-tools-extra/trunk/test/clang-tidy/google-readability-namespace-comments.cpp

Modified: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/CMakeLists.txt?rev=284399&r1=284398&r2=284399&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt Mon Oct 17 12:25:02 2016
@@ -15,6 +15,7 @@ add_clang_library(clangTidy
   clangAST
   clangASTMatchers
   clangBasic
+  clangFormat
   clangFrontend
   clangLex
   clangRewrite

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp?rev=284399&r1=284398&r2=284399&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp Mon Oct 17 12:25:02 2016
@@ -22,6 +22,7 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Format/Format.h"
 #include "clang/Frontend/ASTConsumers.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
@@ -101,9 +102,8 @@ public:
 DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), &*DiagOpts)),
 Diags(IntrusiveRefCntPtr(new DiagnosticIDs), &*DiagOpts,
   DiagPrinter),
-SourceMgr(Diags, Files), Rewrite(SourceMgr, LangOpts),
-ApplyFixes(ApplyFixes), TotalFixes(0), AppliedFixes(0),
-WarningsAsErrors(0) {
+SourceMgr(Diags, Files), ApplyFixes(ApplyFixes), TotalFixes(0),
+AppliedFixes(0), WarningsAsErrors(0) {
 DiagOpts->ShowColors = llvm::sys::Process::StandardOutHasColors();
 DiagPrinter->BeginSourceFile(LangOpts);
   }
@@ -127,31 +127,58 @@ public:
   auto Diag = Diags.Report(Loc, Diags.getCustomDiagID(Level, "%0 [%1]"))
   << Message.Message << Name;
   for (const auto &FileAndReplacements : Error.Fix) {
-for (const auto &Replacement : FileAndReplacements.second) {
+for (const auto &Repl : FileAndReplacements.second) {
   // Retrieve the source range for applicable fixes. Macro definitions
   // on the command line have locations in a virtual buffer and don't
   // have valid file paths and are therefore not applicable.
   SourceRange Range;
   SourceLocation FixLoc;
-  if (Replacement.isApplicable()) {
-SmallString<128> FixAbsoluteFilePath = Replacement.getFilePath();
+  ++TotalFixes;
+  bool CanBeApplied = false;
+  if (Repl.isApplicable()) {
+SmallString<128> FixAbsoluteFilePath = Repl.getFilePath();
 Files.makeAbsolutePath(FixAbsoluteFilePath);
-FixLoc = getLocation(FixAbsoluteFilePath, Replacement.getOffset());
+if (ApplyFixes) {
+  tooling::Replacement R(FixAbsoluteFilePath, Repl.getOffset(),
+ Repl.getLength(),
+ Repl.getReplacementText());
+  Replacements &Replacements = FileReplacements[R.getFilePath()];
+  llvm::Error Err = Replacements.add(R);
+  if (Err) {
+// FIXME: Implement better conflict handling.
+llvm::errs() << "Trying to resolve conflict: "
+ << llvm::toString(std::move(Err)) << "\n";
+unsigned NewOffset =
+Replacements.getShiftedCodePosition(R.getOffset());
+unsigned NewLength = Replacements.getShiftedCodePosition(
+ R.getOffset() + R.getLength()) -
+ NewOffset;
+if (NewLength == R.getLength()) {
+  R = Replacement(R.getFilePath(), NewOffset, NewLength,
+  R.getReplacementText());
+  Replacements = Replacements.merge(toolin

Re: r284392 - Reapply r284383. The test failures were due to a missing dir in test/

2016-10-17 Thread Tim Northover via cfe-commits
Hi Krzysztof,

This still seems to be failing on Darwin:

/Users/tim/llvm/llvm/tools/clang/test/Driver/hexagon-toolchain-elf.c:9:14:
error: expected string not found in input
// CHECK000: "-cc1" {{.*}} "-internal-externc-isystem"
"{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include"

The directory my Clang is actually choosing is
/Users/tim/llvm/llvm/tools/clang/test/Driver/Inputs/hexagon_tree/Tools/bin/hexagon/include,
and there is no hexagon_tree directory in ToT.

I think this might be something to do with git not actually recording
empty directories. Could you have another look?

Cheers.

Tim.

On 17 October 2016 at 08:30, Krzysztof Parzyszek via cfe-commits
 wrote:
> Author: kparzysz
> Date: Mon Oct 17 10:30:10 2016
> New Revision: 284392
>
> URL: http://llvm.org/viewvc/llvm-project?rev=284392&view=rev
> Log:
> Reapply r284383. The test failures were due to a missing dir in test/
>
> Added:
> cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/
> Modified:
> cfe/trunk/lib/Driver/ToolChains.cpp
>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284392&r1=284391&r2=284392&view=diff
> ==
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 10:30:10 2016
> @@ -2970,7 +2970,7 @@ std::string HexagonToolChain::getHexagon
>if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
>  return InstallRelDir;
>
> -  return InstallRelDir;
> +  return InstalledDir;
>  }
>
>  Optional HexagonToolChain::getSmallDataThreshold(
>
>
> ___
> 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


[PATCH] D24572: [clang-tidy] Clean up code after applying replacements.

2016-10-17 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284399: [clang-tidy] Clean up code after applying 
replacements. (authored by alexfh).

Changed prior to commit:
  https://reviews.llvm.org/D24572?vs=74160&id=74868#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24572

Files:
  clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
  clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
  clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/trunk/test/clang-tidy/clean-up-code.cpp
  clang-tools-extra/trunk/test/clang-tidy/fix.cpp
  
clang-tools-extra/trunk/test/clang-tidy/google-readability-namespace-comments.cpp

Index: clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
===
--- clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyDiagnosticConsumer.cpp
@@ -79,12 +79,13 @@
 
   tooling::Replacement Replacement(SM, Range, FixIt.CodeToInsert);
   llvm::Error Err = Error.Fix[Replacement.getFilePath()].add(Replacement);
-  // FIXME: better error handling.
+  // FIXME: better error handling (at least, don't let other replacements be
+  // applied).
   if (Err) {
 llvm::errs() << "Fix conflicts with existing fix! "
 << llvm::toString(std::move(Err)) << "\n";
+assert(false && "Fix conflicts with existing fix!");
   }
-  assert(!Err && "Fix conflicts with existing fix!");
 }
   }
 
Index: clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
===
--- clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/trunk/clang-tidy/CMakeLists.txt
@@ -15,6 +15,7 @@
   clangAST
   clangASTMatchers
   clangBasic
+  clangFormat
   clangFrontend
   clangLex
   clangRewrite
Index: clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
===
--- clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
+++ clang-tools-extra/trunk/clang-tidy/ClangTidy.cpp
@@ -22,6 +22,7 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Decl.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Format/Format.h"
 #include "clang/Frontend/ASTConsumers.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/FrontendActions.h"
@@ -101,9 +102,8 @@
 DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), &*DiagOpts)),
 Diags(IntrusiveRefCntPtr(new DiagnosticIDs), &*DiagOpts,
   DiagPrinter),
-SourceMgr(Diags, Files), Rewrite(SourceMgr, LangOpts),
-ApplyFixes(ApplyFixes), TotalFixes(0), AppliedFixes(0),
-WarningsAsErrors(0) {
+SourceMgr(Diags, Files), ApplyFixes(ApplyFixes), TotalFixes(0),
+AppliedFixes(0), WarningsAsErrors(0) {
 DiagOpts->ShowColors = llvm::sys::Process::StandardOutHasColors();
 DiagPrinter->BeginSourceFile(LangOpts);
   }
@@ -127,31 +127,58 @@
   auto Diag = Diags.Report(Loc, Diags.getCustomDiagID(Level, "%0 [%1]"))
   << Message.Message << Name;
   for (const auto &FileAndReplacements : Error.Fix) {
-for (const auto &Replacement : FileAndReplacements.second) {
+for (const auto &Repl : FileAndReplacements.second) {
   // Retrieve the source range for applicable fixes. Macro definitions
   // on the command line have locations in a virtual buffer and don't
   // have valid file paths and are therefore not applicable.
   SourceRange Range;
   SourceLocation FixLoc;
-  if (Replacement.isApplicable()) {
-SmallString<128> FixAbsoluteFilePath = Replacement.getFilePath();
+  ++TotalFixes;
+  bool CanBeApplied = false;
+  if (Repl.isApplicable()) {
+SmallString<128> FixAbsoluteFilePath = Repl.getFilePath();
 Files.makeAbsolutePath(FixAbsoluteFilePath);
-FixLoc = getLocation(FixAbsoluteFilePath, Replacement.getOffset());
+if (ApplyFixes) {
+  tooling::Replacement R(FixAbsoluteFilePath, Repl.getOffset(),
+ Repl.getLength(),
+ Repl.getReplacementText());
+  Replacements &Replacements = FileReplacements[R.getFilePath()];
+  llvm::Error Err = Replacements.add(R);
+  if (Err) {
+// FIXME: Implement better conflict handling.
+llvm::errs() << "Trying to resolve conflict: "
+ << llvm::toString(std::move(Err)) << "\n";
+unsigned NewOffset =
+Replacements.getShiftedCodePosition(R.getOffset());
+unsigned NewLength = Replacements.getShiftedCodePosition(
+ R.getOffset() + R.getLength()) -
+   

Fwd: r198063 - Warn on mismatched parentheses in memcmp and friends.

2016-10-17 Thread Richard Smith via cfe-commits
[Re-send to correct addresses.]

On Thu, Dec 26, 2013 at 3:38 PM, Nico Weber  wrote:

> Author: nico
> Date: Thu Dec 26 17:38:39 2013
> New Revision: 198063
>
> URL: http://llvm.org/viewvc/llvm-project?rev=198063&view=rev
> Log:
> Warn on mismatched parentheses in memcmp and friends.
>
> Thisadds a new warning that warns on code like this:
>
>   if (memcmp(a, b, sizeof(a) != 0))
>
> The warning looks like:
>
> test4.cc:5:30: warning: size argument in 'memcmp' call is a comparison
> [-Wmemsize-comparison]
>   if (memcmp(a, b, sizeof(a) != 0))
>~~^~~~
> test4.cc:5:7: note: did you mean to compare the result of 'memcmp' instead?
>   if (memcmp(a, b, sizeof(a) != 0))
>   ^  ~
> )
> test4.cc:5:20: note: explicitly cast the argument to size_t to silence
> this warning
>   if (memcmp(a, b, sizeof(a) != 0))
>^
>(size_t)( )
> 1 warning generated.
>
> This found 2 bugs in chromium and has 0 false positives on both chromium
> and
> llvm.
>
> The idea of triggering this warning on a binop in the size argument is due
> to
> rnk.
>
>
> Added:
> cfe/trunk/test/SemaCXX/warn-memsize-comparison.cpp
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/lib/Sema/SemaChecking.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/
> Basic/DiagnosticSemaKinds.td?rev=198063&r1=198062&r2=198063&view=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Dec 26
> 17:38:39 2013
> @@ -390,11 +390,18 @@ def warn_sizeof_pointer_type_memaccess :
>"%select{destination|source}2; expected %3 or an explicit length">,
>InGroup;
>  def warn_strlcpycat_wrong_size : Warning<
> -  "size argument in %0 call appears to be size of the source; expected
> the size of "
> -  "the destination">,
> +  "size argument in %0 call appears to be size of the source; "
> +  "expected the size of the destination">,
>InGroup>;
>  def note_strlcpycat_wrong_size : Note<
>"change size argument to be the size of the destination">;
> +def warn_memsize_comparison : Warning<
> +  "size argument in %0 call is a comparison">,
> +  InGroup>;
> +def warn_memsize_comparison_paren_note : Note<
> +  "did you mean to compare the result of %0 instead?">;
> +def warn_memsize_comparison_cast_note : Note<
> +  "explicitly cast the argument to size_t to silence this warning">;
>
>  def warn_strncat_large_size : Warning<
>"the value of the size argument in 'strncat' is too large, might lead
> to a "
>
> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaC
> hecking.cpp?rev=198063&r1=198062&r2=198063&view=diff
> 
> ==
> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Dec 26 17:38:39 2013
> @@ -622,7 +622,7 @@ bool Sema::CheckARMBuiltinFunctionCall(u
>   RHS.get(), AA_Assigning))
>return true;
>}
> -
> +
>// For NEON intrinsics which take an immediate value as part of the
>// instruction, range check them here.
>unsigned i = 0, l = 0, u = 0;
> @@ -3560,6 +3560,40 @@ void Sema::CheckFormatString(const Strin
>
>  //===--- CHECK: Standard memory functions --
> ---===//
>
> +/// \brief Takes the expression passed to the size_t parameter of
> functions
> +/// such as memcmp, strncat, etc and warns if it's a comparison.
> +///
> +/// This is to catch typos like `if (memcmp(&a, &b, sizeof(a) > 0))`.
> +static bool CheckMemorySizeofForComparison(Sema &S, const Expr *E,
> +   IdentifierInfo *FnName,
> +   SourceLocation FnLoc,
> +   SourceLocation RParenLoc) {
> +  const BinaryOperator *Size = dyn_cast(E);
> +  if (!Size)
> +return false;
> +
> +  // if E is binop and op is >, <, >=, <=, ==, &&, ||:
> +  if (!Size->isComparisonOp() && !Size->isEqualityOp() &&
> !Size->isLogicalOp())
> +return false;
> +
> +  Preprocessor &PP = S.getPreprocessor();
> +  SourceRange SizeRange = Size->getSourceRange();
> +  S.Diag(Size->getOperatorLoc(), diag::warn_memsize_comparison)
> +  << SizeRange << FnName;
> +  S.Diag(FnLoc, diag::warn_memsize_comparison_paren_note)
> +  << FnName
> +  << FixItHint::CreateInsertion(
> + PP.getLocForEndOfToken(Size->getLHS()->getLocEnd()),
> + ")")
> +  << FixItHint::CreateRemoval(RParenLoc);
> +  S.Diag(SizeRange.getBegin(), diag::warn_memsize_comparison_cast_note)
> +  << FixItHint::CreateInsertion(SizeRange.ge

r284400 - Fix a typo.

2016-10-17 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Mon Oct 17 12:41:51 2016
New Revision: 284400

URL: http://llvm.org/viewvc/llvm-project?rev=284400&view=rev
Log:
Fix a typo.

Modified:
cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=284400&r1=284399&r2=284400&view=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Mon Oct 17 12:41:51 2016
@@ -5728,7 +5728,7 @@ void Clang::ConstructJob(Compilation &C,
   ObjCRuntime objcRuntime = AddObjCRuntimeArgs(Args, CmdArgs, rewriteKind);
 
   // -fobjc-dispatch-method is only relevant with the nonfragile-abi, and
-  // legacy is the default. Except for deployment taget of 10.5,
+  // legacy is the default. Except for deployment target of 10.5,
   // next runtime is always legacy dispatch and -fno-objc-legacy-dispatch
   // gets ignored silently.
   if (objcRuntime.isNonFragile()) {


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


[PATCH] D25641: [Driver] Use VFS to perform all distribution checks

2016-10-17 Thread Bruno Cardoso Lopes via cfe-commits
bruno accepted this revision.
bruno added a comment.
This revision is now accepted and ready to land.

Thanks! LGTM!


https://reviews.llvm.org/D25641



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


[PATCH] D24669: {Sema] Gcc compatibility of vector shift.

2016-10-17 Thread Bruno Cardoso Lopes via cfe-commits
bruno accepted this revision.
bruno added a comment.
This revision is now accepted and ready to land.

Ok, great!

LGTM


https://reviews.llvm.org/D24669



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


Re: [libcxx] r284214 - XFAIL aligned allocation tests for older Clang versions

2016-10-17 Thread Tim Northover via cfe-commits
On 14 October 2016 at 14:21, Eric Fiselier via cfe-commits
 wrote:
> Could you give me more information about the compiler your using?

Do you mostly build libcxx outside of a Clang source tree? I suspect
the problem is that if Clang is built at the same time then that's the
Clang which gets used to test libcxx, so it's effectively always 4.0.

This is consistent with local tests I've run of both in-tree builds
and out (using Xcode 8).

Cheers.

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


[PATCH] D25686: [Driver] Support "hardfloat" vendor triples used by Gentoo

2016-10-17 Thread Michał Górny via cfe-commits
mgorny created this revision.
mgorny added reviewers: bob.wilson, rengolin, rafael, ddunbar.
mgorny added subscribers: cfe-commits, zlei.
Herald added a subscriber: aemerson.

Support the arm-hardfloat-*-*eabi triples used by Gentoo to signify
hardfloat variants of ARM *EABI. Add tests for correct determination of
float ABIs for various triples.


https://reviews.llvm.org/D25686

Files:
  lib/Driver/Tools.cpp
  test/Driver/arm-float-abi.c


Index: test/Driver/arm-float-abi.c
===
--- test/Driver/arm-float-abi.c
+++ test/Driver/arm-float-abi.c
@@ -4,3 +4,16 @@
 
 // ARMV7-ERROR: unsupported option '-mfloat-abi=hard' for target 'thumbv7'
 // NOERROR-NOT: unsupported option
+
+// Check for correct -mfloat-abi= values for various -targets.
+// RUN: %clang %s -target armv7-pc-linux-gnueabi -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=SOFTFLOAT %s
+// RUN: %clang %s -target armv7-pc-linux-gnueabihf -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=HARDFLOAT %s
+
+// Gentoo uses 'hardfloat' in vendor field.
+// RUN: %clang %s -target armv7-hardfloat-linux-gnueabi -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=HARDFLOAT %s
+
+// SOFTFLOAT: "-mfloat-abi" "soft"
+// HARDFLOAT: "-mfloat-abi" "hard"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -838,8 +838,12 @@
   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;
+// Gentoo puts "hardfloat" in vendor field instead of using *hf
+// environment variant.
+if (Triple.getVendorName() == "hardfloat")
+  ABI = FloatABI::Hard;
+else // EABI is always AAPCS, and if it was not marked 'hard', it's 
softfp
+  ABI = FloatABI::SoftFP;
 break;
   case llvm::Triple::Android:
 ABI = (SubArch == 7) ? FloatABI::SoftFP : FloatABI::Soft;


Index: test/Driver/arm-float-abi.c
===
--- test/Driver/arm-float-abi.c
+++ test/Driver/arm-float-abi.c
@@ -4,3 +4,16 @@
 
 // ARMV7-ERROR: unsupported option '-mfloat-abi=hard' for target 'thumbv7'
 // NOERROR-NOT: unsupported option
+
+// Check for correct -mfloat-abi= values for various -targets.
+// RUN: %clang %s -target armv7-pc-linux-gnueabi -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=SOFTFLOAT %s
+// RUN: %clang %s -target armv7-pc-linux-gnueabihf -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=HARDFLOAT %s
+
+// Gentoo uses 'hardfloat' in vendor field.
+// RUN: %clang %s -target armv7-hardfloat-linux-gnueabi -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=HARDFLOAT %s
+
+// SOFTFLOAT: "-mfloat-abi" "soft"
+// HARDFLOAT: "-mfloat-abi" "hard"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -838,8 +838,12 @@
   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;
+// Gentoo puts "hardfloat" in vendor field instead of using *hf
+// environment variant.
+if (Triple.getVendorName() == "hardfloat")
+  ABI = FloatABI::Hard;
+else // EABI is always AAPCS, and if it was not marked 'hard', it's softfp
+  ABI = FloatABI::SoftFP;
 break;
   case llvm::Triple::Android:
 ABI = (SubArch == 7) ? FloatABI::SoftFP : FloatABI::Soft;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r284401 - Hexagon: add dummy files to test dir so git keeps them.

2016-10-17 Thread Tim Northover via cfe-commits
Author: tnorthover
Date: Mon Oct 17 13:00:27 2016
New Revision: 284401

URL: http://llvm.org/viewvc/llvm-project?rev=284401&view=rev
Log:
Hexagon: add dummy files to test dir so git keeps them.

Should fix hexagon-elf-toolchain.c tests on Git.

Added:
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/.keep
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/.keep

Added: cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/.keep
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/.keep?rev=284401&view=auto
==
(empty)

Added: cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/.keep
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/.keep?rev=284401&view=auto
==
(empty)


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


r284402 - Add a dummy file in each subdirectory in test/Driver/Inputs/hexagon_tree

2016-10-17 Thread Krzysztof Parzyszek via cfe-commits
Author: kparzysz
Date: Mon Oct 17 13:04:05 2016
New Revision: 284402

URL: http://llvm.org/viewvc/llvm-project?rev=284402&view=rev
Log:
Add a dummy file in each subdirectory in test/Driver/Inputs/hexagon_tree

Git does not store empty subdirectories (while SVN does). Git clone of
the clang repository did not create the fake Hexagon installation tree
used for testing the driver. This only became evident after a change
in the Hexagon toolchain that started checking for existence of certain
directories.

Added:
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/readme
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/readme
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/c++/

cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/c++/readme

cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/readme
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/readme
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/readme

Added: cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/readme
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/readme?rev=284402&view=auto
==
--- cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/readme (added)
+++ cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/readme Mon Oct 17 
13:04:05 2016
@@ -0,0 +1,4 @@
+Git does not record empty directories. Create a dummy file in each directory
+here. Strictly speaking, putting dummy files in leaf directories should be
+sufficient, but adding them everywhere reduces the risk of repeating the same
+problem in case new directories are added.

Added: cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/readme
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/readme?rev=284402&view=auto
==
--- cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/readme (added)
+++ cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/readme Mon Oct 17 13:04:05 
2016
@@ -0,0 +1,4 @@
+Git does not record empty directories. Create a dummy file in each directory
+here. Strictly speaking, putting dummy files in leaf directories should be
+sufficient, but adding them everywhere reduces the risk of repeating the same
+problem in case new directories are added.

Added: 
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/c++/readme
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/c%2B%2B/readme?rev=284402&view=auto
==
--- 
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/c++/readme
 (added)
+++ 
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/c++/readme
 Mon Oct 17 13:04:05 2016
@@ -0,0 +1,4 @@
+Git does not record empty directories. Create a dummy file in each directory
+here. Strictly speaking, putting dummy files in leaf directories should be
+sufficient, but adding them everywhere reduces the risk of repeating the same
+problem in case new directories are added.

Added: 
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/readme
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/readme?rev=284402&view=auto
==
--- 
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/readme 
(added)
+++ 
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/include/readme 
Mon Oct 17 13:04:05 2016
@@ -0,0 +1,4 @@
+Git does not record empty directories. Create a dummy file in each directory
+here. Strictly speaking, putting dummy files in leaf directories should be
+sufficient, but adding them everywhere reduces the risk of repeating the same
+problem in case new directories are added.

Added: cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/readme
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/readme?rev=284402&view=auto
==
--- cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/readme 
(added)
+++ cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/hexagon/readme Mon 
Oct 17 13:04:05 2016
@@ -0,0 +1,4 @@
+Git does not record empty directories. Create a dummy file in each directory
+here. Strictly speaking, putting dummy files in leaf directories should be
+sufficient, but adding them everywhere reduces the risk of repeating the same
+problem in case new directories are added.

Added: cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/target/readme
URL: 
http://

Re: r284392 - Reapply r284383. The test failures were due to a missing dir in test/

2016-10-17 Thread Krzysztof Parzyszek via cfe-commits
That is crazy! You are right---git does not store empty directories. 
"SVN co" worked fine for me, but "git clone" didn't.  D:


Fixed in r284402.

-Krzysztof


On 10/17/2016 12:34 PM, Tim Northover wrote:

Hi Krzysztof,

This still seems to be failing on Darwin:

/Users/tim/llvm/llvm/tools/clang/test/Driver/hexagon-toolchain-elf.c:9:14:
error: expected string not found in input
// CHECK000: "-cc1" {{.*}} "-internal-externc-isystem"
"{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/include"

The directory my Clang is actually choosing is
/Users/tim/llvm/llvm/tools/clang/test/Driver/Inputs/hexagon_tree/Tools/bin/hexagon/include,
and there is no hexagon_tree directory in ToT.

I think this might be something to do with git not actually recording
empty directories. Could you have another look?

Cheers.

Tim.

On 17 October 2016 at 08:30, Krzysztof Parzyszek via cfe-commits
 wrote:

Author: kparzysz
Date: Mon Oct 17 10:30:10 2016
New Revision: 284392

URL: http://llvm.org/viewvc/llvm-project?rev=284392&view=rev
Log:
Reapply r284383. The test failures were due to a missing dir in test/

Added:
cfe/trunk/test/Driver/Inputs/hexagon_tree/Tools/bin/
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284392&r1=284391&r2=284392&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 10:30:10 2016
@@ -2970,7 +2970,7 @@ std::string HexagonToolChain::getHexagon
   if (getVFS().exists(InstallRelDir = InstalledDir + "/../target"))
 return InstallRelDir;

-  return InstallRelDir;
+  return InstalledDir;
 }

 Optional HexagonToolChain::getSmallDataThreshold(


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


--
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: r284392 - Reapply r284383. The test failures were due to a missing dir in test/

2016-10-17 Thread Tim Northover via cfe-commits
On 17 October 2016 at 11:13, Krzysztof Parzyszek
 wrote:
> That is crazy! You are right---git does not store empty directories. "SVN
> co" worked fine for me, but "git clone" didn't.  D:

Oops, a bit of overlap. Thanks for fixing it more thoroughly than me!

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


r284403 - [Driver] Use VFS to perform all distribution checks

2016-10-17 Thread Michal Gorny via cfe-commits
Author: mgorny
Date: Mon Oct 17 13:07:15 2016
New Revision: 284403

URL: http://llvm.org/viewvc/llvm-project?rev=284403&view=rev
Log:
[Driver] Use VFS to perform all distribution checks

Use the VFS provided by D.getVFS() for all distribution checks,
including those performing read of the release file. Requested
by @bruno on D24954.

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

Modified:
cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284403&r1=284402&r2=284403&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 13:07:15 2016
@@ -3844,7 +3844,7 @@ static bool IsUbuntu(enum Distro Distro)
 
 static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) {
   llvm::ErrorOr> File =
-  llvm::MemoryBuffer::getFile("/etc/lsb-release");
+  D.getVFS().getBufferForFile("/etc/lsb-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 SmallVector Lines;
@@ -3876,7 +3876,7 @@ static Distro DetectDistro(const Driver
   return Version;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/redhat-release");
+  File = D.getVFS().getBufferForFile("/etc/redhat-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data.startswith("Fedora release"))
@@ -3894,7 +3894,7 @@ static Distro DetectDistro(const Driver
 return UnknownDistro;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/debian_version");
+  File = D.getVFS().getBufferForFile("/etc/debian_version");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data[0] == '5')


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


[PATCH] D25641: [Driver] Use VFS to perform all distribution checks

2016-10-17 Thread Michał Górny via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL284403: [Driver] Use VFS to perform all distribution checks 
(authored by mgorny).

Changed prior to commit:
  https://reviews.llvm.org/D25641?vs=74767&id=74874#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D25641

Files:
  cfe/trunk/lib/Driver/ToolChains.cpp


Index: cfe/trunk/lib/Driver/ToolChains.cpp
===
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -3844,7 +3844,7 @@
 
 static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) {
   llvm::ErrorOr> File =
-  llvm::MemoryBuffer::getFile("/etc/lsb-release");
+  D.getVFS().getBufferForFile("/etc/lsb-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 SmallVector Lines;
@@ -3876,7 +3876,7 @@
   return Version;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/redhat-release");
+  File = D.getVFS().getBufferForFile("/etc/redhat-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data.startswith("Fedora release"))
@@ -3894,7 +3894,7 @@
 return UnknownDistro;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/debian_version");
+  File = D.getVFS().getBufferForFile("/etc/debian_version");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data[0] == '5')


Index: cfe/trunk/lib/Driver/ToolChains.cpp
===
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -3844,7 +3844,7 @@
 
 static Distro DetectDistro(const Driver &D, llvm::Triple::ArchType Arch) {
   llvm::ErrorOr> File =
-  llvm::MemoryBuffer::getFile("/etc/lsb-release");
+  D.getVFS().getBufferForFile("/etc/lsb-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 SmallVector Lines;
@@ -3876,7 +3876,7 @@
   return Version;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/redhat-release");
+  File = D.getVFS().getBufferForFile("/etc/redhat-release");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data.startswith("Fedora release"))
@@ -3894,7 +3894,7 @@
 return UnknownDistro;
   }
 
-  File = llvm::MemoryBuffer::getFile("/etc/debian_version");
+  File = D.getVFS().getBufferForFile("/etc/debian_version");
   if (File) {
 StringRef Data = File.get()->getBuffer();
 if (Data[0] == '5')
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r284392 - Reapply r284383. The test failures were due to a missing dir in test/

2016-10-17 Thread Tim Northover via cfe-commits
On 17 October 2016 at 10:34, Tim Northover  wrote:
> I think this might be something to do with git not actually recording
> empty directories. Could you have another look?

Never mind, I've confirmed and committed a fix in r284401.

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


[PATCH] D25337: [Modules] Add a command line option for enabling the modules feature exclusively for the Clang builtins.

2016-10-17 Thread Bruno Cardoso Lopes via cfe-commits
bruno added a comment.



> The long answer is that there is a history of problems regarding the 
> intrinsic files:
>  http://lists.llvm.org/pipermail/cfe-dev/2016-May/048837.html
>  http://lists.llvm.org/pipermail/cfe-dev/2016-September/050943.html
>  Mainly compatibility issues because MSVC makes all the intrinsics available 
> all the time, while in clang this is not always the case (On Windows the 
> different h files are not-included unless asked for explicitly since AVX512 
> was added which impacted compile-time).

Thinking a bit more about this: did you ever consider a solution where 
"immintrin.h" (or any similar other) would use "#include_next" and 
"__has_include_next" to point to a second level (user specified) immintrin.h, 
which then could use ifdefs to only include what's relevant?

> A suggestion was made to try and mitigate this by reducing the compile time 
> using modules (only for the x86 intrinsics). This patch aims at adding this 
> option. The new compile flag is just a milestone - if all goes well, we can 
> turn this on by default (Then we won't actually need to use a specific 
> compile flag, and we could always include all the intrinsic h files without 
> their long compile time).

The speedup sounds nice, but it seems awkward IMO to have such specific 
behavior for x86 intrinsics only.


https://reviews.llvm.org/D25337



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


[PATCH] D25686: [Driver] Support "hardfloat" vendor triples used by Gentoo

2016-10-17 Thread Hal Finkel via cfe-commits
hfinkel added a comment.

It seems like we should teach Triple how to parse this triples correctly (i.e. 
to recognize that the vendor is ARM), and then canonicalize the environment to 
GNUEABIHF (or whatever)?


https://reviews.llvm.org/D25686



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


[PATCH] D25337: [Modules] Add a command line option for enabling the modules feature exclusively for the Clang builtins.

2016-10-17 Thread Richard Smith via cfe-commits
rsmith added a comment.

I really don't like the command-line interface you're proposing here. It seems 
like it will be extremely confusing what something like `-fmodules 
-fexclusive-builtin-modules` means, for instance (usually, later `-f` flags 
override earlier ones, so does this *turn off* modules for everything other 
than builtin headers?). Instead, we should use a command-line interface that 
more naturally / obviously composes with other flags.

It seems like the behavior you want here is precisely:

  `-fmodules -fno-implicit-module-maps -fmodule-map-file=/include/module.modulemap`

(The `-fmodules-validate-system-headers` part would only make sense for people 
using clang directly from their build area; installed / released versions of 
clang should not need this. Adding it makes your flag compose poorly with other 
uses of modules.)

I'd be happy with you adding a flag that is equivalent to 
`-fmodule-map-file=/include/module.modulemap`.

Also, it seems unlikely to me that we would ever turn this on by default. It 
will cause havoc for distributed builds, especially ones that run compilation 
actions in 'clean' environments, as (for instance) it will cause the complete 
set of intrinsics headers to be compiled into a module on every compile. So if 
this is your proposed solution for slow compiles using intrinsics headers, you 
should be aware that this is not a complete solution to that problem.


https://reviews.llvm.org/D25337



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


[PATCH] D22045: [X86] Support of no_caller_saved_registers attribute (Clang part)

2016-10-17 Thread Alexey Bataev via cfe-commits
ABataev added inline comments.



Comment at: include/clang/AST/Type.h:2934
 ExtInfo(bool noReturn, bool hasRegParm, unsigned regParm, CallingConv cc,
-bool producesResult) {
+bool producesResult, bool noCallerSavedRegs) {
   assert((!hasRegParm || regParm < 7) && "Invalid regparm value");

s/noCallerSavedRegs/NoCallerSavedRegs/g



Comment at: include/clang/AST/Type.h:2987
 
+ExtInfo withNoCallerSavedRegs(bool noCallerSavedRegs) const {
+  if (noCallerSavedRegs)

s/noCallerSavedRegs/NoCallerSavedRegs/g



Comment at: include/clang/AST/Type.h:2990-2991
+return ExtInfo(Bits | NoCallerSavedRegsMask);
+  else
+return ExtInfo(Bits & ~NoCallerSavedRegsMask);
+}

Remove `else`, just return



Comment at: lib/Sema/SemaDecl.cpp:2885
+  NewTypeInfo.getNoCallerSavedRegs()) {
+NewTypeInfo = NewTypeInfo.withNoCallerSavedRegs(true);
+RequiresAdjustment = true;

Add a comment with the name of parameter for `true` argument



Comment at: lib/Sema/SemaDeclAttr.cpp:1693
+static void handleNoCallerSavedRegsAttr(Sema &S, Decl *D,
+const AttributeList &attr) {
+  if (S.CheckNoCallerSavedRegsAttr(attr))

`attr` does follow rules of LLVM Coding standard. Must be `Attr`



Comment at: lib/Sema/SemaDeclAttr.cpp:1710
 
+bool Sema::CheckNoCallerSavedRegsAttr(const AttributeList &attr) {
+  if (!checkAttributeNumArgs(*this, attr, 0)) {

s/attr/Attr/g



Comment at: lib/Sema/SemaDeclAttr.cpp:1710
 
+bool Sema::CheckNoCallerSavedRegsAttr(const AttributeList &attr) {
+  if (!checkAttributeNumArgs(*this, attr, 0)) {

ABataev wrote:
> s/attr/Attr/g
s/CheckNoCallerSavedRegsAttr/checkNoCallerSavedRegsAttr/g


https://reviews.llvm.org/D22045



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


[PATCH] D25686: [Driver] Support "hardfloat" vendor triples used by Gentoo

2016-10-17 Thread Michał Górny via cfe-commits
mgorny added a comment.

In https://reviews.llvm.org/D25686#571857, @hfinkel wrote:

> It seems like we should teach Triple how to parse this triples correctly 
> (i.e. to recognize that the vendor is ARM), and then canonicalize the 
> environment to GNUEABIHF (or whatever)?


I've attempted that but altering the triple resulted in clang being unable to 
find gcc files (since the triple didn't match anymore). My previous patch is 
available here: https://595834.bugs.gentoo.org/attachment.cgi?id=450004. If you 
think that I've did something stupid-wrong there and there's a better way of 
doing this via Triple API, I'll gladly update the patch.


https://reviews.llvm.org/D25686



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


[PATCH] D23752: cmake: Supporting overriding runtime libdir via CLANG_LIBDIR_SUFFIX

2016-10-17 Thread Michał Górny via cfe-commits
mgorny added a comment.

A gentle ping.


https://reviews.llvm.org/D23752



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


[PATCH] D24954: [ToolChains] Disable OpenSUSE rules for SLES10

2016-10-17 Thread Michał Górny via cfe-commits
mgorny planned changes to this revision.
mgorny added a comment.

I'm going to delay this one a bit. I've already fixed all other distro checks 
to use VFS. Now I'd like to update them to use proper numeric parsing.


https://reviews.llvm.org/D24954



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


[PATCH] D24693: [CodeGen] Don't emit lifetime intrinsics for some local variables

2016-10-17 Thread Vitaly Buka via cfe-commits
vitalybuka marked an inline comment as done.
vitalybuka added a comment.

Slowdown from this function is below: 0.05% and it's mostly just traversing AST.


https://reviews.llvm.org/D24693



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


[PATCH] D25606: alpha.core.UnreachableCode - don't warn about unreachable code inside macro

2016-10-17 Thread Anna Zaks via cfe-commits
zaks.anna accepted this revision.
zaks.anna added a comment.
This revision is now accepted and ready to land.

LGTM. Thank you!


Repository:
  rL LLVM

https://reviews.llvm.org/D25606



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


[PATCH] D25448: [ubsan] Disable -fsanitize=vptr checks for devirtualized calls

2016-10-17 Thread Vedant Kumar via cfe-commits
vsk added a comment.

Thanks for your feedback so far, and sorry for the delayed response.

In https://reviews.llvm.org/D25448#570014, @rjmccall wrote:

> Wait, can you talk me through the bug here?


Derived inherits from Base1 and Base2. We upcast an instance of Derived to 
Base2, then call a method (f1). Clang figures out that the method has to be 
Derived::f1. Next, clang passes in a pointer to the vtable pointer for 
**Base1**, along with the typeinfo for **Base2**, into the sanitizer runtime. 
This confuses the runtime, which reports that the dynamic type of the object is 
"Base1", and that this does not match the expected type ("Base2").

With the 'final' keyword:

  %6 = ptrtoint <2 x i32 (...)**>* %1 to i64
  call void @__ubsan_handle_dynamic_type_cache_miss(@1 (TypeInfo for Base2), 
i64 %6, ...)

Without the 'final' keyword:

  %6 = bitcast <2 x i32 (...)**>* %1 to %class.Derived*
  %7 = getelementptr inbounds %class.Derived, %class.Derived* %6, i64 0, i32 1
  %8 = ptrtoint %class.Base2* %7 to i64, !nosanitize !5
  call void @__ubsan_handle_dynamic_type_cache_miss(@1 (TypeInfo for Base2), 
i64 %8, ...)



>   Why is final-based devirtualization here different from, say, user-directed 
> devirtualization via a qualified method name?

I'm not sure. I tested this by removing the 'final' specifier from 'Derived' 
and calling:

  obj.Derived::f1()

In this case, clang passes the correct typeinfo (for Derived) in to the runtime.

> It sounds to me from your description that you're not sure why this is 
> happening.  If this indeed only triggers in the presence of multiple 
> inheritance, it might just be the case that you're doing your object-extents 
> analysis starting from the wrong offset.

It looks like I just haven't done a good job of explaining the issue. The bug 
really does seem to be that clang isn't passing the right information to the 
ubsan runtime. However, I'm not sure what the right fix is. Do we disable 
sanitization in cases where we expect FP's, do we try harder to pass in the 
right vptr (in this case, the vptr for Base2) into the runtime, or do we try 
harder to pass in the right typeinfo (in this case, the typeinfo for Derived)?


https://reviews.llvm.org/D25448



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


[PATCH] D25431: [libcxx] Convert Solaris support library to C++ to fix -std=c++11 build

2016-10-17 Thread Michał Górny via cfe-commits
mgorny planned changes to this revision.
mgorny added a comment.

Damn it, it seems that SunOS isn't actually exposing some functions. I need to 
work on this further, and figure out WTF.


https://reviews.llvm.org/D25431



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


Re: [PATCH] D25448: [ubsan] Disable -fsanitize=vptr checks for devirtualized calls

2016-10-17 Thread Richard Smith via cfe-commits
On 17 Oct 2016 12:06 pm, "Vedant Kumar via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

vsk added a comment.

Thanks for your feedback so far, and sorry for the delayed response.

In https://reviews.llvm.org/D25448#570014, @rjmccall wrote:

> Wait, can you talk me through the bug here?


Derived inherits from Base1 and Base2. We upcast an instance of Derived to
Base2, then call a method (f1). Clang figures out that the method has to be
Derived::f1. Next, clang passes in a pointer to the vtable pointer for
**Base1**, along with the typeinfo for **Base2**, into the sanitizer
runtime. This confuses the runtime, which reports that the dynamic type of
the object is "Base1", and that this does not match the expected type
("Base2").

With the 'final' keyword:

  %6 = ptrtoint <2 x i32 (...)**>* %1 to i64
  call void @__ubsan_handle_dynamic_type_cache_miss(@1 (TypeInfo for
Base2), i64 %6, ...)

Without the 'final' keyword:

  %6 = bitcast <2 x i32 (...)**>* %1 to %class.Derived*
  %7 = getelementptr inbounds %class.Derived, %class.Derived* %6, i64 0,
i32 1
  %8 = ptrtoint %class.Base2* %7 to i64, !nosanitize !5
  call void @__ubsan_handle_dynamic_type_cache_miss(@1 (TypeInfo for
Base2), i64 %8, ...)



>   Why is final-based devirtualization here different from, say,
user-directed devirtualization via a qualified method name?

I'm not sure. I tested this by removing the 'final' specifier from
'Derived' and calling:

  obj.Derived::f1()

In this case, clang passes the correct typeinfo (for Derived) in to the
runtime.

> It sounds to me from your description that you're not sure why this is
happening.  If this indeed only triggers in the presence of multiple
inheritance, it might just be the case that you're doing your
object-extents analysis starting from the wrong offset.

It looks like I just haven't done a good job of explaining the issue. The
bug really does seem to be that clang isn't passing the right information
to the ubsan runtime. However, I'm not sure what the right fix is. Do we
disable sanitization in cases where we expect FP's, do we try harder to
pass in the right vptr (in this case, the vptr for Base2) into the runtime,
or do we try harder to pass in the right typeinfo (in this case, the
typeinfo for Derived)?


The baseline correct behaviour is that we should be passing a pointer to
the Base2 subobject, since we're calling a function declared in Base2.
However, since we know we can devirtualize, we can do better by passing a
pointer to the Derived object and the Derived typeinfo.

But we should not be working around our broken instrumentation by just
turning it off.

https://reviews.llvm.org/D25448



___
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


r284416 - Driver/Darwin: Set the DWARF version based on the deployment target.

2016-10-17 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Mon Oct 17 14:36:18 2016
New Revision: 284416

URL: http://llvm.org/viewvc/llvm-project?rev=284416&view=rev
Log:
Driver/Darwin: Set the DWARF version based on the deployment target.

System utilities such as atos only support DWARF 4 on OS X 10.11+ and
iOS 9+. We thus want to enable DWARF 4 only if the deployment target
has a recent enough operating system version and use DWARF 2 for older
systems.



Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/test/Driver/clang-g-opts.c
cfe/trunk/test/Driver/debug-options.c

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284416&r1=284415&r2=284416&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 14:36:18 2016
@@ -289,6 +289,14 @@ void DarwinClang::AddLinkARCArgs(const A
   CmdArgs.push_back(Args.MakeArgString(P));
 }
 
+unsigned DarwinClang::GetDefaultDwarfVersion() const {
+  // Default to use DWARF 2 on OS X 10.10 / iOS 8 and lower.
+  if ((isTargetMacOS() && isMacosxVersionLT(10, 11)) ||
+  (isTargetIOSBased() && isIPhoneOSVersionLT(9)))
+return 2;
+  return 4;
+}
+
 void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
   StringRef DarwinLibName, bool AlwaysLink,
   bool IsEmbedded, bool AddRPath) const {

Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=284416&r1=284415&r2=284416&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Mon Oct 17 14:36:18 2016
@@ -585,7 +585,7 @@ public:
   void AddLinkARCArgs(const llvm::opt::ArgList &Args,
   llvm::opt::ArgStringList &CmdArgs) const override;
 
-  unsigned GetDefaultDwarfVersion() const override { return 4; }
+  unsigned GetDefaultDwarfVersion() const override;
   // Until dtrace (via CTF) and LLDB can deal with distributed debug info,
   // Darwin defaults to standalone/full debug info.
   bool GetDefaultStandaloneDebug() const override { return true; }

Modified: cfe/trunk/test/Driver/clang-g-opts.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-g-opts.c?rev=284416&r1=284415&r2=284416&view=diff
==
--- cfe/trunk/test/Driver/clang-g-opts.c (original)
+++ cfe/trunk/test/Driver/clang-g-opts.c Mon Oct 17 14:36:18 2016
@@ -4,7 +4,7 @@
 
 // Assert that the toolchains which should default to a lower Dwarf version do 
so.
 // RUN: %clang -### -S %s -g -target x86_64-apple-darwin 2>&1 \
-// RUN: | FileCheck --check-prefix=CHECK-WITH-G-STANDALONE %s
+// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g -target i686-pc-openbsd 2>&1 \
 // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
 // RUN: %clang -### -S %s -g -target x86_64-pc-freebsd10.0 2>&1 \
@@ -36,4 +36,4 @@
 // CHECK-WITH-G-DWARF2: "-dwarf-version=2"
 
 // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
-// CHECK-WITH-G-STANDALONE: "-dwarf-version=4"
+// CHECK-WITH-G-STANDALONE: "-dwarf-version=2"

Modified: cfe/trunk/test/Driver/debug-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=284416&r1=284415&r2=284416&view=diff
==
--- cfe/trunk/test/Driver/debug-options.c (original)
+++ cfe/trunk/test/Driver/debug-options.c Mon Oct 17 14:36:18 2016
@@ -19,17 +19,31 @@
 // RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s
 
 // RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
-// RUN: | FileCheck -check-prefix=G_DARWIN -check-prefix=G_LLDB %s
-// RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin 2>&1 \
-// RUN: | FileCheck -check-prefix=G_DARWIN %s
-// RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin 2>&1 \
-// RUN: | FileCheck -check-prefix=G_DARWIN %s
-// RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin 2>&1 \
-// RUN: | FileCheck -check-prefix=G_DARWIN -check-prefix=G_GDB %s
-// RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin 2>&1 \
+// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 
-check-prefix=G_LLDB %s
+// RUN: %clang -### -c -g %s -target x86_64-apple-darwin16 2>&1 \
+// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 
-check-prefix=G_LLDB %s
+// RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin16 2>&1 \
+// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 %s
+// RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin16 2>&

r284417 - Update testcase for r284416.

2016-10-17 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Mon Oct 17 14:46:26 2016
New Revision: 284417

URL: http://llvm.org/viewvc/llvm-project?rev=284417&view=rev
Log:
Update testcase for r284416.

Modified:
cfe/trunk/test/CodeGen/dwarf-version.c

Modified: cfe/trunk/test/CodeGen/dwarf-version.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/dwarf-version.c?rev=284417&r1=284416&r2=284417&view=diff
==
--- cfe/trunk/test/CodeGen/dwarf-version.c (original)
+++ cfe/trunk/test/CodeGen/dwarf-version.c Mon Oct 17 14:46:26 2016
@@ -4,7 +4,8 @@
 // RUN: %clang -target x86_64-linux-gnu -gdwarf-5 -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER5
 // RUN: %clang -target x86_64-linux-gnu -g -S -emit-llvm -o - %s | FileCheck 
%s --check-prefix=VER4
 // RUN: %clang -target x86_64-linux-gnu -gdwarf -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER4
-// RUN: %clang -target x86_64-apple-darwin -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER4
+// RUN: %clang -target x86_64-apple-macosx10.11 -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER4
+// RUN: %clang -target x86_64-apple-darwin -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
 // RUN: %clang -target powerpc-unknown-openbsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
 // RUN: %clang -target powerpc-unknown-freebsd -g -S -emit-llvm -o - %s | 
FileCheck %s --check-prefix=VER2
 // RUN: %clang -target i386-pc-solaris -g -S -emit-llvm -o - %s | FileCheck %s 
--check-prefix=VER2


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


RE: r284416 - Driver/Darwin: Set the DWARF version based on the deployment target.

2016-10-17 Thread Robinson, Paul via cfe-commits


> -Original Message-
> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of
> Adrian Prantl via cfe-commits
> Sent: Monday, October 17, 2016 12:36 PM
> To: cfe-commits@lists.llvm.org
> Subject: r284416 - Driver/Darwin: Set the DWARF version based on the
> deployment target.
> 
> Author: adrian
> Date: Mon Oct 17 14:36:18 2016
> New Revision: 284416
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=284416&view=rev
> Log:
> Driver/Darwin: Set the DWARF version based on the deployment target.
> 
> System utilities such as atos only support DWARF 4 on OS X 10.11+ and
> iOS 9+. We thus want to enable DWARF 4 only if the deployment target
> has a recent enough operating system version and use DWARF 2 for older
> systems.
> 
> 
> 
> Modified:
> cfe/trunk/lib/Driver/ToolChains.cpp
> cfe/trunk/lib/Driver/ToolChains.h
> cfe/trunk/test/Driver/clang-g-opts.c
> cfe/trunk/test/Driver/debug-options.c
> 
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284416&r1=284415&r2=284416
> &view=diff
> ==
> 
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 14:36:18 2016
> @@ -289,6 +289,14 @@ void DarwinClang::AddLinkARCArgs(const A
>CmdArgs.push_back(Args.MakeArgString(P));
>  }
> 
> +unsigned DarwinClang::GetDefaultDwarfVersion() const {
> +  // Default to use DWARF 2 on OS X 10.10 / iOS 8 and lower.
> +  if ((isTargetMacOS() && isMacosxVersionLT(10, 11)) ||
> +  (isTargetIOSBased() && isIPhoneOSVersionLT(9)))
> +return 2;
> +  return 4;
> +}
> +
>  void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList
> &CmdArgs,
>StringRef DarwinLibName, bool AlwaysLink,
>bool IsEmbedded, bool AddRPath) const {
> 
> Modified: cfe/trunk/lib/Driver/ToolChains.h
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Driver/ToolChains.h?rev=284416&r1=284415&r2=284416&v
> iew=diff
> ==
> 
> --- cfe/trunk/lib/Driver/ToolChains.h (original)
> +++ cfe/trunk/lib/Driver/ToolChains.h Mon Oct 17 14:36:18 2016
> @@ -585,7 +585,7 @@ public:
>void AddLinkARCArgs(const llvm::opt::ArgList &Args,
>llvm::opt::ArgStringList &CmdArgs) const override;
> 
> -  unsigned GetDefaultDwarfVersion() const override { return 4; }
> +  unsigned GetDefaultDwarfVersion() const override;
>// Until dtrace (via CTF) and LLDB can deal with distributed debug
> info,
>// Darwin defaults to standalone/full debug info.
>bool GetDefaultStandaloneDebug() const override { return true; }
> 
> Modified: cfe/trunk/test/Driver/clang-g-opts.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-g-
> opts.c?rev=284416&r1=284415&r2=284416&view=diff
> ==
> 
> --- cfe/trunk/test/Driver/clang-g-opts.c (original)
> +++ cfe/trunk/test/Driver/clang-g-opts.c Mon Oct 17 14:36:18 2016
> @@ -4,7 +4,7 @@
> 
>  // Assert that the toolchains which should default to a lower Dwarf
> version do so.
>  // RUN: %clang -### -S %s -g -target x86_64-apple-darwin 2>&1 \
> -// RUN: | FileCheck --check-prefix=CHECK-WITH-G-STANDALONE %s
> +// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s

This seems to weaken the test unnecessarily.
That is, "G-STANDALONE" should still work and checks more things.
--paulr

>  // RUN: %clang -### -S %s -g -target i686-pc-openbsd 2>&1 \
>  // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
>  // RUN: %clang -### -S %s -g -target x86_64-pc-freebsd10.0 2>&1 \
> @@ -36,4 +36,4 @@
>  // CHECK-WITH-G-DWARF2: "-dwarf-version=2"
> 
>  // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
> -// CHECK-WITH-G-STANDALONE: "-dwarf-version=4"
> +// CHECK-WITH-G-STANDALONE: "-dwarf-version=2"
> 
> Modified: cfe/trunk/test/Driver/debug-options.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-
> options.c?rev=284416&r1=284415&r2=284416&view=diff
> ==
> 
> --- cfe/trunk/test/Driver/debug-options.c (original)
> +++ cfe/trunk/test/Driver/debug-options.c Mon Oct 17 14:36:18 2016
> @@ -19,17 +19,31 @@
>  // RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s
> 
>  // RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
> -// RUN: | FileCheck -check-prefix=G_DARWIN -check-
> prefix=G_LLDB %s
> -// RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin 2>&1 \
> -// RUN: | FileCheck -check-prefix=G_DARWIN %s
> -// RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin 2>&1 \
> -// RUN: | FileCheck -check-prefix=G_DARWIN %s
> -// RUN: %clang -

[PATCH] D25258: [coroutines] Create allocation and deallocation sub-statements.

2016-10-17 Thread Gor Nishanov via cfe-commits
GorNishanov added a comment.

friendly ping


https://reviews.llvm.org/D25258



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


r284419 - [Coverage] Update test after r284418.

2016-10-17 Thread Davide Italiano via cfe-commits
Author: davide
Date: Mon Oct 17 15:06:32 2016
New Revision: 284419

URL: http://llvm.org/viewvc/llvm-project?rev=284419&view=rev
Log:
[Coverage] Update test after r284418.

We now strip coverage metadata if debug info are not present.

Modified:
cfe/trunk/test/CodeGen/code-coverage.c

Modified: cfe/trunk/test/CodeGen/code-coverage.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/code-coverage.c?rev=284419&r1=284418&r2=284419&view=diff
==
--- cfe/trunk/test/CodeGen/code-coverage.c (original)
+++ cfe/trunk/test/CodeGen/code-coverage.c Mon Oct 17 15:06:32 2016
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data %s -o - | 
FileCheck %s
 // RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data 
-coverage-no-function-names-in-data %s -o - | FileCheck %s --check-prefix 
WITHOUTNAMES
-// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data 
-coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda %s -o - | FileCheck 
%s --check-prefix GCOV_FILE_INFO
+// RUN: %clang_cc1 -emit-llvm -disable-red-zone -femit-coverage-data 
-coverage-notes-file=aaa.gcno -coverage-data-file=bbb.gcda -dwarf-column-info 
-debug-info-kind=limited -dwarf-version=4 %s -o - | FileCheck %s --check-prefix 
GCOV_FILE_INFO
 
 // 
 


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


Re: r284137 - [ThinLTO] Update doc to include lld (now supported).

2016-10-17 Thread Davide Italiano via cfe-commits
Glad we all agree. I opened
https://llvm.org/bugs/show_bug.cgi?id=30720 to keep track of this.

On Mon, Oct 17, 2016 at 9:08 AM, Rui Ueyama  wrote:
> Agreed. We should define them as aliases to existing options without
> -plugin-opt.
>
> On Sun, Oct 16, 2016 at 6:43 PM, Sean Silva via cfe-commits
>  wrote:
>>
>> Nice to see this land!
>>
>> One nit:
>> Currently, doesn't LLD/ELF ignore -plugin-opt? That will mean that if a
>> user uses the "gold syntax" then LLD will silently ignore it, which isn't
>> good. At the very least, can we issue an error if we see `-plugin-opt
>> jobs=N` and suggest the LLD spelling?
>>
>> Or maybe just accept the gold syntax? Our current handling of `-plugin`
>> and `-plugin-opt` is intended to make LLD transparently Do The Right Thing
>> when LLD is invoked as if it were gold, so clearly gold compatibility is
>> important enough for that. This suggests it is important enough to be
>> compatible from a ThinLTO perspective too.
>>
>> -- Sean Silva
>>
>> On Thu, Oct 13, 2016 at 10:42 AM, Davide Italiano via cfe-commits
>>  wrote:
>>>
>>> Author: davide
>>> Date: Thu Oct 13 12:42:38 2016
>>> New Revision: 284137
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=284137&view=rev
>>> Log:
>>> [ThinLTO] Update doc to include lld (now supported).
>>>
>>> Differential Revision:  https://reviews.llvm.org/D25537
>>>
>>> Modified:
>>> cfe/trunk/docs/ThinLTO.rst
>>>
>>> Modified: cfe/trunk/docs/ThinLTO.rst
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ThinLTO.rst?rev=284137&r1=284136&r2=284137&view=diff
>>>
>>> ==
>>> --- cfe/trunk/docs/ThinLTO.rst (original)
>>> +++ cfe/trunk/docs/ThinLTO.rst Thu Oct 13 12:42:38 2016
>>> @@ -62,8 +62,8 @@ ThinLTO is currently supported for the f
>>>`_.
>>>  - **ld64**:
>>>Starting with `Xcode 8 `_.
>>> -
>>> -Additionally, support is being added to the *lld* linker.
>>> +- **lld**:
>>> +  Starting with r284050 (ELF only).
>>>
>>>  Usage
>>>  =
>>> @@ -109,6 +109,8 @@ be reduced to ``N`` via:
>>>``-Wl,-plugin-opt,jobs=N``
>>>  - ld64:
>>>``-Wl,-mllvm,-threads=N``
>>> +- lld:
>>> +  ``-Wl,--thinlto-jobs=N``
>>>
>>>  Incremental
>>>  ---
>>>
>>>
>>> ___
>>> 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
>>
>



-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r284420 - Improve the CHECK lines in debug-options.c by separating out the check

2016-10-17 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Mon Oct 17 15:14:23 2016
New Revision: 284420

URL: http://llvm.org/viewvc/llvm-project?rev=284420&view=rev
Log:
Improve the CHECK lines in debug-options.c by separating out the check
for debug info kind and dwarf version.

Modified:
cfe/trunk/test/Driver/debug-options.c

Modified: cfe/trunk/test/Driver/debug-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-options.c?rev=284420&r1=284419&r2=284420&view=diff
==
--- cfe/trunk/test/Driver/debug-options.c (original)
+++ cfe/trunk/test/Driver/debug-options.c Mon Oct 17 15:14:23 2016
@@ -1,6 +1,7 @@
 // Check to make sure clang is somewhat picky about -g options.
 // rdar://10383444
 
+// Linux.
 // RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \
 // RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
 // RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \
@@ -16,35 +17,50 @@
 // RUN: %clang -### -c -glldb %s -target x86_64-linux-gnu 2>&1 \
 // RUN: | FileCheck -check-prefix=G -check-prefix=G_LLDB %s
 // RUN: %clang -### -c -gsce %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s
 
+// Darwin.
+// RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s
 // RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
-// RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 
-check-prefix=G_LLDB %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF2 \
+// RUN: -check-prefix=G_LLDB %s
 // RUN: %clang -### -c -g %s -target x86_64-apple-darwin16 2>&1 \
-// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 
-check-prefix=G_LLDB %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 \
+// RUN: -check-prefix=G_LLDB %s
 // RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin16 2>&1 \
-// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 %s
 // RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin16 2>&1 \
-// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 %s
 // RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin16 2>&1 \
-// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 
-check-prefix=G_GDB %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 \
+// RUN: -check-prefix=G_GDB %s
 // RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin16 2>&1 \
 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s
 // RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin16 2>&1 \
-// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 %s
 // RUN: %clang -### -c -g %s -target x86_64-apple-macosx10.11 2>&1 \
-// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 %s
 // RUN: %clang -### -c -g %s -target x86_64-apple-macosx10.10 2>&1 \
 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
 // RUN: %clang -### -c -g %s -target armv7-apple-ios9.0 2>&1 \
-// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 %s
 // RUN: %clang -### -c -g %s -target armv7-apple-ios8.0 2>&1 \
 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s
 // RUN: %clang -### -c -g %s -target armv7k-apple-watchos 2>&1 \
-// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 %s
 // RUN: %clang -### -c -g %s -target arm64-apple-tvos9.0 2>&1 \
-// RUN: | FileCheck -check-prefix=G_STANDALONE_DWARF4 %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE \
+// RUN: -check-prefix=G_DWARF4 %s
 
+// FreeBSD.
 // RUN: %clang -### -c -g %s -target x86_64-pc-freebsd10.0 2>&1 \
 // RUN: | FileCheck -check-prefix=G_GDB %s
 
@@ -61,7 +77,8 @@
 // RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \
 // RUN: | FileCheck -check-prefix=CI %s
 
-// RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G_D2 %s
+// RUN: %clang -### -c -gdwarf-2 %s 2>&1 \
+// RUN: | FileCh

Re: r284416 - Driver/Darwin: Set the DWARF version based on the deployment target.

2016-10-17 Thread Adrian Prantl via cfe-commits
Thanks for noticing! I improved the test in r284420 by separating the check for 
debug info kind and dwarf version.

-- adrian
> On Oct 17, 2016, at 1:11 PM, Robinson, Paul  wrote:
> 
> 
> 
>> -Original Message-
>> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of
>> Adrian Prantl via cfe-commits
>> Sent: Monday, October 17, 2016 12:36 PM
>> To: cfe-commits@lists.llvm.org
>> Subject: r284416 - Driver/Darwin: Set the DWARF version based on the
>> deployment target.
>> 
>> Author: adrian
>> Date: Mon Oct 17 14:36:18 2016
>> New Revision: 284416
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=284416&view=rev
>> Log:
>> Driver/Darwin: Set the DWARF version based on the deployment target.
>> 
>> System utilities such as atos only support DWARF 4 on OS X 10.11+ and
>> iOS 9+. We thus want to enable DWARF 4 only if the deployment target
>> has a recent enough operating system version and use DWARF 2 for older
>> systems.
>> 
>> 
>> 
>> Modified:
>>cfe/trunk/lib/Driver/ToolChains.cpp
>>cfe/trunk/lib/Driver/ToolChains.h
>>cfe/trunk/test/Driver/clang-g-opts.c
>>cfe/trunk/test/Driver/debug-options.c
>> 
>> Modified: cfe/trunk/lib/Driver/ToolChains.cpp
>> URL: http://llvm.org/viewvc/llvm-
>> project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=284416&r1=284415&r2=284416
>> &view=diff
>> ==
>> 
>> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)
>> +++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Oct 17 14:36:18 2016
>> @@ -289,6 +289,14 @@ void DarwinClang::AddLinkARCArgs(const A
>>   CmdArgs.push_back(Args.MakeArgString(P));
>> }
>> 
>> +unsigned DarwinClang::GetDefaultDwarfVersion() const {
>> +  // Default to use DWARF 2 on OS X 10.10 / iOS 8 and lower.
>> +  if ((isTargetMacOS() && isMacosxVersionLT(10, 11)) ||
>> +  (isTargetIOSBased() && isIPhoneOSVersionLT(9)))
>> +return 2;
>> +  return 4;
>> +}
>> +
>> void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList
>> &CmdArgs,
>>   StringRef DarwinLibName, bool AlwaysLink,
>>   bool IsEmbedded, bool AddRPath) const {
>> 
>> Modified: cfe/trunk/lib/Driver/ToolChains.h
>> URL: http://llvm.org/viewvc/llvm-
>> project/cfe/trunk/lib/Driver/ToolChains.h?rev=284416&r1=284415&r2=284416&v
>> iew=diff
>> ==
>> 
>> --- cfe/trunk/lib/Driver/ToolChains.h (original)
>> +++ cfe/trunk/lib/Driver/ToolChains.h Mon Oct 17 14:36:18 2016
>> @@ -585,7 +585,7 @@ public:
>>   void AddLinkARCArgs(const llvm::opt::ArgList &Args,
>>   llvm::opt::ArgStringList &CmdArgs) const override;
>> 
>> -  unsigned GetDefaultDwarfVersion() const override { return 4; }
>> +  unsigned GetDefaultDwarfVersion() const override;
>>   // Until dtrace (via CTF) and LLDB can deal with distributed debug
>> info,
>>   // Darwin defaults to standalone/full debug info.
>>   bool GetDefaultStandaloneDebug() const override { return true; }
>> 
>> Modified: cfe/trunk/test/Driver/clang-g-opts.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-g-
>> opts.c?rev=284416&r1=284415&r2=284416&view=diff
>> ==
>> 
>> --- cfe/trunk/test/Driver/clang-g-opts.c (original)
>> +++ cfe/trunk/test/Driver/clang-g-opts.c Mon Oct 17 14:36:18 2016
>> @@ -4,7 +4,7 @@
>> 
>> // Assert that the toolchains which should default to a lower Dwarf
>> version do so.
>> // RUN: %clang -### -S %s -g -target x86_64-apple-darwin 2>&1 \
>> -// RUN: | FileCheck --check-prefix=CHECK-WITH-G-STANDALONE %s
>> +// RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
> 
> This seems to weaken the test unnecessarily.
> That is, "G-STANDALONE" should still work and checks more things.
> --paulr
> 
>> // RUN: %clang -### -S %s -g -target i686-pc-openbsd 2>&1 \
>> // RUN: | FileCheck --check-prefix=CHECK-WITH-G-DWARF2 %s
>> // RUN: %clang -### -S %s -g -target x86_64-pc-freebsd10.0 2>&1 \
>> @@ -36,4 +36,4 @@
>> // CHECK-WITH-G-DWARF2: "-dwarf-version=2"
>> 
>> // CHECK-WITH-G-STANDALONE: "-debug-info-kind=standalone"
>> -// CHECK-WITH-G-STANDALONE: "-dwarf-version=4"
>> +// CHECK-WITH-G-STANDALONE: "-dwarf-version=2"
>> 
>> Modified: cfe/trunk/test/Driver/debug-options.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/debug-
>> options.c?rev=284416&r1=284415&r2=284416&view=diff
>> ==
>> 
>> --- cfe/trunk/test/Driver/debug-options.c (original)
>> +++ cfe/trunk/test/Driver/debug-options.c Mon Oct 17 14:36:18 2016
>> @@ -19,17 +19,31 @@
>> // RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s
>> 
>> // RUN: %clang -### -c -g %s -target x86_64-apple-darwin 2>&1 \
>> -// RUN: | FileCheck -check-prefix=G_DARWIN -check-
>> prefix=G_

  1   2   >