[PATCH] D39176: [Driver] Use ld.lld directly for Fuchsia rather than passing flavor

2017-10-22 Thread Petr Hosek via Phabricator via cfe-commits
phosek created this revision.
phosek added a project: clang.

Passing a flavor to LLD requires command line argument, but if these
are being passed through a response file, this will fail because LLD
needs to know which driver to use before processing the response file.
Use ld.lld directly instead to avoid this issue.


Repository:
  rL LLVM

https://reviews.llvm.org/D39176

Files:
  lib/Driver/ToolChains/Fuchsia.cpp
  lib/Driver/ToolChains/Fuchsia.h
  test/Driver/fuchsia.c
  test/Driver/fuchsia.cpp


Index: test/Driver/fuchsia.cpp
===
--- test/Driver/fuchsia.cpp
+++ test/Driver/fuchsia.cpp
@@ -1,13 +1,12 @@
 // RUN: %clangxx %s -### -no-canonical-prefixes 
--target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform 2>&1 -fuse-ld=ld | FileCheck %s
+// RUN: --sysroot=%S/platform 2>&1 | FileCheck %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-triple" "x86_64-fuchsia"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-isystem" 
"{{.*[/\\]}}x86_64-fuchsia{{/|}}include{{/|}}c++{{/|}}v1"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: test/Driver/fuchsia.c
===
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -1,16 +1,15 @@
 // RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
 // RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia 
\
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-munwind-tables"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: lib/Driver/ToolChains/Fuchsia.h
===
--- lib/Driver/ToolChains/Fuchsia.h
+++ lib/Driver/ToolChains/Fuchsia.h
@@ -82,7 +82,7 @@
llvm::opt::ArgStringList ) const override;
 
   const char *getDefaultLinker() const override {
-return "lld";
+return "ld.lld";
   }
 
 protected:
Index: lib/Driver/ToolChains/Fuchsia.cpp
===
--- lib/Driver/ToolChains/Fuchsia.cpp
+++ lib/Driver/ToolChains/Fuchsia.cpp
@@ -44,10 +44,7 @@
   Args.ClaimAllArgs(options::OPT_w);
 
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
-  if (llvm::sys::path::stem(Exec).equals_lower("lld")) {
-CmdArgs.push_back("-flavor");
-CmdArgs.push_back("gnu");
-
+  if (llvm::sys::path::filename(Exec).startswith_lower("ld.lld")) {
 CmdArgs.push_back("-z");
 CmdArgs.push_back("rodynamic");
   }


Index: test/Driver/fuchsia.cpp
===
--- test/Driver/fuchsia.cpp
+++ test/Driver/fuchsia.cpp
@@ -1,13 +1,12 @@
 // RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform 2>&1 -fuse-ld=ld | FileCheck %s
+// RUN: --sysroot=%S/platform 2>&1 | FileCheck %s
 // CHECK: {{.*}}clang{{.*}}" "-cc1"
 // CHECK: "-triple" "x86_64-fuchsia"
 // CHECK: "-fuse-init-array"
 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK: "-internal-isystem" "{{.*[/\\]}}x86_64-fuchsia{{/|}}include{{/|}}c++{{/|}}v1"
 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|}}include"
-// CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu"
-// CHECK: "-z" "rodynamic"
+// CHECK: {{.*}}ld.lld{{.*}}" "-z" "rodynamic"
 // CHECK: "--sysroot=[[SYSROOT]]"
 // CHECK: "-pie"
 // CHECK: "--build-id"
Index: test/Driver/fuchsia.c
===
--- test/Driver/fuchsia.c
+++ test/Driver/fuchsia.c
@@ -1,16 +1,15 @@
 // RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
 // RUN: %clang %s -### -no-canonical-prefixes --target=aarch64-unknown-fuchsia \
-// RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
+// RUN: --sysroot=%S/platform 2>&1 \
 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
 // CHECK: {{.*}}clang{{.*}}" 

r316310 - For better compatibility with C++11 and C++14, emit a nondiscardable definition

2017-10-22 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sun Oct 22 20:58:34 2017
New Revision: 316310

URL: http://llvm.org/viewvc/llvm-project?rev=316310=rev
Log:
For better compatibility with C++11 and C++14, emit a nondiscardable definition
of a static constexpr data member if it's defined 'constexpr' out of line, not
only if it's defined 'constexpr' in the class.

Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/CodeGenCXX/cxx1z-inline-variables.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=316310=316309=316310=diff
==
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Oct 22 20:58:34 2017
@@ -5635,14 +5635,14 @@ ASTContext::getInlineVariableDefinitionK
 
   // In almost all cases, it's a weak definition.
   auto *First = VD->getFirstDecl();
-  if (!First->isConstexpr() || First->isInlineSpecified() ||
-  !VD->isStaticDataMember())
+  if (First->isInlineSpecified() || !First->isStaticDataMember())
 return InlineVariableDefinitionKind::Weak;
 
   // If there's a file-context declaration in this translation unit, it's a
   // non-discardable definition.
   for (auto *D : VD->redecls())
-if (D->getLexicalDeclContext()->isFileContext())
+if (D->getLexicalDeclContext()->isFileContext() &&
+!D->isInlineSpecified() && (D->isConstexpr() || First->isConstexpr()))
   return InlineVariableDefinitionKind::Strong;
 
   // If we've not seen one yet, we don't know.

Modified: cfe/trunk/test/CodeGenCXX/cxx1z-inline-variables.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx1z-inline-variables.cpp?rev=316310=316309=316310=diff
==
--- cfe/trunk/test/CodeGenCXX/cxx1z-inline-variables.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/cxx1z-inline-variables.cpp Sun Oct 22 20:58:34 
2017
@@ -31,18 +31,28 @@ struct compat {
   static constexpr int b = 2;
   static constexpr int c = 3;
   static inline constexpr int d = 4;
+  static const int e = 5;
+  static const int f = 6;
+  static const int g = 7;
 };
 const int _use_before_redecl = compat::b;
 const int compat::a;
 const int compat::b;
 const int compat::c;
 const int compat::d;
+const int compat::e;
+constexpr int compat::f;
+constexpr inline int compat::g;
 const int _use_after_redecl1 = compat::c;
 const int _use_after_redecl2 = compat::d;
-// CHECK: @_ZN6compat1bE = weak_odr constant i32 2
-// CHECK: @_ZN6compat1aE = weak_odr constant i32 1
-// CHECK: @_ZN6compat1cE = weak_odr constant i32 3
-// CHECK: @_ZN6compat1dE = linkonce_odr constant i32 4
+const int _use_after_redecl3 = compat::g;
+// CHECK-DAG: @_ZN6compat1bE = weak_odr constant i32 2
+// CHECK-DAG: @_ZN6compat1aE = weak_odr constant i32 1
+// CHECK-DAG: @_ZN6compat1cE = weak_odr constant i32 3
+// CHECK-DAG: @_ZN6compat1dE = linkonce_odr constant i32 4
+// CHECK-DAG: @_ZN6compat1eE = constant i32 5
+// CHECK-DAG: @_ZN6compat1fE = weak_odr constant i32 6
+// CHECK-DAG: @_ZN6compat1gE = linkonce_odr constant i32 7
 
 template struct X {
   static int a;


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


[PATCH] D38774: [CodeGen] Add support for IncompleteArrayType in Obj-C ivars.

2017-10-22 Thread John McCall via Phabricator via cfe-commits
rjmccall added inline comments.



Comment at: clang/lib/CodeGen/CGObjCMac.cpp:5095
+fieldType = fieldType->getAsArrayTypeUnsafe()->getElementType();
+  }
+

You can't just use isa<> here; there can be typedefs of incomplete array type.


https://reviews.llvm.org/D38774



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


[PATCH] D39174: [analyzer] Fix handling of labels getLValueElement

2017-10-22 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap created this revision.
Herald added subscribers: szepet, xazax.hun.

In getLValueElement Base may represent the address of a label (as in the 
newly-added test case),
in this case it's not a loc::MemRegionVal and Base.castAs() 
triggers an assert.

Test plan: make check-all


Repository:
  rL LLVM

https://reviews.llvm.org/D39174

Files:
  lib/StaticAnalyzer/Core/Store.cpp
  test/Analysis/ptr-arith.c


Index: test/Analysis/ptr-arith.c
===
--- test/Analysis/ptr-arith.c
+++ test/Analysis/ptr-arith.c
@@ -342,3 +342,8 @@
   clang_analyzer_eval(*ptr3 == 'a'); // expected-warning{{UNKNOWN}}
 }
 
+void test_no_crash_on_pointer_to_label() {
+  char *a = &
+  a[0] = 0;
+label:;
+}
Index: lib/StaticAnalyzer/Core/Store.cpp
===
--- lib/StaticAnalyzer/Core/Store.cpp
+++ lib/StaticAnalyzer/Core/Store.cpp
@@ -440,7 +440,10 @@
   //  value. See also the similar FIXME in getLValueFieldOrIvar().
   if (Base.isUnknownOrUndef() || Base.getAs())
 return Base;
-
+  
+  if (Base.getAs())
+return UnknownVal();
+  
   const SubRegion *BaseRegion =
   Base.castAs().getRegionAs();
 


Index: test/Analysis/ptr-arith.c
===
--- test/Analysis/ptr-arith.c
+++ test/Analysis/ptr-arith.c
@@ -342,3 +342,8 @@
   clang_analyzer_eval(*ptr3 == 'a'); // expected-warning{{UNKNOWN}}
 }
 
+void test_no_crash_on_pointer_to_label() {
+  char *a = &
+  a[0] = 0;
+label:;
+}
Index: lib/StaticAnalyzer/Core/Store.cpp
===
--- lib/StaticAnalyzer/Core/Store.cpp
+++ lib/StaticAnalyzer/Core/Store.cpp
@@ -440,7 +440,10 @@
   //  value. See also the similar FIXME in getLValueFieldOrIvar().
   if (Base.isUnknownOrUndef() || Base.getAs())
 return Base;
-
+  
+  if (Base.getAs())
+return UnknownVal();
+  
   const SubRegion *BaseRegion =
   Base.castAs().getRegionAs();
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39162: [test] Fix clang-test for FreeBSD and NetBSD

2017-10-22 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 119803.
lichray edited the summary of this revision.
lichray added a comment.

Changed to an warning given @zturner 's comments and experiments.


https://reviews.llvm.org/D39162

Files:
  test/Unit/lit.cfg.py


Index: test/Unit/lit.cfg.py
===
--- test/Unit/lit.cfg.py
+++ test/Unit/lit.cfg.py
@@ -35,17 +35,23 @@
 if symbolizer in os.environ:
 config.environment[symbolizer] = os.environ[symbolizer]
 
-shlibpath_var = ''
-if platform.system() == 'Linux':
-shlibpath_var = 'LD_LIBRARY_PATH'
-elif platform.system() == 'Darwin':
-shlibpath_var = 'DYLD_LIBRARY_PATH'
-elif platform.system() == 'Windows':
-shlibpath_var = 'PATH'
-
-# in stand-alone builds, shlibdir is clang's build tree
-# while llvm_libs_dir is installed LLVM (and possibly older clang)
-shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir,
- config.environment.get(shlibpath_var,'')))
-
-config.environment[shlibpath_var] = shlibpath
+def find_shlibpath_var():
+if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']:
+yield 'LD_LIBRARY_PATH'
+elif platform.system() == 'Darwin':
+yield 'DYLD_LIBRARY_PATH'
+elif platform.system() == 'Windows':
+yield 'PATH'
+
+for shlibpath_var in find_shlibpath_var():
+# in stand-alone builds, shlibdir is clang's build tree
+# while llvm_libs_dir is installed LLVM (and possibly older clang)
+shlibpath = os.path.pathsep.join(
+(config.shlibdir,
+ config.llvm_libs_dir,
+ config.environment.get(shlibpath_var, '')))
+config.environment[shlibpath_var] = shlibpath
+break
+else:
+lit_config.warning("unable to inject shared library path on '{}'"
+   .format(platform.system()))


Index: test/Unit/lit.cfg.py
===
--- test/Unit/lit.cfg.py
+++ test/Unit/lit.cfg.py
@@ -35,17 +35,23 @@
 if symbolizer in os.environ:
 config.environment[symbolizer] = os.environ[symbolizer]
 
-shlibpath_var = ''
-if platform.system() == 'Linux':
-shlibpath_var = 'LD_LIBRARY_PATH'
-elif platform.system() == 'Darwin':
-shlibpath_var = 'DYLD_LIBRARY_PATH'
-elif platform.system() == 'Windows':
-shlibpath_var = 'PATH'
-
-# in stand-alone builds, shlibdir is clang's build tree
-# while llvm_libs_dir is installed LLVM (and possibly older clang)
-shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir,
- config.environment.get(shlibpath_var,'')))
-
-config.environment[shlibpath_var] = shlibpath
+def find_shlibpath_var():
+if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']:
+yield 'LD_LIBRARY_PATH'
+elif platform.system() == 'Darwin':
+yield 'DYLD_LIBRARY_PATH'
+elif platform.system() == 'Windows':
+yield 'PATH'
+
+for shlibpath_var in find_shlibpath_var():
+# in stand-alone builds, shlibdir is clang's build tree
+# while llvm_libs_dir is installed LLVM (and possibly older clang)
+shlibpath = os.path.pathsep.join(
+(config.shlibdir,
+ config.llvm_libs_dir,
+ config.environment.get(shlibpath_var, '')))
+config.environment[shlibpath_var] = shlibpath
+break
+else:
+lit_config.warning("unable to inject shared library path on '{}'"
+   .format(platform.system()))
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39127: Fix template parameter default args missed if redecled

2017-10-22 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: lib/Sema/SemaTemplate.cpp:4811
+  TemplateParameterList *Params =
+  cast(Template->getMostRecentDecl())
+  ->getTemplateParameters();

mstorsjo wrote:
> erichkeane wrote:
> > mstorsjo wrote:
> > > How does this work if there's another forward declaration missing the 
> > > parameter later? Is the logic with "most recent" ok, or should it be 
> > > "most qualified/complete" instead?
> > I'm not sure the case you mean.  Any future declarations with fewer 
> > parameters would be aspecialization and a different decl, right?
> Sorry, I meant a declaration with fewer defaults. E.g. the original forward 
> declaration without defaults again after the actual definition.
> 
> E.g. by adding
> 
> ```
> namespace llvm {
>   template struct StringSet;
> }
> ```
> before the last `namespace lld`.
> 
> 
I think thats OK.  The code propagates those forward.  The problem here is that 
it does NOT propagate them backwards.


https://reviews.llvm.org/D39127



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


Re: [PATCH] D39162: [test] Fix clang-test for FreeBSD and NetBSD

2017-10-22 Thread Zachary Turner via cfe-commits
Because this is not tge only part of ghe library search algorithm, and it’s
not necessarily an error if the variable isn’t set

On Sun, Oct 22, 2017 at 1:56 PM Zhihao Yuan via Phabricator <
revi...@reviews.llvm.org> wrote:

> lichray marked an inline comment as done.
> lichray added a comment.
>
> In https://reviews.llvm.org/D39162#903179, @zturner wrote:
>
> > Please don't throw an exception here.  Instead, write this as:
> >
> >   lit_config.warning('Unable to determine shared library path variable
> for platform {}'.format(platform.system()))
> >
> >
>
>
> Why a warning rather than fatal?
>
>
> https://reviews.llvm.org/D39162
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r316304 - [c++2a] Update cxx_status w __VA_OPT__ marked as completed in SVN.

2017-10-22 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Sun Oct 22 15:29:52 2017
New Revision: 316304

URL: http://llvm.org/viewvc/llvm-project?rev=316304=rev
Log:
[c++2a] Update cxx_status w __VA_OPT__ marked as completed in SVN.

Modified:
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/www/cxx_status.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/www/cxx_status.html?rev=316304=316303=316304=diff
==
--- cfe/trunk/www/cxx_status.html (original)
+++ cfe/trunk/www/cxx_status.html Sun Oct 22 15:29:52 2017
@@ -813,7 +813,7 @@ as the draft C++2a standard evolves.
 
   __VA_OPT__ for preprocessor comma elision
   http://wg21.link/p0306r4;>P0306R4
-  No
+  SVN
 
 
   Designated initializers


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


Re: Attribute spelling policy

2017-10-22 Thread Saleem Abdulrasool via cfe-commits
Very much a +1 on having attributes map in via `__attribute__` and
`[[clang::]]` uniformly when appropriate.

On Sat, Oct 21, 2017 at 8:14 AM, Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Attributes come with multiple spelling flavors, but when it comes to
> adding new attributes that are not present in other compiler tools
> such as GCC or MSVC, we have done a poor job of being consistent with
> which spelling flavors we adopt the attributes under. Some of our
> attributes are specified with only an __attribute__ spelling (about
> 100), while others are specified with both __attribute__ and
> [[clang::XXX]] (about 30), and still others are specified as only
> [[clang::XXX]] attributes (only 1). This puts additional burden on
> developers to remember which attributes are spelled with what syntax
> and the various rules surrounding how to write attributes with that
> spelling.
>
> I am proposing that we take a more principled approach when adding new
> attributes so that we provide a better user experience. Specifically,
> when adding an attribute that other vendors do not support, the
> attribute should be given an __attribute__ and [[clang::]] spelling
> unless there's good reason not to. This is not a novel proposal -- GCC
> supports all of their documented __attribute__ spellings under a
> [[gnu::XXX]] spelling, and I am proposing we do the same with our
> vendor namespace.
>
> Assuming this approach is reasonable to the community, I will add a
> CLANG spelling that behaves similar to the GCC spelling in that it
> automatically provides both the GNU and CXX11 spellings as
> appropriate. There are some attributes for which a [[clang::XXX]]
> spelling is not appropriate:
>   * attributes that appertain to function declarations but require
> accessing the function parameters, such as disable_if or
> requires_capability
>   * attributes with GNU spellings whose use is discouraged or
> deprecated, such as no_sanitize_memory
>   * attributes that are part of other vendor specifications, like CUDA or
> OpenCL
> These deviations are reasonable, but should be documented in Attr.td
> near the Spelling definition for the attribute so that it's explicitly
> understood why the spelling differs.
>
> Additionally, I intend for the proposed CLANG spelling to be extended
> in the future to more easily expose [[clang::XXX]] spellings for
> attributes intended to be used in C (with
> -fdouble-square-bracket-attributes) as well as C++.
>
> As always, feedback is welcome!
>
> ~Aaron
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>



-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38819: [libunwind] Add support for dwarf unwinding on windows on x86_64

2017-10-22 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added inline comments.



Comment at: src/UnwindRegistersRestore.S:98
+  # skip fs
+  # skip gs
+  movq  56(%rcx), %rsp  # cut back rsp to new location

compnerd wrote:
> Doesn't Win64 ABI require some of the MMX registers be saved/restored too?
Right, yes, xmm6-xmm15 should be backed up and restored. I'll try to amend this 
with such a change.


https://reviews.llvm.org/D38819



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


[PATCH] D38819: [libunwind] Add support for dwarf unwinding on windows on x86_64

2017-10-22 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added inline comments.



Comment at: src/UnwindRegistersRestore.S:98
+  # skip fs
+  # skip gs
+  movq  56(%rcx), %rsp  # cut back rsp to new location

Doesn't Win64 ABI require some of the MMX registers be saved/restored too?


https://reviews.llvm.org/D38819



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


[PATCH] D39162: [test] Fix clang-test for FreeBSD and NetBSD

2017-10-22 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

In https://reviews.llvm.org/D39162#903190, @krytarowski wrote:

> In https://reviews.llvm.org/D39162#903186, @joerg wrote:
>
> > I think we should special case Darwin and Windows and fall-back to 
> > LD_LIBRARY_PATH for the rest. Can't remember if there is a UNIX-like 
> > platform left where it doesn't work.
>
>
> SHLIB_PATH in HP/UX


Hmm SHLIB_PATH has been marked as legacy and they probably switched to 
LD_LIBRARY_PATH.

AIX might still ship with LIBPATH.

I agree that adding defines for OS'es that are barely developed (especially 
closed-source) without LLVM developers might be accumulating unused code.


https://reviews.llvm.org/D39162



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


[PATCH] D38680: [libunwind] Fix handling of DW_CFA_GNU_args_size

2017-10-22 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

I've looked at this in some detail now. I'm not exactly sure yet why it is 
broken. The patch seems quite wrong to me. DW_CFA_GNU_args_size should be 
applied only when unwinding a call instruction and that regard, the commit 
message of the original change is quite correct. What I am still trying to 
understand is how the precise unwind frame disagrees with the unwinder.


https://reviews.llvm.org/D38680



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


[PATCH] D39162: [test] Fix clang-test for FreeBSD and NetBSD

2017-10-22 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 119800.

https://reviews.llvm.org/D39162

Files:
  test/Unit/lit.cfg.py


Index: test/Unit/lit.cfg.py
===
--- test/Unit/lit.cfg.py
+++ test/Unit/lit.cfg.py
@@ -35,13 +35,15 @@
 if symbolizer in os.environ:
 config.environment[symbolizer] = os.environ[symbolizer]
 
-shlibpath_var = ''
-if platform.system() == 'Linux':
+if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']:
 shlibpath_var = 'LD_LIBRARY_PATH'
 elif platform.system() == 'Darwin':
 shlibpath_var = 'DYLD_LIBRARY_PATH'
 elif platform.system() == 'Windows':
 shlibpath_var = 'PATH'
+else:
+lit_config.fatal("unable to inject shared library path on '{}'"
+ .format(platform.system()))
 
 # in stand-alone builds, shlibdir is clang's build tree
 # while llvm_libs_dir is installed LLVM (and possibly older clang)


Index: test/Unit/lit.cfg.py
===
--- test/Unit/lit.cfg.py
+++ test/Unit/lit.cfg.py
@@ -35,13 +35,15 @@
 if symbolizer in os.environ:
 config.environment[symbolizer] = os.environ[symbolizer]
 
-shlibpath_var = ''
-if platform.system() == 'Linux':
+if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']:
 shlibpath_var = 'LD_LIBRARY_PATH'
 elif platform.system() == 'Darwin':
 shlibpath_var = 'DYLD_LIBRARY_PATH'
 elif platform.system() == 'Windows':
 shlibpath_var = 'PATH'
+else:
+lit_config.fatal("unable to inject shared library path on '{}'"
+ .format(platform.system()))
 
 # in stand-alone builds, shlibdir is clang's build tree
 # while llvm_libs_dir is installed LLVM (and possibly older clang)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D39162: [test] Fix clang-test for FreeBSD and NetBSD

2017-10-22 Thread Kamil Rytarowski via Phabricator via cfe-commits
krytarowski added a comment.

In https://reviews.llvm.org/D39162#903186, @joerg wrote:

> I think we should special case Darwin and Windows and fall-back to 
> LD_LIBRARY_PATH for the rest. Can't remember if there is a UNIX-like platform 
> left where it doesn't work.


SHLIB_PATH in HP/UX


https://reviews.llvm.org/D39162



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


[PATCH] D39162: [test] Fix clang-test for FreeBSD and NetBSD

2017-10-22 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added a comment.

In https://reviews.llvm.org/D39162#903186, @joerg wrote:

> I think we should special case Darwin and Windows and fall-back to 
> LD_LIBRARY_PATH for the rest. Can't remember if there is a UNIX-like platform 
> left where it doesn't work.


If those developers come to us, I would say.  The script is for LLVM developers 
only, and to developers, a missed guess wastes more time than pointing out 
where it doesn't work.


https://reviews.llvm.org/D39162



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


[PATCH] D39162: [test] Fix clang-test for FreeBSD and NetBSD

2017-10-22 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg added a comment.

I think we should special case Darwin and Windows and fall-back to 
LD_LIBRARY_PATH for the rest. Can't remember if there is a UNIX-like platform 
left where it doesn't work.


https://reviews.llvm.org/D39162



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


[PATCH] D39162: [test] Fix clang-test for FreeBSD and NetBSD

2017-10-22 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray marked an inline comment as done.
lichray added a comment.

In https://reviews.llvm.org/D39162#903179, @zturner wrote:

> Please don't throw an exception here.  Instead, write this as:
>
>   lit_config.warning('Unable to determine shared library path variable for 
> platform {}'.format(platform.system()))
>
>  


Why a warning rather than fatal?


https://reviews.llvm.org/D39162



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


[PATCH] D39162: [test] Fix clang-test for FreeBSD and NetBSD

2017-10-22 Thread Zachary Turner via Phabricator via cfe-commits
zturner requested changes to this revision.
zturner added a comment.
This revision now requires changes to proceed.

Please don't throw an exception here.  Instead, write this as:

  shlibpath_var = None
  if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']:
  shilbpath = 'LD_LIBRARY_PATH'
  elif platform.system() == 'Darwin':
  shlibpath_var = 'DYLD_LIBRARY_PATH'
  elif platform.system() == 'Windows':
  shlibpath_var = 'PATH'
  
  if shlibpath_var:
  shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir, 
config.environment.get(shlibpath_var,'')))
  config.environment[shlibpath_var] = shlibpath
  else:
  lit_config.warning('Unable to determine shared library path variable for 
platform {}'.format(platform.system()))


https://reviews.llvm.org/D39162



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


[PATCH] D39166: [NFC] Add some assertions to placate my paranoia about sharing a variant bit across FunctionDecl and CXXDeductionGuideDecl - should I do this?

2017-10-22 Thread Faisal Vali via Phabricator via cfe-commits
faisalv added a comment.

In https://reviews.llvm.org/D39166#903131, @lichray wrote:

> Isn't it already an UB if someone set `WillHaveBody` and but later 
> `IsCopyDeductionCandidate` being read, vice versa?


Yes that would be UB - but I'm not sure I see how that would happen w the 
current implementation.  Hence I thought I'd add the assertions to be certain.


Repository:
  rL LLVM

https://reviews.llvm.org/D39166



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


[PATCH] D39166: [NFC] Add some assertions to placate my paranoia about sharing a variant bit across FunctionDecl and CXXDeductionGuideDecl - should I do this?

2017-10-22 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added a comment.

Isn't it already an UB if someone set `WillHaveBody` and but later 
`IsCopyDeductionCandidate` being read, vice versa?


Repository:
  rL LLVM

https://reviews.llvm.org/D39166



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


r316301 - Create fewer copies of StringMaps. No functionality change intended.

2017-10-22 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Sun Oct 22 13:16:28 2017
New Revision: 316301

URL: http://llvm.org/viewvc/llvm-project?rev=316301=rev
Log:
Create fewer copies of StringMaps. No functionality change intended.

Modified:
cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp
cfe/trunk/lib/Parse/ParseStmtAsm.cpp

Modified: cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp?rev=316301=316300=316301=diff
==
--- cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp (original)
+++ cfe/trunk/lib/Frontend/PrecompiledPreamble.cpp Sun Oct 22 13:16:28 2017
@@ -445,7 +445,7 @@ PrecompiledPreamble::PrecompiledPreamble
 TempPCHFile PCHFile, std::vector PreambleBytes,
 bool PreambleEndsAtStartOfLine,
 llvm::StringMap FilesInPreamble)
-: PCHFile(std::move(PCHFile)), FilesInPreamble(FilesInPreamble),
+: PCHFile(std::move(PCHFile)), FilesInPreamble(std::move(FilesInPreamble)),
   PreambleBytes(std::move(PreambleBytes)),
   PreambleEndsAtStartOfLine(PreambleEndsAtStartOfLine) {}
 

Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=316301=316300=316301=diff
==
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Sun Oct 22 13:16:28 2017
@@ -558,7 +558,7 @@ StmtResult Parser::ParseMicrosoftAsmStat
   if (buildMSAsmString(PP, AsmLoc, AsmToks, TokOffsets, AsmString))
 return StmtError();
 
-  TargetOptions TO = Actions.Context.getTargetInfo().getTargetOpts();
+  const TargetOptions  = Actions.Context.getTargetInfo().getTargetOpts();
   std::string FeaturesStr =
   llvm::join(TO.Features.begin(), TO.Features.end(), ",");
 


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


[PATCH] D39166: [NFC] Add some assertions to placate my paranoia about sharing a variant bit across FunctionDecl and CXXDeductionGuideDecl - should I do this?

2017-10-22 Thread Faisal Vali via Phabricator via cfe-commits
faisalv created this revision.
faisalv added a project: clang.
Herald added a subscriber: eraman.

I'd like to harden my patch here: https://reviews.llvm.org/rL316292 by adding 
some assertions.

But since the assertions in Decl,.h (FunctionDecl) require knowledge from 
DeclCXX.h (CXXDeductionGuideDecl),-  my question is: In order to keep the 
member functions inline I factored them out into a separate header file that I 
included in certain areas.

Is this an acceptable pattern?

Or does anyone have any other preferred engineering suggestions?

Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D39166

Files:
  include/clang/AST/Decl.h
  include/clang/AST/InlineDeclMembers.h
  include/clang/Sema/Sema.h
  lib/AST/Decl.cpp
  lib/AST/DeclCXX.cpp
  lib/Parse/ParseCXXInlineMethods.cpp

Index: lib/Parse/ParseCXXInlineMethods.cpp
===
--- lib/Parse/ParseCXXInlineMethods.cpp
+++ lib/Parse/ParseCXXInlineMethods.cpp
@@ -13,6 +13,7 @@
 
 #include "clang/Parse/Parser.h"
 #include "clang/AST/DeclTemplate.h"
+#include "clang/AST/InlineDeclMembers.h"
 #include "clang/Parse/ParseDiagnostic.h"
 #include "clang/Parse/RAIIObjectsForParser.h"
 #include "clang/Sema/DeclSpec.h"
Index: lib/AST/DeclCXX.cpp
===
--- lib/AST/DeclCXX.cpp
+++ lib/AST/DeclCXX.cpp
@@ -18,6 +18,7 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/InlineDeclMembers.h"
 #include "clang/AST/ODRHash.h"
 #include "clang/AST/TypeLoc.h"
 #include "clang/Basic/IdentifierTable.h"
Index: lib/AST/Decl.cpp
===
--- lib/AST/Decl.cpp
+++ lib/AST/Decl.cpp
@@ -23,6 +23,7 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
+#include "clang/AST/InlineDeclMembers.h"
 #include "clang/AST/PrettyPrinter.h"
 #include "clang/AST/Stmt.h"
 #include "clang/AST/TypeLoc.h"
Index: include/clang/Sema/Sema.h
===
--- include/clang/Sema/Sema.h
+++ include/clang/Sema/Sema.h
@@ -22,6 +22,7 @@
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprObjC.h"
 #include "clang/AST/ExternalASTSource.h"
+#include "clang/AST/InlineDeclMembers.h"
 #include "clang/AST/LocInfoType.h"
 #include "clang/AST/MangleNumberingContext.h"
 #include "clang/AST/NSAPI.h"
Index: include/clang/AST/InlineDeclMembers.h
===
--- include/clang/AST/InlineDeclMembers.h
+++ include/clang/AST/InlineDeclMembers.h
@@ -0,0 +1,37 @@
+//===- InlineDeclMembers.h - Decl.h Members that must be inlined -*- C++ -*-==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+//  This file defines the Decl subclasses.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_AST_INLINEDECLMEMBERS_H
+#define LLVM_CLANG_AST_INLINEDECLMEMBERS_H
+
+#include "clang/AST/Decl.h"
+#include "clang/AST/DeclCXX.h"
+
+
+inline bool clang::FunctionDecl::willHaveBody() const {
+  assert(!isa(this) &&
+"must not be called on a deduction guide since we share this data "
+"member while giving it different semantics");
+  return WillHaveBody;
+}
+inline void clang::FunctionDecl::setWillHaveBody(bool V) {
+  assert(!isa(this) &&
+"must not be called on a deduction guide since we share this data "
+"member while giving it different semantics");
+  WillHaveBody = V;
+}
+
+
+#endif  //LLVM_CLANG_AST_INLINEDECLMEMBERS_H
+
+
Index: include/clang/AST/Decl.h
===
--- include/clang/AST/Decl.h
+++ include/clang/AST/Decl.h
@@ -1680,7 +1680,9 @@
 
 protected:
   // Since a Deduction Guide [C++17] will never have a body, we can share the
-  // storage, and use a different name.
+  // storage, and use a different name.  Since WillHaveBody is not serialized we
+  // don't need to worry about collisions there.
+
   union {
 /// Indicates if the function declaration will have a body, once we're done
 /// parsing it.
@@ -2074,8 +2076,8 @@
   void setHasSkippedBody(bool Skipped = true) { HasSkippedBody = Skipped; }
 
   /// True if this function will eventually have a body, once it's fully parsed.
-  bool willHaveBody() const { return WillHaveBody; }
-  void setWillHaveBody(bool V = true) { WillHaveBody = V; }
+  bool willHaveBody() const;
+  void setWillHaveBody(bool V = true);
 
   void setPreviousDeclaration(FunctionDecl * PrevDecl);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D39156: [libunwind] Make HIDDEN_DIRECTIVE a function-like macro. NFCI.

2017-10-22 Thread Martin Storsjö via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL316300: Make HIDDEN_DIRECTIVE a function-like macro. NFCI. 
(authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D39156?vs=119740=119792#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39156

Files:
  libunwind/trunk/src/assembly.h


Index: libunwind/trunk/src/assembly.h
===
--- libunwind/trunk/src/assembly.h
+++ libunwind/trunk/src/assembly.h
@@ -24,27 +24,14 @@
 #define SEPARATOR ;
 #endif
 
-#if defined(__APPLE__)
-#define HIDDEN_DIRECTIVE .private_extern
-#elif defined(_WIN32)
-// In the COFF object file format, there's no attributes for a global,
-// non-static symbol to make it somehow hidden. So on windows, we don't
-// want to set this at all. To avoid conditionals in
-// DEFINE_LIBUNWIND_PRIVATE_FUNCTION below, make it .globl (which it already
-// is, defined in the same DEFINE_LIBUNWIND_PRIVATE_FUNCTION macro; the
-// duplicate .globl directives are harmless).
-#define HIDDEN_DIRECTIVE .globl
-#else
-#define HIDDEN_DIRECTIVE .hidden
-#endif
-
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
 
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
 #elif defined(__ELF__)
@@ -54,24 +41,30 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
 defined(__linux__)
 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
 #else
 #define NO_EXEC_STACK_DIRECTIVE
 #endif
 
-#else
+#elif defined(_WIN32)
 
 #define SYMBOL_IS_FUNC(name)   
\
   .def name SEPARATOR  
\
 .scl 2 SEPARATOR   
\
 .type 32 SEPARATOR 
\
   .endef
+#define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
 
+#else
+
+#error Unsupported target
+
 #endif
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
@@ -81,7 +74,7 @@
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
-  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR\
+  HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR  \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
   SYMBOL_NAME(name):
 


Index: libunwind/trunk/src/assembly.h
===
--- libunwind/trunk/src/assembly.h
+++ libunwind/trunk/src/assembly.h
@@ -24,27 +24,14 @@
 #define SEPARATOR ;
 #endif
 
-#if defined(__APPLE__)
-#define HIDDEN_DIRECTIVE .private_extern
-#elif defined(_WIN32)
-// In the COFF object file format, there's no attributes for a global,
-// non-static symbol to make it somehow hidden. So on windows, we don't
-// want to set this at all. To avoid conditionals in
-// DEFINE_LIBUNWIND_PRIVATE_FUNCTION below, make it .globl (which it already
-// is, defined in the same DEFINE_LIBUNWIND_PRIVATE_FUNCTION macro; the
-// duplicate .globl directives are harmless).
-#define HIDDEN_DIRECTIVE .globl
-#else
-#define HIDDEN_DIRECTIVE .hidden
-#endif
-
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
 
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
 #elif defined(__ELF__)
@@ -54,24 +41,30 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
 defined(__linux__)
 #define NO_EXEC_STACK_DIRECTIVE .section .note.GNU-stack,"",%progbits
 #else
 #define NO_EXEC_STACK_DIRECTIVE
 #endif
 
-#else
+#elif defined(_WIN32)
 
 #define SYMBOL_IS_FUNC(name)   \
   .def name SEPARATOR  \
 .scl 2 SEPARATOR   \
 .type 32 SEPARATOR \
   .endef
+#define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
 
+#else
+
+#error Unsupported target
+
 #endif
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
@@ -81,7 +74,7 @@
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
-  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR\
+  HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR  \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
  

[libunwind] r316300 - Make HIDDEN_DIRECTIVE a function-like macro. NFCI.

2017-10-22 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Sun Oct 22 12:39:26 2017
New Revision: 316300

URL: http://llvm.org/viewvc/llvm-project?rev=316300=rev
Log:
Make HIDDEN_DIRECTIVE a function-like macro. NFCI.

This avoids a hack for making it a no-op for windows.

Also explicitly check for _WIN32 instead of assuming it.

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

Modified:
libunwind/trunk/src/assembly.h

Modified: libunwind/trunk/src/assembly.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=316300=316299=316300=diff
==
--- libunwind/trunk/src/assembly.h (original)
+++ libunwind/trunk/src/assembly.h Sun Oct 22 12:39:26 2017
@@ -24,20 +24,6 @@
 #define SEPARATOR ;
 #endif
 
-#if defined(__APPLE__)
-#define HIDDEN_DIRECTIVE .private_extern
-#elif defined(_WIN32)
-// In the COFF object file format, there's no attributes for a global,
-// non-static symbol to make it somehow hidden. So on windows, we don't
-// want to set this at all. To avoid conditionals in
-// DEFINE_LIBUNWIND_PRIVATE_FUNCTION below, make it .globl (which it already
-// is, defined in the same DEFINE_LIBUNWIND_PRIVATE_FUNCTION macro; the
-// duplicate .globl directives are harmless).
-#define HIDDEN_DIRECTIVE .globl
-#else
-#define HIDDEN_DIRECTIVE .hidden
-#endif
-
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
@@ -45,6 +31,7 @@
 #if defined(__APPLE__)
 
 #define SYMBOL_IS_FUNC(name)
+#define HIDDEN_SYMBOL(name) .private_extern name
 #define NO_EXEC_STACK_DIRECTIVE
 
 #elif defined(__ELF__)
@@ -54,6 +41,7 @@
 #else
 #define SYMBOL_IS_FUNC(name) .type name,@function
 #endif
+#define HIDDEN_SYMBOL(name) .hidden name
 
 #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
 defined(__linux__)
@@ -62,16 +50,21 @@
 #define NO_EXEC_STACK_DIRECTIVE
 #endif
 
-#else
+#elif defined(_WIN32)
 
 #define SYMBOL_IS_FUNC(name)   
\
   .def name SEPARATOR  
\
 .scl 2 SEPARATOR   
\
 .type 32 SEPARATOR 
\
   .endef
+#define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE
 
+#else
+
+#error Unsupported target
+
 #endif
 
 #define DEFINE_LIBUNWIND_FUNCTION(name)   \
@@ -81,7 +74,7 @@
 
 #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name)   \
   .globl SYMBOL_NAME(name) SEPARATOR  \
-  HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR\
+  HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR  \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \
   SYMBOL_NAME(name):
 


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


[PATCH] D39127: Fix template parameter default args missed if redecled

2017-10-22 Thread Martin Storsjö via Phabricator via cfe-commits
mstorsjo added inline comments.



Comment at: lib/Sema/SemaTemplate.cpp:4811
+  TemplateParameterList *Params =
+  cast(Template->getMostRecentDecl())
+  ->getTemplateParameters();

erichkeane wrote:
> mstorsjo wrote:
> > How does this work if there's another forward declaration missing the 
> > parameter later? Is the logic with "most recent" ok, or should it be "most 
> > qualified/complete" instead?
> I'm not sure the case you mean.  Any future declarations with fewer 
> parameters would be aspecialization and a different decl, right?
Sorry, I meant a declaration with fewer defaults. E.g. the original forward 
declaration without defaults again after the actual definition.

E.g. by adding

```
namespace llvm {
  template struct StringSet;
}
```
before the last `namespace lld`.




https://reviews.llvm.org/D39127



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


[PATCH] D39127: Fix template parameter default args missed if redecled

2017-10-22 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: lib/Sema/SemaTemplate.cpp:4811
+  TemplateParameterList *Params =
+  cast(Template->getMostRecentDecl())
+  ->getTemplateParameters();

mstorsjo wrote:
> How does this work if there's another forward declaration missing the 
> parameter later? Is the logic with "most recent" ok, or should it be "most 
> qualified/complete" instead?
I'm not sure the case you mean.  Any future declarations with fewer parameters 
would be aspecialization and a different decl, right?


https://reviews.llvm.org/D39127



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


r316292 - [C++17] Fix PR34970 - tweak overload resolution for class template deduction-guides in line with WG21's p0620r0.

2017-10-22 Thread Faisal Vali via cfe-commits
Author: faisalv
Date: Sun Oct 22 07:45:08 2017
New Revision: 316292

URL: http://llvm.org/viewvc/llvm-project?rev=316292=rev
Log:
[C++17] Fix PR34970 - tweak overload resolution for class template 
deduction-guides in line with WG21's p0620r0.

In order to identify the copy deduction candidate, I considered two approaches:
  - attempt to determine whether an implicit guide is a copy deduction 
candidate by checking certain properties of its subsituted parameter during 
overload-resolution.
  - using one of the many bits (WillHaveBody) from FunctionDecl (that 
CXXDeductionGuideDecl inherits from) that are otherwise irrelevant for 
deduction guides

After some brittle gymnastics w the first strategy, I settled on the second, 
although to avoid confusion and to give that bit a better name, i turned it 
into a member of an anonymous union.

Given this identification 'bit', the tweak to overload resolution was a simple 
reordering of the deduction guide checks (in 
SemaOverload.cpp::isBetterOverloadCandidate), in-line with Jason Merrill's 
p0620r0 drafting which made it into the working paper.  Concordant with that, I 
made sure the copy deduction candidate is always added.


References:
See https://bugs.llvm.org/show_bug.cgi?id=34970 
See http://wg21.link/p0620r0

Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/test/CXX/over/over.match/over.match.best/p1.cpp

cfe/trunk/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=316292=316291=316292=diff
==
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Sun Oct 22 07:45:08 2017
@@ -1678,10 +1678,18 @@ private:
   /// skipped.
   unsigned HasSkippedBody : 1;
 
-  /// Indicates if the function declaration will have a body, once we're done
-  /// parsing it.
-  unsigned WillHaveBody : 1;
-
+protected:
+  // Since a Deduction Guide [C++17] will never have a body, we can share the
+  // storage, and use a different name.
+  union {
+/// Indicates if the function declaration will have a body, once we're done
+/// parsing it.
+unsigned WillHaveBody : 1;
+/// Indicates that the Deduction Guide is the implicitly generated 'copy
+/// deduction candidate' (is used during overload resolution).
+unsigned IsCopyDeductionCandidate : 1;
+  };
+private:
   /// \brief End part of this FunctionDecl's source range.
   ///
   /// We could compute the full range in getSourceRange(). However, when we're

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=316292=316291=316292=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Sun Oct 22 07:45:08 2017
@@ -1881,6 +1881,10 @@ private:
 if (EndLocation.isValid())
   setRangeEnd(EndLocation);
 IsExplicitSpecified = IsExplicit;
+
+// IsCopyDeductionCandidate is a union variant member, so ensure it is the
+// active member by storing to it.
+IsCopyDeductionCandidate = false; 
   }
 
 public:
@@ -1903,6 +1907,12 @@ public:
 return getDeclName().getCXXDeductionGuideTemplate();
   }
 
+  void setIsCopyDeductionCandidate() {
+IsCopyDeductionCandidate = true;
+  }
+
+  bool isCopyDeductionCandidate() const { return IsCopyDeductionCandidate; }
+
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) { return classofKind(D->getKind()); }
   static bool classofKind(Kind K) { return K == CXXDeductionGuide; }

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=316292=316291=316292=diff
==
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Sun Oct 22 07:45:08 2017
@@ -8965,12 +8965,6 @@ bool clang::isBetterOverloadCandidate(
 // C++14 [over.match.best]p1 section 2 bullet 3.
   }
 
-  //-- F1 is generated from a deduction-guide and F2 is not
-  auto *Guide1 = dyn_cast_or_null(Cand1.Function);
-  auto *Guide2 = dyn_cast_or_null(Cand2.Function);
-  if (Guide1 && Guide2 && Guide1->isImplicit() != Guide2->isImplicit())
-return Guide2->isImplicit();
-
   //-- F1 is a non-template function and F2 is a function template
   //   specialization, or, if not that,
   bool Cand1IsSpecialization = Cand1.Function &&
@@ -9015,6 

[libclc] r316291 - shared: Implement aligned vector stores (vstorea_half)

2017-10-22 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sun Oct 22 07:21:59 2017
New Revision: 316291

URL: http://llvm.org/viewvc/llvm-project?rev=316291=rev
Log:
shared: Implement aligned vector stores (vstorea_half)

Float version passes newly posted piglit tests on turks, float and double pass 
on carrizo.
v2: scalar vstorea_half
v3: fix typo

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely 

Modified:
libclc/trunk/generic/include/clc/shared/vstore.h
libclc/trunk/generic/lib/shared/vstore.cl
libclc/trunk/generic/lib/shared/vstore_half.inc

Modified: libclc/trunk/generic/include/clc/shared/vstore.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/shared/vstore.h?rev=316291=316290=316291=diff
==
--- libclc/trunk/generic/include/clc/shared/vstore.h (original)
+++ libclc/trunk/generic/include/clc/shared/vstore.h Sun Oct 22 07:21:59 2017
@@ -16,37 +16,52 @@
 #define _CLC_VECTOR_VSTORE_PRIM1(PRIM_TYPE) \
   _CLC_VECTOR_VSTORE_PRIM3(,PRIM_TYPE, PRIM_TYPE) \
 
-#define _CLC_VECTOR_VSTORE_PRIM() \
-_CLC_VECTOR_VSTORE_PRIM1(char) \
-_CLC_VECTOR_VSTORE_PRIM1(uchar) \
-_CLC_VECTOR_VSTORE_PRIM1(short) \
-_CLC_VECTOR_VSTORE_PRIM1(ushort) \
-_CLC_VECTOR_VSTORE_PRIM1(int) \
-_CLC_VECTOR_VSTORE_PRIM1(uint) \
-_CLC_VECTOR_VSTORE_PRIM1(long) \
-_CLC_VECTOR_VSTORE_PRIM1(ulong) \
-_CLC_VECTOR_VSTORE_PRIM1(float) \
-_CLC_VECTOR_VSTORE_PRIM3(_half, half, float)
+_CLC_VECTOR_VSTORE_PRIM1(char)
+_CLC_VECTOR_VSTORE_PRIM1(uchar)
+_CLC_VECTOR_VSTORE_PRIM1(short)
+_CLC_VECTOR_VSTORE_PRIM1(ushort)
+_CLC_VECTOR_VSTORE_PRIM1(int)
+_CLC_VECTOR_VSTORE_PRIM1(uint)
+_CLC_VECTOR_VSTORE_PRIM1(long)
+_CLC_VECTOR_VSTORE_PRIM1(ulong)
+_CLC_VECTOR_VSTORE_PRIM1(float)
+_CLC_VECTOR_VSTORE_PRIM3(_half, half, float)
+// Use suffix to declare aligned vstorea_halfN
+_CLC_VECTOR_VSTORE_PRIM3(a_half, half, float)
 
 #ifdef cl_khr_fp64
   _CLC_VECTOR_VSTORE_PRIM1(double)
   _CLC_VECTOR_VSTORE_PRIM3(_half, half, double)
+  // Use suffix to declare aligned vstorea_halfN
+  _CLC_VECTOR_VSTORE_PRIM3(a_half, half, double)
+
+  // Scalar vstore_half also needs to be declared
   _CLC_VSTORE_DECL(_half, half, double, , __private)
   _CLC_VSTORE_DECL(_half, half, double, , __local)
   _CLC_VSTORE_DECL(_half, half, double, , __global)
+
+  // Scalar vstorea_half is not part of the specs but CTS expects it
+  _CLC_VSTORE_DECL(a_half, half, double, , __private)
+  _CLC_VSTORE_DECL(a_half, half, double, , __local)
+  _CLC_VSTORE_DECL(a_half, half, double, , __global)
 #endif
 
 #ifdef cl_khr_fp16
   _CLC_VECTOR_VSTORE_PRIM1(half)
 #endif
 
-_CLC_VECTOR_VSTORE_PRIM()
+// Scalar vstore_half also needs to be declared
 _CLC_VSTORE_DECL(_half, half, float, , __private)
 _CLC_VSTORE_DECL(_half, half, float, , __local)
 _CLC_VSTORE_DECL(_half, half, float, , __global)
 
+// Scalar vstorea_half is not part of the specs but CTS expects it
+_CLC_VSTORE_DECL(a_half, half, float, , __private)
+_CLC_VSTORE_DECL(a_half, half, float, , __local)
+_CLC_VSTORE_DECL(a_half, half, float, , __global)
+
+
 #undef _CLC_VSTORE_DECL
 #undef _CLC_VECTOR_VSTORE_DECL
 #undef _CLC_VECTOR_VSTORE_PRIM3
 #undef _CLC_VECTOR_VSTORE_PRIM1
-#undef _CLC_VECTOR_VSTORE_PRIM

Modified: libclc/trunk/generic/lib/shared/vstore.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/shared/vstore.cl?rev=316291=316290=316291=diff
==
--- libclc/trunk/generic/lib/shared/vstore.cl (original)
+++ libclc/trunk/generic/lib/shared/vstore.cl Sun Oct 22 07:21:59 2017
@@ -33,23 +33,22 @@
 VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __local) \
 VSTORE_VECTORIZE(__CLC_SCALAR___CLC_GENTYPE, __global) \
 
-#define VSTORE_TYPES() \
-VSTORE_ADDR_SPACES(char) \
-VSTORE_ADDR_SPACES(uchar) \
-VSTORE_ADDR_SPACES(short) \
-VSTORE_ADDR_SPACES(ushort) \
-VSTORE_ADDR_SPACES(int) \
-VSTORE_ADDR_SPACES(uint) \
-VSTORE_ADDR_SPACES(long) \
-VSTORE_ADDR_SPACES(ulong) \
-VSTORE_ADDR_SPACES(float) \
+VSTORE_ADDR_SPACES(char)
+VSTORE_ADDR_SPACES(uchar)
+VSTORE_ADDR_SPACES(short)
+VSTORE_ADDR_SPACES(ushort)
+VSTORE_ADDR_SPACES(int)
+VSTORE_ADDR_SPACES(uint)
+VSTORE_ADDR_SPACES(long)
+VSTORE_ADDR_SPACES(ulong)
+VSTORE_ADDR_SPACES(float)
 
-VSTORE_TYPES()
 
 #ifdef cl_khr_fp64
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 VSTORE_ADDR_SPACES(double)
 #endif
+
 #ifdef cl_khr_fp16
 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
 VSTORE_ADDR_SPACES(half)
@@ -95,13 +94,17 @@ DECLARE_HELPER(double, __local, __builti
VEC_STORE8(STYPE, AS, val.lo) \
VEC_STORE8(STYPE, AS, val.hi)
 
-#define __FUNC(SUFFIX, VEC_SIZE, TYPE, STYPE, AS) \
+#define __FUNC(SUFFIX, VEC_SIZE, OFFSET, TYPE, STYPE, AS) \
   _CLC_OVERLOAD _CLC_DEF void vstore_half##SUFFIX(TYPE vec, size_t offset, AS 
half *mem) { \
 offset *= VEC_SIZE; \
 VEC_STORE##VEC_SIZE(STYPE, AS, vec) 

[libclc] r316290 - shared: Implement aligned vector loads (vloada_half)

2017-10-22 Thread Jan Vesely via cfe-commits
Author: jvesely
Date: Sun Oct 22 07:21:56 2017
New Revision: 316290

URL: http://llvm.org/viewvc/llvm-project?rev=316290=rev
Log:
shared: Implement aligned vector loads (vloada_half)

Passes newly posted piglits on turks and carrizo
v2: add scalar vloada_half
v3: fix typo

Reviewer: Aaron Watry
Signed-off-by: Jan Vesely 

Modified:
libclc/trunk/generic/include/clc/shared/vload.h
libclc/trunk/generic/lib/shared/vload.cl
libclc/trunk/generic/lib/shared/vload_half.inc

Modified: libclc/trunk/generic/include/clc/shared/vload.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/shared/vload.h?rev=316290=316289=316290=diff
==
--- libclc/trunk/generic/include/clc/shared/vload.h (original)
+++ libclc/trunk/generic/include/clc/shared/vload.h Sun Oct 22 07:21:56 2017
@@ -12,22 +12,24 @@
   _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __private) \
   _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __local) \
   _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __constant) \
-  _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __global) \
+  _CLC_VECTOR_VLOAD_DECL(SUFFIX, MEM_TYPE, PRIM_TYPE, __global)
 
 #define _CLC_VECTOR_VLOAD_PRIM1(PRIM_TYPE) \
-  _CLC_VECTOR_VLOAD_PRIM3(, PRIM_TYPE, PRIM_TYPE) \
+  _CLC_VECTOR_VLOAD_PRIM3(, PRIM_TYPE, PRIM_TYPE)
 
-#define _CLC_VECTOR_VLOAD_PRIM() \
-_CLC_VECTOR_VLOAD_PRIM1(char) \
-_CLC_VECTOR_VLOAD_PRIM1(uchar) \
-_CLC_VECTOR_VLOAD_PRIM1(short) \
-_CLC_VECTOR_VLOAD_PRIM1(ushort) \
-_CLC_VECTOR_VLOAD_PRIM1(int) \
-_CLC_VECTOR_VLOAD_PRIM1(uint) \
-_CLC_VECTOR_VLOAD_PRIM1(long) \
-_CLC_VECTOR_VLOAD_PRIM1(ulong) \
-_CLC_VECTOR_VLOAD_PRIM1(float) \
-_CLC_VECTOR_VLOAD_PRIM3(_half, half, float)
+// Declare vector load prototypes
+_CLC_VECTOR_VLOAD_PRIM1(char)
+_CLC_VECTOR_VLOAD_PRIM1(uchar)
+_CLC_VECTOR_VLOAD_PRIM1(short)
+_CLC_VECTOR_VLOAD_PRIM1(ushort)
+_CLC_VECTOR_VLOAD_PRIM1(int)
+_CLC_VECTOR_VLOAD_PRIM1(uint)
+_CLC_VECTOR_VLOAD_PRIM1(long)
+_CLC_VECTOR_VLOAD_PRIM1(ulong)
+_CLC_VECTOR_VLOAD_PRIM1(float)
+_CLC_VECTOR_VLOAD_PRIM3(_half, half, float)
+// Use suffix to declare aligned vloada_halfN
+_CLC_VECTOR_VLOAD_PRIM3(a_half, half, float)
 
 #ifdef cl_khr_fp64
 #pragma OPENCL EXTENSION cl_khr_fp64: enable
@@ -38,15 +40,19 @@
   _CLC_VECTOR_VLOAD_PRIM1(half)
 #endif
 
-_CLC_VECTOR_VLOAD_PRIM()
-// Plain vload_half also needs to be declared
+// Scalar vload_half also needs to be declared
 _CLC_VLOAD_DECL(_half, half, float, , __constant)
 _CLC_VLOAD_DECL(_half, half, float, , __global)
 _CLC_VLOAD_DECL(_half, half, float, , __local)
 _CLC_VLOAD_DECL(_half, half, float, , __private)
 
+// Scalar vloada_half is not part of the specs but CTS expects it
+_CLC_VLOAD_DECL(a_half, half, float, , __constant)
+_CLC_VLOAD_DECL(a_half, half, float, , __global)
+_CLC_VLOAD_DECL(a_half, half, float, , __local)
+_CLC_VLOAD_DECL(a_half, half, float, , __private)
+
 #undef _CLC_VLOAD_DECL
 #undef _CLC_VECTOR_VLOAD_DECL
 #undef _CLC_VECTOR_VLOAD_PRIM3
 #undef _CLC_VECTOR_VLOAD_PRIM1
-#undef _CLC_VECTOR_VLOAD_PRIM

Modified: libclc/trunk/generic/lib/shared/vload.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/shared/vload.cl?rev=316290=316289=316290=diff
==
--- libclc/trunk/generic/lib/shared/vload.cl (original)
+++ libclc/trunk/generic/lib/shared/vload.cl Sun Oct 22 07:21:56 2017
@@ -85,15 +85,21 @@ float __clc_vload_half_float_helper__pri
VEC_LOAD8(val.lo, AS) \
VEC_LOAD8(val.hi, AS)
 
-#define __FUNC(SUFFIX, VEC_SIZE, TYPE, AS) \
+#define __FUNC(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS) \
   _CLC_OVERLOAD _CLC_DEF TYPE vload_half##SUFFIX(size_t offset, const AS half 
*mem) { \
 offset *= VEC_SIZE; \
 TYPE __tmp; \
 VEC_LOAD##VEC_SIZE(__tmp, AS) \
 return __tmp; \
+  } \
+  _CLC_OVERLOAD _CLC_DEF TYPE vloada_half##SUFFIX(size_t offset, const AS half 
*mem) { \
+offset *= OFFSET_SIZE; \
+TYPE __tmp; \
+VEC_LOAD##VEC_SIZE(__tmp, AS) \
+return __tmp; \
   }
 
-#define FUNC(SUFFIX, VEC_SIZE, TYPE, AS) __FUNC(SUFFIX, VEC_SIZE, TYPE, AS)
+#define FUNC(SUFFIX, VEC_SIZE, OFFSET_SIZE, TYPE, AS) __FUNC(SUFFIX, VEC_SIZE, 
OFFSET_SIZE, TYPE, AS)
 
 #define __CLC_BODY "vload_half.inc"
 #include 

Modified: libclc/trunk/generic/lib/shared/vload_half.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/shared/vload_half.inc?rev=316290=316289=316290=diff
==
--- libclc/trunk/generic/lib/shared/vload_half.inc (original)
+++ libclc/trunk/generic/lib/shared/vload_half.inc Sun Oct 22 07:21:56 2017
@@ -1,13 +1,23 @@
 #if __CLC_FPSIZE == 32
+
 #ifdef __CLC_VECSIZE
-  FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __private);
-  FUNC(__CLC_VECSIZE, __CLC_VECSIZE, __CLC_GENTYPE, __local);
-  

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

2017-10-22 Thread Ábel Sinkovics via Phabricator via cfe-commits
sabel83 added a comment.

I've updated the patch based on your comments.


https://reviews.llvm.org/D5767



___
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

2017-10-22 Thread Ábel Sinkovics via Phabricator via cfe-commits
sabel83 updated this revision to Diff 119774.

https://reviews.llvm.org/D5767

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

Index: tools/CMakeLists.txt
===
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -35,3 +35,4 @@
 
 # libclang may require clang-tidy in clang-tools-extra.
 add_clang_subdirectory(libclang)
+add_subdirectory(templight)
Index: test/Sema/templight-prior-template-arg.cpp
===
--- test/Sema/templight-prior-template-arg.cpp
+++ test/Sema/templight-prior-template-arg.cpp
@@ -0,0 +1,62 @@
+// RUN: %clang_cc1 -templight-dump %s 2>&1 | FileCheck %s
+template
+class A {};
+
+template  class Outer>
+class B {};
+
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B::Outer'$}}
+// CHECK: {{^kind:[ ]+PriorTemplateArgumentSubstitution$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+50]]{{:1'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B::Outer'$}}
+// CHECK: {{^kind:[ ]+PriorTemplateArgumentSubstitution$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+45]]{{:1'$}}
+//
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+39]]{{:6'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+34]]{{:6'$}}
+//
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+28]]{{:6'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+23]]{{:6'$}}
+//
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B'$}}
+// CHECK: {{^kind:[ ]+Memoization$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+17]]{{:6'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B'$}}
+// CHECK: {{^kind:[ ]+Memoization$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+12]]{{:6'$}}
+//
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B'$}}
+// CHECK: {{^kind:[ ]+Memoization$}}
+// CHECK: {{^event:[ ]+Begin$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+6]]{{:6'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'B'$}}
+// CHECK: {{^kind:[ ]+Memoization$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^poi:[ ]+'.*templight-prior-template-arg.cpp:}}[[@LINE+1]]{{:6'$}}
+B b;
Index: test/Sema/templight-one-instantiation.cpp
===
--- test/Sema/templight-one-instantiation.cpp
+++ test/Sema/templight-one-instantiation.cpp
@@ -0,0 +1,16 @@
+// 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: {{^poi:[ ]+'.*templight-one-instantiation.cpp:}}[[@LINE+6]]{{:10'$}}
+// CHECK-LABEL: {{^---$}}
+// CHECK: {{^name:[ ]+'foo'$}}
+// CHECK: {{^kind:[ ]+TemplateInstantiation$}}
+// CHECK: {{^event:[ ]+End$}}
+// CHECK: {{^poi:[ ]+'.*templight-one-instantiation.cpp:}}[[@LINE+1]]{{:10'$}}
+foo x;
Index: test/Sema/templight-nested-template-instantiation.cpp
===
--- test/Sema/templight-nested-template-instantiation.cpp
+++ test/Sema/templight-nested-template-instantiation.cpp
@@ -0,0 +1,72 @@
+// RUN: %clang_cc1