[PATCH] D30393: Do not inherit default arguments for friend function in class template.

2017-06-05 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff updated this revision to Diff 101512.
sepavloff added a comment.

Rebased patch


https://reviews.llvm.org/D30393

Files:
  lib/Sema/SemaDeclCXX.cpp
  test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp


Index: test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
===
--- test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
+++ test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
@@ -73,3 +73,36 @@
 }
 
 } // namespace
+
+namespace pr12724 {
+
+void func_01(bool param = true);
+class C01 {
+public:
+  friend void func_01(bool param);
+};
+
+void func_02(bool param = true);
+template
+class C02 {
+public:
+  friend void func_02(bool param);
+};
+C02 c02;
+
+void func_03(bool param);
+template
+class C03 {
+public:
+  friend void func_03(bool param);
+};
+void func_03(bool param = true);
+C03 c03;
+
+void main() {
+  func_01();
+  func_02();
+  func_03();
+}
+
+} // namespace pr12724
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -547,17 +547,23 @@
   Diag(OldParam->getLocation(), diag::note_previous_definition)
 << OldParam->getDefaultArgRange();
 } else if (OldParamHasDfl) {
-  // Merge the old default argument into the new parameter.
-  // It's important to use getInit() here;  getDefaultArg()
-  // strips off any top-level ExprWithCleanups.
-  NewParam->setHasInheritedDefaultArg();
-  if (OldParam->hasUnparsedDefaultArg())
-NewParam->setUnparsedDefaultArg();
-  else if (OldParam->hasUninstantiatedDefaultArg())
-NewParam->setUninstantiatedDefaultArg(
-  OldParam->getUninstantiatedDefaultArg());
-  else
-NewParam->setDefaultArg(OldParam->getInit());
+  // Merge the old default argument into the new parameter unless the new
+  // function is a friend declaration in a template class. In the latter
+  // case the default arguments will be inherited when the friend
+  // declaration will be instantiated.
+  if (New->getFriendObjectKind() == Decl::FOK_None ||
+  !New->getLexicalDeclContext()->isDependentContext()) {
+// It's important to use getInit() here;  getDefaultArg()
+// strips off any top-level ExprWithCleanups.
+NewParam->setHasInheritedDefaultArg();
+if (OldParam->hasUnparsedDefaultArg())
+  NewParam->setUnparsedDefaultArg();
+else if (OldParam->hasUninstantiatedDefaultArg())
+  NewParam->setUninstantiatedDefaultArg(
+   
OldParam->getUninstantiatedDefaultArg());
+else
+  NewParam->setDefaultArg(OldParam->getInit());
+  }
 } else if (NewParamHasDfl) {
   if (New->getDescribedFunctionTemplate()) {
 // Paragraph 4, quoted above, only applies to non-template functions.


Index: test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
===
--- test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
+++ test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
@@ -73,3 +73,36 @@
 }
 
 } // namespace
+
+namespace pr12724 {
+
+void func_01(bool param = true);
+class C01 {
+public:
+  friend void func_01(bool param);
+};
+
+void func_02(bool param = true);
+template
+class C02 {
+public:
+  friend void func_02(bool param);
+};
+C02 c02;
+
+void func_03(bool param);
+template
+class C03 {
+public:
+  friend void func_03(bool param);
+};
+void func_03(bool param = true);
+C03 c03;
+
+void main() {
+  func_01();
+  func_02();
+  func_03();
+}
+
+} // namespace pr12724
Index: lib/Sema/SemaDeclCXX.cpp
===
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -547,17 +547,23 @@
   Diag(OldParam->getLocation(), diag::note_previous_definition)
 << OldParam->getDefaultArgRange();
 } else if (OldParamHasDfl) {
-  // Merge the old default argument into the new parameter.
-  // It's important to use getInit() here;  getDefaultArg()
-  // strips off any top-level ExprWithCleanups.
-  NewParam->setHasInheritedDefaultArg();
-  if (OldParam->hasUnparsedDefaultArg())
-NewParam->setUnparsedDefaultArg();
-  else if (OldParam->hasUninstantiatedDefaultArg())
-NewParam->setUninstantiatedDefaultArg(
-  OldParam->getUninstantiatedDefaultArg());
-  else
-NewParam->setDefaultArg(OldParam->getInit());
+  // Merge the old default argument into the new parameter unless the new
+  // function is a friend declaration in a template class. In the latter
+  // case the default arguments will be inherited when the friend
+  // declaration will be instantiated.
+  if (New->getFriendObjectKind() == Decl::FOK_None ||
+  

[PATCH] D33820: [PowerPC] Pass CPU to assembler with -no-integrated-as

2017-06-05 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai updated this revision to Diff 101508.
nemanjai added a comment.

Remove the temporary string variable for the CPU.


Repository:
  rL LLVM

https://reviews.llvm.org/D33820

Files:
  lib/Driver/ToolChains/Arch/PPC.cpp
  lib/Driver/ToolChains/Arch/PPC.h
  lib/Driver/ToolChains/Gnu.cpp
  test/Driver/linux-as.c
  test/Driver/ppc-features.cpp

Index: test/Driver/ppc-features.cpp
===
--- test/Driver/ppc-features.cpp
+++ test/Driver/ppc-features.cpp
@@ -171,8 +171,8 @@
 
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o -no-integrated-as 2>&1 | FileCheck -check-prefix=CHECK_LE_AS_ARGS %s
 // CHECK_LE_AS_ARGS: "-mppc64"
-// CHECK_LE_AS_ARGS: "-many"
 // CHECK_LE_AS_ARGS: "-mlittle-endian"
+// CHECK_LE_AS_ARGS: "-mpower8"
 
 // linker features
 // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK_BE_LD_ARGS %s
Index: test/Driver/linux-as.c
===
--- test/Driver/linux-as.c
+++ test/Driver/linux-as.c
@@ -174,3 +174,18 @@
 // RUN:   -no-integrated-as -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-Z-ARCH-Z196 %s
 // CHECK-Z-ARCH-Z196: as{{.*}} "-march=z196"
+//
+// RUN: %clang -target powerpc64le-linux -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PPC64LE %s
+// CHECK-PPC64LE: as{{.*}} "-mpower8"
+//
+// RUN: %clang -target powerpc64-linux -mcpu=pwr7 -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PPC64 %s
+// CHECK-PPC64: as{{.*}} "-mpower7"
+//
+// RUN: %clang -target powerpc-linux -mcpu=pwr9 -### \
+// RUN:   -no-integrated-as -c %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-PPC32 %s
+// CHECK-PPC32: as{{.*}} "-mpower9"
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -11,6 +11,7 @@
 #include "Linux.h"
 #include "Arch/ARM.h"
 #include "Arch/Mips.h"
+#include "Arch/PPC.h"
 #include "Arch/Sparc.h"
 #include "Arch/SystemZ.h"
 #include "CommonArgs.h"
@@ -674,22 +675,28 @@
 else
   CmdArgs.push_back("--64");
 break;
-  case llvm::Triple::ppc:
+  case llvm::Triple::ppc: {
 CmdArgs.push_back("-a32");
 CmdArgs.push_back("-mppc");
-CmdArgs.push_back("-many");
+CmdArgs.push_back(
+  ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(;
 break;
-  case llvm::Triple::ppc64:
+  }
+  case llvm::Triple::ppc64: {
 CmdArgs.push_back("-a64");
 CmdArgs.push_back("-mppc64");
-CmdArgs.push_back("-many");
+CmdArgs.push_back(
+  ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(;
 break;
-  case llvm::Triple::ppc64le:
+  }
+  case llvm::Triple::ppc64le: {
 CmdArgs.push_back("-a64");
 CmdArgs.push_back("-mppc64");
-CmdArgs.push_back("-many");
 CmdArgs.push_back("-mlittle-endian");
+CmdArgs.push_back(
+  ppc::getPPCAsmModeForCPU(getCPUName(Args, getToolChain().getTriple(;
 break;
+  }
   case llvm::Triple::sparc:
   case llvm::Triple::sparcel: {
 CmdArgs.push_back("-32");
Index: lib/Driver/ToolChains/Arch/PPC.h
===
--- lib/Driver/ToolChains/Arch/PPC.h
+++ lib/Driver/ToolChains/Arch/PPC.h
@@ -32,6 +32,7 @@
 FloatABI getPPCFloatABI(const Driver , const llvm::opt::ArgList );
 
 std::string getPPCTargetCPU(const llvm::opt::ArgList );
+const char *getPPCAsmModeForCPU(StringRef Name);
 
 void getPPCTargetFeatures(const Driver , const llvm::Triple ,
   const llvm::opt::ArgList ,
Index: lib/Driver/ToolChains/Arch/PPC.cpp
===
--- lib/Driver/ToolChains/Arch/PPC.cpp
+++ lib/Driver/ToolChains/Arch/PPC.cpp
@@ -86,6 +86,18 @@
   return "";
 }
 
+const char *ppc::getPPCAsmModeForCPU(StringRef Name) {
+  return llvm::StringSwitch(Name)
+.Case("pwr7", "-mpower7")
+.Case("power7", "-mpower7")
+.Case("pwr8", "-mpower8")
+.Case("power8", "-mpower8")
+.Case("ppc64le", "-mpower8")
+.Case("pwr9", "-mpower9")
+.Case("power9", "-mpower9")
+.Default("-many");
+}
+
 void ppc::getPPCTargetFeatures(const Driver , const llvm::Triple ,
const ArgList ,
std::vector ) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D33926: [clang] Remove double semicolons. NFC.

2017-06-05 Thread Mandeep Singh Grang via Phabricator via cfe-commits
mgrang created this revision.
mgrang added a project: clang-c.

https://reviews.llvm.org/D33926

Files:
  lib/AST/Type.cpp
  lib/Sema/SemaType.cpp


Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -3367,7 +3367,7 @@
 if (auto objcClass = type->getAs()) {
   if (objcClass->getInterface()->getIdentifier() == S.getNSErrorIdent()) {
 if (numNormalPointers == 2 && numTypeSpecifierPointers < 2)
-  return PointerDeclaratorKind::NSErrorPointerPointer;;
+  return PointerDeclaratorKind::NSErrorPointerPointer;
   }
 
   break;
Index: lib/AST/Type.cpp
===
--- lib/AST/Type.cpp
+++ lib/AST/Type.cpp
@@ -1344,7 +1344,7 @@
   } else if (getAs()) {
 ASTContext  = dc->getParentASTContext();
 objectType = ctx.getObjCObjectType(ctx.ObjCBuiltinIdTy, { }, { })
-   ->castAs();;
+   ->castAs();
   } else {
 objectType = getAs();
   }


Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -3367,7 +3367,7 @@
 if (auto objcClass = type->getAs()) {
   if (objcClass->getInterface()->getIdentifier() == S.getNSErrorIdent()) {
 if (numNormalPointers == 2 && numTypeSpecifierPointers < 2)
-  return PointerDeclaratorKind::NSErrorPointerPointer;;
+  return PointerDeclaratorKind::NSErrorPointerPointer;
   }
 
   break;
Index: lib/AST/Type.cpp
===
--- lib/AST/Type.cpp
+++ lib/AST/Type.cpp
@@ -1344,7 +1344,7 @@
   } else if (getAs()) {
 ASTContext  = dc->getParentASTContext();
 objectType = ctx.getObjCObjectType(ctx.ObjCBuiltinIdTy, { }, { })
-   ->castAs();;
+   ->castAs();
   } else {
 objectType = getAs();
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r304765 - [libcxx] [test] Add _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to msvc_stdlib_force_include.hpp.

2017-06-05 Thread Stephan T. Lavavej via cfe-commits
Author: stl_msft
Date: Mon Jun  5 21:46:12 2017
New Revision: 304765

URL: http://llvm.org/viewvc/llvm-project?rev=304765=rev
Log:
[libcxx] [test] Add _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to 
msvc_stdlib_force_include.hpp.

This macro will instruct MSVC's STL to not warn about features that are 
deprecated in C++17,
as libcxx tests those features and uses them elsewhere.

Modified:
libcxx/trunk/test/support/msvc_stdlib_force_include.hpp

Modified: libcxx/trunk/test/support/msvc_stdlib_force_include.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/msvc_stdlib_force_include.hpp?rev=304765=304764=304765=diff
==
--- libcxx/trunk/test/support/msvc_stdlib_force_include.hpp (original)
+++ libcxx/trunk/test/support/msvc_stdlib_force_include.hpp Mon Jun  5 21:46:12 
2017
@@ -81,6 +81,9 @@ const AssertionDialogAvoider assertion_d
 
 // Silence warnings about raw pointers and other unchecked iterators.
 #define _SCL_SECURE_NO_WARNINGS
+
+// Silence warnings about features that are deprecated in C++17.
+#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
 #endif // _LIBCXX_IN_DEVCRT
 
 #include 


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


[PATCH] D17215: [Sema] Fix PR14211 Crash for explicit instantiation of overloaded template function within class template

2017-06-05 Thread don hinton via Phabricator via cfe-commits
hintonda added a comment.

Great, thanks John.

Yes, that's correct -- I do not have commit access.


https://reviews.llvm.org/D17215



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


[PATCH] D17215: [Sema] Fix PR14211 Crash for explicit instantiation of overloaded template function within class template

2017-06-05 Thread John McCall via Phabricator via cfe-commits
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.

Thanks, looks great.  Do you still not have commit access?


https://reviews.llvm.org/D17215



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


[PATCH] D17215: [Sema] Fix PR14211 Crash for explicit instantiation of overloaded template function within class template

2017-06-05 Thread don hinton via Phabricator via cfe-commits
hintonda updated this revision to Diff 101503.
hintonda added a comment.

- Addressed comments.


https://reviews.llvm.org/D17215

Files:
  lib/Sema/SemaTemplate.cpp
  test/CXX/temp/temp.decls/temp.mem/p5.cpp


Index: test/CXX/temp/temp.decls/temp.mem/p5.cpp
===
--- test/CXX/temp/temp.decls/temp.mem/p5.cpp
+++ test/CXX/temp/temp.decls/temp.mem/p5.cpp
@@ -77,3 +77,16 @@
   x0.operator float *();
   x0c.operator const char*();
 }
+
+namespace PR14211 {
+template  struct X {
+  void foo(U){}
+  template  void foo(T){}
+
+  template  void bar(T){}
+  void bar(U){}
+};
+
+template void X::foo(int);
+template void X::bar(int);
+}
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -8955,7 +8955,8 @@
   //   A member function [...] of a class template can be explicitly
   //  instantiated from the member definition associated with its class
   //  template.
-  UnresolvedSet<8> Matches;
+  UnresolvedSet<8> TemplateMatches;
+  FunctionDecl *NonTemplateMatch = nullptr;
   AttributeList *Attr = D.getDeclSpec().getAttributes().getList();
   TemplateSpecCandidateSet FailedCandidates(D.getIdentifierLoc());
   for (LookupResult::iterator P = Previous.begin(), PEnd = Previous.end();
@@ -8966,11 +8967,13 @@
 QualType Adjusted = adjustCCAndNoReturn(R, Method->getType(),
 /*AdjustExceptionSpec*/true);
 if (Context.hasSameUnqualifiedType(Method->getType(), Adjusted)) {
-  Matches.clear();
-
-  Matches.addDecl(Method, P.getAccess());
-  if (Method->getTemplateSpecializationKind() == TSK_Undeclared)
-break;
+  if (Method->getPrimaryTemplate()) {
+TemplateMatches.addDecl(Method, P.getAccess());
+  } else {
+// FIXME: Can this assert ever happen?  Needs a test.
+assert(!NonTemplateMatch && "Multiple NonTemplateMatches");
+NonTemplateMatch = Method;
+  }
 }
   }
 }
@@ -9009,22 +9012,25 @@
   continue;
 }
 
-Matches.addDecl(Specialization, P.getAccess());
+TemplateMatches.addDecl(Specialization, P.getAccess());
   }
 
-  // Find the most specialized function template specialization.
-  UnresolvedSetIterator Result = getMostSpecialized(
-  Matches.begin(), Matches.end(), FailedCandidates,
-  D.getIdentifierLoc(),
-  PDiag(diag::err_explicit_instantiation_not_known) << Name,
-  PDiag(diag::err_explicit_instantiation_ambiguous) << Name,
-  PDiag(diag::note_explicit_instantiation_candidate));
-
-  if (Result == Matches.end())
-return true;
+  FunctionDecl *Specialization = NonTemplateMatch;
+  if (!Specialization) {
+// Find the most specialized function template specialization.
+UnresolvedSetIterator Result = getMostSpecialized(
+TemplateMatches.begin(), TemplateMatches.end(), FailedCandidates,
+D.getIdentifierLoc(),
+PDiag(diag::err_explicit_instantiation_not_known) << Name,
+PDiag(diag::err_explicit_instantiation_ambiguous) << Name,
+PDiag(diag::note_explicit_instantiation_candidate));
+
+if (Result == TemplateMatches.end())
+  return true;
 
-  // Ignore access control bits, we don't need them for redeclaration checking.
-  FunctionDecl *Specialization = cast(*Result);
+// Ignore access control bits, we don't need them for redeclaration 
checking.
+Specialization = cast(*Result);
+  }
 
   // C++11 [except.spec]p4
   // In an explicit instantiation an exception-specification may be specified,


Index: test/CXX/temp/temp.decls/temp.mem/p5.cpp
===
--- test/CXX/temp/temp.decls/temp.mem/p5.cpp
+++ test/CXX/temp/temp.decls/temp.mem/p5.cpp
@@ -77,3 +77,16 @@
   x0.operator float *();
   x0c.operator const char*();
 }
+
+namespace PR14211 {
+template  struct X {
+  void foo(U){}
+  template  void foo(T){}
+
+  template  void bar(T){}
+  void bar(U){}
+};
+
+template void X::foo(int);
+template void X::bar(int);
+}
Index: lib/Sema/SemaTemplate.cpp
===
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -8955,7 +8955,8 @@
   //   A member function [...] of a class template can be explicitly
   //  instantiated from the member definition associated with its class
   //  template.
-  UnresolvedSet<8> Matches;
+  UnresolvedSet<8> TemplateMatches;
+  FunctionDecl *NonTemplateMatch = nullptr;
   AttributeList *Attr = D.getDeclSpec().getAttributes().getList();
   TemplateSpecCandidateSet FailedCandidates(D.getIdentifierLoc());
   for (LookupResult::iterator P = Previous.begin(), PEnd = Previous.end();
@@ -8966,11 +8967,13 @@
 QualType Adjusted = adjustCCAndNoReturn(R, Method->getType(),
 

[PATCH] D33923: [Driver] Don't force .exe suffix for lld

2017-06-05 Thread Shoaib Meenai via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL304761: [Driver] Don't force .exe suffix for lld (authored 
by smeenai).

Changed prior to commit:
  https://reviews.llvm.org/D33923?vs=101495=101502#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33923

Files:
  cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
  cfe/trunk/test/Driver/cl-link.c


Index: cfe/trunk/test/Driver/cl-link.c
===
--- cfe/trunk/test/Driver/cl-link.c
+++ cfe/trunk/test/Driver/cl-link.c
@@ -56,4 +56,4 @@
 // NONEXISTENT: nonexistent
 
 // RUN: %clang_cl /Tc%s -fuse-ld=lld -### 2>&1 | FileCheck 
--check-prefix=USE_LLD %s
-// USE_LLD: lld-link.exe
+// USE_LLD: lld-link
Index: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
@@ -529,9 +529,7 @@
   SkipSettingEnvironment:;
 #endif
   } else {
-linkPath = Linker;
-llvm::sys::path::replace_extension(linkPath, "exe");
-linkPath = TC.GetProgramPath(linkPath.c_str());
+linkPath = TC.GetProgramPath(Linker.str().c_str());
   }
 
   auto LinkCmd = llvm::make_unique(


Index: cfe/trunk/test/Driver/cl-link.c
===
--- cfe/trunk/test/Driver/cl-link.c
+++ cfe/trunk/test/Driver/cl-link.c
@@ -56,4 +56,4 @@
 // NONEXISTENT: nonexistent
 
 // RUN: %clang_cl /Tc%s -fuse-ld=lld -### 2>&1 | FileCheck --check-prefix=USE_LLD %s
-// USE_LLD: lld-link.exe
+// USE_LLD: lld-link
Index: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
@@ -529,9 +529,7 @@
   SkipSettingEnvironment:;
 #endif
   } else {
-linkPath = Linker;
-llvm::sys::path::replace_extension(linkPath, "exe");
-linkPath = TC.GetProgramPath(linkPath.c_str());
+linkPath = TC.GetProgramPath(Linker.str().c_str());
   }
 
   auto LinkCmd = llvm::make_unique(
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r304761 - [Driver] Don't force .exe suffix for lld

2017-06-05 Thread Shoaib Meenai via cfe-commits
Author: smeenai
Date: Mon Jun  5 21:06:28 2017
New Revision: 304761

URL: http://llvm.org/viewvc/llvm-project?rev=304761=rev
Log:
[Driver] Don't force .exe suffix for lld

When cross-compiling to Windows using lld, we want the driver to invoke
it as lld-link rather than lld-link.exe. On Windows, the LLVM fs
functions take care of adding the .exe suffix where necessary, so we can
just drop the addition in the toolchain entirely.

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

Modified:
cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
cfe/trunk/test/Driver/cl-link.c

Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=304761=304760=304761=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Mon Jun  5 21:06:28 2017
@@ -529,9 +529,7 @@ void visualstudio::Linker::ConstructJob(
   SkipSettingEnvironment:;
 #endif
   } else {
-linkPath = Linker;
-llvm::sys::path::replace_extension(linkPath, "exe");
-linkPath = TC.GetProgramPath(linkPath.c_str());
+linkPath = TC.GetProgramPath(Linker.str().c_str());
   }
 
   auto LinkCmd = llvm::make_unique(

Modified: cfe/trunk/test/Driver/cl-link.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-link.c?rev=304761=304760=304761=diff
==
--- cfe/trunk/test/Driver/cl-link.c (original)
+++ cfe/trunk/test/Driver/cl-link.c Mon Jun  5 21:06:28 2017
@@ -56,4 +56,4 @@
 // NONEXISTENT: nonexistent
 
 // RUN: %clang_cl /Tc%s -fuse-ld=lld -### 2>&1 | FileCheck 
--check-prefix=USE_LLD %s
-// USE_LLD: lld-link.exe
+// USE_LLD: lld-link


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


r304760 - PR33318: Add missing full-expression checking to static_assert expression.

2017-06-05 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Mon Jun  5 20:34:24 2017
New Revision: 304760

URL: http://llvm.org/viewvc/llvm-project?rev=304760=rev
Log:
PR33318: Add missing full-expression checking to static_assert expression.

This fixes missing lambda-captures for variables referenced only inside a
static_assert (!), among other things.

Modified:
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-capturing.cpp
cfe/trunk/test/SemaTemplate/deduction.cpp

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=304760=304759=304760=diff
==
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Mon Jun  5 20:34:24 2017
@@ -1461,7 +1461,8 @@ public:
   };
 
   ExprResult ParseExpression(TypeCastState isTypeCast = NotTypeCast);
-  ExprResult ParseConstantExpressionInExprEvalContext(TypeCastState 
isTypeCast);
+  ExprResult ParseConstantExpressionInExprEvalContext(
+  TypeCastState isTypeCast = NotTypeCast);
   ExprResult ParseConstantExpression(TypeCastState isTypeCast = NotTypeCast);
   ExprResult ParseConstraintExpression();
   // Expr that doesn't include commas.

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=304760=304759=304760=diff
==
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Mon Jun  5 20:34:24 2017
@@ -840,7 +840,9 @@ Decl *Parser::ParseStaticAssertDeclarati
 return nullptr;
   }
 
-  ExprResult AssertExpr(ParseConstantExpression());
+  EnterExpressionEvaluationContext ConstantEvaluated(
+  Actions, Sema::ExpressionEvaluationContext::ConstantEvaluated);
+  ExprResult AssertExpr(ParseConstantExpressionInExprEvalContext());
   if (AssertExpr.isInvalid()) {
 SkipMalformedDecl();
 return nullptr;

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=304760=304759=304760=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Mon Jun  5 20:34:24 2017
@@ -13232,6 +13232,14 @@ Decl *Sema::BuildStaticAssertDeclaration
 }
   }
 
+  ExprResult FullAssertExpr = ActOnFinishFullExpr(AssertExpr, StaticAssertLoc,
+  /*DiscardedValue*/false,
+  /*IsConstexpr*/true);
+  if (FullAssertExpr.isInvalid())
+Failed = true;
+  else
+AssertExpr = FullAssertExpr.get();
+
   Decl *Decl = StaticAssertDecl::Create(Context, CurContext, StaticAssertLoc,
 AssertExpr, AssertMessage, RParenLoc,
 Failed);

Modified: cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-capturing.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-capturing.cpp?rev=304760=304759=304760=diff
==
--- cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-capturing.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-capturing.cpp Mon Jun  5 
20:34:24 2017
@@ -1376,3 +1376,7 @@ XT xt{};
 
 
 }
+
+void PR33318(int i) {
+  [&](auto) { static_assert( != nullptr, ""); }(0); // expected-warning 
2{{always true}} expected-note {{instantiation}}
+}

Modified: cfe/trunk/test/SemaTemplate/deduction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/deduction.cpp?rev=304760=304759=304760=diff
==
--- cfe/trunk/test/SemaTemplate/deduction.cpp (original)
+++ cfe/trunk/test/SemaTemplate/deduction.cpp Mon Jun  5 20:34:24 2017
@@ -305,11 +305,11 @@ namespace nullptr_deduction {
 
   template struct X {};
   template void f(X) {
-static_assert(!v, "");
+static_assert(!v, ""); // expected-warning 2{{implicit conversion of 
nullptr constant to 'bool'}}
   }
   void g() {
-f(X());
-f(X());
+f(X()); // expected-note {{instantiation of}}
+f(X()); // expected-note {{instantiation of}}
   }
 
   template