<div dir="ltr">I see. If will clean up the recent style violations introduced by me soon.<div><br></div><div>thanks,<br><div><br></div><div>David</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 5, 2015 at 9:37 PM, Duncan P. N. Exon Smith via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 2015-Oct-28, at 18:29, Xinliang David Li via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
><br>
><br>
> On Wed, Oct 28, 2015 at 4:01 PM, Justin Bogner <<a href="mailto:mail@justinbogner.com">mail@justinbogner.com</a>> wrote:<br>
> Xinliang David Li <<a href="mailto:davidxl@google.com">davidxl@google.com</a>> writes:<br>
> > Regarding the formatting of return statement -- it is the<br>
> > clang-format-diff.py tool that does that for me (which I always run).<br>
><br>
> Strange. clang-format-diff.py on my machine puts the return on a new<br>
> line. Maybe clang-format's llvm-style changed at some point?<br>
><br>
> Could be that. I checked the latest clang-format-diff, it does produce the single line output. In fact, I see both styles are used widely in LLVM, so I guess they are both acceptable.<br>
<br>
</span>Both styles are widely used just because we have a lot of code that<br>
hasn't been clang-formatted.<br>
<br>
Note that Teresa had the same configuration issue: for some reason<br>
(that neither of us could figure out), clang-format was using the<br>
Google style on her laptop instead of the LLVM style. I noticed it<br>
because of the same quirk: `return`s on the same line.<br>
<br>
Since the whole point of clang-format is to (over time) canonicalize<br>
the whitespace style, maybe Teresa (or Daniel!) can help you<br>
configure correctly for LLVM.<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> David<br>
><br>
><br>
> > David<br>
> ><br>
> > On Wed, Oct 28, 2015 at 11:29 AM, Justin Bogner <<a href="mailto:mail@justinbogner.com">mail@justinbogner.com</a>><br>
> > wrote:<br>
> ><br>
> >> David Li <<a href="mailto:davidxl@google.com">davidxl@google.com</a>> writes:<br>
> >> > davidxl created this revision.<br>
> >> > davidxl added a reviewer: bogner.<br>
> >> > davidxl added a subscriber: llvm-commits.<br>
> >> ><br>
> >> > This is patch part-2 following: <a href="http://reviews.llvm.org/D14030" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14030</a><br>
> >> ><br>
> >> > <a href="http://reviews.llvm.org/D14033" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14033</a><br>
> >> ><br>
> >> > Files:<br>
> >> > lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
> >> > test/Instrumentation/InstrProfiling/linkage.ll<br>
> >> ><br>
> >> > Index: test/Instrumentation/InstrProfiling/linkage.ll<br>
> >> > ===================================================================<br>
> >> > --- test/Instrumentation/InstrProfiling/linkage.ll<br>
> >> > +++ test/Instrumentation/InstrProfiling/linkage.ll<br>
> >> > @@ -1,7 +1,7 @@<br>
> >> > ;; Check that runtime symbols get appropriate linkage.<br>
> >> ><br>
> >> > ; RUN: opt < %s -mtriple=x86_64-apple-macosx10.10.0 -instrprof -S |<br>
> >> FileCheck %s<br>
> >> > -; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck<br>
> >> %s<br>
> >> > +; RUN: opt < %s -mtriple=x86_64-unknown-linux -instrprof -S | FileCheck<br>
> >> %s --check-prefix=LINUX<br>
> >> ><br>
> >> > @__llvm_profile_name_foo = hidden constant [3 x i8] c"foo"<br>
> >> > @__llvm_profile_name_foo_weak = weak hidden constant [8 x i8]<br>
> >> c"foo_weak"<br>
> >> > @@ -10,6 +10,8 @@<br>
> >> ><br>
> >> > ; CHECK: @__llvm_profile_counters_foo = hidden global<br>
> >> > ; CHECK: @__llvm_profile_data_foo = hidden constant<br>
> >> > +; LINUX: @__llvm_profile_counters_foo = hidden global<br>
> >> > +; LINUX: @__llvm_profile_data_foo = hidden constant<br>
> >><br>
> >> You can simplify the checks a bit by using multiple prefices - FileCheck<br>
> >> will check all of them. So you'd change these to "COMMON:" or something<br>
> >> and then have specific ones for emitting and skipping the runtime hook<br>
> >> definition below.<br>
> >><br>
> >> > define void @foo() {<br>
> >> > call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x<br>
> >> i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i64 0, i32 1, i32 0)<br>
> >> > ret void<br>
> >> > @@ -17,6 +19,8 @@<br>
> >> ><br>
> >> > ; CHECK: @__llvm_profile_counters_foo_weak = weak hidden global<br>
> >> > ; CHECK: @__llvm_profile_data_foo_weak = weak hidden constant<br>
> >> > +; LINUX: @__llvm_profile_counters_foo_weak = weak hidden global<br>
> >> > +; LINUX: @__llvm_profile_data_foo_weak = weak hidden constant<br>
> >> > define weak void @foo_weak() {<br>
> >> > call void @llvm.instrprof.increment(i8* getelementptr inbounds ([8 x<br>
> >> i8], [8 x i8]* @__llvm_profile_name_foo_weak, i32 0, i32 0), i64 0, i32 1,<br>
> >> i32 0)<br>
> >> > ret void<br>
> >> > @@ -24,6 +28,8 @@<br>
> >> ><br>
> >> > ; CHECK: @"__llvm_profile_counters_linkage.ll:foo_internal" = internal<br>
> >> global<br>
> >> > ; CHECK: @"__llvm_profile_data_linkage.ll:foo_internal" = internal<br>
> >> constant<br>
> >> > +; LINUX: @"__llvm_profile_counters_linkage.ll:foo_internal" = internal<br>
> >> global<br>
> >> > +; LINUX: @"__llvm_profile_data_linkage.ll:foo_internal" = internal<br>
> >> constant<br>
> >> > define internal void @foo_internal() {<br>
> >> > call void @llvm.instrprof.increment(i8* getelementptr inbounds ([23 x<br>
> >> i8], [23 x i8]* @"__llvm_profile_name_linkage.ll:foo_internal", i32 0, i32<br>
> >> 0), i64 0, i32 1, i32 0)<br>
> >> > ret void<br>
> >> > @@ -31,6 +37,8 @@<br>
> >> ><br>
> >> > ; CHECK: @__llvm_profile_counters_foo_inline = linkonce_odr hidden<br>
> >> global<br>
> >> > ; CHECK: @__llvm_profile_data_foo_inline = linkonce_odr hidden constant<br>
> >> > +; LINUX: @__llvm_profile_counters_foo_inline = linkonce_odr hidden<br>
> >> global<br>
> >> > +; LINUX: @__llvm_profile_data_foo_inline = linkonce_odr hidden constant<br>
> >> > define linkonce_odr void @foo_inline() {<br>
> >> > call void @llvm.instrprof.increment(i8* getelementptr inbounds ([10 x<br>
> >> i8], [10 x i8]* @__llvm_profile_name_foo_inline, i32 0, i32 0), i64 0, i32<br>
> >> 1, i32 0)<br>
> >> > ret void<br>
> >> > @@ -39,8 +47,11 @@<br>
> >> > declare void @llvm.instrprof.increment(i8*, i64, i32, i32)<br>
> >> ><br>
> >> > ; CHECK: @__llvm_profile_runtime = external global i32<br>
> >> > +; LINUX-NOT: @__llvm_profile_runtime = external global i32<br>
> >> ><br>
> >> > ; CHECK: define linkonce_odr hidden i32 @__llvm_profile_runtime_user()<br>
> >> {{.*}} {<br>
> >> > ; CHECK: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime<br>
> >> > ; CHECK: ret i32 %[[REG]]<br>
> >> > ; CHECK: }<br>
> >> > +; LINUX-NOT: define linkonce_odr hidden i32<br>
> >> @__llvm_profile_runtime_user() {{.*}} {<br>
> >> > +; LINUX-NOT: %[[REG:.*]] = load i32, i32* @__llvm_profile_runtime<br>
> >> > Index: lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
> >> > ===================================================================<br>
> >> > --- lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
> >> > +++ lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
> >> > @@ -288,6 +288,8 @@<br>
> >> ><br>
> >> > void InstrProfiling::emitRuntimeHook() {<br>
> >> ><br>
> >> > + if (Triple(M->getTargetTriple()).isOSLinux()) return;<br>
> >> > +<br>
> >><br>
> >> This could use a comment. Also, despite the formatting on the line<br>
> >> below, the style is to put the return on a new line. clang-format will<br>
> >> do that for you.<br>
> >><br>
> >> > // If the module's provided its own runtime, we don't need to do<br>
> >> anything.<br>
> >> > if (M->getGlobalVariable(getInstrProfRuntimeHookVarName())) return;<br>
> >><br>
> >><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>