[PATCH] D42351: Emit DWARF "constructor" calling convention for every supported Clang CC

2018-02-10 Thread Adrien Guinet via Phabricator via cfe-commits
aguinet updated this revision to Diff 133745.
aguinet added a comment.
Herald added a subscriber: krytarowski.

Test case added!


https://reviews.llvm.org/D42351

Files:
  lib/CodeGen/CGDebugInfo.cpp
  test/CodeGen/debug-info-cc.c

Index: test/CodeGen/debug-info-cc.c
===
--- /dev/null
+++ test/CodeGen/debug-info-cc.c
@@ -0,0 +1,121 @@
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s >%t
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -o - -emit-llvm -debug-info-kind=limited %s >>%t
+// RUN: %clang_cc1 -triple i386-pc-linux-gnu -o - -emit-llvm -debug-info-kind=limited %s >>%t
+// RUN: %clang_cc1 -triple armv7--linux-gnueabihf -o - -emit-llvm -debug-info-kind=limited %s >>%t
+// RUN: FileCheck %s <%t
+
+//  enum CallingConv {
+//CC_C,   // __attribute__((cdecl))
+//CC_X86StdCall,  // __attribute__((stdcall))
+//CC_X86FastCall, // __attribute__((fastcall))
+//CC_X86ThisCall, // __attribute__((thiscall))
+//CC_X86VectorCall, // __attribute__((vectorcall))
+//CC_X86Pascal,   // __attribute__((pascal))
+//CC_Win64,   // __attribute__((ms_abi))
+//CC_X86_64SysV,  // __attribute__((sysv_abi))
+//CC_X86RegCall, // __attribute__((regcall))
+//CC_AAPCS,   // __attribute__((pcs("aapcs")))
+//CC_AAPCS_VFP,   // __attribute__((pcs("aapcs-vfp")))
+//CC_IntelOclBicc, // __attribute__((intel_ocl_bicc))
+//CC_SpirFunction, // default for OpenCL functions on SPIR target
+//CC_OpenCLKernel, // inferred for OpenCL kernels
+//CC_Swift,// __attribute__((swiftcall))
+//CC_PreserveMost, // __attribute__((preserve_most))
+//CC_PreserveAll,  // __attribute__((preserve_all))
+//  };
+
+#ifdef __x86_64__
+
+#ifdef __linux__
+// CHECK: !DISubprogram({{.*}}"add_msabi", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Win64,
+__attribute__((ms_abi)) int add_msabi(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_regcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86RegCall,
+__attribute__((regcall)) int add_regcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_preserve_most", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveMost,
+__attribute__((preserve_most)) int add_preserve_most(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_preserve_all", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_PreserveAll,
+__attribute__((preserve_all)) int add_preserve_all(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_swiftcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_Swift,
+__attribute__((swiftcall)) int add_swiftcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_inteloclbicc", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_IntelOclBicc,
+__attribute__((intel_ocl_bicc)) int add_inteloclbicc(int a, int b) {
+  return a+b;
+}
+#endif
+
+#ifdef _WIN64
+// CHECK: !DISubprogram({{.*}}"add_sysvabi", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_X86_64SysV,
+__attribute__((sysv_abi)) int add_sysvabi(int a, int b) {
+  return a+b;
+}
+#endif
+
+#endif
+
+#ifdef __i386__
+// CHECK: !DISubprogram({{.*}}"add_stdcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_stdcall,
+__attribute__((stdcall)) int add_stdcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_fastcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_msfastcall,
+__attribute__((fastcall)) int add_fastcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_thiscall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_thiscall,
+__attribute__((thiscall)) int add_thiscall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_vectorcall", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_vectorcall,
+__attribute__((vectorcall)) int add_vectorcall(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_pascal", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_BORLAND_pascal,
+__attribute__((pascal)) int add_pascal(int a, int b) {
+  return a+b;
+}
+#endif
+
+#ifdef __arm__
+// CHECK: !DISubprogram({{.*}}"add_aapcs", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISubroutineType({{.*}}cc: DW_CC_LLVM_AAPCS,
+__attribute__((pcs("aapcs"))) int add_aapcs(int a, int b) {
+  return a+b;
+}
+
+// CHECK: !DISubprogram({{.*}}"add_aapcs_vfp", {{.*}}type: ![[FTY:[0-9]+]]
+// CHECK: ![[FTY]] = !DISu

[PATCH] Fix linker errors caused bv passing "-Og" to gold plugin

2018-02-10 Thread Joey Pabalinas via cfe-commits
[Driver] Pass -O0 to gold plugin when -Og is specified on the command-line

The gold plugin understands -O0..-O3, so when -Og is passed to it, the link
fails with:

> /bin/ld.gold: fatal error: Optimization level must be between 0 and 3
>
> clang-5.0: error: linker command failed with exit code 1 (use -v to see
> invocation)

Pass -O0 instead of -Og to the gold plugin when that optimization level
is specified as a command-line argument.

-- 
Joey Pabalinas
Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp(revision 324803)
+++ lib/Driver/ToolChains/CommonArgs.cpp(working copy)
@@ -405,7 +405,9 @@
 A->getOption().matches(options::OPT_Ofast))
   OOpt = "3";
 else if (A->getOption().matches(options::OPT_O))
-  OOpt = A->getValue();
+  // The ld.gold linker needs an optimization level between 0 and 3.
+  // If optimization level is`-Og`, pass `-O0` to avoid linker errors.
+  OOpt = A->getValue()[0] == 'g' ? "0" : A->getValue();
 else if (A->getOption().matches(options::OPT_O0))
   OOpt = "0";
 if (!OOpt.empty())
Index: test/Driver/gold-lto.c
===
--- test/Driver/gold-lto.c  (revision 324803)
+++ test/Driver/gold-lto.c  (working copy)
@@ -8,6 +8,14 @@
 // CHECK-X86-64-BASIC: "-plugin-opt=foo"
 //
 // RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
+// RUN: -Wl,-plugin-opt=foo -Og \
+// RUN: | FileCheck %s --check-prefix=CHECK-X86-64-CORE2
+// CHECK-X86-64-BASIC: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"
+// CHECK-X86-64-CORE2: "-plugin-opt=mcpu=core2"
+// CHECK-X86-64-BASIC: "-plugin-opt=Og"
+// CHECK-X86-64-BASIC: "-plugin-opt=foo"
+//
+// RUN: %clang -target x86_64-unknown-linux -### %t.o -flto 2>&1 \
 // RUN: -march=corei7 -Wl,-plugin-opt=foo -Ofast \
 // RUN: | FileCheck %s --check-prefix=CHECK-X86-64-COREI7
 // CHECK-X86-64-COREI7: "-plugin" "{{.*}}{{[/\\]}}LLVMgold.{{dll|dylib|so}}"


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


[PATCH] D5767: Template Instantiation Observer + a few other templight-related changes

2018-02-10 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL324808: [Templight] Template Instantiation Observer 
(authored by xazax, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D5767?vs=133614&id=133748#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D5767

Files:
  cfe/trunk/include/clang/Driver/CC1Options.td
  cfe/trunk/include/clang/Frontend/FrontendActions.h
  cfe/trunk/include/clang/Frontend/FrontendOptions.h
  cfe/trunk/include/clang/FrontendTool/Utils.h
  cfe/trunk/include/clang/Sema/Sema.h
  cfe/trunk/include/clang/Sema/TemplateInstCallback.h
  cfe/trunk/lib/Frontend/CompilerInvocation.cpp
  cfe/trunk/lib/Frontend/FrontendActions.cpp
  cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
  cfe/trunk/lib/Parse/ParseAST.cpp
  cfe/trunk/lib/Sema/Sema.cpp
  cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
  cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
  cfe/trunk/lib/Sema/SemaType.cpp
  cfe/trunk/test/Templight/templight-deduced-func.cpp
  cfe/trunk/test/Templight/templight-default-arg-inst.cpp
  cfe/trunk/test/Templight/templight-default-func-arg.cpp
  cfe/trunk/test/Templight/templight-default-template-arg.cpp
  cfe/trunk/test/Templight/templight-exception-spec-func.cpp
  cfe/trunk/test/Templight/templight-explicit-template-arg.cpp
  cfe/trunk/test/Templight/templight-memoization.cpp
  cfe/trunk/test/Templight/templight-nested-memoization.cpp
  cfe/trunk/test/Templight/templight-nested-template-instantiation.cpp
  cfe/trunk/test/Templight/templight-one-instantiation.cpp
  cfe/trunk/test/Templight/templight-prior-template-arg.cpp

Index: cfe/trunk/test/Templight/templight-one-instantiation.cpp
===
--- cfe/trunk/test/Templight/templight-one-instantiation.cpp
+++ cfe/trunk/test/Templight/templight-one-instantiation.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -templight-dump %s 2>&1 | FileCheck %s
+
+template 
+struct foo {};
+
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'foo'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^orig:[ ]+'.*templight-one-instantiation.cpp:4:8'}}
+// CHECK: {{^poi:[ ]+'.*templight-one-instantiation.cpp:18:10'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'foo'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^orig:[ ]+'.*templight-one-instantiation.cpp:4:8'}}
+// CHECK: {{^poi:[ ]+'.*templight-one-instantiation.cpp:18:10'$}}
+foo x;
Index: cfe/trunk/test/Templight/templight-explicit-template-arg.cpp
===
--- cfe/trunk/test/Templight/templight-explicit-template-arg.cpp
+++ cfe/trunk/test/Templight/templight-explicit-template-arg.cpp
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 -templight-dump %s 2>&1 | FileCheck %s
+template 
+void f(){}
+
+int main()
+{
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+f$}}
+// CHECK: {{^kind:[ ]+ExplicitTemplateArgumentSubstitution$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}}
+// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+f$}}
+// CHECK: {{^kind:[ ]+ExplicitTemplateArgumentSubstitution$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}}
+// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}}
+//
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+f$}}
+// CHECK: {{^kind:[ ]+DeducedTemplateArgumentSubstitution$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}}
+// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+f$}}
+// CHECK: {{^kind:[ ]+DeducedTemplateArgumentSubstitution$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}}
+// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}}
+//
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'f'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}}
+// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'f'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}}
+// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}}
+//
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'f'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^orig:[ ]+'.*templight-explicit-template-arg.cpp:3:6'}}
+// CHECK: {{^poi:[ ]+'.*templight-explicit-template-arg.cpp:58:3'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK:

r324808 - [Templight] Template Instantiation Observer

2018-02-10 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Sat Feb 10 06:04:45 2018
New Revision: 324808

URL: http://llvm.org/viewvc/llvm-project?rev=324808&view=rev
Log:
[Templight] Template Instantiation Observer

This patch adds a base-class called TemplateInstantiationObserver which gets
notified whenever a template instantiation is entered or exited during
semantic analysis. This is a base class used to implement the template
profiling and debugging tool called
Templight (https://github.com/mikael-s-persson/templight).

The patch also makes a few more changes:

* ActiveTemplateInstantiation class is moved out of the Sema class (so it can 
be used with inclusion of Sema.h).
* CreateFrontendAction function in front-end utilities is given external 
linkage (not longer a hidden static function).
* TemplateInstObserverChain data member added to Sema class to hold the list of 
template-inst observers.
* Notifications to the template-inst observer are added at the key places where 
templates are instantiated.

Patch by: Abel Sinkovics!

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

Added:
cfe/trunk/include/clang/Sema/TemplateInstCallback.h
cfe/trunk/test/Templight/
cfe/trunk/test/Templight/templight-deduced-func.cpp
cfe/trunk/test/Templight/templight-default-arg-inst.cpp
cfe/trunk/test/Templight/templight-default-func-arg.cpp
cfe/trunk/test/Templight/templight-default-template-arg.cpp
cfe/trunk/test/Templight/templight-exception-spec-func.cpp
cfe/trunk/test/Templight/templight-explicit-template-arg.cpp
cfe/trunk/test/Templight/templight-memoization.cpp
cfe/trunk/test/Templight/templight-nested-memoization.cpp
cfe/trunk/test/Templight/templight-nested-template-instantiation.cpp
cfe/trunk/test/Templight/templight-one-instantiation.cpp
cfe/trunk/test/Templight/templight-prior-template-arg.cpp
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Frontend/FrontendActions.h
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/include/clang/FrontendTool/Utils.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
cfe/trunk/lib/Parse/ParseAST.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=324808&r1=324807&r2=324808&view=diff
==
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Sat Feb 10 06:04:45 2018
@@ -533,6 +533,8 @@ def ast_dump : Flag<["-"], "ast-dump">,
   HelpText<"Build ASTs and then debug dump them">;
 def ast_dump_all : Flag<["-"], "ast-dump-all">,
   HelpText<"Build ASTs and then debug dump them, forcing deserialization">;
+def templight_dump : Flag<["-"], "templight-dump">,
+  HelpText<"Dump templight information to stdout">;
 def ast_dump_lookups : Flag<["-"], "ast-dump-lookups">,
   HelpText<"Build ASTs and then debug dump their name lookup tables">;
 def ast_view : Flag<["-"], "ast-view">,

Modified: cfe/trunk/include/clang/Frontend/FrontendActions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendActions.h?rev=324808&r1=324807&r2=324808&view=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendActions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendActions.h Sat Feb 10 06:04:45 2018
@@ -167,6 +167,14 @@ public:
   bool hasCodeCompletionSupport() const override { return false; }
 };
 
+class TemplightDumpAction : public ASTFrontendAction {
+protected:
+  std::unique_ptr CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) override;
+
+  void ExecuteAction() override;
+};
+
 /**
  * \brief Frontend action adaptor that merges ASTs together.
  *

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=324808&r1=324807&r2=324808&view=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Sat Feb 10 06:04:45 2018
@@ -58,6 +58,7 @@ namespace frontend {
 RewriteObjC,///< ObjC->C Rewriter.
 RewriteTest,///< Rewriter playground
 RunAnalysis,///< Run one or more source code analyses.
+TemplightDump,  ///< Dump template instantiations
 MigrateSource,  ///< Run migrator.
 RunPreprocessorOnly

r324809 - Make a build bot happy.

2018-02-10 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Sat Feb 10 06:26:53 2018
New Revision: 324809

URL: http://llvm.org/viewvc/llvm-project?rev=324809&view=rev
Log:
Make a build bot happy.

Modified:
cfe/trunk/lib/Frontend/FrontendActions.cpp
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp

Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=324809&r1=324808&r2=324809&view=diff
==
--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Sat Feb 10 06:26:53 2018
@@ -309,17 +309,17 @@ class DefaultTemplateInstCallback : publ
   using CodeSynthesisContext = Sema::CodeSynthesisContext;
 
 public:
-  virtual void initialize(const Sema &) {}
+  void initialize(const Sema &) override {}
 
-  virtual void finalize(const Sema &) {}
+  void finalize(const Sema &) override {}
 
-  virtual void atTemplateBegin(const Sema &TheSema,
-   const CodeSynthesisContext &Inst) override {
+  void atTemplateBegin(const Sema &TheSema,
+   const CodeSynthesisContext &Inst) override {
 displayTemplightEntry(llvm::outs(), TheSema, Inst);
   }
 
-  virtual void atTemplateEnd(const Sema &TheSema,
- const CodeSynthesisContext &Inst) override {
+  void atTemplateEnd(const Sema &TheSema,
+ const CodeSynthesisContext &Inst) override {
 displayTemplightEntry(llvm::outs(), TheSema, Inst);
   }
 

Modified: cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=324809&r1=324808&r2=324809&view=diff
==
--- cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp (original)
+++ cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp Sat Feb 10 
06:26:53 2018
@@ -258,4 +258,4 @@ bool ExecuteCompilerInvocation(CompilerI
   return Success;
 }
 
-} //namespace clang 
+} // namespace clang 


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


[PATCH] D43159: Modernize: Use nullptr more.

2018-02-10 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
brucem added reviewers: mclow.lists, EricWF.

Repository:
  rCXX libc++

https://reviews.llvm.org/D43159

Files:
  include/__locale
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/fstream
  include/functional
  include/ios
  include/iterator
  include/locale
  include/memory
  include/sstream
  include/string
  include/system_error

Index: include/system_error
===
--- include/system_error
+++ include/system_error
@@ -512,7 +512,7 @@
 template 
 _LIBCPP_ALWAYS_INLINE
 error_code(_Ep __e,
-   typename enable_if::value>::type* = 0
+   typename enable_if::value>::type* = nullptr
  ) _NOEXCEPT
 {*this = make_error_code(__e);}
 
Index: include/string
===
--- include/string
+++ include/string
@@ -426,15 +426,15 @@
 typedef basic_string u16string;
 typedef basic_string u32string;
 
-intstoi  (const string& str, size_t* idx = 0, int base = 10);
-long   stol  (const string& str, size_t* idx = 0, int base = 10);
-unsigned long  stoul (const string& str, size_t* idx = 0, int base = 10);
-long long  stoll (const string& str, size_t* idx = 0, int base = 10);
-unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10);
+intstoi  (const string& str, size_t* idx = nullptr, int base = 10);
+long   stol  (const string& str, size_t* idx = nullptr, int base = 10);
+unsigned long  stoul (const string& str, size_t* idx = nullptr, int base = 10);
+long long  stoll (const string& str, size_t* idx = nullptr, int base = 10);
+unsigned long long stoull(const string& str, size_t* idx = nullptr, int base = 10);
 
-float   stof (const string& str, size_t* idx = 0);
-double  stod (const string& str, size_t* idx = 0);
-long double stold(const string& str, size_t* idx = 0);
+float   stof (const string& str, size_t* idx = nullptr);
+double  stod (const string& str, size_t* idx = nullptr);
+long double stold(const string& str, size_t* idx = nullptr);
 
 string to_string(int val);
 string to_string(unsigned val);
@@ -446,15 +446,15 @@
 string to_string(double val);
 string to_string(long double val);
 
-intstoi  (const wstring& str, size_t* idx = 0, int base = 10);
-long   stol  (const wstring& str, size_t* idx = 0, int base = 10);
-unsigned long  stoul (const wstring& str, size_t* idx = 0, int base = 10);
-long long  stoll (const wstring& str, size_t* idx = 0, int base = 10);
-unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10);
+intstoi  (const wstring& str, size_t* idx = nullptr, int base = 10);
+long   stol  (const wstring& str, size_t* idx = nullptr, int base = 10);
+unsigned long  stoul (const wstring& str, size_t* idx = nullptr, int base = 10);
+long long  stoll (const wstring& str, size_t* idx = nullptr, int base = 10);
+unsigned long long stoull(const wstring& str, size_t* idx = nullptr, int base = 10);
 
-float   stof (const wstring& str, size_t* idx = 0);
-double  stod (const wstring& str, size_t* idx = 0);
-long double stold(const wstring& str, size_t* idx = 0);
+float   stof (const wstring& str, size_t* idx = nullptr);
+double  stod (const wstring& str, size_t* idx = nullptr);
+long double stold(const wstring& str, size_t* idx = nullptr);
 
 wstring to_wstring(int val);
 wstring to_wstring(unsigned val);
@@ -3923,15 +3923,15 @@
 
 #endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
 
-_LIBCPP_FUNC_VIS intstoi  (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS long   stol  (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS unsigned long  stoul (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS long long  stoll (const string& __str, size_t* __idx = 0, int __base = 10);
-_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10);
+_LIBCPP_FUNC_VIS intstoi  (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS long   stol  (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long  stoul (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS long long  stoll (const string& __str, size_t* __idx = nullptr, int __base = 10);
+_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
 
-_LIBCPP_FUNC_VIS float   stof (const string& __str, size_t* __idx = 0);
-_LIBCPP_FUNC_VIS double  stod (const string& __str, size_t* __idx =

[PATCH] D42530: Clang permits assignment to vector/extvector elements in a const method

2018-02-10 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added a comment.

@avt77 Close this now that https://reviews.llvm.org/rL324721 has landed?


https://reviews.llvm.org/D42530



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


[PATCH] D43012: [ASTImporter] Fix lexical DC for templated decls; support VarTemplatePartialSpecDecl

2018-02-10 Thread Gabor Marton via Phabricator via cfe-commits
martong added inline comments.



Comment at: lib/AST/ASTImporter.cpp:2858
+
+  // Templated declarations should never appear in the enclosing DeclContext.
+  if (!D->getDescribedVarTemplate())

In case of class templates, the explicit instantiation is the member of the 
DeclContext. It does not belong to the DeclContext only in case of implicit 
instantiations.
I suppose the same is true for template variables as well.
In our code base we fixed it by checking on the TSK_ kind, see 
https://github.com/Ericsson/clang/pull/270/files.

@xazax.hun perhaps we should open source some of our fixes as well?



Comment at: lib/AST/ASTImporter.cpp:4455
 D2->setLexicalDeclContext(LexicalDC);
 LexicalDC->addDeclInternal(D2);
+

This is related to my other comment, perhaps we should not add `D2` to the 
DeclContext unconditionnally. I think only implicit instantiations should be 
added. See
https://github.com/Ericsson/clang/pull/270/files


Repository:
  rC Clang

https://reviews.llvm.org/D43012



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


[PATCH] D43012: [ASTImporter] Fix lexical DC for templated decls; support VarTemplatePartialSpecDecl

2018-02-10 Thread Gabor Marton via Phabricator via cfe-commits
martong added a comment.

Just ignore my previous comments, the issue with explicit instantiations could 
be fixed in a separate independent patch. All is good.


Repository:
  rC Clang

https://reviews.llvm.org/D43012



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


r324818 - Add vector add/sub/mul/div by scalar tests (PR27085)

2018-02-10 Thread Simon Pilgrim via cfe-commits
Author: rksimon
Date: Sat Feb 10 09:55:23 2018
New Revision: 324818

URL: http://llvm.org/viewvc/llvm-project?rev=324818&view=rev
Log:
Add vector add/sub/mul/div by scalar tests (PR27085)

Ensure the scalar is correctly splatted to all lanes

Added:
cfe/trunk/test/CodeGen/vector-scalar.c

Added: cfe/trunk/test/CodeGen/vector-scalar.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/vector-scalar.c?rev=324818&view=auto
==
--- cfe/trunk/test/CodeGen/vector-scalar.c (added)
+++ cfe/trunk/test/CodeGen/vector-scalar.c Sat Feb 10 09:55:23 2018
@@ -0,0 +1,42 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+// PR27085
+
+typedef unsigned char uchar4  __attribute__ ((vector_size (4)));
+
+// CHECK: @add2
+// CHECK: add <4 x i8> {{.*}}, 
+uchar4 add2(uchar4 v)
+{
+  return v + 2;
+}
+
+// CHECK: @sub2
+// CHECK: sub <4 x i8> {{.*}}, 
+uchar4 sub2(uchar4 v)
+{
+  return v - 2;
+}
+
+// CHECK: @mul2
+// CHECK: mul <4 x i8> {{.*}}, 
+uchar4 mul2(uchar4 v)
+{
+  return v * 2;
+}
+
+// CHECK: @div2
+// CHECK: udiv <4 x i8> {{.*}}, 
+uchar4 div2(uchar4 v)
+{
+  return v / 2;
+}
+
+typedef __attribute__(( ext_vector_type(4) )) unsigned char uchar4_ext;
+
+// CHECK: @div3_ext
+// CHECK: udiv <4 x i8> %{{.*}}, 
+uchar4_ext div3_ext(uchar4_ext v)
+{
+  return v / 3;
+}


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


[PATCH] D42614: AST: support ObjC lifetime qualifiers in MS ABI

2018-02-10 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd closed this revision.
compnerd added a comment.

SVN r324701


Repository:
  rC Clang

https://reviews.llvm.org/D42614



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


[PATCH] D43162: [Parser] (C++) Make -Wextra-semi slightly more useful

2018-02-10 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri created this revision.
lebedev.ri added reviewers: rsmith, rtrieu, aaron.ballman.
lebedev.ri added a project: clang.

Let's suppose the `-Weverything` is passed.

Given code like

  void F() {}
  ;

If the code is compiled with `-std=c++03`, it would diagnose that extra sema:

  :2:1: warning: extra ';' outside of a function is a C++11 extension 
[-Wc++11-extra-semi]
  ;
  ^~

If the code is compiled with `-std=c++11`, it also would diagnose that extra 
sema:

  :2:1: warning: extra ';' outside of a function is incompatible with 
C++98 [-Wc++98-compat-pedantic]
  ;
  ^~

But, let's suppose the C++11 or higher is used, and the used does not care
about `-Wc++98-compat-pedantic`, so he disables that diagnostic.
And that silences the complaint about extra `;` too.
And there is no way to re-enable that particular diagnostic, passing 
`-Wextra-semi` does nothing...

Now, there is also a related `no newline at end of file` diagnostic, which is 
also emitted by `-Wc++98-compat-pedantic`

  :2:2: warning: C++98 requires newline at end of file 
[-Wc++98-compat-pedantic]
  ;
   ^

But unlike the previous case, if `-Wno-c++98-compat-pedantic` is passed, that 
diagnostic stays displayed:

  :2:2: warning: no newline at end of file [-Wnewline-eof]
  ;
   ^

This diff adds `warn_extra_semi` (under `-Wextra-semi`), which allows to 
diagnose
that extra semi even if it is not invalid, and the `-Wc++98-compat-pedantic` is 
disabled.

This does not answer the questionability of that new warning.
It is **disabled by default**.
This simply allows to diagnose it.

Testing: `$ ninja check-clang-sema check-clang-semacxx check-clang-parser`

Thoughts?


Repository:
  rC Clang

https://reviews.llvm.org/D43162

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  lib/Parse/Parser.cpp
  test/Parser/cxx-extra-semi.cpp
  test/SemaCXX/extra-semi.cpp


Index: test/SemaCXX/extra-semi.cpp
===
--- /dev/null
+++ test/SemaCXX/extra-semi.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -verify -std=c++98 -Wextra-semi %s
+// RUN: %clang_cc1 -verify -std=c++03 -Wextra-semi %s
+// RUN: %clang_cc1 -verify -std=c++11 -Wextra-semi %s
+// RUN: %clang_cc1 -verify -std=c++17 -Wextra-semi %s
+// RUN: %clang_cc1 -verify -std=c++2a -Wextra-semi %s
+// RUN: %clang_cc1 -verify -Weverything -Wno-c++98-compat %s
+// RUN: %clang_cc1 -verify -Weverything -Wno-c++98-compat-pedantic %s
+
+// Last two RUN lines check that -Wextra-semi, which was enabled by
+// -Weverything will still be issued even though -Wc++98-compat contains
+// diag::warn_cxx98_compat_top_level_semi, which would be silenced by -Wno-.
+
+void F();
+
+void F() {}
+; // expected-warning {{extra ';' outside of a function}}
+
+namespace ns {
+class C {
+  void F() const;
+};
+}
+; // expected-warning {{extra ';' outside of a function}}
+
+void ns::C::F() const {}
+; // expected-warning {{extra ';' outside of a function}}
Index: test/Parser/cxx-extra-semi.cpp
===
--- test/Parser/cxx-extra-semi.cpp
+++ test/Parser/cxx-extra-semi.cpp
@@ -38,4 +38,7 @@
 #if __cplusplus < 201103L
 // expected-warning@-3{{extra ';' outside of a function is a C++11 extension}}
 // expected-warning@-3{{extra ';' outside of a function is a C++11 extension}}
+#elif !defined(PEDANTIC)
+// expected-warning@-6{{extra ';' outside of a function}}
+// expected-warning@-6{{extra ';' outside of a function}}
 #endif
Index: lib/Parse/Parser.cpp
===
--- lib/Parse/Parser.cpp
+++ lib/Parse/Parser.cpp
@@ -191,12 +191,20 @@
   // C++11 allows extra semicolons at namespace scope, but not in any of the
   // other contexts.
   if (Kind == OutsideFunction && getLangOpts().CPlusPlus) {
+unsigned DiagID;
+
 if (getLangOpts().CPlusPlus11)
-  Diag(StartLoc, diag::warn_cxx98_compat_top_level_semi)
-  << FixItHint::CreateRemoval(SourceRange(StartLoc, EndLoc));
+  DiagID = diag::warn_cxx98_compat_top_level_semi;
 else
-  Diag(StartLoc, diag::ext_extra_semi_cxx11)
-  << FixItHint::CreateRemoval(SourceRange(StartLoc, EndLoc));
+  DiagID = diag::ext_extra_semi_cxx11;
+
+// Prefer the pedantic compatibility warning over the generic,
+// non-extension, user-requested "extra semi" warning.
+if (Diags.isIgnored(DiagID, EndLoc))
+  DiagID = diag::warn_extra_semi;
+
+Diag(StartLoc, DiagID)
+<< FixItHint::CreateRemoval(SourceRange(StartLoc, EndLoc));
 return;
   }
 
Index: include/clang/Basic/DiagnosticParseKinds.td
===
--- include/clang/Basic/DiagnosticParseKinds.td
+++ include/clang/Basic/DiagnosticParseKinds.td
@@ -47,6 +47,9 @@
   "inside instance variable list|"
   "after member function definition}0">,
   InGroup;
+def warn_extra_semi : Warning<
+  "extra ';' outside of a function">,
+  InGroup, DefaultIgnore;
 def ext_ext

[PATCH] D43164: Fix test from failing when the python path has spaces

2018-02-10 Thread Aaron Smith via Phabricator via cfe-commits
asmith created this revision.
asmith added reviewers: zturner, llvm-commits.
Herald added subscribers: cfe-commits, klimek.

This test would fail if the python path had spaces. Add a quote around the path 
to fix this problem and update some test values changed by the addition of 
quotes around the path.

Tested on Windows and Linux with Python 3.x


Repository:
  rC Clang

https://reviews.llvm.org/D43164

Files:
  test/Tooling/clang-diff-json.cpp


Index: test/Tooling/clang-diff-json.cpp
===
--- test/Tooling/clang-diff-json.cpp
+++ test/Tooling/clang-diff-json.cpp
@@ -1,10 +1,10 @@
 // RUN: clang-diff -ast-dump-json %s -- \
-// RUN: | %python -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN: | '%python' -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
 // RUN: | FileCheck %s
 
-// CHECK: "begin": 299,
+// CHECK: "begin": 301,
 // CHECK: "type": "FieldDecl",
-// CHECK: "end": 319,
+// CHECK: "end": 321,
 // CHECK: "type": "CXXRecordDecl",
 class A {
   int x;


Index: test/Tooling/clang-diff-json.cpp
===
--- test/Tooling/clang-diff-json.cpp
+++ test/Tooling/clang-diff-json.cpp
@@ -1,10 +1,10 @@
 // RUN: clang-diff -ast-dump-json %s -- \
-// RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN: | '%python' -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
 // RUN: | FileCheck %s
 
-// CHECK: "begin": 299,
+// CHECK: "begin": 301,
 // CHECK: "type": "FieldDecl",
-// CHECK: "end": 319,
+// CHECK: "end": 321,
 // CHECK: "type": "CXXRecordDecl",
 class A {
   int x;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D43164: Fix test from failing when the python path has spaces

2018-02-10 Thread Zachary Turner via cfe-commits
Lgtm
On Sat, Feb 10, 2018 at 12:16 PM Aaron Smith via Phabricator <
revi...@reviews.llvm.org> wrote:

> asmith created this revision.
> asmith added reviewers: zturner, llvm-commits.
> Herald added subscribers: cfe-commits, klimek.
>
> This test would fail if the python path had spaces. Add a quote around the
> path to fix this problem and update some test values changed by the
> addition of quotes around the path.
>
> Tested on Windows and Linux with Python 3.x
>
>
> Repository:
>   rC Clang
>
> https://reviews.llvm.org/D43164
>
> Files:
>   test/Tooling/clang-diff-json.cpp
>
>
> Index: test/Tooling/clang-diff-json.cpp
> ===
> --- test/Tooling/clang-diff-json.cpp
> +++ test/Tooling/clang-diff-json.cpp
> @@ -1,10 +1,10 @@
>  // RUN: clang-diff -ast-dump-json %s -- \
> -// RUN: | %python -c 'import json, sys;
> json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True,
> indent=2)' \
> +// RUN: | '%python' -c 'import json, sys;
> json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True,
> indent=2)' \
>  // RUN: | FileCheck %s
>
> -// CHECK: "begin": 299,
> +// CHECK: "begin": 301,
>  // CHECK: "type": "FieldDecl",
> -// CHECK: "end": 319,
> +// CHECK: "end": 321,
>  // CHECK: "type": "CXXRecordDecl",
>  class A {
>int x;
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43164: Fix test clang-diff-json.cpp

2018-02-10 Thread Aaron Smith via Phabricator via cfe-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rC324824: Fix test clang-diff-json.cpp (authored by asmith, 
committed by ).

Repository:
  rC Clang

https://reviews.llvm.org/D43164

Files:
  test/Tooling/clang-diff-json.cpp


Index: test/Tooling/clang-diff-json.cpp
===
--- test/Tooling/clang-diff-json.cpp
+++ test/Tooling/clang-diff-json.cpp
@@ -1,10 +1,10 @@
 // RUN: clang-diff -ast-dump-json %s -- \
-// RUN: | %python -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN: | '%python' -c 'import json, sys; 
json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
 // RUN: | FileCheck %s
 
-// CHECK: "begin": 299,
+// CHECK: "begin": 301,
 // CHECK: "type": "FieldDecl",
-// CHECK: "end": 319,
+// CHECK: "end": 321,
 // CHECK: "type": "CXXRecordDecl",
 class A {
   int x;


Index: test/Tooling/clang-diff-json.cpp
===
--- test/Tooling/clang-diff-json.cpp
+++ test/Tooling/clang-diff-json.cpp
@@ -1,10 +1,10 @@
 // RUN: clang-diff -ast-dump-json %s -- \
-// RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN: | '%python' -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
 // RUN: | FileCheck %s
 
-// CHECK: "begin": 299,
+// CHECK: "begin": 301,
 // CHECK: "type": "FieldDecl",
-// CHECK: "end": 319,
+// CHECK: "end": 321,
 // CHECK: "type": "CXXRecordDecl",
 class A {
   int x;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43166: Add default C++ ABI libname and include paths for FreeBSD

2018-02-10 Thread Dimitry Andric via Phabricator via cfe-commits
dim created this revision.
dim added reviewers: emaste, EricWF, mclow.lists.
Herald added subscribers: krytarowski, mgorny.

As noted in a discussion about testing the LLVM 6.0.0 release candidates
(with libc++) for FreeBSD, many tests turned out to fail with
"exception_ptr not yet implemented".  This was because libc++ did not
choose the correct C++ ABI library, and therefore it fell back to the
`exception_fallback.ipp` header.

Since FreeBSD 10.x, we have been using libcxxrt as our C++ ABI library,
and its headers have always been installed in /usr/include/c++/v1,
together with the (system) libc++ headers.  (Older versions of FreeBSD
used GNU libsupc++ by default, but these are now unsupported.)

Therefore, if we are building libc++ for FreeBSD, set:

- `LIBCXX_CXX_ABI_LIBNAME` to "libcxxrt"
- `LIBCXX_CXX_ABI_INCLUDE_PATHS` to "/usr/include/c++/v1"

by default.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43166

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -136,6 +136,9 @@
   elseif (APPLE)
 set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
 set(LIBCXX_CXX_ABI_SYSTEM 1)
+  elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
   else()
 set(LIBCXX_CXX_ABI_LIBNAME "default")
   endif()


Index: CMakeLists.txt
===
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -136,6 +136,9 @@
   elseif (APPLE)
 set(LIBCXX_CXX_ABI_LIBNAME "libcxxabi")
 set(LIBCXX_CXX_ABI_SYSTEM 1)
+  elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+set(LIBCXX_CXX_ABI_LIBNAME "libcxxrt")
+set(LIBCXX_CXX_ABI_INCLUDE_PATHS "/usr/include/c++/v1")
   else()
 set(LIBCXX_CXX_ABI_LIBNAME "default")
   endif()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r324828 - [X86] Change the signature of the AVX512 packed fp compare intrinsics to return vXi1 mask. Make bitcasts to scalar explicit in IR

2018-02-10 Thread Craig Topper via cfe-commits
Author: ctopper
Date: Sat Feb 10 15:34:27 2018
New Revision: 324828

URL: http://llvm.org/viewvc/llvm-project?rev=324828&view=rev
Log:
[X86] Change the signature of the AVX512 packed fp compare intrinsics to return 
vXi1 mask. Make bitcasts to scalar explicit in IR

Summary: This is the clang equivalent of r324827

Reviewers: zvi, delena, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

Modified:
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-builtins.c

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=324828&r1=324827&r2=324828&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Sat Feb 10 15:34:27 2018
@@ -8060,6 +8060,29 @@ static Value *EmitX86Select(CodeGenFunct
   return CGF.Builder.CreateSelect(Mask, Op0, Op1);
 }
 
+static Value *EmitX86MaskedCompareResult(CodeGenFunction &CGF, Value *Cmp,
+ unsigned NumElts, Value *MaskIn) {
+  if (MaskIn) {
+const auto *C = dyn_cast(MaskIn);
+if (!C || !C->isAllOnesValue())
+  Cmp = CGF.Builder.CreateAnd(Cmp, getMaskVecValue(CGF, MaskIn, NumElts));
+  }
+
+  if (NumElts < 8) {
+uint32_t Indices[8];
+for (unsigned i = 0; i != NumElts; ++i)
+  Indices[i] = i;
+for (unsigned i = NumElts; i != 8; ++i)
+  Indices[i] = i % NumElts + NumElts;
+Cmp = CGF.Builder.CreateShuffleVector(
+Cmp, llvm::Constant::getNullValue(Cmp->getType()), Indices);
+  }
+
+  return CGF.Builder.CreateBitCast(Cmp,
+   IntegerType::get(CGF.getLLVMContext(),
+std::max(NumElts, 8U)));
+}
+
 static Value *EmitX86MaskedCompare(CodeGenFunction &CGF, unsigned CC,
bool Signed, ArrayRef Ops) {
   assert((Ops.size() == 2 || Ops.size() == 4) &&
@@ -8087,24 +8110,11 @@ static Value *EmitX86MaskedCompare(CodeG
 Cmp = CGF.Builder.CreateICmp(Pred, Ops[0], Ops[1]);
   }
 
-  if (Ops.size() == 4) {
-const auto *C = dyn_cast(Ops[3]);
-if (!C || !C->isAllOnesValue())
-  Cmp = CGF.Builder.CreateAnd(Cmp, getMaskVecValue(CGF, Ops[3], NumElts));
-  }
+  Value *MaskIn = nullptr;
+  if (Ops.size() == 4)
+MaskIn = Ops[3];
 
-  if (NumElts < 8) {
-uint32_t Indices[8];
-for (unsigned i = 0; i != NumElts; ++i)
-  Indices[i] = i;
-for (unsigned i = NumElts; i != 8; ++i)
-  Indices[i] = i % NumElts + NumElts;
-Cmp = CGF.Builder.CreateShuffleVector(
-Cmp, llvm::Constant::getNullValue(Cmp->getType()), Indices);
-  }
-  return CGF.Builder.CreateBitCast(Cmp,
-   IntegerType::get(CGF.getLLVMContext(),
-std::max(NumElts, 8U)));
+  return EmitX86MaskedCompareResult(CGF, Cmp, NumElts, MaskIn);
 }
 
 static Value *EmitX86ConvertToMask(CodeGenFunction &CGF, Value *In) {
@@ -8882,6 +8892,43 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 return Builder.CreateExtractValue(Call, 1);
   }
 
+  case X86::BI__builtin_ia32_cmpps128_mask:
+  case X86::BI__builtin_ia32_cmpps256_mask:
+  case X86::BI__builtin_ia32_cmpps512_mask:
+  case X86::BI__builtin_ia32_cmppd128_mask:
+  case X86::BI__builtin_ia32_cmppd256_mask:
+  case X86::BI__builtin_ia32_cmppd512_mask: {
+unsigned NumElts = Ops[0]->getType()->getVectorNumElements();
+Value *MaskIn = Ops[3];
+Ops.erase(&Ops[3]);
+
+Intrinsic::ID ID;
+switch (BuiltinID) {
+default: llvm_unreachable("Unsupported intrinsic!");
+case X86::BI__builtin_ia32_cmpps128_mask:
+  ID = Intrinsic::x86_avx512_mask_cmp_ps_128;
+  break;
+case X86::BI__builtin_ia32_cmpps256_mask:
+  ID = Intrinsic::x86_avx512_mask_cmp_ps_256;
+  break;
+case X86::BI__builtin_ia32_cmpps512_mask:
+  ID = Intrinsic::x86_avx512_mask_cmp_ps_512;
+  break;
+case X86::BI__builtin_ia32_cmppd128_mask:
+  ID = Intrinsic::x86_avx512_mask_cmp_pd_128;
+  break;
+case X86::BI__builtin_ia32_cmppd256_mask:
+  ID = Intrinsic::x86_avx512_mask_cmp_pd_256;
+  break;
+case X86::BI__builtin_ia32_cmppd512_mask:
+  ID = Intrinsic::x86_avx512_mask_cmp_pd_512;
+  break;
+}
+
+Value *Cmp = Builder.CreateCall(CGM.getIntrinsic(ID), Ops);
+return EmitX86MaskedCompareResult(*this, Cmp, NumElts, MaskIn);
+  }
+
   // SSE packed comparison intrinsics
   case X86::BI__builtin_ia32_cmpeqps:
   case X86::BI__builtin_ia32_cmpeqpd:

Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=324828&r1=324827&r2=324828&view=diff
==

[PATCH] D42895: [libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfo

2018-02-10 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

Ping. Now this is a pure API extension to current implicit/direct roles. Is it 
possible to see this landed before clang+llvm 6 is released?


Repository:
  rC Clang

https://reviews.llvm.org/D42895



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


[PATCH] D43159: Modernize: Use nullptr more.

2018-02-10 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem updated this revision to Diff 133778.
brucem added a comment.

More nullptr usage.


Repository:
  rCXX libc++

https://reviews.llvm.org/D43159

Files:
  include/__locale
  include/__sso_allocator
  include/__string
  include/__threading_support
  include/algorithm
  include/bitset
  include/chrono
  include/fstream
  include/functional
  include/ios
  include/istream
  include/iterator
  include/locale
  include/memory
  include/sstream
  include/streambuf
  include/string
  include/strstream
  include/system_error
  include/valarray
  src/new.cpp

Index: src/new.cpp
===
--- src/new.cpp
+++ src/new.cpp
@@ -71,7 +71,7 @@
 if (size == 0)
 size = 1;
 void* p;
-while ((p = ::malloc(size)) == 0)
+while ((p = ::malloc(size)) == nullptr)
 {
 // If malloc fails and there is a new_handler,
 // call it to try free up memory.
@@ -92,7 +92,7 @@
 void*
 operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -118,7 +118,7 @@
 void*
 operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -214,7 +214,7 @@
 void*
 operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
@@ -240,7 +240,7 @@
 void*
 operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT
 {
-void* p = 0;
+void* p = nullptr;
 #ifndef _LIBCPP_NO_EXCEPTIONS
 try
 {
Index: include/valarray
===
--- include/valarray
+++ include/valarray
@@ -802,7 +802,7 @@
 public:
 // construct/destroy:
 _LIBCPP_INLINE_VISIBILITY
-valarray() : __begin_(0), __end_(0) {}
+valarray() : __begin_(nullptr), __end_(0) {}
 inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
 explicit valarray(size_t __n);
 _LIBCPP_INLINE_VISIBILITY
@@ -2750,8 +2750,8 @@
 template 
 inline
 valarray<_Tp>::valarray(size_t __n)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 if (__n)
 {
@@ -2776,16 +2776,16 @@
 template 
 inline
 valarray<_Tp>::valarray(const value_type& __x, size_t __n)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 resize(__n, __x);
 }
 
 template 
 valarray<_Tp>::valarray(const value_type* __p, size_t __n)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 if (__n)
 {
@@ -2809,8 +2809,8 @@
 
 template 
 valarray<_Tp>::valarray(const valarray& __v)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 if (__v.size())
 {
@@ -2845,8 +2845,8 @@
 
 template 
 valarray<_Tp>::valarray(initializer_list __il)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __il.size();
 if (__n)
@@ -2873,8 +2873,8 @@
 
 template 
 valarray<_Tp>::valarray(const slice_array& __sa)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __sa.__size_;
 if (__n)
@@ -2899,8 +2899,8 @@
 
 template 
 valarray<_Tp>::valarray(const gslice_array& __ga)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __ga.__1d_.size();
 if (__n)
@@ -2928,8 +2928,8 @@
 
 template 
 valarray<_Tp>::valarray(const mask_array& __ma)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __ma.__1d_.size();
 if (__n)
@@ -2957,8 +2957,8 @@
 
 template 
 valarray<_Tp>::valarray(const indirect_array& __ia)
-: __begin_(0),
-  __end_(0)
+: __begin_(nullptr),
+  __end_(nullptr)
 {
 size_t __n = __ia.__1d_.size();
 if (__n)
Index: include/system_error
===
--- include/system_error
+++ include/system_error
@@ -440,7 +440,7 @@
 template 
 _LIBCPP_ALWAYS_INLINE
 error_condition(_Ep __e,
-  typename enable_if::value>::type* = 0
+  typename enable_if::value>::type* = nullptr
  ) _NOEXCEPT
 {*this = make_error_condition(__e);}
 
@@ -512,7 +512,7 @@
 template 
 _LIBCPP_ALWAYS_INLINE
 error_code(_Ep __e,
-   typename enable_if::value>::type* = 0
+   typename enable_if::value>::type* = nullptr
  ) _NOEXCEPT
 {*this = make_error_code(__e);}
 
Index: include/strstream
===
--- include/s

[PATCH] D43167: Fix incorrect indentation.

2018-02-10 Thread Bruce Mitchener via Phabricator via cfe-commits
brucem created this revision.
brucem added a reviewer: mclow.lists.

Repository:
  rCXX libc++

https://reviews.llvm.org/D43167

Files:
  include/ios


Index: include/ios
===
--- include/ios
+++ include/ios
@@ -670,7 +670,7 @@
 void set_rdbuf(basic_streambuf* __sb);
 private:
 basic_ostream* __tie_;
- mutable int_type __fill_;
+mutable int_type __fill_;
 };
 
 template 


Index: include/ios
===
--- include/ios
+++ include/ios
@@ -670,7 +670,7 @@
 void set_rdbuf(basic_streambuf* __sb);
 private:
 basic_ostream* __tie_;
- mutable int_type __fill_;
+mutable int_type __fill_;
 };
 
 template 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D43153: [clang] Implement P0692 "Access Checking on Specializations"

2018-02-10 Thread Anton Bikineev via Phabricator via cfe-commits
AntonBikineev added a comment.

@rsmith Thanks for pointing out this example. Now I see that I misunderstood 
the wording.
Another question is that in the provided example you say that the following line

  template A::B x; // ok!

should suppress the error of accessing private A::B. But in the wording it's 
said that

> The usual access checking rules do not apply to non-dependent names used to 
> specify **template arguments of the simple-template-id** of the partial 
> specialization.

So it gave me the impression that only names used as template arguments should 
be exempted from checks. But here `A::B` is a non-dependent name that's part of 
the declaration-specifier. So is my impression wrong and names in 
declaration-specifiers/declarators of partial-specialiations of 
variable-templates should be exempted from checks as well?

Thanks.


Repository:
  rC Clang

https://reviews.llvm.org/D43153



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


[PATCH] D43153: [clang] Implement P0692 "Access Checking on Specializations"

2018-02-10 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment.

In https://reviews.llvm.org/D43153#1004464, @AntonBikineev wrote:

> So is my impression wrong and names in declaration-specifiers/declarators of 
> partial-specialiations of variable-templates should be exempted from checks 
> as well?


No, sorry, that's my error not yours.


Repository:
  rC Clang

https://reviews.llvm.org/D43153



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