<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 3, 2014 at 11:21 AM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Thu, Jul 3, 2014 at 11:08 AM, Larisse Voufo <<a href="mailto:lvoufo@gmail.com">lvoufo@gmail.com</a>> wrote:<br>


> I pushed the previous patch in since it is a simple extension of existing template implementation logic for variable templates, which continues a trend that we started last summer.<br>
><br>
<br>
</div>I'm talking less about the particular pass, but the development<br>
process. Once a patch is out for review you need to wait for approval<br>
to commit. Do feel free to commit what you consider to be an obvious<br>
patch in the future, however...<br>
<div class=""><br></div></blockquote><div>Ok. Noted.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
> Now, I am adding a test case.<br>
<br>
</div>Please make sure to add a test case in the future when you commit.<br></blockquote><div><br></div><div>Certainly. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<br>
-eric<br>
<div><div class="h5"><br>
> I am not very experienced in writing linkage-level test cases yet. So, I could use additional pairs of eyes. Could someone please take a quick look and let me know if it's okay to go asap?<br>
><br>
> <a href="http://reviews.llvm.org/D4362" target="_blank">http://reviews.llvm.org/D4362</a><br>
><br>
> Files:<br>
>   test/CodeGenCXX/cxx1y-variable-template-linkage.cpp<br>
><br>
> Index: test/CodeGenCXX/cxx1y-variable-template-linkage.cpp<br>
> ===================================================================<br>
> --- /dev/null<br>
> +++ test/CodeGenCXX/cxx1y-variable-template-linkage.cpp<br>
> @@ -0,0 +1,57 @@<br>
> +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -std=c++1y -O1 -disable-llvm-optzns %s -o - -DFILEA | FileCheck %s -check-prefix=CHECKA<br>
> +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -std=c++1y -O1 -disable-llvm-optzns -fcxx-exceptions %s -o - -DFILEB | FileCheck %s -check-prefix=CHECKB<br>
> +// expected-no-diagnostics<br>
> +<br>
> +// The variable template specialization x<Foo> generated in each file<br>
> +// should be 'internal global' and not 'linkonce_odr global'.<br>
> +<br>
> +// File A<br>
> +#ifdef FILEA<br>
> +<br>
> +template <typename T> int x = 42;<br>
> +<br>
> +// CHECKA-DAG: @_Z1xIZL3foovE3FooE = internal global<br>
> +<br>
> +// CHECKA-DAG: define internal nonnull i32* @_ZL3foov(<br>
> +static int &foo() {<br>
> +   struct Foo { };<br>
> +<br>
> +   // CHECKA-DAG: ret i32* @_Z1xIZL3foovE3FooE<br>
> +   return x<Foo>;<br>
> +}<br>
> +<br>
> +// CHECKA-DAG: define nonnull i32* @_Z3barv(<br>
> +int &bar() {<br>
> +       // CHECKA-DAG: %call = call nonnull i32* @_ZL3foov()<br>
> +       return foo();<br>
> +}<br>
> +<br>
> +#endif // end of FILE A<br>
> +<br>
> +<br>
> +// File B<br>
> +#ifdef FILEB<br>
> +<br>
> +template <typename T> int x = 42;<br>
> +<br>
> +// CHECKB-DAG: @_Z1xIZL3foovE3FooE = internal global<br>
> +<br>
> +// CHECKB-DAG: define internal nonnull i32* @_ZL3foov(<br>
> +static int &foo() {<br>
> +   struct Foo { };<br>
> +<br>
> +   // CHECKB-DAG: ret i32* @_Z1xIZL3foovE3FooE<br>
> +   return x<Foo>;<br>
> +}<br>
> +<br>
> +// CHECKB-DAG: declare nonnull i32* @_Z3barv(<br>
> +int &bar();<br>
> +<br>
> +int main() {<br>
> +       // CHECKB-DAG: %call = call nonnull i32* @_Z3barv()<br>
> +       // CHECKB-DAG: %call1 = call nonnull i32* @_ZL3foov()<br>
> +       &bar() == &foo() ? throw 0 : (void)0; // Should not throw exception at runtime.<br>
> +}<br>
> +<br>
> +#endif // end of FILE B<br>
> +<br>
</div></div>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>