[PATCH] D34972: [CodeGen] Propagate dllexport to thunks

2017-07-21 Thread David Majnemer via Phabricator via cfe-commits
majnemer added a comment.

OK, so we are exporting the thunks so that the linker will generate import 
thunks for the thunks. I think that we should have a comment to that effect 
near the code you added.


https://reviews.llvm.org/D34972



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


[PATCH] D34972: [CodeGen] Propagate dllexport to thunks

2017-07-21 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added a comment.

Ping. I updated the description based on the email discussion with @majnemer.


https://reviews.llvm.org/D34972



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


[PATCH] D35757: Work around an MSVC2017 update 3 codegen bug.

2017-07-21 Thread Nico Weber via Phabricator via cfe-commits
thakis added a comment.

From what I understand, _MSC_VER changes with each 2017 update.


https://reviews.llvm.org/D35757



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


[PATCH] D34444: Teach codegen to work in incremental processing mode.

2017-07-21 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D3#812836, @v.g.vassilev wrote:

> In https://reviews.llvm.org/D3#812418, @rjmccall wrote:
>
> > In https://reviews.llvm.org/D3#795175, @v.g.vassilev wrote:
> >
> > > @rjmccall, thanks for the prompt and thorough reply.
> > >
> > > In https://reviews.llvm.org/D3#793311, @rjmccall wrote:
> > >
> > > > Okay.  In that case, I see two problems, one major and one potentially 
> > > > major.
> > >
> > >
> > >
> > >
> > >   This is a very accurate diagnosis which took us 5 years to discover on 
> > > an empirical basis ;)
> >
> >
> > You could've asked at any time. :)
>
>
> True. I am not really sure I knew what to ask, though ;)


We're open to general "I'm trying to do this and having problems" questions on 
the mailing lists.  You probably would've needed to know to CC me specifically, 
though; sadly, I can't keep up with all the lists I need to.

>> That's quite brittle, because that code is only executed in a code path that 
>> only you are using, and you're not adding any tests.  I would greatly prefer 
>> a change to IRGen's core assumptions, as suggested.
> 
> I am open to changing this code as well. That should probably be another 
> review.

I agree.  Are you comfortable with blocking this review until that lands?  It 
seems like it would significantly change this.

>> I feel it is important that there be a way to inform an ASTConsumer that no 
>> further requests will be made of it, something other than calling its 
>> destructor.  I would like you to make sure that the ASTConsumer interface 
>> supports that and that that call is not made too soon in your alternate 
>> processing mode.
> 
> Do you have a preference of a name of this new interface?

Maybe just "finish"?

John.


Repository:
  rL LLVM

https://reviews.llvm.org/D3



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


[PATCH] D35757: Work around an MSVC2017 update 3 codegen bug.

2017-07-21 Thread Shoaib Meenai via Phabricator via cfe-commits
smeenai added inline comments.



Comment at: lib/AST/StmtProfile.cpp:1367
 
+#if defined(_MSC_VER) && _MSC_VER == 1911
+// Work around 
https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html

Is it worth using `_MSC_FULL_VER` to limit this to Update 3 specifically?


https://reviews.llvm.org/D35757



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


[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags

2017-07-21 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added inline comments.



Comment at: clang/lib/Driver/Driver.cpp:1302
 
-llvm::outs() << llvm::join(SuggestedCompletions, " ") << '\n';
+llvm::outs() << llvm::join(SuggestedCompletions, "\n") << '\n';
 return false;

Now that the separator and the terminator are the same, there's no reason to 
use llvm::join. Since llvm::join creates a large temporary string, you want to 
avoid that if it is easily avoidable.

  for (StringRef S : SuggestedCompletions)
llvm::outs << S << "\n";

If you do this, you might be able to remove StringExtras.h from this file?



Comment at: llvm/lib/Option/OptTable.cpp:240
   if (StringRef(S).startswith(Cur))
-Ret.push_back(S);
+Ret.push_back(S + "\t" + std::string(StringRef(In.HelpText)));
 }

I believe

  Ret.push_back(S + "\t" + In.HelpText);

should just work.


https://reviews.llvm.org/D35759



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


[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags

2017-07-21 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi created this revision.
Herald added a subscriber: hiraditya.

`clang --autocomplete=-std` will show

  -std:   Language standard to compile for
  -std=   Language standard to compile for
  -stdlib=C++ standard library to use

by this change.

However, showing HelpText with completion in bash seems super tricky, so
this feature will be used in other shells(fish, zsh...).


https://reviews.llvm.org/D35759

Files:
  clang/lib/Driver/Driver.cpp
  clang/utils/bash-autocomplete.sh
  llvm/lib/Option/OptTable.cpp


Index: llvm/lib/Option/OptTable.cpp
===
--- llvm/lib/Option/OptTable.cpp
+++ llvm/lib/Option/OptTable.cpp
@@ -237,7 +237,7 @@
 for (int I = 0; In.Prefixes[I]; I++) {
   std::string S = std::string(In.Prefixes[I]) + std::string(In.Name);
   if (StringRef(S).startswith(Cur))
-Ret.push_back(S);
+Ret.push_back(S + "\t" + std::string(StringRef(In.HelpText)));
 }
   }
   return Ret;
Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -57,7 +57,7 @@
 
   # expand ~ to $HOME
   eval local path=${COMP_WORDS[0]}
-  flags=$( "$path" --autocomplete="$arg" 2>/dev/null )
+  flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*//' )
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1299,7 +1299,7 @@
 std::sort(SuggestedCompletions.begin(), SuggestedCompletions.end(),
   [](StringRef A, StringRef B) { return A.compare_lower(B) < 0; });
 
-llvm::outs() << llvm::join(SuggestedCompletions, " ") << '\n';
+llvm::outs() << llvm::join(SuggestedCompletions, "\n") << '\n';
 return false;
   }
 


Index: llvm/lib/Option/OptTable.cpp
===
--- llvm/lib/Option/OptTable.cpp
+++ llvm/lib/Option/OptTable.cpp
@@ -237,7 +237,7 @@
 for (int I = 0; In.Prefixes[I]; I++) {
   std::string S = std::string(In.Prefixes[I]) + std::string(In.Name);
   if (StringRef(S).startswith(Cur))
-Ret.push_back(S);
+Ret.push_back(S + "\t" + std::string(StringRef(In.HelpText)));
 }
   }
   return Ret;
Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -57,7 +57,7 @@
 
   # expand ~ to $HOME
   eval local path=${COMP_WORDS[0]}
-  flags=$( "$path" --autocomplete="$arg" 2>/dev/null )
+  flags=$( "$path" --autocomplete="$arg" 2>/dev/null | sed -e 's/\t.*//' )
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1299,7 +1299,7 @@
 std::sort(SuggestedCompletions.begin(), SuggestedCompletions.end(),
   [](StringRef A, StringRef B) { return A.compare_lower(B) < 0; });
 
-llvm::outs() << llvm::join(SuggestedCompletions, " ") << '\n';
+llvm::outs() << llvm::join(SuggestedCompletions, "\n") << '\n';
 return false;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35757: Work around an MSVC2017 update 3 codegen bug.

2017-07-21 Thread Nico Weber via Phabricator via cfe-commits
thakis created this revision.

MSVC2017 update 3 produces a clang that crashes when compiling clang. Disabling 
optimizations for StmtProfiler::VisitCXXOperatorCallExpr() makes the crash go 
away.

Patch from Bruce Dawson !


https://reviews.llvm.org/D35757

Files:
  lib/AST/StmtProfile.cpp


Index: lib/AST/StmtProfile.cpp
===
--- lib/AST/StmtProfile.cpp
+++ lib/AST/StmtProfile.cpp
@@ -1364,6 +1364,13 @@
   llvm_unreachable("Invalid overloaded operator expression");
 }
 
+#if defined(_MSC_VER) && _MSC_VER == 1911
+// Work around 
https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
+// MSVC 2017 update 3 miscompiles this function, and a clang built with it
+// will crash in stage 2 of a bootstrap build.
+#pragma optimize("", off)
+#endif
+
 void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
   if (S->isTypeDependent()) {
 // Type-dependent operator calls are profiled like their underlying
@@ -1396,6 +1403,10 @@
   ID.AddInteger(S->getOperator());
 }
 
+#if defined(_MSC_VER) && _MSC_VER == 1911
+#pragma optimize("", on)
+#endif
+
 void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
   VisitCallExpr(S);
 }


Index: lib/AST/StmtProfile.cpp
===
--- lib/AST/StmtProfile.cpp
+++ lib/AST/StmtProfile.cpp
@@ -1364,6 +1364,13 @@
   llvm_unreachable("Invalid overloaded operator expression");
 }
 
+#if defined(_MSC_VER) && _MSC_VER == 1911
+// Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html
+// MSVC 2017 update 3 miscompiles this function, and a clang built with it
+// will crash in stage 2 of a bootstrap build.
+#pragma optimize("", off)
+#endif
+
 void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
   if (S->isTypeDependent()) {
 // Type-dependent operator calls are profiled like their underlying
@@ -1396,6 +1403,10 @@
   ID.AddInteger(S->getOperator());
 }
 
+#if defined(_MSC_VER) && _MSC_VER == 1911
+#pragma optimize("", on)
+#endif
+
 void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) {
   VisitCallExpr(S);
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35755: [Solaris] gcc toolchain handling revamp

2017-07-21 Thread Fedor Sergeev via Phabricator via cfe-commits
fedor.sergeev created this revision.

General idea is to utilize generic (mostly Generic_GCC) code
and get rid of Solaris-specific handling as much as possible.

In particular:

- scanLibDirForGCCTripleSolaris was removed, relying on generic 
CollectLibDirsAndTriples

- findBiarchMultilibs is now properly utilized to switch between m32 and m64 
include & lib paths on Solaris

- C system include handling copied from Linux (bar multilib hacks)

Fixes PR24606.


https://reviews.llvm.org/D35755

Files:
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/ToolChains/Gnu.h
  lib/Driver/ToolChains/Solaris.cpp
  lib/Driver/ToolChains/Solaris.h
  lib/Frontend/InitHeaderSearch.cpp
  
test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/include/c++/4.8.2/sparc-sun-solaris2.11/bits/gthr.h
  test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/include/c++/4.8.2/typeinfo
  
test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crt1.o
  
test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtbegin.o
  
test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtend.o
  
test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/sparcv9/crt1.o
  
test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/sparcv9/crtbegin.o
  
test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/sparcv9/crtend.o
  test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/lib/libatomic.a
  test/Driver/Inputs/solaris_sparc_tree/usr/gcc/4.8/lib/sparcv9/libatomic.a
  test/Driver/Inputs/solaris_sparc_tree/usr/lib/crti.o
  test/Driver/Inputs/solaris_sparc_tree/usr/lib/crtn.o
  test/Driver/Inputs/solaris_sparc_tree/usr/lib/ld.so.1
  test/Driver/Inputs/solaris_sparc_tree/usr/lib/sparcv9/crti.o
  test/Driver/Inputs/solaris_sparc_tree/usr/lib/sparcv9/crtn.o
  test/Driver/Inputs/solaris_sparc_tree/usr/lib/sparcv9/ld.so.1
  
test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/include/c++/4.9.4/i386-pc-solaris2.11/bits/gthr.h
  test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/include/c++/4.9.4/typeinfo
  test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/amd64/libatomic.a
  
test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/amd64/crtbegin.o
  
test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/amd64/crtend.o
  
test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/crtbegin.o
  
test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/crtend.o
  test/Driver/Inputs/solaris_x86_tree/usr/gcc/4.9/lib/libatomic.a
  test/Driver/Inputs/solaris_x86_tree/usr/lib/amd64/crt1.o
  test/Driver/Inputs/solaris_x86_tree/usr/lib/amd64/crti.o
  test/Driver/Inputs/solaris_x86_tree/usr/lib/amd64/crtn.o
  test/Driver/Inputs/solaris_x86_tree/usr/lib/amd64/ld.so.1
  test/Driver/Inputs/solaris_x86_tree/usr/lib/crt1.o
  test/Driver/Inputs/solaris_x86_tree/usr/lib/crti.o
  test/Driver/Inputs/solaris_x86_tree/usr/lib/crtn.o
  test/Driver/Inputs/solaris_x86_tree/usr/lib/ld.so.1
  
test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crt1.o
  
test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtbegin.o
  
test/Driver/Inputs/sparc-sun-solaris2.11/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/crtend.o
  test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/crti.o
  test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/crtn.o
  test/Driver/Inputs/sparc-sun-solaris2.11/usr/lib/ld.so.1
  test/Driver/solaris-header-search.cpp
  test/Driver/solaris-ld.c

Index: test/Driver/solaris-ld.c
===
--- test/Driver/solaris-ld.c
+++ test/Driver/solaris-ld.c
@@ -1,33 +1,105 @@
-// Test ld invocation on Solaris targets.
+// General tests that ld invocations on Solaris targets sane. Note that we use
+// sysroot to make these tests independent of the host system.
 
-// Check sparc-sun-solaris2.1
+// Check sparc-sun-solaris2.11, 32bit
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=sparc-sun-solaris2.11 \
-// RUN: --gcc-toolchain="" \
-// RUN: --sysroot=%S/Inputs/sparc-sun-solaris2.11 \
-// RUN:   | FileCheck %s
-// CHECK: "-cc1" "-triple" "sparc-sun-solaris2.11"
-// CHECK: ld{{.*}}"
-// CHECK: "--dynamic-linker" "{{.*}}/usr/lib/ld.so.1"
-// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|}}crt1.o"
-// CHECK: "{{.*}}/usr/lib/crti.o"
-// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|}}crtbegin.o"
-// CHECK: "{{.*}}/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|}}crtend.o"
-// CHECK: "{{.*}}/usr/lib/crtn.o"
-// CHECK "-lc"
-// CHECK "-lgcc_s"
-// CHECK "-lgcc"
-// CHECK "-lm"
+// RUN: --sysroot=%S/Inputs/solaris_sparc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD-SPARC32 %s
+// CHECK-LD-SPARC32-NOT: 

[PATCH] D35577: Add -flookup-tables and -fno-lookup-tables flags

2017-07-21 Thread Eric Christopher via Phabricator via cfe-commits
echristo added a comment.

In https://reviews.llvm.org/D35577#817267, @sgundapa wrote:

> The discussion is scattered across these patches 
> https://reviews.llvm.org/D35578 and https://reviews.llvm.org/D35579.
>  I will provide a brief summary here:
>
> The idea is to control the generation of data (lookup table) generated from a 
> function, specifically when the user is not expecting it.
>  For hexagon, there is tightly coupled memory and the customers usually place 
> "text" in it. 
>  For functions, which generate lookup tables, it is very very expensive to 
> read the table from a far away non-TCM data section.
>  This option will disable the generation of lookup tables at the expense of 
> code bloat. This is really driven by the customers of hexagon backend.


I don't think we're communicating effectively. Let me try another way:

"Is there any reason why a user of the hexagon backend will ever not want to 
set these options to a particular value"

in other words:

"Should this just be part of the tuning for the hexagon backend and not options 
at all"

Thanks.


https://reviews.llvm.org/D35577



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


[PATCH] D35747: [Driver] Fuchsia defaults to -fno-math-errno

2017-07-21 Thread Petr Hosek via Phabricator via cfe-commits
phosek accepted this revision.
phosek added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D35747



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


Buildbot numbers for the last of 07/09/2017 - 07/15/2017

2017-07-21 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last of 07/09/2017 - 07/15/2017.

Please see the same data in attached csv files:

The longest time each builder was red during the last week;
"Status change ratio" by active builder (percent of builds that changed the
builder status from greed to red or from red to green);
Count of commits by project;
Number of completed builds, failed builds and average build time for
successful builds per active builder;
Average waiting time for a revision to get build result per active builder
(response time).

Thanks

Galina


The longest time each builder was red during the last week:

buildername| was_red
---+-
 clang-x86_64-linux-selfhost-modules   | 91:34:55
 sanitizer-x86_64-linux-autoconf   | 64:26:20
 sanitizer-x86_64-linux| 64:11:43
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan | 55:25:21
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast  | 45:24:09
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only | 41:50:32
 perf-x86_64-penryn-O3-polly-before-vectorizer | 35:07:42
 perf-x86_64-penryn-O3 | 28:05:17
 perf-x86_64-penryn-O3-polly   | 27:55:07
 lld-x86_64-darwin13   | 24:20:33
 llvm-clang-x86_64-expensive-checks-win| 23:33:42
 clang-ppc64le-linux-multistage| 19:11:38
 perf-x86_64-penryn-O3-polly-parallel-fast | 17:12:24
 clang-cmake-aarch64-lld   | 15:04:01
 clang-cmake-thumbv7-a15-full-sh   | 14:35:02
 perf-x86_64-penryn-O3-polly-unprofitable  | 14:06:54
 clang-lld-x86_64-2stage   | 12:29:54
 clang-cmake-armv7-a15-selfhost-neon   | 12:26:45
 clang-cmake-armv7-a15-selfhost| 12:06:52
 ubuntu-gcc7.1-werror  | 11:57:11
 clang-s390x-linux-multistage  | 11:11:04
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z-32bit  | 11:06:19
 sanitizer-ppc64be-linux   | 10:43:52
 sanitizer-x86_64-linux-bootstrap  | 08:57:31
 clang-ppc64be-linux-multistage| 08:17:01
 clang-with-thin-lto-windows   | 08:04:10
 perf-x86_64-penryn-O3-polly-fast  | 07:52:29
 clang-bpf-build   | 07:33:29
 clang-with-lto-ubuntu | 07:06:34
 clang-x86_64-linux-selfhost-modules-2 | 06:47:58
 clang-x86-windows-msvc2015| 06:30:08
 sanitizer-x86_64-linux-fast   | 06:25:21
 clang-x64-ninja-win7  | 06:17:17
 clang-cmake-aarch64-quick | 05:48:31
 sanitizer-x86_64-linux-android| 05:36:25
 libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan| 05:28:49
 clang-with-thin-lto-ubuntu| 05:20:36
 clang-native-arm-lnt  | 05:17:31
 clang-s390x-linux-lnt | 05:09:57
 clang-ppc64be-linux-lnt   | 04:35:43
 libcxx-libcxxabi-libunwind-aarch64-linux  | 04:28:16
 clang-x86_64-debian-fast  | 04:12:46
 clang-cmake-thumbv7-a15   | 03:39:48
 clang-cmake-armv7-a15 | 03:37:39
 polly-amd64-linux | 03:24:25
 clang-cmake-armv7-a15-full| 03:21:02
 clang-atom-d525-fedora-rel| 03:17:45
 clang-ppc64le-linux   | 03:04:26
 clang-s390x-linux | 02:56:13
 clang-cmake-aarch64-42vma | 02:55:17
 clang-ppc64be-linux   | 02:53:15
 sanitizer-windows | 02:41:24
 sanitizer-ppc64le-linux   | 02:31:52
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast| 02:26:00
 lldb-windows7-android | 02:21:25
 clang-hexagon-elf | 02:08:45
 llvm-hexagon-elf  | 02:03:53
 clang-cmake-aarch64-global-isel   | 02:02:45
 lld-x86_64-win7   | 01:50:07
 lld-x86_64-freebsd| 01:49:58
 

[clang-tools-extra] r308807 - clangDaemon: Update libdeps in r308738.

2017-07-21 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Fri Jul 21 16:48:26 2017
New Revision: 308807

URL: http://llvm.org/viewvc/llvm-project?rev=308807=rev
Log:
clangDaemon: Update libdeps in r308738.

Modified:
clang-tools-extra/trunk/clangd/CMakeLists.txt

Modified: clang-tools-extra/trunk/clangd/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CMakeLists.txt?rev=308807=308806=308807=diff
==
--- clang-tools-extra/trunk/clangd/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clangd/CMakeLists.txt Fri Jul 21 16:48:26 2017
@@ -21,6 +21,7 @@ add_clang_library(clangDaemon
   clangIndex
   clangLex
   clangSema
+  clangSerialization
   clangTooling
   clangToolingCore
   ${LLVM_PTHREAD_LIB}


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


[PATCH] D35747: [Driver] Fuchsia defaults to -fno-math-errno

2017-07-21 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr updated this revision to Diff 107752.
mcgrathr added a comment.

test case


https://reviews.llvm.org/D35747

Files:
  lib/Driver/ToolChains/Fuchsia.h
  test/Driver/fast-math.c


Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -93,6 +93,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 //
 // Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
 // preserves the target default. Also check various flag set operations between
Index: lib/Driver/ToolChains/Fuchsia.h
===
--- lib/Driver/ToolChains/Fuchsia.h
+++ lib/Driver/ToolChains/Fuchsia.h
@@ -42,6 +42,7 @@
 
   bool HasNativeLLVMSupport() const override { return true; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool IsMathErrnoDefault() const override { return false; }
   RuntimeLibType GetDefaultRuntimeLibType() const override {
 return ToolChain::RLT_CompilerRT;
   }


Index: test/Driver/fast-math.c
===
--- test/Driver/fast-math.c
+++ test/Driver/fast-math.c
@@ -93,6 +93,8 @@
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 // RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
 //
 // Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely
 // preserves the target default. Also check various flag set operations between
Index: lib/Driver/ToolChains/Fuchsia.h
===
--- lib/Driver/ToolChains/Fuchsia.h
+++ lib/Driver/ToolChains/Fuchsia.h
@@ -42,6 +42,7 @@
 
   bool HasNativeLLVMSupport() const override { return true; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool IsMathErrnoDefault() const override { return false; }
   RuntimeLibType GetDefaultRuntimeLibType() const override {
 return ToolChain::RLT_CompilerRT;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35747: [Driver] Fuchsia defaults to -fno-math-errno

2017-07-21 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr added a comment.

Please land it for me when approved.


https://reviews.llvm.org/D35747



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


[PATCH] D35747: [Driver] Fuchsia defaults to -fno-math-errno

2017-07-21 Thread Roland McGrath via Phabricator via cfe-commits
mcgrathr created this revision.

Repository:
  rL LLVM

https://reviews.llvm.org/D35747

Files:
  lib/Driver/ToolChains/Fuchsia.h


Index: lib/Driver/ToolChains/Fuchsia.h
===
--- lib/Driver/ToolChains/Fuchsia.h
+++ lib/Driver/ToolChains/Fuchsia.h
@@ -42,6 +42,7 @@
 
   bool HasNativeLLVMSupport() const override { return true; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool IsMathErrnoDefault() const override { return false; }
   RuntimeLibType GetDefaultRuntimeLibType() const override {
 return ToolChain::RLT_CompilerRT;
   }


Index: lib/Driver/ToolChains/Fuchsia.h
===
--- lib/Driver/ToolChains/Fuchsia.h
+++ lib/Driver/ToolChains/Fuchsia.h
@@ -42,6 +42,7 @@
 
   bool HasNativeLLVMSupport() const override { return true; }
   bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool IsMathErrnoDefault() const override { return false; }
   RuntimeLibType GetDefaultRuntimeLibType() const override {
 return ToolChain::RLT_CompilerRT;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r308800 - [index] Set SymbolSubKind::Accessor[GS]etter on class methods

2017-07-21 Thread Ben Langmuir via cfe-commits
Author: benlangmuir
Date: Fri Jul 21 16:04:27 2017
New Revision: 308800

URL: http://llvm.org/viewvc/llvm-project?rev=308800=rev
Log:
[index] Set SymbolSubKind::Accessor[GS]etter on class methods

We have the same relation between class properties and getter/setters
that we have for instance properties, so set the same symbol sub-kind.

rdar://problem/32376404

Modified:
cfe/trunk/lib/Index/IndexSymbol.cpp
cfe/trunk/test/Index/Core/index-source.m

Modified: cfe/trunk/lib/Index/IndexSymbol.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexSymbol.cpp?rev=308800=308799=308800=diff
==
--- cfe/trunk/lib/Index/IndexSymbol.cpp (original)
+++ cfe/trunk/lib/Index/IndexSymbol.cpp Fri Jul 21 16:04:27 2017
@@ -201,25 +201,22 @@ SymbolInfo index::getSymbolInfo(const De
 Info.Properties |= (unsigned)SymbolProperty::UnitTest;
   break;
 }
-case Decl::ObjCMethod:
-  if (cast(D)->isInstanceMethod()) {
-const ObjCMethodDecl *MD = cast(D);
-Info.Kind = SymbolKind::InstanceMethod;
-if (MD->isPropertyAccessor()) {
-  if (MD->param_size())
-Info.SubKind = SymbolSubKind::AccessorSetter;
-  else
-Info.SubKind = SymbolSubKind::AccessorGetter;
-}
-  } else {
-Info.Kind = SymbolKind::ClassMethod;
+case Decl::ObjCMethod: {
+  const ObjCMethodDecl *MD = cast(D);
+  Info.Kind = MD->isInstanceMethod() ? SymbolKind::InstanceMethod : 
SymbolKind::ClassMethod;
+  if (MD->isPropertyAccessor()) {
+if (MD->param_size())
+  Info.SubKind = SymbolSubKind::AccessorSetter;
+else
+  Info.SubKind = SymbolSubKind::AccessorGetter;
   }
   Info.Lang = SymbolLanguage::ObjC;
-  if (isUnitTest(cast(D)))
+  if (isUnitTest(MD))
 Info.Properties |= (unsigned)SymbolProperty::UnitTest;
   if (D->hasAttr())
 Info.Properties |= (unsigned)SymbolProperty::IBAnnotated;
   break;
+}
 case Decl::ObjCProperty:
   Info.Kind = SymbolKind::InstanceProperty;
   Info.Lang = SymbolLanguage::ObjC;

Modified: cfe/trunk/test/Index/Core/index-source.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.m?rev=308800=308799=308800=diff
==
--- cfe/trunk/test/Index/Core/index-source.m (original)
+++ cfe/trunk/test/Index/Core/index-source.m Fri Jul 21 16:04:27 2017
@@ -389,6 +389,15 @@ struct Separate separateE;
 @interface ClassReceivers
 
 @property(class) int p1;
+// CHECK: [[@LINE-1]]:22 | class-method/acc-get/ObjC | p1 | 
c:objc(cs)ClassReceivers(cm)p1 | +[ClassReceivers p1] | 
Decl,Dyn,Impl,RelChild,RelAcc | rel: 2
+// CHECK-NEXT: RelChild | ClassReceivers | c:objc(cs)ClassReceivers
+// CHECK-NEXT: RelAcc | p1 | c:objc(cs)ClassReceivers(cpy)p1
+// CHECK: [[@LINE-4]]:22 | class-method/acc-set/ObjC | setP1: | 
c:objc(cs)ClassReceivers(cm)setP1: | +[ClassReceivers setP1:] | 
Decl,Dyn,Impl,RelChild,RelAcc | rel: 2
+// CHECK-NEXT: RelChild | ClassReceivers | c:objc(cs)ClassReceivers
+// CHECK-NEXT: RelAcc | p1 | c:objc(cs)ClassReceivers(cpy)p1
+// CHECK: [[@LINE-7]]:22 | instance-property/ObjC | p1 | 
c:objc(cs)ClassReceivers(cpy)p1 |  | Decl,RelChild | rel: 1
+// CHECK-NEXT: RelChild | ClassReceivers | c:objc(cs)ClassReceivers
+
 + (int)implicit;
 + (void)setImplicit:(int)x;
 
@@ -399,13 +408,13 @@ void classReceivers() {
 // CHECK: [[@LINE-1]]:3 | class/ObjC | ClassReceivers | 
c:objc(cs)ClassReceivers | _OBJC_CLASS_$_ClassReceivers | Ref,RelCont | rel: 1
 // CHECK: [[@LINE-2]]:18 | instance-property/ObjC | p1 | 
c:objc(cs)ClassReceivers(cpy)p1 |  | Ref,Writ,RelCont | rel: 1
 // CHECK-NEXT: RelCont | classReceivers | c:@F@classReceivers
-// CHECK: [[@LINE-4]]:18 | class-method/ObjC | setP1: | 
c:objc(cs)ClassReceivers(cm)setP1: | +[ClassReceivers setP1:] | 
Ref,Call,Impl,RelCall,RelCont | rel: 1
+// CHECK: [[@LINE-4]]:18 | class-method/acc-set/ObjC | setP1: | 
c:objc(cs)ClassReceivers(cm)setP1: | +[ClassReceivers setP1:] | 
Ref,Call,Impl,RelCall,RelCont | rel: 1
 // CHECK-NEXT: RelCall,RelCont | classReceivers | c:@F@classReceivers
   (void)ClassReceivers.p1;
 // CHECK: [[@LINE-1]]:9 | class/ObjC | ClassReceivers | 
c:objc(cs)ClassReceivers | _OBJC_CLASS_$_ClassReceivers | Ref,RelCont | rel: 1
 // CHECK: [[@LINE-2]]:24 | instance-property/ObjC | p1 | 
c:objc(cs)ClassReceivers(cpy)p1 |  | Ref,RelCont | rel: 1
 // CHECK-NEXT: RelCont | classReceivers | c:@F@classReceivers
-// CHECK: [[@LINE-4]]:24 | class-method/ObjC | p1 | 
c:objc(cs)ClassReceivers(cm)p1 | +[ClassReceivers p1] | 
Ref,Call,Impl,RelCall,RelCont | rel: 1
+// CHECK: [[@LINE-4]]:24 | class-method/acc-get/ObjC | p1 | 
c:objc(cs)ClassReceivers(cm)p1 | +[ClassReceivers p1] | 
Ref,Call,Impl,RelCall,RelCont | rel: 1
 // CHECK-NEXT: RelCall,RelCont | classReceivers | c:@F@classReceivers
 
   

[PATCH] D35746: Make new PM honor -fdebug-info-for-profiling (clang side)

2017-07-21 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh created this revision.
Herald added a subscriber: sanjoy.

The new PM needs to invoke add-discriminator pass when building with 
-fdebug-info-for-profiling.


https://reviews.llvm.org/D35746

Files:
  lib/CodeGen/BackendUtil.cpp


Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -861,7 +861,9 @@
 (PGOOpt.RunProfileGen ||
   !PGOOpt.ProfileUseFile.empty() ||
   !PGOOpt.SampleProfileFile.empty()) ?
-Optional(PGOOpt) : None);
+Optional(PGOOpt) : None,
+(CodeGenOpts.DebugInfoForProfiling ||
+ !CodeGenOpts.SampleProfileFile.empty()));
 
   LoopAnalysisManager LAM;
   FunctionAnalysisManager FAM;


Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -861,7 +861,9 @@
 (PGOOpt.RunProfileGen ||
   !PGOOpt.ProfileUseFile.empty() ||
   !PGOOpt.SampleProfileFile.empty()) ?
-Optional(PGOOpt) : None);
+Optional(PGOOpt) : None,
+(CodeGenOpts.DebugInfoForProfiling ||
+ !CodeGenOpts.SampleProfileFile.empty()));
 
   LoopAnalysisManager LAM;
   FunctionAnalysisManager FAM;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35735: [ubsan] Null-check pointers in -fsanitize=vptr (PR33881)

2017-07-21 Thread Vedant Kumar via Phabricator via cfe-commits
vsk updated this revision to Diff 107741.
vsk marked an inline comment as done.
vsk added a comment.

- Drop 'REQUIRES: asserts'.


https://reviews.llvm.org/D35735

Files:
  docs/UndefinedBehaviorSanitizer.rst
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Basic/DiagnosticGroups.td
  lib/CodeGen/CGExpr.cpp
  lib/Driver/SanitizerArgs.cpp
  test/CodeGenCXX/catch-undef-behavior.cpp
  test/CodeGenCXX/ubsan-devirtualized-calls.cpp
  test/CodeGenCXX/ubsan-type-checks.cpp
  test/CodeGenCXX/ubsan-vtable-checks.cpp
  test/Driver/fsanitize.c
  test/Driver/rtti-options.cpp

Index: test/Driver/rtti-options.cpp
===
--- test/Driver/rtti-options.cpp
+++ test/Driver/rtti-options.cpp
@@ -16,14 +16,14 @@
 // Make sure we only error/warn once, when trying to enable vptr and
 // undefined and have -fno-rtti
 // RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s
+// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=null,vptr %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
+// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=null,vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
+// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=null,vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s
 // RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
 // RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-WARN %s
-// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s
+// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=null,vptr %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-WARN %s
+// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=null,vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
+// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=null,vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s
 // RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
 
 // Exceptions + no/default rtti
Index: test/Driver/fsanitize.c
===
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -58,6 +58,10 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-NO-RTTI
 // CHECK-UNDEFINED-NO-RTTI-NOT: vptr
 
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-sanitize=null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-NULL
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-NULL
+// CHECK-VPTR-NO-NULL: warning: implicitly disabling vptr sanitizer because null checking wasn't enabled
+
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,thread -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANT
 // CHECK-SANA-SANT: '-fsanitize=address' not allowed with '-fsanitize=thread'
 
@@ -362,8 +366,8 @@
 // RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.8 -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-OLD
 // CHECK-VPTR-DARWIN-OLD: unsupported option '-fsanitize=vptr' for target 'x86_64-apple-darwin10'
 
-// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.9 -fsanitize=alignment,vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-NEW
-// CHECK-VPTR-DARWIN-NEW: -fsanitize=alignment,vptr
+// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.9 -fsanitize=alignment,null,vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-NEW
+// CHECK-VPTR-DARWIN-NEW: -fsanitize=alignment,null,vptr
 
 // RUN: %clang -target armv7-apple-ios7 -miphoneos-version-min=7.0 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-IOS
 // CHECK-ASAN-IOS: -fsanitize=address
Index: test/CodeGenCXX/ubsan-vtable-checks.cpp
===
--- test/CodeGenCXX/ubsan-vtable-checks.cpp
+++ test/CodeGenCXX/ubsan-vtable-checks.cpp
@@ 

[PATCH] D35709: Remove Bitrig: CompilerRT Changes

2017-07-21 Thread Erich Keane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308798: Remove Bitrig: CompilerRT Changes (authored by 
erichkeane).

Changed prior to commit:
  https://reviews.llvm.org/D35709?vs=107606=107742#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35709

Files:
  compiler-rt/trunk/lib/builtins/clear_cache.c
  compiler-rt/trunk/lib/builtins/int_endianness.h
  compiler-rt/trunk/test/builtins/Unit/endianness.h


Index: compiler-rt/trunk/lib/builtins/int_endianness.h
===
--- compiler-rt/trunk/lib/builtins/int_endianness.h
+++ compiler-rt/trunk/lib/builtins/int_endianness.h
@@ -61,7 +61,7 @@
 
 #endif /* *BSD */
 
-#if defined(__OpenBSD__) || defined(__Bitrig__)
+#if defined(__OpenBSD__)
 #include 
 
 #if _BYTE_ORDER == _BIG_ENDIAN
@@ -72,7 +72,7 @@
 #define _YUGA_BIG_ENDIAN0
 #endif /* _BYTE_ORDER */
 
-#endif /* OpenBSD and Bitrig. */
+#endif /* OpenBSD */
 
 /* .. */
 
Index: compiler-rt/trunk/lib/builtins/clear_cache.c
===
--- compiler-rt/trunk/lib/builtins/clear_cache.c
+++ compiler-rt/trunk/lib/builtins/clear_cache.c
@@ -23,7 +23,7 @@
 uintptr_t GetCurrentProcess(void);
 #endif
 
-#if (defined(__FreeBSD__) || defined(__Bitrig__)) && defined(__arm__)
+#if defined(__FreeBSD__) && defined(__arm__)
   #include 
   #include 
 #endif
@@ -96,7 +96,7 @@
  * so there is nothing to do
  */
 #elif defined(__arm__) && !defined(__APPLE__)
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__Bitrig__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 struct arm_sync_icache_args arg;
 
 arg.addr = (uintptr_t)start;
Index: compiler-rt/trunk/test/builtins/Unit/endianness.h
===
--- compiler-rt/trunk/test/builtins/Unit/endianness.h
+++ compiler-rt/trunk/test/builtins/Unit/endianness.h
@@ -51,7 +51,7 @@
 
 /* .. */
 
-#if defined(__OpenBSD__) || defined(__Bitrig__)
+#if defined(__OpenBSD__)
 #include 
 
 #if _BYTE_ORDER == _BIG_ENDIAN
@@ -62,7 +62,7 @@
 #define _YUGA_BIG_ENDIAN0
 #endif /* _BYTE_ORDER */
 
-#endif /* OpenBSD and Bitrig. */
+#endif /* OpenBSD */
 
 /* .. */
 


Index: compiler-rt/trunk/lib/builtins/int_endianness.h
===
--- compiler-rt/trunk/lib/builtins/int_endianness.h
+++ compiler-rt/trunk/lib/builtins/int_endianness.h
@@ -61,7 +61,7 @@
 
 #endif /* *BSD */
 
-#if defined(__OpenBSD__) || defined(__Bitrig__)
+#if defined(__OpenBSD__)
 #include 
 
 #if _BYTE_ORDER == _BIG_ENDIAN
@@ -72,7 +72,7 @@
 #define _YUGA_BIG_ENDIAN0
 #endif /* _BYTE_ORDER */
 
-#endif /* OpenBSD and Bitrig. */
+#endif /* OpenBSD */
 
 /* .. */
 
Index: compiler-rt/trunk/lib/builtins/clear_cache.c
===
--- compiler-rt/trunk/lib/builtins/clear_cache.c
+++ compiler-rt/trunk/lib/builtins/clear_cache.c
@@ -23,7 +23,7 @@
 uintptr_t GetCurrentProcess(void);
 #endif
 
-#if (defined(__FreeBSD__) || defined(__Bitrig__)) && defined(__arm__)
+#if defined(__FreeBSD__) && defined(__arm__)
   #include 
   #include 
 #endif
@@ -96,7 +96,7 @@
  * so there is nothing to do
  */
 #elif defined(__arm__) && !defined(__APPLE__)
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__Bitrig__)
+#if defined(__FreeBSD__) || defined(__NetBSD__)
 struct arm_sync_icache_args arg;
 
 arg.addr = (uintptr_t)start;
Index: compiler-rt/trunk/test/builtins/Unit/endianness.h
===
--- compiler-rt/trunk/test/builtins/Unit/endianness.h
+++ compiler-rt/trunk/test/builtins/Unit/endianness.h
@@ -51,7 +51,7 @@
 
 /* .. */
 
-#if defined(__OpenBSD__) || defined(__Bitrig__)
+#if defined(__OpenBSD__)
 #include 
 
 #if _BYTE_ORDER == _BIG_ENDIAN
@@ -62,7 +62,7 @@
 #define _YUGA_BIG_ENDIAN0
 #endif /* _BYTE_ORDER */
 
-#endif /* OpenBSD and Bitrig. */
+#endif /* OpenBSD */
 
 /* .. */
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35743: [clang-format] Handle Structured binding declaration in C++17

2017-07-21 Thread Yan Wang via Phabricator via cfe-commits
yawanng created this revision.
yawanng added a project: clang-tools-extra.
Herald added a subscriber: klimek.

Add handling for Structured binding declaration in C++17 in clang-format. For 
example:
auto [x,y] = a; 
auto &[xr, yr] = a; 
auto &&[xrr, yrr] = a;


https://reviews.llvm.org/D35743

Files:
  lib/Format/TokenAnnotator.cpp
  lib/Format/UnwrappedLineParser.cpp
  test/Format/structured-binding-declaration.cpp

Index: test/Format/structured-binding-declaration.cpp
===
--- /dev/null
+++ test/Format/structured-binding-declaration.cpp
@@ -0,0 +1,54 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -style=LLVM \
+// RUN:   | FileCheck -strict-whitespace %s
+
+// CHECK: {{^auto\ \[x,\ y\]\ =\ a;}}
+auto[x, y] = a;
+// CHECK: {{^auto\ \&\[x,\ y\]\ =\ a;}}
+auto   &   [x, y] = a;
+// CHECK: {{^auto\ \&\&\[x,\ y\]\ =\ a;}}
+auto &&   [x, y] = a;
+
+// CHECK: {{^auto\ \[x\]\ =\ a;}}
+auto[x] = a;
+// CHECK: {{^auto\ \&\[x\]\ =\ a;}}
+auto   &   [x] = a;
+// CHECK: {{^auto\ \&\&\[x\]\ =\ a;}}
+auto &&   [x] = a;
+
+// CHECK: {{^const\ auto\ \[x,\ y\]\ =\ f\(\);}}
+const auto[x, y] = f();
+// CHECK: {{^const\ auto\ \&\[x,\ y\]\ =\ f\(\);}}
+const auto &   [x, y] = f();
+// CHECK: {{^const\ auto\ \&\&\[x,\ y\]\ =\ f\(\);}}
+const auto &&[x, y] = f();
+
+// CHECK: {{^auto\ \[x,\ y\]\ =\ A\{\};}}
+auto[x,y] = A{};
+// CHECK: {{^auto\ \&\[x,\ y\]\ =\ A\{\};}}
+auto   &   [x,y] = A{};
+// CHECK: {{^auto\ \&\&\[x,\ y\]\ =\ A\{\};}}
+auto   &&   [x,y] = A{};
+
+// CHECK: {{^for\ \(const\ auto\ \&\&\[a,\ b\]\ :\ some_range\)\ \{}}
+for (const auto   &&   [a, b] : some_range) {
+}
+// CHECK: {{^for\ \(const\ auto\ \&\[a,\ b\]\ :\ some_range\)\ \{}}
+for (const auto   &[a, b] : some_range) {
+}
+// CHECK: {{^for\ \(const\ auto\ \[a,\ b\]\ :\ some_range\)\ \{}}
+for (const auto[a, b] : some_range) {
+}
+
+// CHECK: {{^auto\ \[x,\ y\]\(expr\);}}
+auto[x,y]  (expr);
+// CHECK: {{^auto\ \&\[x,\ y\]\(expr\);}}
+auto   &   [x,y](expr);
+// CHECK: {{^auto\ \&\&\[x,\ y\]\(expr\);}}
+auto   &&   [x,y](expr);
+
+// CHECK: {{^auto\ \[x,\ y\]\{expr\};}}
+auto[x,y] {expr};
+// CHECK: {{^auto\ \&\[x,\ y\]\{expr\};}}
+auto   &   [x,y]  {expr};
+// CHECK: {{^auto\ \&\&\[x,\ y\]\{expr\};}}
+auto   &&   [x,y] {expr};
Index: lib/Format/UnwrappedLineParser.cpp
===
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -1213,7 +1213,7 @@
   const FormatToken* Previous = getPreviousToken();
   if (Previous &&
   (Previous->isOneOf(tok::identifier, tok::kw_operator, tok::kw_new,
- tok::kw_delete) ||
+ tok::kw_delete, tok::kw_auto, tok::ampamp, tok::amp) ||
Previous->closesScope() || Previous->isSimpleTypeSpecifier())) {
 nextToken();
 return false;
Index: lib/Format/TokenAnnotator.cpp
===
--- lib/Format/TokenAnnotator.cpp
+++ lib/Format/TokenAnnotator.cpp
@@ -330,8 +330,12 @@
 (Contexts.back().CanBeExpression || Contexts.back().IsExpression ||
  Contexts.back().InTemplateArgument);
 
+bool CppStructuredBindingDecl =
+!CppArrayTemplates && Style.isCpp() && Parent &&
+Parent->isOneOf(tok::kw_auto, tok::amp, tok::ampamp);
+
 bool StartsObjCMethodExpr =
-!CppArrayTemplates && Style.isCpp() &&
+!CppStructuredBindingDecl && !CppArrayTemplates && Style.isCpp() &&
 Contexts.back().CanBeExpression && Left->isNot(TT_LambdaLSquare) &&
 CurrentToken->isNot(tok::l_brace) &&
 (!Parent ||
@@ -344,7 +348,10 @@
 
 unsigned BindingIncrease = 1;
 if (Left->is(TT_Unknown)) {
-  if (StartsObjCMethodExpr) {
+  if (CppStructuredBindingDecl) {
+Left->Type = Parent->is(tok::kw_auto) ? TT_DesignatedInitializerLSquare
+  : TT_ArraySubscriptLSquare;
+  } else if (StartsObjCMethodExpr) {
 Left->Type = TT_ObjCMethodExpr;
   } else if (Style.Language == FormatStyle::LK_JavaScript && Parent &&
  Contexts.back().ContextKind == tok::l_brace &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35739: Fix LLVMgold plugin name/path for non-Linux.

2017-07-21 Thread Dan Albert via Phabricator via cfe-commits
danalbert added a comment.

In https://reviews.llvm.org/D35739#817705, @srhines wrote:

> It's hard to believe that there is nothing in Support that gives you the 
> proper suffix for shared libraries. It would seem like this might be useful 
> elsewhere, but I actually didn't find really any other place that wants to 
> use this value generically.


I didn't see anything, but these terms show up often enough that it was 
difficult to grep.


Repository:
  rL LLVM

https://reviews.llvm.org/D35739



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


[PATCH] D35708: Remove Bitrig: Clang Changes

2017-07-21 Thread Erich Keane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308797: Remove Bitrig: Clang Changes (authored by 
erichkeane).

Changed prior to commit:
  https://reviews.llvm.org/D35708?vs=107605=107740#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35708

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/lib/Basic/Targets/ARM.h
  cfe/trunk/lib/Basic/Targets/OSTargets.h
  cfe/trunk/lib/Basic/Targets/X86.h
  cfe/trunk/lib/CodeGen/TargetInfo.cpp
  cfe/trunk/lib/Driver/CMakeLists.txt
  cfe/trunk/lib/Driver/Driver.cpp
  cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp
  cfe/trunk/lib/Driver/ToolChains/Bitrig.cpp
  cfe/trunk/lib/Driver/ToolChains/Bitrig.h
  cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
  cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
  cfe/trunk/test/CodeGen/linux-arm-atomic.c
  cfe/trunk/test/Driver/bitrig.c
  cfe/trunk/test/Frontend/gnu-mcount.c
  cfe/trunk/test/Preprocessor/init.c
  cfe/trunk/test/Sema/tls.c

Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -1903,7 +1903,6 @@
   case llvm::Triple::DragonFly:
   case llvm::Triple::FreeBSD:
   case llvm::Triple::OpenBSD:
-  case llvm::Triple::Bitrig:
   case llvm::Triple::Win32:
 return true;
   default:
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
@@ -32,7 +32,6 @@
  T.getOS() == llvm::Triple::FreeBSD ||
  T.getOS() == llvm::Triple::NetBSD ||
  T.getOS() == llvm::Triple::OpenBSD ||
- T.getOS() == llvm::Triple::Bitrig ||
  T.getOS() == llvm::Triple::DragonFly;
 }
 
Index: cfe/trunk/lib/Driver/CMakeLists.txt
===
--- cfe/trunk/lib/Driver/CMakeLists.txt
+++ cfe/trunk/lib/Driver/CMakeLists.txt
@@ -31,7 +31,6 @@
   ToolChains/Ananas.cpp
   ToolChains/AMDGPU.cpp
   ToolChains/AVR.cpp
-  ToolChains/Bitrig.cpp
   ToolChains/BareMetal.cpp
   ToolChains/Clang.cpp
   ToolChains/CloudABI.cpp
Index: cfe/trunk/lib/Driver/Driver.cpp
===
--- cfe/trunk/lib/Driver/Driver.cpp
+++ cfe/trunk/lib/Driver/Driver.cpp
@@ -12,7 +12,6 @@
 #include "ToolChains/AMDGPU.h"
 #include "ToolChains/AVR.h"
 #include "ToolChains/Ananas.h"
-#include "ToolChains/Bitrig.h"
 #include "ToolChains/Clang.h"
 #include "ToolChains/CloudABI.h"
 #include "ToolChains/Contiki.h"
@@ -3815,9 +3814,6 @@
 case llvm::Triple::OpenBSD:
   TC = llvm::make_unique(*this, Target, Args);
   break;
-case llvm::Triple::Bitrig:
-  TC = llvm::make_unique(*this, Target, Args);
-  break;
 case llvm::Triple::NetBSD:
   TC = llvm::make_unique(*this, Target, Args);
   break;
Index: cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp
@@ -101,8 +101,6 @@
 return "i486";
   case llvm::Triple::Haiku:
 return "i586";
-  case llvm::Triple::Bitrig:
-return "i686";
   default:
 // Fallback to p4.
 return "pentium4";
Index: cfe/trunk/lib/Basic/Targets/ARM.h
===
--- cfe/trunk/lib/Basic/Targets/ARM.h
+++ cfe/trunk/lib/Basic/Targets/ARM.h
@@ -95,10 +95,10 @@
 DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64;
 const llvm::Triple  = getTriple();
 
-// size_t is unsigned long on MachO-derived environments, NetBSD,
-// OpenBSD and Bitrig.
+// size_t is unsigned long on MachO-derived environments, NetBSD, and
+// OpenBSD.
 if (T.isOSBinFormatMachO() || T.getOS() == llvm::Triple::NetBSD ||
-T.getOS() == llvm::Triple::OpenBSD || T.getOS() == llvm::Triple::Bitrig)
+T.getOS() == llvm::Triple::OpenBSD)
   SizeType = UnsignedLong;
 else
   SizeType = UnsignedInt;
Index: cfe/trunk/lib/Basic/Targets/OSTargets.h
===
--- cfe/trunk/lib/Basic/Targets/OSTargets.h
+++ cfe/trunk/lib/Basic/Targets/OSTargets.h
@@ -423,39 +423,6 @@
   }
 };
 
-// Bitrig Target
-template 
-class LLVM_LIBRARY_VISIBILITY BitrigTargetInfo : public OSTargetInfo {
-protected:
-  void getOSDefines(const LangOptions , const llvm::Triple ,
-MacroBuilder ) const override {
-// Bitrig defines; list based off of gcc output
-
-Builder.defineMacro("__Bitrig__");
-DefineStd(Builder, "unix", Opts);
-Builder.defineMacro("__ELF__");
-if (Opts.POSIXThreads)
-  Builder.defineMacro("_REENTRANT");
-
-switch (Triple.getArch()) {
-   

r308797 - Remove Bitrig: Clang Changes

2017-07-21 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Fri Jul 21 15:46:31 2017
New Revision: 308797

URL: http://llvm.org/viewvc/llvm-project?rev=308797=rev
Log:
Remove Bitrig: Clang Changes

Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned.

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

Removed:
cfe/trunk/lib/Driver/ToolChains/Bitrig.cpp
cfe/trunk/lib/Driver/ToolChains/Bitrig.h
cfe/trunk/test/Driver/bitrig.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Basic/Targets/ARM.h
cfe/trunk/lib/Basic/Targets/OSTargets.h
cfe/trunk/lib/Basic/Targets/X86.h
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp
cfe/trunk/lib/Frontend/InitHeaderSearch.cpp
cfe/trunk/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp
cfe/trunk/test/CodeGen/linux-arm-atomic.c
cfe/trunk/test/Frontend/gnu-mcount.c
cfe/trunk/test/Preprocessor/init.c
cfe/trunk/test/Sema/tls.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=308797=308796=308797=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Jul 21 15:46:31 2017
@@ -153,8 +153,6 @@ TargetInfo *AllocateTarget(const llvm::T
   return new NetBSDTargetInfo(Triple, Opts);
 case llvm::Triple::OpenBSD:
   return new OpenBSDTargetInfo(Triple, Opts);
-case llvm::Triple::Bitrig:
-  return new BitrigTargetInfo(Triple, Opts);
 case llvm::Triple::RTEMS:
   return new RTEMSTargetInfo(Triple, Opts);
 case llvm::Triple::NaCl:
@@ -189,8 +187,6 @@ TargetInfo *AllocateTarget(const llvm::T
   return new NetBSDTargetInfo(Triple, Opts);
 case llvm::Triple::OpenBSD:
   return new OpenBSDTargetInfo(Triple, Opts);
-case llvm::Triple::Bitrig:
-  return new BitrigTargetInfo(Triple, Opts);
 case llvm::Triple::RTEMS:
   return new RTEMSTargetInfo(Triple, Opts);
 case llvm::Triple::NaCl:
@@ -421,8 +417,6 @@ TargetInfo *AllocateTarget(const llvm::T
   return new NetBSDI386TargetInfo(Triple, Opts);
 case llvm::Triple::OpenBSD:
   return new OpenBSDI386TargetInfo(Triple, Opts);
-case llvm::Triple::Bitrig:
-  return new BitrigI386TargetInfo(Triple, Opts);
 case llvm::Triple::FreeBSD:
   return new FreeBSDTargetInfo(Triple, Opts);
 case llvm::Triple::KFreeBSD:
@@ -478,8 +472,6 @@ TargetInfo *AllocateTarget(const llvm::T
   return new NetBSDTargetInfo(Triple, Opts);
 case llvm::Triple::OpenBSD:
   return new OpenBSDX86_64TargetInfo(Triple, Opts);
-case llvm::Triple::Bitrig:
-  return new BitrigX86_64TargetInfo(Triple, Opts);
 case llvm::Triple::FreeBSD:
   return new FreeBSDTargetInfo(Triple, Opts);
 case llvm::Triple::Fuchsia:

Modified: cfe/trunk/lib/Basic/Targets/ARM.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.h?rev=308797=308796=308797=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.h (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.h Fri Jul 21 15:46:31 2017
@@ -95,10 +95,10 @@ class LLVM_LIBRARY_VISIBILITY ARMTargetI
 DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64;
 const llvm::Triple  = getTriple();
 
-// size_t is unsigned long on MachO-derived environments, NetBSD,
-// OpenBSD and Bitrig.
+// size_t is unsigned long on MachO-derived environments, NetBSD, and
+// OpenBSD.
 if (T.isOSBinFormatMachO() || T.getOS() == llvm::Triple::NetBSD ||
-T.getOS() == llvm::Triple::OpenBSD || T.getOS() == 
llvm::Triple::Bitrig)
+T.getOS() == llvm::Triple::OpenBSD)
   SizeType = UnsignedLong;
 else
   SizeType = UnsignedInt;

Modified: cfe/trunk/lib/Basic/Targets/OSTargets.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/OSTargets.h?rev=308797=308796=308797=diff
==
--- cfe/trunk/lib/Basic/Targets/OSTargets.h (original)
+++ cfe/trunk/lib/Basic/Targets/OSTargets.h Fri Jul 21 15:46:31 2017
@@ -423,39 +423,6 @@ public:
   }
 };
 
-// Bitrig Target
-template 
-class LLVM_LIBRARY_VISIBILITY BitrigTargetInfo : public OSTargetInfo {
-protected:
-  void getOSDefines(const LangOptions , const llvm::Triple ,
-MacroBuilder ) const override {
-// Bitrig defines; list based off of gcc output
-
-Builder.defineMacro("__Bitrig__");
-DefineStd(Builder, "unix", Opts);
-Builder.defineMacro("__ELF__");
-if (Opts.POSIXThreads)
-  Builder.defineMacro("_REENTRANT");
-
-switch (Triple.getArch()) {
-default:
-  break;
-case llvm::Triple::arm:
-case llvm::Triple::armeb:
-case llvm::Triple::thumb:
-case 

[PATCH] D35739: Fix LLVMgold plugin name/path for non-Linux.

2017-07-21 Thread Stephen Hines via Phabricator via cfe-commits
srhines added a comment.

Looks great. Thanks for fixing this up. It's hard to believe that there is 
nothing in Support that gives you the proper suffix for shared libraries. It 
would seem like this might be useful elsewhere, but I actually didn't find 
really any other place that wants to use this value generically.


Repository:
  rL LLVM

https://reviews.llvm.org/D35739



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


[PATCH] D35735: [ubsan] Null-check pointers in -fsanitize=vptr (PR33881)

2017-07-21 Thread Adrian Prantl via Phabricator via cfe-commits
aprantl added inline comments.



Comment at: test/CodeGenCXX/ubsan-devirtualized-calls.cpp:1
-// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm 
-fsanitize=vptr %s -o - | FileCheck %s
+// REQUIRES: asserts
+// RUN: %clang_cc1 -std=c++11 -triple %itanium_abi_triple -emit-llvm 
-fsanitize=null,vptr %s -o - | FileCheck %s

Perhaps match for the labels instead of restricting to assert only?


https://reviews.llvm.org/D35735



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


[PATCH] D35729: [Frontend] - Mark some ASTUnit methods as const

2017-07-21 Thread Vedant Kumar via Phabricator via cfe-commits
vsk accepted this revision.
vsk added a comment.
This revision is now accepted and ready to land.

LGTM.


https://reviews.llvm.org/D35729



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


[PATCH] D35739: Fix LLVMgold plugin name/path for non-Linux.

2017-07-21 Thread Dan Albert via Phabricator via cfe-commits
danalbert created this revision.

It's only named LLVMgold.so on Linux. Fix the name for Windows and
Darwin.

  

Also fix the path for Windows so binutils doesn't have to.


Repository:
  rL LLVM

https://reviews.llvm.org/D35739

Files:
  lib/Driver/ToolChains/CommonArgs.cpp


Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -357,8 +357,20 @@
   // as gold requires -plugin to come before any -plugin-opt that -Wl might
   // forward.
   CmdArgs.push_back("-plugin");
-  std::string Plugin =
-  ToolChain.getDriver().Dir + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold.so";
+
+#if defined(LLVM_ON_WIN32)
+  const char *Suffix = ".dll";
+#elif defined(__APPLE__)
+  const char *Suffix = ".dylib";
+#else
+  const char *Suffix = ".so";
+#endif
+
+  SmallString<1024> Plugin;
+  llvm::sys::path::native(Twine(ToolChain.getDriver().Dir) +
+  "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold" +
+  Suffix,
+  Plugin);
   CmdArgs.push_back(Args.MakeArgString(Plugin));
 
   // Try to pass driver level flags relevant to LTO code generation down to


Index: lib/Driver/ToolChains/CommonArgs.cpp
===
--- lib/Driver/ToolChains/CommonArgs.cpp
+++ lib/Driver/ToolChains/CommonArgs.cpp
@@ -357,8 +357,20 @@
   // as gold requires -plugin to come before any -plugin-opt that -Wl might
   // forward.
   CmdArgs.push_back("-plugin");
-  std::string Plugin =
-  ToolChain.getDriver().Dir + "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold.so";
+
+#if defined(LLVM_ON_WIN32)
+  const char *Suffix = ".dll";
+#elif defined(__APPLE__)
+  const char *Suffix = ".dylib";
+#else
+  const char *Suffix = ".so";
+#endif
+
+  SmallString<1024> Plugin;
+  llvm::sys::path::native(Twine(ToolChain.getDriver().Dir) +
+  "/../lib" CLANG_LIBDIR_SUFFIX "/LLVMgold" +
+  Suffix,
+  Plugin);
   CmdArgs.push_back(Args.MakeArgString(Plugin));
 
   // Try to pass driver level flags relevant to LTO code generation down to
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35701: Break up Targets.cpp into a header/impl pair per target type[NFCI]

2017-07-21 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

LGTM


https://reviews.llvm.org/D35701



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


r308783 - Inline variable into assert to fix unused warning.

2017-07-21 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Fri Jul 21 14:29:35 2017
New Revision: 308783

URL: http://llvm.org/viewvc/llvm-project?rev=308783=rev
Log:
Inline variable into assert to fix unused warning.

Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=308783=308782=308783=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Jul 21 14:29:35 2017
@@ -745,9 +745,8 @@ void DSAStackTy::addReductionData(ValueD
   BinaryOperatorKind BOK) {
   D = getCanonicalDecl(D);
   assert(!isStackEmpty() && "Data-sharing attributes stack is empty");
-  auto  = Stack.back().first.back().SharingMap[D];
   assert(
-  Data.Attributes == OMPC_reduction &&
+  Stack.back().first.back().SharingMap[D].Attributes == OMPC_reduction &&
   "Additional reduction info may be specified only for reduction items.");
   auto  = Stack.back().first.back().ReductionMap[D];
   assert(ReductionData.ReductionRange.isInvalid() &&
@@ -760,9 +759,8 @@ void DSAStackTy::addReductionData(ValueD
   const Expr *ReductionRef) {
   D = getCanonicalDecl(D);
   assert(!isStackEmpty() && "Data-sharing attributes stack is empty");
-  auto  = Stack.back().first.back().SharingMap[D];
   assert(
-  Data.Attributes == OMPC_reduction &&
+  Stack.back().first.back().SharingMap[D].Attributes == OMPC_reduction &&
   "Additional reduction info may be specified only for reduction items.");
   auto  = Stack.back().first.back().ReductionMap[D];
   assert(ReductionData.ReductionRange.isInvalid() &&


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


r308782 - [Hexagon] Attempt to fix selfhost bots

2017-07-21 Thread Krzysztof Parzyszek via cfe-commits
Author: kparzysz
Date: Fri Jul 21 14:23:05 2017
New Revision: 308782

URL: http://llvm.org/viewvc/llvm-project?rev=308782=rev
Log:
[Hexagon] Attempt to fix selfhost bots

The codegen testcase was checking for specific value names. Make it
ignore the names instead as they are irrelevant. 

Modified:
cfe/trunk/test/CodeGen/hexagon-inline-asm.c

Modified: cfe/trunk/test/CodeGen/hexagon-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/hexagon-inline-asm.c?rev=308782=308781=308782=diff
==
--- cfe/trunk/test/CodeGen/hexagon-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/hexagon-inline-asm.c Fri Jul 21 14:23:05 2017
@@ -18,6 +18,6 @@ void foo(v64 v0, v64 v1, v64 *p) {
 
 void fred(unsigned *p, unsigned m, unsigned v) {
   asm ("memw(%0++%1) = %2" : : "r"(p),"a"(m),"r"(v) : "memory");
-// CHECK: call void asm sideeffect "memw($0++$1) = $2", "r,a,r,~{memory}"(i32* 
%0, i32 %1, i32 %2)
+// CHECK: call void asm sideeffect "memw($0++$1) = $2", "r,a,r,~{memory}"(i32* 
%{{.*}}, i32 %{{.*}}, i32 %{{.*}})
 }
 


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


[PATCH] D35701: Break up Targets.cpp into a header/impl pair per target type[NFCI]

2017-07-21 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

Please recheck all the cpp file headers. Many of them aren't 80 columns and 
they should probably mention the target the way the header comments do. Right 
now it looks like a copy and paste from Targets.cpp with only the file name 
changed.

Clang format seems to have been really inconsistent about whether the closing 
curly brace for a static array is on a line by itself or the end of the 
previous line.




Comment at: lib/Basic/Targets/AMDGPU.cpp:1
+//===--- AMDGPU.cpp - Implement target feature support ---===//
+//

I think this line is short.



Comment at: lib/Basic/Targets/AMDGPU.cpp:144
+  "m0", "flat_scratch", "exec_lo", "exec_hi", "vcc_lo", "vcc_hi", 
+  "flat_scratch_lo", "flat_scratch_hi"};
+

Closing curly on separate line.



Comment at: lib/Basic/Targets/ARM.cpp:1
+//===--- ARM.cpp - Implement target feature support ---===//
+//

Short



Comment at: lib/Basic/Targets/ARM.cpp:54
+"q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11",
+"q12", "q13", "q14", "q15"};
+

Place losing curly on separate line



Comment at: lib/Basic/Targets/AVR.h:78
+"r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19",
+"r20", "r21", "r22", "r23", "r24", "r25", "X",   "Y",   "Z",   "SP"};
+return llvm::makeArrayRef(GCCRegNames);

Closing curly on separate line



Comment at: lib/Basic/Targets/BPF.cpp:1
+//===--- BPF.cpp - Implement target feature support ---===//
+//

Line is short and description should match the header.



Comment at: lib/Basic/Targets/Hexagon.cpp:112
+"r27", "r28", "r29", "r30", "r31", "p0",  "p1",  "p2",  "p3",
+"sa0", "lc0", "sa1", "lc1", "m0",  "m1",  "usr", "ugp"};
+

Closing curly on separate line.



Comment at: lib/Basic/Targets/MSP430.cpp:22
+"r0", "r1", "r2",  "r3",  "r4",  "r5",  "r6",  "r7",
+"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"};
+

Closing curly on separate line



Comment at: lib/Basic/Targets/Mips.cpp:1
+//===--- Mips.cpp - Implement target feature support ---===//
+//

This line looks short of 80 columns.



Comment at: lib/Basic/Targets/Mips.h:218
+"$msair", "$msacsr", "$msaaccess", "$msasave", "$msamodify",
+"$msarequest", "$msamap", "$msaunmap"};
+return llvm::makeArrayRef(GCCRegNames);

Closing curly on separate line



Comment at: lib/Basic/Targets/Mips.h:363
+{{"gp"}, "$28"}, {{"sp", "$sp"}, "$29"}, {{"fp", "$fp"}, "$30"},
+{{"ra"}, "$31"}};
+static const TargetInfo::GCCRegAlias NewABIRegAliases[] = {

Closing curly



Comment at: lib/Basic/Targets/Mips.h:375
+{{"gp"}, "$28"}, {{"sp", "$sp"}, "$29"}, {{"fp", "$fp"}, "$30"},
+{{"ra"}, "$31"}};
+if (ABI == "o32")

Closing curly



Comment at: lib/Basic/Targets/NVPTX.cpp:1
+//===--- NVPTX.cpp - Implement target feature support ---===//
+//

Short of 80 columns



Comment at: lib/Basic/Targets/Nios2.cpp:1
+//===--- Nios2.cpp - Implement target feature support ---===//
+//

Line is short and should probably match the header description.



Comment at: lib/Basic/Targets/Nios2.h:104
+"ctl0", "ctl1", "ctl2", "ctl3", "ctl4", "ctl5", "ctl6", "ctl7", "ctl8",
+"ctl9", "ctl10", "ctl11", "ctl12", "ctl13", "ctl14", "ctl15"};
+return llvm::makeArrayRef(GCCRegNames);

Closing curly



Comment at: lib/Basic/Targets/PNaCl.cpp:1
+//===--- PNaCl.cpp - Implement target feature support ---===//
+//

Short and probably the wrong description.



Comment at: lib/Basic/Targets/PPC.cpp:449
+"v22", "v23","v24",  "v25", "v26", "v27", "v28", "v29", "v30",
+"v31", "vrsave", "vscr", "spe_acc", "spefscr", "sfp"};
+

Closing curly



Comment at: lib/Basic/Targets/Sparc.cpp:1
+//===--- Sparc.cpp - Implement target feature support ---===//
+//

Line is short



Comment at: lib/Basic/Targets/Sparc.cpp:25
+"r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19", "r20", 
"r21",
+"r22", "r23", "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"};
+

Closing curly



Comment at: lib/Basic/Targets/SystemZ.cpp:35
+"r11", "r12", "r13", "r14", "r15", "f0",  "f2", "f4",  "f6",  "f1", "f3",
+"f5",  "f7",  "f8",  "f10", "f12", "f14", "f9", "f11", "f13", "f15"};
+


[PATCH] D35736: [ubsan] -fsanitize=vptr now requires -fsanitize=null, update tests

2017-07-21 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision.
Herald added a subscriber: kubamracek.

See: https://bugs.llvm.org/show_bug.cgi?id=33881

Depends on https://reviews.llvm.org/D35735


https://reviews.llvm.org/D35736

Files:
  test/ubsan/TestCases/TypeCheck/PR33221.cpp
  test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp
  test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
  test/ubsan/TestCases/TypeCheck/vptr.cpp


Index: test/ubsan/TestCases/TypeCheck/vptr.cpp
===
--- test/ubsan/TestCases/TypeCheck/vptr.cpp
+++ test/ubsan/TestCases/TypeCheck/vptr.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 
-o %t -mllvm -enable-tail-merge=false
+// RUN: %clangxx -frtti -fsanitize=null,vptr -fno-sanitize-recover=null,vptr 
-g %s -O3 -o %t -mllvm -enable-tail-merge=false
 // RUN: %run %t rT && %run %t mT && %run %t fT && %run %t cT
 // RUN: %run %t rU && %run %t mU && %run %t fU && %run %t cU
 // RUN: %run %t rS && %run %t rV && %run %t oV
@@ -9,7 +9,9 @@
 // RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t fV 2>&1 | FileCheck %s 
--check-prefix=CHECK-MEMFUN --strict-whitespace
 // RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t cV 2>&1 | FileCheck %s 
--check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST 
--strict-whitespace
 // RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t oU 2>&1 | FileCheck %s 
--check-prefix=CHECK-OFFSET --check-prefix=CHECK-%os-OFFSET --strict-whitespace
-// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s 
--check-prefix=CHECK-NULL-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER 
--strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s 
--check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER 
--strict-whitespace
+// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s 
--check-prefix=CHECK-INVALID-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER 
--strict-whitespace
+// RUN: not %run %t nN 2>&1 | FileCheck %s --check-prefix=CHECK-NULL-MEMFUN 
--strict-whitespace
 
 // RUN: (echo "vptr_check:S"; echo "vptr_check:T"; echo "vptr_check:U") > 
%t.supp
 // RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t mS
@@ -99,6 +101,9 @@
   case 'V':
 p = reinterpret_cast(new U);
 break;
+  case 'N':
+p = 0;
+break;
   }
 
   access_p(p, argv[1][0]);
@@ -134,11 +139,11 @@
 // CHECK-Linux-MEMBER: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
 return p->b;
 
-// CHECK-NULL-MEMBER: vptr.cpp:[[@LINE-2]]:15: runtime error: member 
access within address [[PTR:0x[0-9a-f]*]] which does not point to an object of 
type 'T'
-// CHECK-NULL-MEMBER-NEXT: [[PTR]]: note: object has invalid vptr
-// CHECK-NULL-MEMBER-NEXT: {{^  ?.. .. .. ..  ?00 00 00 00  ?00 00 00 00  
?}}
-// CHECK-NULL-MEMBER-NEXT: {{^  \^~~()? 
*$}}
-// CHECK-NULL-MEMBER-NEXT: {{^  invalid vptr}}
+// CHECK-INVALID-MEMBER: vptr.cpp:[[@LINE-2]]:15: runtime error: member 
access within address [[PTR:0x[0-9a-f]*]] which does not point to an object of 
type 'T'
+// CHECK-INVALID-MEMBER-NEXT: [[PTR]]: note: object has invalid vptr
+// CHECK-INVALID-MEMBER-NEXT: {{^  ?.. .. .. ..  ?00 00 00 00  ?00 00 00 
00  ?}}
+// CHECK-INVALID-MEMBER-NEXT: {{^  \^~~()? 
*$}}
+// CHECK-INVALID-MEMBER-NEXT: {{^  invalid vptr}}
 // CHECK-Linux-NULL-MEMBER: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE-7]]
 
   case 'f':
@@ -168,6 +173,10 @@
 // CHECK-Linux-DOWNCAST: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
 (void)static_cast(reinterpret_cast(p));
 return 0;
+
+  case 'n':
+// CHECK-NULL-MEMFUN: vptr.cpp:[[@LINE+1]]:15: runtime error: member call 
on null pointer of type 'T'
+return p->g();
   }
   return 0;
 }
Index: test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
===
--- test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
+++ test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 
-o %t
+// RUN: %clangxx -frtti -fsanitize=null,vptr -fno-sanitize-recover=vptr -g %s 
-O3 -o %t
 // RUN: not %run %t 2>&1 | FileCheck %s
 
 // REQUIRES: cxxabi
Index: test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp
===
--- test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp
+++ test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 
-o %t
+// RUN: %clangxx -frtti -fsanitize=vptr,null -fno-sanitize-recover=vptr,null 
-g %s -O3 -o %t
 // RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-CORRUPTED-VTABLE 
--strict-whitespace
 
 // 

[PATCH] D35735: [ubsan] Null-check pointers in -fsanitize=vptr (PR33881)

2017-07-21 Thread Vedant Kumar via Phabricator via cfe-commits
vsk created this revision.

The instrumentation generated by -fsanitize=vptr does not null check a
user pointer before loading from it. This causes crashes in the face of
UB member calls (this=nullptr), i.e it causes user programs to crash only
after UBSan is turned on.

The fix is to make run-time null checking a prerequisite for enabling
-fsanitize=vptr, and to then teach UBSan to reuse these run-time null
checks to make -fsanitize=vptr safe.

Testing: check-clang, check-ubsan, a stage2 ubsan-enabled build
(Test updates in compiler-rt to follow in a separate patch)

https://bugs.llvm.org/show_bug.cgi?id=33881
rdar://problem/32659008


https://reviews.llvm.org/D35735

Files:
  docs/UndefinedBehaviorSanitizer.rst
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Basic/DiagnosticGroups.td
  lib/CodeGen/CGExpr.cpp
  lib/Driver/SanitizerArgs.cpp
  test/CodeGenCXX/catch-undef-behavior.cpp
  test/CodeGenCXX/ubsan-devirtualized-calls.cpp
  test/CodeGenCXX/ubsan-type-checks.cpp
  test/CodeGenCXX/ubsan-vtable-checks.cpp
  test/Driver/fsanitize.c
  test/Driver/rtti-options.cpp

Index: test/Driver/rtti-options.cpp
===
--- test/Driver/rtti-options.cpp
+++ test/Driver/rtti-options.cpp
@@ -16,14 +16,14 @@
 // Make sure we only error/warn once, when trying to enable vptr and
 // undefined and have -fno-rtti
 // RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s
+// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=null,vptr %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
+// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=null,vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
+// RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=null,vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s
 // RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
 // RUN: %clang -### -c -target x86_64-unknown-linux -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-WARN %s
-// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
-// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s
+// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=null,vptr %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-WARN %s
+// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=null,vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
+// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=null,vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s
 // RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s
 
 // Exceptions + no/default rtti
Index: test/Driver/fsanitize.c
===
--- test/Driver/fsanitize.c
+++ test/Driver/fsanitize.c
@@ -58,6 +58,10 @@
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-NO-RTTI
 // CHECK-UNDEFINED-NO-RTTI-NOT: vptr
 
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-sanitize=null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-NULL
+// RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-NULL
+// CHECK-VPTR-NO-NULL: warning: implicitly disabling vptr sanitizer because null checking wasn't enabled
+
 // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,thread -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANT
 // CHECK-SANA-SANT: '-fsanitize=address' not allowed with '-fsanitize=thread'
 
@@ -362,8 +366,8 @@
 // RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.8 -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-OLD
 // CHECK-VPTR-DARWIN-OLD: unsupported option '-fsanitize=vptr' for target 'x86_64-apple-darwin10'
 
-// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.9 -fsanitize=alignment,vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-NEW
-// CHECK-VPTR-DARWIN-NEW: -fsanitize=alignment,vptr
+// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.9 -fsanitize=alignment,null,vptr %s 

[PATCH] D35701: Break up Targets.cpp into a header/impl pair per target type[NFCI]

2017-07-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment.

In https://reviews.llvm.org/D35701#817526, @echristo wrote:

> I'm going to say this ahead of time without looking into it "LGTM", but wait 
> for ctopper (or someone else) to ack it for style etc since I'm unlikely to 
> get to it any time shortly. :)
>
> Also, make sure to clang format all the files please. I'm assuming you have, 
> but...
>
> -eric


Thanks!  I did 'clang-format' in advance, though I reverted 1 version of it 
(the big list it turned into single entries for some reason).  I'll wait for 
@craig.topper's finished.


https://reviews.llvm.org/D35701



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


r308777 - Fix tblgen error

2017-07-21 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Fri Jul 21 13:32:22 2017
New Revision: 308777

URL: http://llvm.org/viewvc/llvm-project?rev=308777=rev
Log:
Fix tblgen error

Add Heading string to attribute documentation.

Modified:
cfe/trunk/include/clang/Basic/AttrDocs.td

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=308777=308776=308777=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Jul 21 13:32:22 2017
@@ -1346,6 +1346,7 @@ as ``-mlong-calls`` and ``-mno-long-call
 
 def MipsShortCallStyleDocs : Documentation {
   let Category = DocCatFunction;
+  let Heading = "short_call (gnu::short_call, gnu::near)";
   let Content = [{
 Clang supports the ``__attribute__((long_call))``, ``__attribute__((far))``,
 ``__attribute__((short__call))``, and ``__attribute__((near))`` attributes


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


[PATCH] D35701: Break up Targets.cpp into a header/impl pair per target type[NFCI]

2017-07-21 Thread Eric Christopher via Phabricator via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

I'm going to say this ahead of time without looking into it "LGTM", but wait 
for ctopper (or someone else) to ack it for style etc since I'm unlikely to get 
to it any time shortly. :)

Also, make sure to clang format all the files please. I'm assuming you have, 
but...

-eric


https://reviews.llvm.org/D35701



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


[PATCH] D35577: Add -flookup-tables and -fno-lookup-tables flags

2017-07-21 Thread Sumanth Gundapaneni via Phabricator via cfe-commits
sgundapa added a comment.

This is not going to be a temporary option


https://reviews.llvm.org/D35577



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


[PATCH] D35732: Update system_error tests for more platforms.

2017-07-21 Thread Dan Albert via Phabricator via cfe-commits
danalbert created this revision.

Old versions of Android used the "Unknown error: -1" format.


Repository:
  rL LLVM

https://reviews.llvm.org/D35732

Files:
  
test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
  
test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp


Index: 
test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
===
--- 
test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
+++ 
test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -31,7 +31,9 @@
 errno = E2BIG; // something that message will never generate
 const std::error_category& e_cat1 = std::system_category();
 const std::string msg = e_cat1.message(-1);
-LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error");
+// Exact message format varries by platform.
+LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error" ||
+  msg == "Unknown error: -1");
 assert(errno == E2BIG);
 }
 
Index: 
test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
===
--- 
test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
+++ 
test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -31,7 +31,9 @@
 errno = E2BIG; // something that message will never generate
 const std::error_category& e_cat1 = std::generic_category();
 const std::string msg = e_cat1.message(-1);
-LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error");
+// Exact message format varies by platform.
+LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error" ||
+  msg == "Unknown error: -1");
 assert(errno == E2BIG);
 }
 


Index: test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
===
--- test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
+++ test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/system_category.pass.cpp
@@ -31,7 +31,9 @@
 errno = E2BIG; // something that message will never generate
 const std::error_category& e_cat1 = std::system_category();
 const std::string msg = e_cat1.message(-1);
-LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error");
+// Exact message format varries by platform.
+LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error" ||
+  msg == "Unknown error: -1");
 assert(errno == E2BIG);
 }
 
Index: test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
===
--- test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
+++ test/std/diagnostics/syserr/syserr.errcat/syserr.errcat.objects/generic_category.pass.cpp
@@ -31,7 +31,9 @@
 errno = E2BIG; // something that message will never generate
 const std::error_category& e_cat1 = std::generic_category();
 const std::string msg = e_cat1.message(-1);
-LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error");
+// Exact message format varies by platform.
+LIBCPP_ASSERT(msg == "Unknown error -1" || msg == "Unknown error" ||
+  msg == "Unknown error: -1");
 assert(errno == E2BIG);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D35715: Preserve typedef names in debug info for template type parameters

2017-07-21 Thread David Blaikie via cfe-commits
On Fri, Jul 21, 2017 at 12:57 PM David Blaikie  wrote:

> On Fri, Jul 21, 2017 at 11:34 AM David Majnemer via Phabricator <
> revi...@reviews.llvm.org> wrote:
>
>> majnemer added a comment.
>>
>> This might be a silly question but why not do this by default?
>>
>
> I'd hazard a guess that GDB wouldn't cope well with this (in terms of
> identifying templates as the same type under this flag - one TU has a
> function that has a parameter type with the name "foo" and the other
> has a type named "foo" (where f is a typedef of int) - going to guess
> GDB doesn't realize those are the same type... )
>

(in fact, the DWARF doesn't necessarily have any mention of 'x' or that
it's a typedef of int... - the DW_TAG_template_type_parameter says the
parameter is int, so it's not not impossible to figure it all out - though
that's predicated on another patch Paul has, to include
DW_TAG_template_type_parameters of template declarations (which Clang
currently doesn't do - saves space, etc))


>
> Also, Paul: This doesn't change the type that's referenced in the
> DW_TAG_template_type_parameter? Would it make sense to actually do this the
> opposite way - use the canonical name for the name, but have the
> DW_TAG_template_type_parameter refer to the typedef? Still means the type
> can vary between different translation units, which seems a bit difficult
> to deal with, but probably harmless in that case?
>
> Would still mean long/unweildy names, though, which I guess is what's
> being avoided/addressed here.
>
>
>>
>>
>> https://reviews.llvm.org/D35715
>>
>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D35715: Preserve typedef names in debug info for template type parameters

2017-07-21 Thread David Blaikie via cfe-commits
On Fri, Jul 21, 2017 at 11:34 AM David Majnemer via Phabricator <
revi...@reviews.llvm.org> wrote:

> majnemer added a comment.
>
> This might be a silly question but why not do this by default?
>

I'd hazard a guess that GDB wouldn't cope well with this (in terms of
identifying templates as the same type under this flag - one TU has a
function that has a parameter type with the name "foo" and the other
has a type named "foo" (where f is a typedef of int) - going to guess
GDB doesn't realize those are the same type... )

Also, Paul: This doesn't change the type that's referenced in the
DW_TAG_template_type_parameter? Would it make sense to actually do this the
opposite way - use the canonical name for the name, but have the
DW_TAG_template_type_parameter refer to the typedef? Still means the type
can vary between different translation units, which seems a bit difficult
to deal with, but probably harmless in that case?

Would still mean long/unweildy names, though, which I guess is what's being
avoided/addressed here.


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


New buildbot admin

2017-07-21 Thread Galina Kistanova via cfe-commits
Hello everyone,

I'm going on vacation starting from the next week. I will be traveling, so
likely will be slow with my e-mails.

Please feel free to contact Victor Leschuk with the questions or request
related to the LLVM Lab and the buildbot infrastructure.

Thanks

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


r308773 - [OPENMP] Fix build problem, NFC.

2017-07-21 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Jul 21 12:26:22 2017
New Revision: 308773

URL: http://llvm.org/viewvc/llvm-project?rev=308773=rev
Log:
[OPENMP] Fix build problem, NFC.

Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=308773=308772=308773=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Jul 21 12:26:22 2017
@@ -86,10 +86,9 @@ private:
   typedef llvm::DenseMap
   DoacrossDependMapTy;
   struct ReductionData {
+typedef llvm::PointerEmbeddedInt BOKPtrType;
 SourceRange ReductionRange;
-llvm::PointerUnion>
-ReductionOp;
+llvm::PointerUnion ReductionOp;
 ReductionData() = default;
 void set(BinaryOperatorKind BO, SourceRange RR) {
   ReductionRange = RR;
@@ -788,8 +787,7 @@ bool DSAStackTy::getTopMostReductionData
 ReductionData.ReductionOp.is())
   return false;
 SR = ReductionData.ReductionRange;
-BOK = ReductionData.ReductionOp
-  .get();
+BOK = ReductionData.ReductionOp.get();
 return true;
   }
   return false;


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


r308771 - [OPENMP] Add ast-print tests for in_reduction clause, NFC.

2017-07-21 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Jul 21 11:55:46 2017
New Revision: 308771

URL: http://llvm.org/viewvc/llvm-project?rev=308771=rev
Log:
[OPENMP] Add ast-print tests for in_reduction clause, NFC.

Modified:
cfe/trunk/test/OpenMP/taskloop_ast_print.cpp
cfe/trunk/test/OpenMP/taskloop_simd_ast_print.cpp

Modified: cfe/trunk/test/OpenMP/taskloop_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_ast_print.cpp?rev=308771=308770=308771=diff
==
--- cfe/trunk/test/OpenMP/taskloop_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/taskloop_ast_print.cpp Fri Jul 21 11:55:46 2017
@@ -13,8 +13,10 @@ T tmain(T argc) {
   T b = argc, c, d, e, f, g;
   static T a;
 // CHECK: static T a;
-#pragma omp taskloop if(taskloop: argc > N) default(shared) untied priority(N) 
grainsize(N) reduction(+:g)
-  // CHECK-NEXT: #pragma omp taskloop if(taskloop: argc > N) default(shared) 
untied priority(N) grainsize(N) reduction(+: g)
+#pragma omp taskgroup task_reduction(+: d)
+#pragma omp taskloop if(taskloop: argc > N) default(shared) untied priority(N) 
grainsize(N) reduction(+:g) in_reduction(+: d)
+  // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d)
+  // CHECK-NEXT: #pragma omp taskloop if(taskloop: argc > N) default(shared) 
untied priority(N) grainsize(N) reduction(+: g) in_reduction(+: d)
   for (int i = 0; i < 2; ++i)
 a = 2;
 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
@@ -53,8 +55,10 @@ int main(int argc, char **argv) {
   int b = argc, c, d, e, f, g;
   static int a;
 // CHECK: static int a;
-#pragma omp taskloop if(taskloop: a) default(none) shared(a) final(b) 
priority(5) num_tasks(argc) reduction(*: g)
-  // CHECK-NEXT: #pragma omp taskloop if(taskloop: a) default(none) shared(a) 
final(b) priority(5) num_tasks(argc) reduction(*: g)
+#pragma omp taskgroup task_reduction(+: d)
+#pragma omp taskloop if(taskloop: a) default(none) shared(a) final(b) 
priority(5) num_tasks(argc) reduction(*: g) in_reduction(+:d)
+  // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d)
+  // CHECK-NEXT: #pragma omp taskloop if(taskloop: a) default(none) shared(a) 
final(b) priority(5) num_tasks(argc) reduction(*: g) in_reduction(+: d)
   for (int i = 0; i < 2; ++i)
 a = 2;
 // CHECK-NEXT: for (int i = 0; i < 2; ++i)

Modified: cfe/trunk/test/OpenMP/taskloop_simd_ast_print.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_simd_ast_print.cpp?rev=308771=308770=308771=diff
==
--- cfe/trunk/test/OpenMP/taskloop_simd_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/taskloop_simd_ast_print.cpp Fri Jul 21 11:55:46 2017
@@ -14,8 +14,10 @@ T tmain(T argc) {
   T *ptr;
   static T a;
 // CHECK: static T a;
-#pragma omp taskloop simd if(taskloop: argc > N) default(shared) untied 
priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+:g)
-  // CHECK-NEXT: #pragma omp taskloop simd if(taskloop: argc > N) 
default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) 
grainsize(N) reduction(+: g)
+#pragma omp taskgroup task_reduction(+: d)
+#pragma omp taskloop simd if(taskloop: argc > N) default(shared) untied 
priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+:g) 
in_reduction(+: d)
+  // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d)
+  // CHECK-NEXT: #pragma omp taskloop simd if(taskloop: argc > N) 
default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) 
grainsize(N) reduction(+: g) in_reduction(+: d)
   for (int i = 0; i < 2; ++i)
 a = 2;
 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
@@ -54,8 +56,10 @@ int main(int argc, char **argv) {
   int b = argc, c, d, e, f, g;
   static int a;
 // CHECK: static int a;
-#pragma omp taskloop simd if(taskloop: a) default(none) shared(a) final(b) 
priority(5) safelen(8) linear(b), aligned(argv) num_tasks(argc) reduction(*: g)
-  // CHECK-NEXT: #pragma omp taskloop simd if(taskloop: a) default(none) 
shared(a) final(b) priority(5) safelen(8) linear(b) aligned(argv) 
num_tasks(argc) reduction(*: g)
+#pragma omp taskgroup task_reduction(+: d)
+#pragma omp taskloop simd if(taskloop: a) default(none) shared(a) final(b) 
priority(5) safelen(8) linear(b), aligned(argv) num_tasks(argc) reduction(*: g) 
in_reduction(+: d)
+  // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d)
+  // CHECK-NEXT: #pragma omp taskloop simd if(taskloop: a) default(none) 
shared(a) final(b) priority(5) safelen(8) linear(b) aligned(argv) 
num_tasks(argc) reduction(*: g) in_reduction(+: d)
   for (int i = 0; i < 2; ++i)
 a = 2;
 // CHECK-NEXT: for (int i = 0; i < 2; ++i)


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


r308769 - Complex Long Double classification In RegCall calling convention

2017-07-21 Thread Erich Keane via cfe-commits
Author: erichkeane
Date: Fri Jul 21 11:50:36 2017
New Revision: 308769

URL: http://llvm.org/viewvc/llvm-project?rev=308769=rev
Log:
Complex Long Double classification In RegCall calling convention

This change is part of the RegCall calling convention support for LLVM. 
Existing RegCall implementation was extended to include correct handling of 
Complex Long Double type. Complex long double types should be returned/passed 
in memory and not register stack. This patch implements this behavior.

Patch by: eandrews

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

Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/CodeGenCXX/regcall.cpp

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=308769=308768=308769=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Fri Jul 21 11:50:36 2017
@@ -882,8 +882,14 @@ static llvm::Type* X86AdjustInlineAsmTyp
 /// X86_VectorCall calling convention. Shared between x86_32 and x86_64.
 static bool isX86VectorTypeForVectorCall(ASTContext , QualType Ty) {
   if (const BuiltinType *BT = Ty->getAs()) {
-if (BT->isFloatingPoint() && BT->getKind() != BuiltinType::Half)
+if (BT->isFloatingPoint() && BT->getKind() != BuiltinType::Half) {
+  if (BT->getKind() == BuiltinType::LongDouble) {
+if (().getLongDoubleFormat() ==
+::APFloat::x87DoubleExtended())
+  return false;
+  }
   return true;
+}
   } else if (const VectorType *VT = Ty->getAs()) {
 // vectorcall can pass XMM, YMM, and ZMM vectors. We don't pass SSE1 MMX
 // registers specially.
@@ -3515,18 +3521,27 @@ void X86_64ABIInfo::computeInfo(CGFuncti
   unsigned FreeSSERegs = IsRegCall ? 16 : 8;
   unsigned NeededInt, NeededSSE;
 
-  if (IsRegCall && FI.getReturnType()->getTypePtr()->isRecordType() &&
-  !FI.getReturnType()->getTypePtr()->isUnionType()) {
-FI.getReturnInfo() =
-classifyRegCallStructType(FI.getReturnType(), NeededInt, NeededSSE);
-if (FreeIntRegs >= NeededInt && FreeSSERegs >= NeededSSE) {
-  FreeIntRegs -= NeededInt;
-  FreeSSERegs -= NeededSSE;
-} else {
-  FI.getReturnInfo() = getIndirectReturnResult(FI.getReturnType());
-}
-  } else if (!getCXXABI().classifyReturnType(FI))
-FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+  if (!getCXXABI().classifyReturnType(FI)) {
+if (IsRegCall && FI.getReturnType()->getTypePtr()->isRecordType() &&
+!FI.getReturnType()->getTypePtr()->isUnionType()) {
+  FI.getReturnInfo() =
+  classifyRegCallStructType(FI.getReturnType(), NeededInt, NeededSSE);
+  if (FreeIntRegs >= NeededInt && FreeSSERegs >= NeededSSE) {
+FreeIntRegs -= NeededInt;
+FreeSSERegs -= NeededSSE;
+  } else {
+FI.getReturnInfo() = getIndirectReturnResult(FI.getReturnType());
+  }
+} else if (IsRegCall && FI.getReturnType()->getAs()) {
+  // Complex Long Double Type is passed in Memory when Regcall
+  // calling convention is used.
+  const ComplexType *CT = FI.getReturnType()->getAs();
+  if (getContext().getCanonicalType(CT->getElementType()) ==
+  getContext().LongDoubleTy)
+FI.getReturnInfo() = getIndirectReturnResult(FI.getReturnType());
+} else
+  FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+  }
 
   // If the return value is indirect, then the hidden argument is consuming one
   // integer register.

Modified: cfe/trunk/test/CodeGenCXX/regcall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/regcall.cpp?rev=308769=308768=308769=diff
==
--- cfe/trunk/test/CodeGenCXX/regcall.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/regcall.cpp Fri Jul 21 11:50:36 2017
@@ -73,8 +73,8 @@ bool __regcall operator ==(const test_cl
 // CHECK-WIN64-DAG: define x86_regcallcc zeroext i1 
@"\01??8@Yw_NAEBVtest_class@@0@Z"
 // CHECK-WIN32-DAG: define x86_regcallcc zeroext i1 
@"\01??8@Yw_NABVtest_class@@0@Z"
 
-test_class __regcall operator""_test_class (unsigned long long) { ++x; return 
test_class{};} 
-// CHECK-LIN64-DAG: define x86_regcallcc %class.test_class 
@_Zli11_test_classy(i64)
+test_class __regcall operator""_test_class (unsigned long long) { ++x; return 
test_class{};}
+// CHECK-LIN64-DAG: define x86_regcallcc void 
@_Zli11_test_classy(%class.test_class* noalias sret %agg.result, i64)
 // CHECK-LIN32-DAG: define x86_regcallcc void 
@_Zli11_test_classy(%class.test_class* inreg noalias sret %agg.result, i64)
 // CHECK-WIN64-DAG: \01??__K_test_class@@Yw?AVtest_class@@_K@Z"
 // CHECK-WIN32-DAG: \01??__K_test_class@@Yw?AVtest_class@@_K@Z"
@@ -95,3 +95,11 @@ void force_gen() {
   freeTempFunc(1);
   t3.do_thing();
 }
+
+long double _Complex __regcall foo(long double 

[PATCH] D35259: Complex Long Double classification In RegCall calling convention

2017-07-21 Thread Erich Keane via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308769: Complex Long Double classification In RegCall 
calling convention (authored by erichkeane).

Changed prior to commit:
  https://reviews.llvm.org/D35259?vs=107667=107696#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35259

Files:
  cfe/trunk/lib/CodeGen/TargetInfo.cpp
  cfe/trunk/test/CodeGenCXX/regcall.cpp


Index: cfe/trunk/test/CodeGenCXX/regcall.cpp
===
--- cfe/trunk/test/CodeGenCXX/regcall.cpp
+++ cfe/trunk/test/CodeGenCXX/regcall.cpp
@@ -73,8 +73,8 @@
 // CHECK-WIN64-DAG: define x86_regcallcc zeroext i1 
@"\01??8@Yw_NAEBVtest_class@@0@Z"
 // CHECK-WIN32-DAG: define x86_regcallcc zeroext i1 
@"\01??8@Yw_NABVtest_class@@0@Z"
 
-test_class __regcall operator""_test_class (unsigned long long) { ++x; return 
test_class{};} 
-// CHECK-LIN64-DAG: define x86_regcallcc %class.test_class 
@_Zli11_test_classy(i64)
+test_class __regcall operator""_test_class (unsigned long long) { ++x; return 
test_class{};}
+// CHECK-LIN64-DAG: define x86_regcallcc void 
@_Zli11_test_classy(%class.test_class* noalias sret %agg.result, i64)
 // CHECK-LIN32-DAG: define x86_regcallcc void 
@_Zli11_test_classy(%class.test_class* inreg noalias sret %agg.result, i64)
 // CHECK-WIN64-DAG: \01??__K_test_class@@Yw?AVtest_class@@_K@Z"
 // CHECK-WIN32-DAG: \01??__K_test_class@@Yw?AVtest_class@@_K@Z"
@@ -95,3 +95,11 @@
   freeTempFunc(1);
   t3.do_thing();
 }
+
+long double _Complex __regcall foo(long double _Complex f) {
+  return f;
+}
+// CHECK-LIN64-DAG: define x86_regcallcc void @_Z15__regcall3__fooCe({ 
x86_fp80, x86_fp80 }* noalias sret %agg.result, { x86_fp80, x86_fp80 }* byval 
align 16 %f)
+// CHECK-LIN32-DAG: define x86_regcallcc void @_Z15__regcall3__fooCe({ 
x86_fp80, x86_fp80 }* inreg noalias sret %agg.result, { x86_fp80, x86_fp80 }* 
byval align 4 %f)
+// CHECK-WIN64-DAG: define x86_regcallcc { double, double } 
@"\01?foo@@YwU?$_Complex@O@__clang@@U12@@Z"(double %f.0, double %f.1)
+// CHECK-WIN32-DAG: define x86_regcallcc { double, double } 
@"\01?foo@@YwU?$_Complex@O@__clang@@U12@@Z"(double %f.0, double %f.1)
Index: cfe/trunk/lib/CodeGen/TargetInfo.cpp
===
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp
@@ -882,8 +882,14 @@
 /// X86_VectorCall calling convention. Shared between x86_32 and x86_64.
 static bool isX86VectorTypeForVectorCall(ASTContext , QualType Ty) {
   if (const BuiltinType *BT = Ty->getAs()) {
-if (BT->isFloatingPoint() && BT->getKind() != BuiltinType::Half)
+if (BT->isFloatingPoint() && BT->getKind() != BuiltinType::Half) {
+  if (BT->getKind() == BuiltinType::LongDouble) {
+if (().getLongDoubleFormat() ==
+::APFloat::x87DoubleExtended())
+  return false;
+  }
   return true;
+}
   } else if (const VectorType *VT = Ty->getAs()) {
 // vectorcall can pass XMM, YMM, and ZMM vectors. We don't pass SSE1 MMX
 // registers specially.
@@ -3515,18 +3521,27 @@
   unsigned FreeSSERegs = IsRegCall ? 16 : 8;
   unsigned NeededInt, NeededSSE;
 
-  if (IsRegCall && FI.getReturnType()->getTypePtr()->isRecordType() &&
-  !FI.getReturnType()->getTypePtr()->isUnionType()) {
-FI.getReturnInfo() =
-classifyRegCallStructType(FI.getReturnType(), NeededInt, NeededSSE);
-if (FreeIntRegs >= NeededInt && FreeSSERegs >= NeededSSE) {
-  FreeIntRegs -= NeededInt;
-  FreeSSERegs -= NeededSSE;
-} else {
-  FI.getReturnInfo() = getIndirectReturnResult(FI.getReturnType());
-}
-  } else if (!getCXXABI().classifyReturnType(FI))
-FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+  if (!getCXXABI().classifyReturnType(FI)) {
+if (IsRegCall && FI.getReturnType()->getTypePtr()->isRecordType() &&
+!FI.getReturnType()->getTypePtr()->isUnionType()) {
+  FI.getReturnInfo() =
+  classifyRegCallStructType(FI.getReturnType(), NeededInt, NeededSSE);
+  if (FreeIntRegs >= NeededInt && FreeSSERegs >= NeededSSE) {
+FreeIntRegs -= NeededInt;
+FreeSSERegs -= NeededSSE;
+  } else {
+FI.getReturnInfo() = getIndirectReturnResult(FI.getReturnType());
+  }
+} else if (IsRegCall && FI.getReturnType()->getAs()) {
+  // Complex Long Double Type is passed in Memory when Regcall
+  // calling convention is used.
+  const ComplexType *CT = FI.getReturnType()->getAs();
+  if (getContext().getCanonicalType(CT->getElementType()) ==
+  getContext().LongDoubleTy)
+FI.getReturnInfo() = getIndirectReturnResult(FI.getReturnType());
+} else
+  FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+  }
 
   // If the return value is indirect, then the hidden argument is consuming one
   // integer register.


Index: cfe/trunk/test/CodeGenCXX/regcall.cpp

r308768 - [OPENMP] Initial support for 'in_reduction' clause.

2017-07-21 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Jul 21 11:48:21 2017
New Revision: 308768

URL: http://llvm.org/viewvc/llvm-project?rev=308768=rev
Log:
[OPENMP] Initial support for 'in_reduction' clause.

Parsing/sema analysis for 'in_reduction' clause for task-based
directives.

Added:
cfe/trunk/test/OpenMP/task_in_reduction_message.cpp
cfe/trunk/test/OpenMP/taskloop_in_reduction_messages.cpp
cfe/trunk/test/OpenMP/taskloop_simd_in_reduction_messages.cpp
Modified:
cfe/trunk/include/clang/AST/OpenMPClause.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/OpenMPKinds.def
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/OpenMPClause.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Basic/OpenMPKinds.cpp
cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
cfe/trunk/lib/Parse/ParseOpenMP.cpp
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/test/OpenMP/task_ast_print.cpp
cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/include/clang/AST/OpenMPClause.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=308768=308767=308768=diff
==
--- cfe/trunk/include/clang/AST/OpenMPClause.h (original)
+++ cfe/trunk/include/clang/AST/OpenMPClause.h Fri Jul 21 11:48:21 2017
@@ -2101,6 +2101,216 @@ public:
   }
 };
 
+/// This represents clause 'in_reduction' in the '#pragma omp task' directives.
+///
+/// \code
+/// #pragma omp task in_reduction(+:a,b)
+/// \endcode
+/// In this example directive '#pragma omp task' has clause 'in_reduction' with
+/// operator '+' and the variables 'a' and 'b'.
+///
+class OMPInReductionClause final
+: public OMPVarListClause,
+  public OMPClauseWithPostUpdate,
+  private llvm::TrailingObjects {
+  friend TrailingObjects;
+  friend OMPVarListClause;
+  friend class OMPClauseReader;
+  /// Location of ':'.
+  SourceLocation ColonLoc;
+  /// Nested name specifier for C++.
+  NestedNameSpecifierLoc QualifierLoc;
+  /// Name of custom operator.
+  DeclarationNameInfo NameInfo;
+
+  /// Build clause with number of variables \a N.
+  ///
+  /// \param StartLoc Starting location of the clause.
+  /// \param LParenLoc Location of '('.
+  /// \param EndLoc Ending location of the clause.
+  /// \param ColonLoc Location of ':'.
+  /// \param N Number of the variables in the clause.
+  /// \param QualifierLoc The nested-name qualifier with location information
+  /// \param NameInfo The full name info for reduction identifier.
+  ///
+  OMPInReductionClause(SourceLocation StartLoc, SourceLocation LParenLoc,
+   SourceLocation ColonLoc, SourceLocation EndLoc,
+   unsigned N, NestedNameSpecifierLoc QualifierLoc,
+   const DeclarationNameInfo )
+  : OMPVarListClause(OMPC_in_reduction, StartLoc,
+   LParenLoc, EndLoc, N),
+OMPClauseWithPostUpdate(this), ColonLoc(ColonLoc),
+QualifierLoc(QualifierLoc), NameInfo(NameInfo) {}
+
+  /// Build an empty clause.
+  ///
+  /// \param N Number of variables.
+  ///
+  explicit OMPInReductionClause(unsigned N)
+  : OMPVarListClause(
+OMPC_in_reduction, SourceLocation(), SourceLocation(),
+SourceLocation(), N),
+OMPClauseWithPostUpdate(this), ColonLoc(), QualifierLoc(), NameInfo() 
{}
+
+  /// Sets location of ':' symbol in clause.
+  void setColonLoc(SourceLocation CL) { ColonLoc = CL; }
+  /// Sets the name info for specified reduction identifier.
+  void setNameInfo(DeclarationNameInfo DNI) { NameInfo = DNI; }
+  /// Sets the nested name specifier.
+  void setQualifierLoc(NestedNameSpecifierLoc NSL) { QualifierLoc = NSL; }
+
+  /// Set list of helper expressions, required for proper codegen of the 
clause.
+  /// These expressions represent private copy of the reduction variable.
+  void setPrivates(ArrayRef Privates);
+
+  /// Get the list of helper privates.
+  MutableArrayRef getPrivates() {
+return MutableArrayRef(varlist_end(), varlist_size());
+  }
+  ArrayRef getPrivates() const {
+return llvm::makeArrayRef(varlist_end(), varlist_size());
+  }
+
+  /// Set list of helper expressions, required for proper codegen of the 
clause.
+  /// These expressions represent LHS expression in the final reduction
+  /// expression performed by the reduction clause.
+  void setLHSExprs(ArrayRef LHSExprs);
+
+  /// Get the list of helper LHS expressions.
+  MutableArrayRef getLHSExprs() {
+return MutableArrayRef(getPrivates().end(), varlist_size());
+  }
+  ArrayRef getLHSExprs() const {
+return llvm::makeArrayRef(getPrivates().end(), varlist_size());
+  }
+
+ 

[PATCH] D35715: Preserve typedef names in debug info for template type parameters

2017-07-21 Thread David Majnemer via Phabricator via cfe-commits
majnemer added a comment.

This might be a silly question but why not do this by default?


https://reviews.llvm.org/D35715



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


r308763 - [Hexagon] Add inline-asm constraint 'a' for modifier register class

2017-07-21 Thread Krzysztof Parzyszek via cfe-commits
Author: kparzysz
Date: Fri Jul 21 11:07:15 2017
New Revision: 308763

URL: http://llvm.org/viewvc/llvm-project?rev=308763=rev
Log:
[Hexagon] Add inline-asm constraint 'a' for modifier register class

For example
  asm ("memw(%0++%1) = %2" : : "r"(addr),"a"(mod),"r"(val) : "memory")

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/hexagon-inline-asm.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=308763=308762=308763=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Fri Jul 21 11:07:15 2017
@@ -6887,6 +6887,9 @@ public:
   return true;
 }
 break;
+  case 'a': // Modifier register m0-m1.
+Info.setAllowsRegister();
+return true;
   case 's':
 // Relocatable constant.
 return true;

Modified: cfe/trunk/test/CodeGen/hexagon-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/hexagon-inline-asm.c?rev=308763=308762=308763=diff
==
--- cfe/trunk/test/CodeGen/hexagon-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/hexagon-inline-asm.c Fri Jul 21 11:07:15 2017
@@ -15,3 +15,9 @@ void foo(v64 v0, v64 v1, v64 *p) {
   asm ("%0 = memw(##%1)" : "=r"(r) : "s"());
 // CHECK: call i32 asm "$0 = memw(##$1)", "=r,s"(i32* @g)
 }
+
+void fred(unsigned *p, unsigned m, unsigned v) {
+  asm ("memw(%0++%1) = %2" : : "r"(p),"a"(m),"r"(v) : "memory");
+// CHECK: call void asm sideeffect "memw($0++$1) = $2", "r,a,r,~{memory}"(i32* 
%0, i32 %1, i32 %2)
+}
+


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


[PATCH] D35259: Complex Long Double classification In RegCall calling convention

2017-07-21 Thread Reid Kleckner via Phabricator via cfe-commits
rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm


https://reviews.llvm.org/D35259



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


[PATCH] D35729: [Frontend] - Mark some ASTUnit methods as const

2017-07-21 Thread Hamza Sood via Phabricator via cfe-commits
hamzasood created this revision.

While using the libtooling API, I ran into problems when using a const ASTUnit. 
There were a few functions I needed to use that don't seem to modify anything, 
but they weren't marked as const so I couldn't use them.

This patch marks those methods (and a few others) as const.


https://reviews.llvm.org/D35729

Files:
  include/clang/Frontend/ASTUnit.h
  lib/Frontend/ASTUnit.cpp

Index: lib/Frontend/ASTUnit.cpp
===
--- lib/Frontend/ASTUnit.cpp
+++ lib/Frontend/ASTUnit.cpp
@@ -2395,7 +2395,7 @@
 /// \brief If \arg Loc is a loaded location from the preamble, returns
 /// the corresponding local location of the main file, otherwise it returns
 /// \arg Loc.
-SourceLocation ASTUnit::mapLocationFromPreamble(SourceLocation Loc) {
+SourceLocation ASTUnit::mapLocationFromPreamble(SourceLocation Loc) const {
   FileID PreambleID;
   if (SourceMgr)
 PreambleID = SourceMgr->getPreambleFileID();
@@ -2416,7 +2416,7 @@
 /// \brief If \arg Loc is a local location of the main file but inside the
 /// preamble chunk, returns the corresponding loaded location from the
 /// preamble, otherwise it returns \arg Loc.
-SourceLocation ASTUnit::mapLocationToPreamble(SourceLocation Loc) {
+SourceLocation ASTUnit::mapLocationToPreamble(SourceLocation Loc) const {
   FileID PreambleID;
   if (SourceMgr)
 PreambleID = SourceMgr->getPreambleFileID();
@@ -2434,7 +2434,7 @@
   return Loc;
 }
 
-bool ASTUnit::isInPreambleFileID(SourceLocation Loc) {
+bool ASTUnit::isInPreambleFileID(SourceLocation Loc) const {
   FileID FID;
   if (SourceMgr)
 FID = SourceMgr->getPreambleFileID();
@@ -2445,7 +2445,7 @@
   return SourceMgr->isInFileID(Loc, FID);
 }
 
-bool ASTUnit::isInMainFileID(SourceLocation Loc) {
+bool ASTUnit::isInMainFileID(SourceLocation Loc) const {
   FileID FID;
   if (SourceMgr)
 FID = SourceMgr->getMainFileID();
@@ -2456,7 +2456,7 @@
   return SourceMgr->isInFileID(Loc, FID);
 }
 
-SourceLocation ASTUnit::getEndOfPreambleFileID() {
+SourceLocation ASTUnit::getEndOfPreambleFileID() const {
   FileID FID;
   if (SourceMgr)
 FID = SourceMgr->getPreambleFileID();
@@ -2467,7 +2467,7 @@
   return SourceMgr->getLocForEndOfFile(FID);
 }
 
-SourceLocation ASTUnit::getStartOfMainFileID() {
+SourceLocation ASTUnit::getStartOfMainFileID() const {
   FileID FID;
   if (SourceMgr)
 FID = SourceMgr->getMainFileID();
@@ -2543,7 +2543,7 @@
   return nullptr;
 }
 
-bool ASTUnit::isModuleFile() {
+bool ASTUnit::isModuleFile() const {
   return isMainFileAST() && getLangOpts().isCompilingModule();
 }
 
Index: include/clang/Frontend/ASTUnit.h
===
--- include/clang/Frontend/ASTUnit.h
+++ include/clang/Frontend/ASTUnit.h
@@ -448,7 +448,7 @@
 
   IntrusiveRefCntPtr getASTReader() const;
 
-  StringRef getOriginalSourceFileName() {
+  StringRef getOriginalSourceFileName() const {
 return OriginalSourceFile;
   }
 
@@ -524,26 +524,26 @@
   /// \brief If \p Loc is a loaded location from the preamble, returns
   /// the corresponding local location of the main file, otherwise it returns
   /// \p Loc.
-  SourceLocation mapLocationFromPreamble(SourceLocation Loc);
+  SourceLocation mapLocationFromPreamble(SourceLocation Loc) const;
 
   /// \brief If \p Loc is a local location of the main file but inside the
   /// preamble chunk, returns the corresponding loaded location from the
   /// preamble, otherwise it returns \p Loc.
-  SourceLocation mapLocationToPreamble(SourceLocation Loc);
+  SourceLocation mapLocationToPreamble(SourceLocation Loc) const;
 
-  bool isInPreambleFileID(SourceLocation Loc);
-  bool isInMainFileID(SourceLocation Loc);
-  SourceLocation getStartOfMainFileID();
-  SourceLocation getEndOfPreambleFileID();
+  bool isInPreambleFileID(SourceLocation Loc) const;
+  bool isInMainFileID(SourceLocation Loc) const;
+  SourceLocation getStartOfMainFileID() const;
+  SourceLocation getEndOfPreambleFileID() const;
 
   /// \see mapLocationFromPreamble.
-  SourceRange mapRangeFromPreamble(SourceRange R) {
+  SourceRange mapRangeFromPreamble(SourceRange R) const {
 return SourceRange(mapLocationFromPreamble(R.getBegin()),
mapLocationFromPreamble(R.getEnd()));
   }
 
   /// \see mapLocationToPreamble.
-  SourceRange mapRangeToPreamble(SourceRange R) {
+  SourceRange mapRangeToPreamble(SourceRange R) const {
 return SourceRange(mapLocationToPreamble(R.getBegin()),
mapLocationToPreamble(R.getEnd()));
   }
@@ -607,7 +607,7 @@
 
   /// \brief Returns true if the ASTUnit was constructed from a serialized
   /// module file.
-  bool isModuleFile();
+  bool isModuleFile() const;
 
   std::unique_ptr
   getBufferForFile(StringRef Filename, std::string *ErrorStr = nullptr);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D35701: Break up Targets.cpp into a header/impl pair per target type[NFCI]

2017-07-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added inline comments.



Comment at: lib/Basic/Targets/OSTargets.h:13
+
+//===--===//
+// Defines specific to certain operating systems.

craig.topper wrote:
> This comment seems somewhat redundant with the earlier one.
Ah, yeah.  That one came from copy/paste from the targets file.  removed.


https://reviews.llvm.org/D35701



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


[PATCH] D35701: Break up Targets.cpp into a header/impl pair per target type[NFCI]

2017-07-21 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments.



Comment at: lib/Basic/Targets/OSTargets.h:13
+
+//===--===//
+// Defines specific to certain operating systems.

This comment seems somewhat redundant with the earlier one.


https://reviews.llvm.org/D35701



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


r308759 - [OPENMP] Simplify analysis of data-sharing attributes.

2017-07-21 Thread Alexey Bataev via cfe-commits
Author: abataev
Date: Fri Jul 21 10:24:30 2017
New Revision: 308759

URL: http://llvm.org/viewvc/llvm-project?rev=308759=rev
Log:
[OPENMP] Simplify analysis of data-sharing attributes.

Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/distribute_firstprivate_messages.cpp
cfe/trunk/test/OpenMP/distribute_private_messages.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=308759=308758=308759=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jul 21 10:24:30 
2017
@@ -8822,12 +8822,6 @@ def note_omp_critical_hint_here : Note<
   "%select{|previous }0'hint' clause with value '%1'">;
 def note_omp_critical_no_hint : Note<
   "%select{|previous }0directive with no 'hint' clause specified">;
-def err_omp_firstprivate_distribute_private_teams : Error<
-  "private variable in '#pragma omp teams' cannot be firstprivate in '#pragma 
omp distribute'">;
-def err_omp_firstprivate_and_lastprivate_in_distribute : Error<
-  "lastprivate variable cannot be firstprivate in '#pragma omp distribute'">;
-def err_omp_firstprivate_distribute_in_teams_reduction : Error<
-  "reduction variable in '#pragma omp teams' cannot be firstprivate in 
'#pragma omp distribute'">;
 def err_omp_depend_clause_thread_simd : Error<
   "'depend' clauses cannot be mixed with '%0' clause">;
 def err_omp_depend_sink_expected_loop_iteration : Error<

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=308759=308758=308759=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Jul 21 10:24:30 2017
@@ -540,7 +540,6 @@ DSAStackTy::DSAVarData DSAStackTy::getDS
 return DVar;
   }
 
-  DVar.DKind = Iter->Directive;
   // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
   // in a Construct, C/C++, predetermined, p.1]
   // Variables with automatic storage duration that are declared in a scope
@@ -551,6 +550,7 @@ DSAStackTy::DSAVarData DSAStackTy::getDS
 return DVar;
   }
 
+  DVar.DKind = Iter->Directive;
   // Explicitly specified attributes and local variables with predetermined
   // attributes.
   if (Iter->SharingMap.count(D)) {
@@ -829,11 +829,10 @@ DSAStackTy::DSAVarData DSAStackTy::getTo
 
   // Explicitly specified attributes and local variables with predetermined
   // attributes.
-  auto StartI = std::next(Stack.back().first.rbegin());
+  auto I = Stack.back().first.rbegin();
   auto EndI = Stack.back().first.rend();
-  if (FromParent && StartI != EndI)
-StartI = std::next(StartI);
-  auto I = std::prev(StartI);
+  if (FromParent && I != EndI)
+std::advance(I, 1);
   if (I->SharingMap.count(D)) {
 DVar.RefExpr = I->SharingMap[D].RefExpr.getPointer();
 DVar.PrivateCopy = I->SharingMap[D].PrivateCopy;
@@ -855,7 +854,7 @@ DSAStackTy::DSAVarData DSAStackTy::getIm
   auto StartI = Stack.back().first.rbegin();
   auto EndI = Stack.back().first.rend();
   if (FromParent && StartI != EndI)
-StartI = std::next(StartI);
+std::advance(StartI, 1);
   return getDSA(StartI, D);
 }
 
@@ -867,16 +866,16 @@ DSAStackTy::hasDSA(ValueDecl *D,
   if (isStackEmpty())
 return {};
   D = getCanonicalDecl(D);
-  auto I = (FromParent && Stack.back().first.size() > 1)
-   ? std::next(Stack.back().first.rbegin())
-   : Stack.back().first.rbegin();
+  auto I = Stack.back().first.rbegin();
   auto EndI = Stack.back().first.rend();
-  while (std::distance(I, EndI) > 1) {
+  if (FromParent && I != EndI)
 std::advance(I, 1);
+  for (; I != EndI; std::advance(I, 1)) {
 if (!DPred(I->Directive) && !isParallelOrTaskRegion(I->Directive))
   continue;
-DSAVarData DVar = getDSA(I, D);
-if (CPred(DVar.CKind))
+auto NewI = I;
+DSAVarData DVar = getDSA(NewI, D);
+if (I == NewI && CPred(DVar.CKind))
   return DVar;
   }
   return {};
@@ -889,14 +888,15 @@ DSAStackTy::DSAVarData DSAStackTy::hasIn
   if (isStackEmpty())
 return {};
   D = getCanonicalDecl(D);
-  auto StartI = std::next(Stack.back().first.rbegin());
+  auto StartI = Stack.back().first.rbegin();
   auto EndI = Stack.back().first.rend();
   if (FromParent && StartI != EndI)
-StartI = std::next(StartI);
+std::advance(StartI, 1);
   if (StartI == EndI || !DPred(StartI->Directive))
 return {};
-  DSAVarData DVar = getDSA(StartI, D);
-  return CPred(DVar.CKind) ? DVar : DSAVarData();
+  auto NewI = StartI;
+  DSAVarData DVar = getDSA(NewI, D);
+  return (NewI == StartI && CPred(DVar.CKind)) ? DVar : DSAVarData();
 }
 
 bool DSAStackTy::hasExplicitDSA(

[PATCH] D35701: Break up Targets.cpp into a header/impl pair per target type[NFCI]

2017-07-21 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment.

I think we should drop "using namespace llvm;" from the cpp files. clang 
doesn't usually do that except in codegen and it doesn't look like it was 
required in the original Targets.cpp.


https://reviews.llvm.org/D35701



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


[PATCH] D35726: unguarded availability: add a fixit for the "annotate '...' with an availability attribute to silence" note

2017-07-21 Thread Erik Pilkington via Phabricator via cfe-commits
erik.pilkington added a comment.

Thanks for working on this! This looks like it would be very useful.




Comment at: lib/Sema/SemaDeclAttr.cpp:7230
+return;
+  for (const auto  : S.getPreprocessor().macros()) {
+if (M.first->getName() != "API_AVAILABLE")

Its unfortunate to loop over every macro. Can we use 
Preprocessor::getMacroDefinition()?



Comment at: lib/Sema/SemaDeclAttr.cpp:7231
+  for (const auto  : S.getPreprocessor().macros()) {
+if (M.first->getName() != "API_AVAILABLE")
+  continue;

It would be nice if we could recommend using this macro even if it isn't 
defined, as users might not have included the  header. Maybe 
we can do that on apple platforms, noting that the the macro is declared in 
os/availability.h if it isn't already defined?



Comment at: lib/Sema/SemaDeclAttr.cpp:7238
+std::string Introduced =
+ReferringDecl->getVersionIntroduced().getAsString();
+FixitNoteDiag << FixItHint::CreateInsertion(

OffendingDecl, right? Thats the one with the offending availability attribute



Comment at: lib/Sema/SemaDeclAttr.cpp:7240
+FixitNoteDiag << FixItHint::CreateInsertion(
+Enclosing->getLocStart(), (llvm::Twine("API_AVAILABLE(") +
+   PlatformName + "(" + Introduced + 
"))\n")

I was somewhat uncertain about adding a fixit for this because its difficult to 
determine where exactly the availability attribute should go, it looks like 
this doesn't emit an attribute at the right place for this, for example. (It 
should go after the meth)
```
@interface X
-(new_int)meth;
@end
```
Maybe we can do better if we look at what Enclosing actually declares? It's not 
worth it to emit an incorrect fixit.


Repository:
  rL LLVM

https://reviews.llvm.org/D35726



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


[PATCH] D35715: Preserve typedef names in debug info for template type parameters

2017-07-21 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added inline comments.



Comment at: include/clang/AST/TemplateBase.h:109-111
+// This is the type that most closely resembles what is in the source.
+// At the moment it is retaining typedefs, but not decltype or typeof.
+uintptr_t DisplayType;

I'd like Richard Smith (currently on vacation) to take a look at the changes to 
the AST like this.

(maybe it should be preserving the type as written, including decltype, typeof, 
etc - and those can be stripped out later by debug info emission? Maybe there's 
a way this is useful for clang diagnostics as well - or could leverage/reuse 
techniques already used there)



Comment at: include/clang/Basic/LangOptions.def:266
+LANGOPT(EmitTypedefNamesInTemplateTypes, 1, 0,
+"emit typedef names in template types (DWARF)")
+

aprantl wrote:
> Perhaps PreserveSugarInTemplateTypes since it appears to also affect 
> qualifiers?
Which qualifiers did you have in mind? (normally qualifiers would have to be 
preserved, right? (eg: a template type parameter of 'const int' is distinct 
from a template type parameter of 'int', etc))

Though I tend to agree Sugar's probably a better/broader/more general term here 
- but would love to have concrete examples of what does end up being preserved 
here.

(also having 'debug' or similar (dwarf, etc) in the name of this option might 
be useful - not sure if there's prior art to draw from in terms of other debug 
related langopts)


https://reviews.llvm.org/D35715



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


r308744 - Test commit

2017-07-21 Thread Andrey Kasaurov via cfe-commits
Author: kasaurov
Date: Fri Jul 21 08:24:37 2017
New Revision: 308744

URL: http://llvm.org/viewvc/llvm-project?rev=308744=rev
Log:
Test commit

Modified:
cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp?rev=308744=308743=308744=diff
==
--- cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp Fri Jul 21 08:24:37 2017
@@ -35,7 +35,7 @@ void amdgpu::Linker::ConstructJob(Compil
   CmdArgs, Inputs));
 }
 
-/// AMDGPU Toolchain 
+/// AMDGPU Toolchain
 AMDGPUToolChain::AMDGPUToolChain(const Driver , const llvm::Triple ,
  const ArgList )
   : Generic_ELF(D, Triple, Args) { }


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


[PATCH] D35726: unguarded availability: add a fixit for the "annotate '...' with an availability attribute to silence" note

2017-07-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman created this revision.

The fixit is given only if the `API_AVAILABLE` macro is defined.


Repository:
  rL LLVM

https://reviews.llvm.org/D35726

Files:
  lib/Sema/SemaDeclAttr.cpp
  test/FixIt/fixit-availability.c
  test/FixIt/fixit-availability.mm


Index: test/FixIt/fixit-availability.mm
===
--- test/FixIt/fixit-availability.mm
+++ test/FixIt/fixit-availability.mm
@@ -109,3 +109,21 @@
   anotherFunction(y);
   anotherFunction(x);
 }
+
+#define API_AVAILABLE(X) __attribute__((availability(macos, 
introduced=10.12))) // dummy macro
+
+API_AVAILABLE(macos(10.12))
+@interface NewClass
+@end
+
+@interface OldButOfferFixit
+@property(copy) NewClass *prop;
+// CHECK: 
fix-it:{{.*}}:{[[@LINE-2]]:1-[[@LINE-2]]:1}:"API_AVAILABLE(macos(10.12))\n"
+@end
+
+// Avoid a fixit for declarations that already have an attribute:
+__attribute__((availability(macos, introduced=10.11)))
+@interface WithoutFixit
+@property(copy) NewClass *prop;
+// CHECK-NOT: API_AVAILABLE
+@end
Index: test/FixIt/fixit-availability.c
===
--- test/FixIt/fixit-availability.c
+++ test/FixIt/fixit-availability.c
@@ -8,3 +8,11 @@
 // CHECK: fix-it:{{.*}}:{[[@LINE-1]]:3-[[@LINE-1]]:3}:"if 
(__builtin_available(macOS 10.12, *)) {\n  "
 // CHECK-NEXT: fix-it:{{.*}}:{[[@LINE-2]]:14-[[@LINE-2]]:14}:"\n  } else {\n   
   // Fallback on earlier versions\n  }"
 }
+
+__attribute__((availability(macos, introduced=10.12)))
+struct New { };
+
+struct NoFixit {
+  struct New field;
+};
+// CHECK-NOT: API_AVAILABLE
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -7221,8 +7221,27 @@
   << /*Anonymous*/1 << TD->getKindName();
   return;
 }
-  S.Diag(Enclosing->getLocation(), diag::note_partial_availability_silence)
-  << /*Named*/0 << Enclosing;
+  auto FixitNoteDiag = S.Diag(Enclosing->getLocation(),
+  diag::note_partial_availability_silence)
+   << /*Named*/ 0 << Enclosing;
+  // Don't offer a fixit for declarations with availability attributes.
+  if (Enclosing->hasAttr())
+return;
+  for (const auto  : S.getPreprocessor().macros()) {
+if (M.first->getName() != "API_AVAILABLE")
+  continue;
+std::string PlatformName =
+AvailabilityAttr::getPlatformNameSourceSpelling(
+S.getASTContext().getTargetInfo().getPlatformName())
+.lower();
+std::string Introduced =
+ReferringDecl->getVersionIntroduced().getAsString();
+FixitNoteDiag << FixItHint::CreateInsertion(
+Enclosing->getLocStart(), (llvm::Twine("API_AVAILABLE(") +
+   PlatformName + "(" + Introduced + 
"))\n")
+  .str());
+break;
+  }
 }
 }
 


Index: test/FixIt/fixit-availability.mm
===
--- test/FixIt/fixit-availability.mm
+++ test/FixIt/fixit-availability.mm
@@ -109,3 +109,21 @@
   anotherFunction(y);
   anotherFunction(x);
 }
+
+#define API_AVAILABLE(X) __attribute__((availability(macos, introduced=10.12))) // dummy macro
+
+API_AVAILABLE(macos(10.12))
+@interface NewClass
+@end
+
+@interface OldButOfferFixit
+@property(copy) NewClass *prop;
+// CHECK: fix-it:{{.*}}:{[[@LINE-2]]:1-[[@LINE-2]]:1}:"API_AVAILABLE(macos(10.12))\n"
+@end
+
+// Avoid a fixit for declarations that already have an attribute:
+__attribute__((availability(macos, introduced=10.11)))
+@interface WithoutFixit
+@property(copy) NewClass *prop;
+// CHECK-NOT: API_AVAILABLE
+@end
Index: test/FixIt/fixit-availability.c
===
--- test/FixIt/fixit-availability.c
+++ test/FixIt/fixit-availability.c
@@ -8,3 +8,11 @@
 // CHECK: fix-it:{{.*}}:{[[@LINE-1]]:3-[[@LINE-1]]:3}:"if (__builtin_available(macOS 10.12, *)) {\n  "
 // CHECK-NEXT: fix-it:{{.*}}:{[[@LINE-2]]:14-[[@LINE-2]]:14}:"\n  } else {\n  // Fallback on earlier versions\n  }"
 }
+
+__attribute__((availability(macos, introduced=10.12)))
+struct New { };
+
+struct NoFixit {
+  struct New field;
+};
+// CHECK-NOT: API_AVAILABLE
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -7221,8 +7221,27 @@
   << /*Anonymous*/1 << TD->getKindName();
   return;
 }
-  S.Diag(Enclosing->getLocation(), diag::note_partial_availability_silence)
-  << /*Named*/0 << Enclosing;
+  auto FixitNoteDiag = S.Diag(Enclosing->getLocation(),
+  diag::note_partial_availability_silence)
+   << /*Named*/ 0 << 

[PATCH] D35577: Add -flookup-tables and -fno-lookup-tables flags

2017-07-21 Thread Sumanth Gundapaneni via Phabricator via cfe-commits
sgundapa added a comment.

The discussion is scattered across these patches 
https://reviews.llvm.org/D35578 and https://reviews.llvm.org/D35579.
I will provide a brief summary here:

The idea is to control the generation of data (lookup table) generated from a 
function, specifically when the user is not expecting it.
For hexagon, there is tightly coupled memory and the customers usually place 
"text" in it. 
For functions, which generate lookup tables, it is very very expensive to read 
the table from a far away non-TCM data section.
This option will disable the generation of lookup tables at the expense of code 
bloat. This is really driven by the customers of hexagon backend.


https://reviews.llvm.org/D35577



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


r308741 - Test commit

2017-07-21 Thread Nikolay Haustov via cfe-commits
Author: nhaustov
Date: Fri Jul 21 06:58:11 2017
New Revision: 308741

URL: http://llvm.org/viewvc/llvm-project?rev=308741=rev
Log:
Test commit

Modified:
cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp?rev=308741=308740=308741=diff
==
--- cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/AMDGPU.cpp Fri Jul 21 06:58:11 2017
@@ -35,7 +35,7 @@ void amdgpu::Linker::ConstructJob(Compil
   CmdArgs, Inputs));
 }
 
-/// AMDGPU Toolchain
+/// AMDGPU Toolchain 
 AMDGPUToolChain::AMDGPUToolChain(const Driver , const llvm::Triple ,
  const ArgList )
   : Generic_ELF(D, Triple, Args) { }


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


[PATCH] D35259: Complex Long Double classification In RegCall calling convention

2017-07-21 Thread Elizabeth Andrews via Phabricator via cfe-commits
eandrews updated this revision to Diff 107667.
eandrews added a comment.

Regcall-specific checks for Lin64 now occur only if CXXABI returns false. An 
existing test has also been modified to verify behavior with non trivial 
destructors.


https://reviews.llvm.org/D35259

Files:
  lib/CodeGen/TargetInfo.cpp
  test/CodeGenCXX/regcall.cpp


Index: test/CodeGenCXX/regcall.cpp
===
--- test/CodeGenCXX/regcall.cpp
+++ test/CodeGenCXX/regcall.cpp
@@ -73,8 +73,8 @@
 // CHECK-WIN64-DAG: define x86_regcallcc zeroext i1 
@"\01??8@Yw_NAEBVtest_class@@0@Z"
 // CHECK-WIN32-DAG: define x86_regcallcc zeroext i1 
@"\01??8@Yw_NABVtest_class@@0@Z"
 
-test_class __regcall operator""_test_class (unsigned long long) { ++x; return 
test_class{};} 
-// CHECK-LIN64-DAG: define x86_regcallcc %class.test_class 
@_Zli11_test_classy(i64)
+test_class __regcall operator""_test_class (unsigned long long) { ++x; return 
test_class{};}
+// CHECK-LIN64-DAG: define x86_regcallcc void 
@_Zli11_test_classy(%class.test_class* noalias sret %agg.result, i64)
 // CHECK-LIN32-DAG: define x86_regcallcc void 
@_Zli11_test_classy(%class.test_class* inreg noalias sret %agg.result, i64)
 // CHECK-WIN64-DAG: \01??__K_test_class@@Yw?AVtest_class@@_K@Z"
 // CHECK-WIN32-DAG: \01??__K_test_class@@Yw?AVtest_class@@_K@Z"
@@ -95,3 +95,11 @@
   freeTempFunc(1);
   t3.do_thing();
 }
+
+long double _Complex __regcall foo(long double _Complex f) {
+  return f;
+}
+// CHECK-LIN64-DAG: define x86_regcallcc void @_Z15__regcall3__fooCe({ 
x86_fp80, x86_fp80 }* noalias sret %agg.result, { x86_fp80, x86_fp80 }* byval 
align 16 %f)
+// CHECK-LIN32-DAG: define x86_regcallcc void @_Z15__regcall3__fooCe({ 
x86_fp80, x86_fp80 }* inreg noalias sret %agg.result, { x86_fp80, x86_fp80 }* 
byval align 4 %f)
+// CHECK-WIN64-DAG: define x86_regcallcc { double, double } 
@"\01?foo@@YwU?$_Complex@O@__clang@@U12@@Z"(double %f.0, double %f.1)
+// CHECK-WIN32-DAG: define x86_regcallcc { double, double } 
@"\01?foo@@YwU?$_Complex@O@__clang@@U12@@Z"(double %f.0, double %f.1)
Index: lib/CodeGen/TargetInfo.cpp
===
--- lib/CodeGen/TargetInfo.cpp
+++ lib/CodeGen/TargetInfo.cpp
@@ -882,8 +882,14 @@
 /// X86_VectorCall calling convention. Shared between x86_32 and x86_64.
 static bool isX86VectorTypeForVectorCall(ASTContext , QualType Ty) {
   if (const BuiltinType *BT = Ty->getAs()) {
-if (BT->isFloatingPoint() && BT->getKind() != BuiltinType::Half)
+if (BT->isFloatingPoint() && BT->getKind() != BuiltinType::Half) {
+  if (BT->getKind() == BuiltinType::LongDouble) {
+if (().getLongDoubleFormat() ==
+::APFloat::x87DoubleExtended())
+  return false;
+  }
   return true;
+}
   } else if (const VectorType *VT = Ty->getAs()) {
 // vectorcall can pass XMM, YMM, and ZMM vectors. We don't pass SSE1 MMX
 // registers specially.
@@ -3505,18 +3511,27 @@
   unsigned FreeSSERegs = IsRegCall ? 16 : 8;
   unsigned NeededInt, NeededSSE;
 
-  if (IsRegCall && FI.getReturnType()->getTypePtr()->isRecordType() &&
-  !FI.getReturnType()->getTypePtr()->isUnionType()) {
-FI.getReturnInfo() =
-classifyRegCallStructType(FI.getReturnType(), NeededInt, NeededSSE);
-if (FreeIntRegs >= NeededInt && FreeSSERegs >= NeededSSE) {
-  FreeIntRegs -= NeededInt;
-  FreeSSERegs -= NeededSSE;
-} else {
-  FI.getReturnInfo() = getIndirectReturnResult(FI.getReturnType());
-}
-  } else if (!getCXXABI().classifyReturnType(FI))
-FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+  if (!getCXXABI().classifyReturnType(FI)) {
+if (IsRegCall && FI.getReturnType()->getTypePtr()->isRecordType() &&
+!FI.getReturnType()->getTypePtr()->isUnionType()) {
+  FI.getReturnInfo() =
+  classifyRegCallStructType(FI.getReturnType(), NeededInt, NeededSSE);
+  if (FreeIntRegs >= NeededInt && FreeSSERegs >= NeededSSE) {
+FreeIntRegs -= NeededInt;
+FreeSSERegs -= NeededSSE;
+  } else {
+FI.getReturnInfo() = getIndirectReturnResult(FI.getReturnType());
+  }
+} else if (IsRegCall && FI.getReturnType()->getAs()) {
+  // Complex Long Double Type is passed in Memory when Regcall
+  // calling convention is used.
+  const ComplexType *CT = FI.getReturnType()->getAs();
+  if (getContext().getCanonicalType(CT->getElementType()) ==
+  getContext().LongDoubleTy)
+FI.getReturnInfo() = getIndirectReturnResult(FI.getReturnType());
+} else
+  FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
+  }
 
   // If the return value is indirect, then the hidden argument is consuming one
   // integer register.


Index: test/CodeGenCXX/regcall.cpp
===
--- test/CodeGenCXX/regcall.cpp
+++ test/CodeGenCXX/regcall.cpp
@@ -73,8 +73,8 @@
 // CHECK-WIN64-DAG: define 

[PATCH] D35406: [clangd] Replace ASTUnit with manual AST management.

2017-07-21 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308738: [clangd] Replace ASTUnit with manual AST management. 
(authored by ibiryukov).

Changed prior to commit:
  https://reviews.llvm.org/D35406?vs=107475=107666#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35406

Files:
  clang-tools-extra/trunk/clangd/ClangdServer.cpp
  clang-tools-extra/trunk/clangd/ClangdUnit.cpp
  clang-tools-extra/trunk/clangd/ClangdUnit.h

Index: clang-tools-extra/trunk/clangd/ClangdUnit.h
===
--- clang-tools-extra/trunk/clangd/ClangdUnit.h
+++ clang-tools-extra/trunk/clangd/ClangdUnit.h
@@ -13,6 +13,9 @@
 #include "Path.h"
 #include "Protocol.h"
 #include "clang/Frontend/ASTUnit.h"
+#include "clang/Frontend/PrecompiledPreamble.h"
+#include "clang/Serialization/ASTBitCodes.h"
+#include "clang/Tooling/CompilationDatabase.h"
 #include "clang/Tooling/Core/Replacement.h"
 #include 
 
@@ -70,11 +73,82 @@
   void dumpAST(llvm::raw_ostream ) const;
 
 private:
+  /// Stores and provides access to parsed AST.
+  class ParsedAST {
+  public:
+/// Attempts to run Clang and store parsed AST. If \p Preamble is non-null
+/// it is reused during parsing.
+static llvm::Optional
+Build(std::unique_ptr CI,
+  const PrecompiledPreamble *Preamble,
+  ArrayRef PreambleDeclIDs,
+  std::unique_ptr Buffer,
+  std::shared_ptr PCHs,
+  IntrusiveRefCntPtr VFS);
+
+ParsedAST(ParsedAST &);
+ParsedAST =(ParsedAST &);
+
+~ParsedAST();
+
+ASTContext ();
+const ASTContext () const;
+
+Preprocessor ();
+const Preprocessor () const;
+
+/// This function returns all top-level decls, including those that come
+/// from Preamble. Decls, coming from Preamble, have to be deserialized, so
+/// this call might be expensive.
+ArrayRef getTopLevelDecls();
+
+const std::vector () const;
+
+  private:
+ParsedAST(std::unique_ptr Clang,
+  std::unique_ptr Action,
+  std::vector TopLevelDecls,
+  std::vector PendingTopLevelDecls,
+  std::vector Diags);
+
+  private:
+void ensurePreambleDeclsDeserialized();
+
+// We store an "incomplete" FrontendAction (i.e. no EndSourceFile was called
+// on it) and CompilerInstance used to run it. That way we don't have to do
+// complex memory management of all Clang structures on our own. (They are
+// stored in CompilerInstance and cleaned up by
+// FrontendAction.EndSourceFile).
+std::unique_ptr Clang;
+std::unique_ptr Action;
+
+// Data, stored after parsing.
+std::vector Diags;
+std::vector TopLevelDecls;
+std::vector PendingTopLevelDecls;
+  };
+
+  // Store Preamble and all associated data
+  struct PreambleData {
+PreambleData(PrecompiledPreamble Preamble,
+ std::vector TopLevelDeclIDs,
+ std::vector Diags);
+
+PrecompiledPreamble Preamble;
+std::vector TopLevelDeclIDs;
+std::vector Diags;
+  };
+
+  SourceLocation getBeginningOfIdentifier(const Position ,
+  const FileEntry *FE) const;
+
   Path FileName;
-  std::unique_ptr Unit;
-  std::shared_ptr PCHs;
+  tooling::CompileCommand Command;
 
-  SourceLocation getBeginningOfIdentifier(const Position& Pos, const FileEntry* FE) const;
+  llvm::Optional Preamble;
+  llvm::Optional Unit;
+
+  std::shared_ptr PCHs;
 };
 
 } // namespace clangd
Index: clang-tools-extra/trunk/clangd/ClangdUnit.cpp
===
--- clang-tools-extra/trunk/clangd/ClangdUnit.cpp
+++ clang-tools-extra/trunk/clangd/ClangdUnit.cpp
@@ -9,23 +9,219 @@
 
 #include "ClangdUnit.h"
 
-#include "clang/Frontend/ASTUnit.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/CompilerInvocation.h"
+#include "clang/Frontend/FrontendActions.h"
 #include "clang/Frontend/Utils.h"
-#include "clang/Index/IndexingAction.h"
 #include "clang/Index/IndexDataConsumer.h"
+#include "clang/Index/IndexingAction.h"
 #include "clang/Lex/Lexer.h"
 #include "clang/Lex/MacroInfo.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/PreprocessorOptions.h"
+#include "clang/Sema/Sema.h"
+#include "clang/Serialization/ASTWriter.h"
 #include "clang/Tooling/CompilationDatabase.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/Format.h"
 
 #include 
 
 using namespace clang::clangd;
 using namespace clang;
 
+namespace {
+
+class DeclTrackingASTConsumer : public ASTConsumer {
+public:
+  DeclTrackingASTConsumer(std::vector )
+  : TopLevelDecls(TopLevelDecls) {}
+
+  bool HandleTopLevelDecl(DeclGroupRef DG) override {
+for (const Decl *D : DG) {
+  // ObjCMethodDecl are not actually top-level decls.
+  if (isa(D))
+continue;
+
+  

[clang-tools-extra] r308738 - [clangd] Replace ASTUnit with manual AST management.

2017-07-21 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Fri Jul 21 06:29:29 2017
New Revision: 308738

URL: http://llvm.org/viewvc/llvm-project?rev=308738=rev
Log:
[clangd] Replace ASTUnit with manual AST management.

Summary:
This refactoring does not aim to introduce any significant changes to
the behaviour of clangd to keep the change as simple as possible.

Reviewers: klimek, krasimir, bkramer

Reviewed By: krasimir

Subscribers: malaperle, cfe-commits

Tags: #clang-tools-extra

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

Modified:
clang-tools-extra/trunk/clangd/ClangdServer.cpp
clang-tools-extra/trunk/clangd/ClangdUnit.cpp
clang-tools-extra/trunk/clangd/ClangdUnit.h

Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=308738=308737=308738=diff
==
--- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Fri Jul 21 06:29:29 2017
@@ -205,14 +205,11 @@ ClangdServer::codeComplete(PathRef File,
 
   std::vector Result;
   auto TaggedFS = FSProvider.getTaggedFileSystem(File);
-  // It would be nice to use runOnUnitWithoutReparse here, but we can't
-  // guarantee the correctness of code completion cache here if we don't do the
-  // reparse.
-  Units.runOnUnit(File, *OverridenContents, ResourceDir, CDB, PCHs,
-  TaggedFS.Value, [&](ClangdUnit ) {
-Result = Unit.codeComplete(*OverridenContents, Pos,
-   TaggedFS.Value);
-  });
+  Units.runOnUnitWithoutReparse(File, *OverridenContents, ResourceDir, CDB,
+PCHs, TaggedFS.Value, [&](ClangdUnit ) {
+  Result = Unit.codeComplete(
+  *OverridenContents, Pos, TaggedFS.Value);
+});
   return make_tagged(std::move(Result), TaggedFS.Tag);
 }
 

Modified: clang-tools-extra/trunk/clangd/ClangdUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdUnit.cpp?rev=308738=308737=308738=diff
==
--- clang-tools-extra/trunk/clangd/ClangdUnit.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdUnit.cpp Fri Jul 21 06:29:29 2017
@@ -9,16 +9,22 @@
 
 #include "ClangdUnit.h"
 
-#include "clang/Frontend/ASTUnit.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Frontend/CompilerInvocation.h"
+#include "clang/Frontend/FrontendActions.h"
 #include "clang/Frontend/Utils.h"
-#include "clang/Index/IndexingAction.h"
 #include "clang/Index/IndexDataConsumer.h"
+#include "clang/Index/IndexingAction.h"
 #include "clang/Lex/Lexer.h"
 #include "clang/Lex/MacroInfo.h"
 #include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/PreprocessorOptions.h"
+#include "clang/Sema/Sema.h"
+#include "clang/Serialization/ASTWriter.h"
 #include "clang/Tooling/CompilationDatabase.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/Format.h"
 
 #include 
@@ -26,6 +32,196 @@
 using namespace clang::clangd;
 using namespace clang;
 
+namespace {
+
+class DeclTrackingASTConsumer : public ASTConsumer {
+public:
+  DeclTrackingASTConsumer(std::vector )
+  : TopLevelDecls(TopLevelDecls) {}
+
+  bool HandleTopLevelDecl(DeclGroupRef DG) override {
+for (const Decl *D : DG) {
+  // ObjCMethodDecl are not actually top-level decls.
+  if (isa(D))
+continue;
+
+  TopLevelDecls.push_back(D);
+}
+return true;
+  }
+
+private:
+  std::vector 
+};
+
+class ClangdFrontendAction : public SyntaxOnlyAction {
+public:
+  std::vector takeTopLevelDecls() {
+return std::move(TopLevelDecls);
+  }
+
+protected:
+  std::unique_ptr CreateASTConsumer(CompilerInstance ,
+ StringRef InFile) override {
+return llvm::make_unique(/*ref*/ TopLevelDecls);
+  }
+
+private:
+  std::vector TopLevelDecls;
+};
+
+class ClangdUnitPreambleCallbacks : public PreambleCallbacks {
+public:
+  std::vector takeTopLevelDeclIDs() {
+return std::move(TopLevelDeclIDs);
+  }
+
+  void AfterPCHEmitted(ASTWriter ) override {
+TopLevelDeclIDs.reserve(TopLevelDecls.size());
+for (Decl *D : TopLevelDecls) {
+  // Invalid top-level decls may not have been serialized.
+  if (D->isInvalidDecl())
+continue;
+  TopLevelDeclIDs.push_back(Writer.getDeclID(D));
+}
+  }
+
+  void HandleTopLevelDecl(DeclGroupRef DG) override {
+for (Decl *D : DG) {
+  if (isa(D))
+continue;
+  TopLevelDecls.push_back(D);
+}
+  }
+
+private:
+  std::vector TopLevelDecls;
+  std::vector TopLevelDeclIDs;
+};
+
+/// Convert from clang diagnostic level to LSP severity.
+static int 

r308737 - [clang-diff] Get rid of unused variable warnings in ASTDiff.cpp

2017-07-21 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Fri Jul 21 06:18:51 2017
New Revision: 308737

URL: http://llvm.org/viewvc/llvm-project?rev=308737=rev
Log:
[clang-diff] Get rid of unused variable warnings in ASTDiff.cpp

Modified:
cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp

Modified: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp?rev=308737=308736=308737=diff
==
--- cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp (original)
+++ cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp Fri Jul 21 06:18:51 2017
@@ -279,9 +279,7 @@ std::string SyntaxTreeImpl::getNodeValue
 return X->getString();
   if (auto *X = DTN.get())
 return X->getNameAsString() + "(" + X->getType().getAsString() + ")";
-  if (auto *X = DTN.get())
-return "";
-  if (auto *X = DTN.get())
+  if (DTN.get() || DTN.get())
 return "";
   std::string Value;
   if (auto *X = DTN.get()) {
@@ -297,15 +295,15 @@ std::string SyntaxTreeImpl::getNodeValue
 Value += X->getNameAsString() + ";";
   if (auto *X = DTN.get())
 return Value + X->getUnderlyingType().getAsString() + ";";
-  if (auto *X = DTN.get())
+  if (DTN.get())
 return Value;
   if (auto *X = DTN.get())
 if (X->getTypeForDecl())
   Value +=
   X->getTypeForDecl()->getCanonicalTypeInternal().getAsString() + ";";
-  if (auto *X = DTN.get())
+  if (DTN.get())
 return Value;
-  if (auto *X = DTN.get())
+  if (DTN.get())
 return "";
   llvm_unreachable("Fatal: unhandled AST node.\n");
 }


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


r308735 - Clang's tests should depend on clang-diff

2017-07-21 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Fri Jul 21 06:12:01 2017
New Revision: 308735

URL: http://llvm.org/viewvc/llvm-project?rev=308735=rev
Log:
Clang's tests should depend on clang-diff

Modified:
cfe/trunk/test/CMakeLists.txt

Modified: cfe/trunk/test/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CMakeLists.txt?rev=308735=308734=308735=diff
==
--- cfe/trunk/test/CMakeLists.txt (original)
+++ cfe/trunk/test/CMakeLists.txt Fri Jul 21 06:12:01 2017
@@ -48,6 +48,7 @@ list(APPEND CLANG_TEST_DEPS
   clang-offload-bundler
   clang-import-test
   clang-rename
+  clang-diff
   )
   
 if(CLANG_ENABLE_STATIC_ANALYZER)


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


r308734 - Fix another compiler error from r308731

2017-07-21 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Fri Jul 21 06:04:57 2017
New Revision: 308734

URL: http://llvm.org/viewvc/llvm-project?rev=308734=rev
Log:
Fix another compiler error from r308731

std::pair in emplace back couldn't be constructed because SNodeId has an
explicit constructor. Not sure how this even compiled on my machine before.

Modified:
cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp

Modified: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp?rev=308734=308733=308734=diff
==
--- cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp (original)
+++ cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp Fri Jul 21 06:04:57 2017
@@ -469,7 +469,7 @@ public:
 
 bool RootNodePair = true;
 
-TreePairs.emplace_back(S1.getSize(), S2.getSize());
+TreePairs.emplace_back(SNodeId(S1.getSize()), SNodeId(S2.getSize()));
 
 while (!TreePairs.empty()) {
   SNodeId LastRow, LastCol, FirstRow, FirstCol, Row, Col;


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


r308733 - Fix tuple construction compiler error from r308731

2017-07-21 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Fri Jul 21 05:57:40 2017
New Revision: 308733

URL: http://llvm.org/viewvc/llvm-project?rev=308733=rev
Log:
Fix tuple construction compiler error from r308731

Modified:
cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp

Modified: cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp?rev=308733=308732=308733=diff
==
--- cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp (original)
+++ cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp Fri Jul 21 05:57:40 2017
@@ -138,7 +138,7 @@ struct PreorderVisitor : public Recursiv
 Parent = MyId;
 ++Id;
 ++Depth;
-return {MyId, Root.getNode(MyId).Parent};
+return std::make_tuple(MyId, Root.getNode(MyId).Parent);
   }
   void PostTraverse(std::tuple State) {
 NodeId MyId, PreviousParent;


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


[PATCH] D34329: [clang-diff] Initial implementation.

2017-07-21 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308731: [clang-diff] Add initial implementation (authored by 
arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D34329?vs=105161=107661#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34329

Files:
  cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h
  cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiffInternal.h
  cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp
  cfe/trunk/lib/Tooling/ASTDiff/CMakeLists.txt
  cfe/trunk/lib/Tooling/CMakeLists.txt
  cfe/trunk/test/Tooling/clang-diff-basic.cpp
  cfe/trunk/tools/CMakeLists.txt
  cfe/trunk/tools/clang-diff/CMakeLists.txt
  cfe/trunk/tools/clang-diff/ClangDiff.cpp

Index: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h
===
--- cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h
+++ cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h
@@ -0,0 +1,108 @@
+//===- ASTDiff.h - AST differencing API ---*- C++ -*- -===//
+//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file specifies an interface that can be used to compare C++ syntax
+// trees.
+//
+// We use the gumtree algorithm which combines a heuristic top-down search that
+// is able to match large subtrees that are equivalent, with an optimal
+// algorithm to match small subtrees.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFF_H
+#define LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFF_H
+
+#include "clang/Tooling/ASTDiff/ASTDiffInternal.h"
+
+namespace clang {
+namespace diff {
+
+class SyntaxTree;
+
+class ASTDiff {
+public:
+  ASTDiff(SyntaxTree , SyntaxTree , const ComparisonOptions );
+  ~ASTDiff();
+
+  // Returns a list of matches.
+  std::vector getMatches();
+  /// Returns an edit script.
+  std::vector getChanges();
+
+  // Prints an edit action.
+  void printChange(raw_ostream , const Change ) const;
+  // Prints a match between two nodes.
+  void printMatch(raw_ostream , const Match ) const;
+
+  class Impl;
+
+private:
+  std::unique_ptr DiffImpl;
+};
+
+/// SyntaxTree objects represent subtrees of the AST.
+/// They can be constructed from any Decl or Stmt.
+class SyntaxTree {
+public:
+  /// Constructs a tree from a translation unit.
+  SyntaxTree(const ASTContext );
+  /// Constructs a tree from any AST node.
+  template 
+  SyntaxTree(T *Node, const ASTContext )
+  : TreeImpl(llvm::make_unique(this, Node, AST)) {}
+
+  /// Serialize the node attributes to a string representation. This should
+  /// uniquely distinguish nodes of the same kind. Note that this function just
+  /// returns a representation of the node value, not considering descendants.
+  std::string getNodeValue(const DynTypedNode ) const;
+
+  void printAsJson(raw_ostream );
+
+  std::unique_ptr TreeImpl;
+};
+
+struct ComparisonOptions {
+  /// During top-down matching, only consider nodes of at least this height.
+  int MinHeight = 2;
+
+  /// During bottom-up matching, match only nodes with at least this value as
+  /// the ratio of their common descendants.
+  double MinSimilarity = 0.2;
+
+  /// Whenever two subtrees are matched in the bottom-up phase, the optimal
+  /// mapping is computed, unless the size of either subtrees exceeds this.
+  int MaxSize = 100;
+
+  /// If this is set to true, nodes that have parents that must not be matched
+  /// (see NodeComparison) will be allowed to be matched.
+  bool EnableMatchingWithUnmatchableParents = false;
+
+  /// Returns false if the nodes should never be matched.
+  bool isMatchingAllowed(const DynTypedNode , const DynTypedNode ) const {
+return N1.getNodeKind().isSame(N2.getNodeKind());
+  }
+
+  /// Returns zero if the nodes are considered to be equal.  Returns a value
+  /// indicating the editing distance between the nodes otherwise.
+  /// There is no need to consider nodes that cannot be matched as input for
+  /// this function (see isMatchingAllowed).
+  double getNodeDistance(const SyntaxTree , const DynTypedNode ,
+ const SyntaxTree , const DynTypedNode ) const {
+if (T1.getNodeValue(N1) == T2.getNodeValue(N2))
+  return 0;
+return 1;
+  }
+};
+
+} // end namespace diff
+} // end namespace clang
+
+#endif
Index: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiffInternal.h
===
--- cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiffInternal.h
+++ cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiffInternal.h
@@ -0,0 +1,192 @@
+//===- ASTDiffInternal.h --*- C++ -*- -===//
+//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is 

r308731 - [clang-diff] Add initial implementation

2017-07-21 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Fri Jul 21 05:49:28 2017
New Revision: 308731

URL: http://llvm.org/viewvc/llvm-project?rev=308731=rev
Log:
[clang-diff] Add initial implementation

This is the first commit for the "Clang-based C/C++ diff tool" GSoC project.

ASTDiff is a new library that computes a structural AST diff between two ASTs
using the gumtree algorithm. Clang-diff is a new Clang tool that will show
the structural code changes between different ASTs.

Patch by Johannes Altmanninger!

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

Added:
cfe/trunk/include/clang/Tooling/ASTDiff/
cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h
cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiffInternal.h
cfe/trunk/lib/Tooling/ASTDiff/
cfe/trunk/lib/Tooling/ASTDiff/ASTDiff.cpp
cfe/trunk/lib/Tooling/ASTDiff/CMakeLists.txt
cfe/trunk/test/Tooling/clang-diff-basic.cpp
cfe/trunk/tools/clang-diff/
cfe/trunk/tools/clang-diff/CMakeLists.txt
cfe/trunk/tools/clang-diff/ClangDiff.cpp
Modified:
cfe/trunk/lib/Tooling/CMakeLists.txt
cfe/trunk/tools/CMakeLists.txt

Added: cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h?rev=308731=auto
==
--- cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h (added)
+++ cfe/trunk/include/clang/Tooling/ASTDiff/ASTDiff.h Fri Jul 21 05:49:28 2017
@@ -0,0 +1,108 @@
+//===- ASTDiff.h - AST differencing API ---*- C++ -*- 
-===//
+//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+//
+// This file specifies an interface that can be used to compare C++ syntax
+// trees.
+//
+// We use the gumtree algorithm which combines a heuristic top-down search that
+// is able to match large subtrees that are equivalent, with an optimal
+// algorithm to match small subtrees.
+//
+//===--===//
+
+#ifndef LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFF_H
+#define LLVM_CLANG_TOOLING_ASTDIFF_ASTDIFF_H
+
+#include "clang/Tooling/ASTDiff/ASTDiffInternal.h"
+
+namespace clang {
+namespace diff {
+
+class SyntaxTree;
+
+class ASTDiff {
+public:
+  ASTDiff(SyntaxTree , SyntaxTree , const ComparisonOptions );
+  ~ASTDiff();
+
+  // Returns a list of matches.
+  std::vector getMatches();
+  /// Returns an edit script.
+  std::vector getChanges();
+
+  // Prints an edit action.
+  void printChange(raw_ostream , const Change ) const;
+  // Prints a match between two nodes.
+  void printMatch(raw_ostream , const Match ) const;
+
+  class Impl;
+
+private:
+  std::unique_ptr DiffImpl;
+};
+
+/// SyntaxTree objects represent subtrees of the AST.
+/// They can be constructed from any Decl or Stmt.
+class SyntaxTree {
+public:
+  /// Constructs a tree from a translation unit.
+  SyntaxTree(const ASTContext );
+  /// Constructs a tree from any AST node.
+  template 
+  SyntaxTree(T *Node, const ASTContext )
+  : TreeImpl(llvm::make_unique(this, Node, AST)) {}
+
+  /// Serialize the node attributes to a string representation. This should
+  /// uniquely distinguish nodes of the same kind. Note that this function just
+  /// returns a representation of the node value, not considering descendants.
+  std::string getNodeValue(const DynTypedNode ) const;
+
+  void printAsJson(raw_ostream );
+
+  std::unique_ptr TreeImpl;
+};
+
+struct ComparisonOptions {
+  /// During top-down matching, only consider nodes of at least this height.
+  int MinHeight = 2;
+
+  /// During bottom-up matching, match only nodes with at least this value as
+  /// the ratio of their common descendants.
+  double MinSimilarity = 0.2;
+
+  /// Whenever two subtrees are matched in the bottom-up phase, the optimal
+  /// mapping is computed, unless the size of either subtrees exceeds this.
+  int MaxSize = 100;
+
+  /// If this is set to true, nodes that have parents that must not be matched
+  /// (see NodeComparison) will be allowed to be matched.
+  bool EnableMatchingWithUnmatchableParents = false;
+
+  /// Returns false if the nodes should never be matched.
+  bool isMatchingAllowed(const DynTypedNode , const DynTypedNode ) const 
{
+return N1.getNodeKind().isSame(N2.getNodeKind());
+  }
+
+  /// Returns zero if the nodes are considered to be equal.  Returns a value
+  /// indicating the editing distance between the nodes otherwise.
+  /// There is no need to consider nodes that cannot be matched as input for
+  /// this function (see isMatchingAllowed).
+  double getNodeDistance(const SyntaxTree , const DynTypedNode ,
+ const SyntaxTree , const DynTypedNode ) const {
+if (T1.getNodeValue(N1) == T2.getNodeValue(N2))
+  return 

[PATCH] D35718: [clang-tidy] Do not issue fixit for explicit template specializations

2017-07-21 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh requested changes to this revision.
alexfh added inline comments.
This revision now requires changes to proceed.



Comment at: test/clang-tidy/performance-unnecessary-value-param.cpp:358
+void templateFunction(ExpensiveToCopyType E) {
+  // CHECK-MESSAGES: [[@LINE-1]]:64: warning: the parameter 'E' is copied
+  E.constReference();

Did you mean to add a CHECK-FIXES to ensure the code stays unchanged?


Repository:
  rL LLVM

https://reviews.llvm.org/D35718



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


[PATCH] D35406: [clangd] Replace ASTUnit with manual AST management.

2017-07-21 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir accepted this revision.
krasimir added a comment.
This revision is now accepted and ready to land.

Looks good!


https://reviews.llvm.org/D35406



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


[PATCH] D31326: Add option to export fixes to run-clang-tidy.py

2017-07-21 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment.

Committed as r308726.

Thank you for the contribution!

One note for the future: the patch doesn't contain repository-based paths, so I 
had to apply it manually. There's a good documentation at 
http://llvm.org/docs/Phabricator.html, which you could follow to create the 
patch next time. Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D31326



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


[PATCH] D31326: Add option to export fixes to run-clang-tidy.py

2017-07-21 Thread Alexander Kornienko via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308726: [clang-tidy] Add option to export fixes to 
run-clang-tidy.py (authored by alexfh).

Changed prior to commit:
  https://reviews.llvm.org/D31326?vs=107633=107650#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31326

Files:
  clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py

Index: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
===
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
@@ -36,6 +36,7 @@
 
 from __future__ import print_function
 import argparse
+import glob
 import json
 import multiprocessing
 import os
@@ -47,6 +48,7 @@
 import tempfile
 import threading
 import traceback
+import yaml
 
 
 def find_compilation_database(path):
@@ -89,6 +91,31 @@
   return start
 
 
+def merge_replacement_files(tmpdir, mergefile):
+  """Merge all replacement files in a directory into a single file"""
+  # The fixes suggested by clang-tidy >= 4.0.0 are given under
+  # the top level key 'Diagnostics' in the output yaml files
+  mergekey="Diagnostics"
+  merged=[]
+  for replacefile in glob.iglob(os.path.join(tmpdir, '*.yaml')):
+content = yaml.safe_load(open(replacefile, 'r'))
+if not content:
+  continue # Skip empty files.
+merged.extend(content.get(mergekey, []))
+
+  if merged:
+# MainSourceFile: The key is required by the definition inside
+# include/clang/Tooling/ReplacementsYaml.h, but the value
+# is actually never used inside clang-apply-replacements,
+# so we set it to '' here.
+output = { 'MainSourceFile': '', mergekey: merged }
+with open(mergefile, 'w') as out:
+  yaml.safe_dump(output, out)
+  else:
+# Empty the file:
+open(mergefile, 'w').close()
+
+
 def check_clang_apply_replacements_binary(args):
   """Checks if invoking supplied clang-apply-replacements binary works."""
   try:
@@ -101,7 +128,7 @@
 
 
 def apply_fixes(args, tmpdir):
-  """Calls clang-apply-fixes on a given directory. Deletes the dir when done."""
+  """Calls clang-apply-fixes on a given directory."""
   invocation = [args.clang_apply_replacements_binary]
   if args.format:
 invocation.append('-format')
@@ -143,6 +170,9 @@
   'headers to output diagnostics from. Diagnostics from '
   'the main file of each translation unit are always '
   'displayed.')
+  parser.add_argument('-export-fixes', metavar='filename', dest='export_fixes',
+  help='Create a yaml file to store suggested fixes in, '
+  'which can be applied with clang-apply-replacements.')
   parser.add_argument('-j', type=int, default=0,
   help='number of tidy instances to be run in parallel.')
   parser.add_argument('files', nargs='*', default=['.*'],
@@ -194,7 +224,7 @@
 max_task = multiprocessing.cpu_count()
 
   tmpdir = None
-  if args.fix:
+  if args.fix or args.export_fixes:
 check_clang_apply_replacements_binary(args)
 tmpdir = tempfile.mkdtemp()
 
@@ -222,24 +252,32 @@
 # This is a sad hack. Unfortunately subprocess goes
 # bonkers with ctrl-c and we start forking merrily.
 print('\nCtrl-C detected, goodbye.')
-if args.fix:
+if tmpdir:
   shutil.rmtree(tmpdir)
 os.kill(0, 9)
 
+  return_code = 0
+  if args.export_fixes:
+print('Writing fixes to ' + args.export_fixes + ' ...')
+try:
+  merge_replacement_files(tmpdir, args.export_fixes)
+except:
+  print('Error exporting fixes.\n', file=sys.stderr)
+  traceback.print_exc()
+  return_code=1
+
   if args.fix:
 print('Applying fixes ...')
-successfully_applied = False
-
 try:
   apply_fixes(args, tmpdir)
-  successfully_applied = True
 except:
   print('Error applying fixes.\n', file=sys.stderr)
   traceback.print_exc()
+  return_code=1
 
+  if tmpdir:
 shutil.rmtree(tmpdir)
-if not successfully_applied:
-  sys.exit(1)
+  sys.exit(return_code)
 
 if __name__ == '__main__':
   main()
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r308726 - [clang-tidy] Add option to export fixes to run-clang-tidy.py

2017-07-21 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Fri Jul 21 03:31:26 2017
New Revision: 308726

URL: http://llvm.org/viewvc/llvm-project?rev=308726=rev
Log:
[clang-tidy] Add option to export fixes to run-clang-tidy.py

This patch adds the option to keep the list of proposed fixes even though they
should not be applied.

This allows to detect possible fixes using the parallelised run-clang-tidy.py
and apply them using clang-apply-replacements at a later time.
Essentially the patch causes the individual temporary yaml files by the parallel
clang-tidy instances to be merged into one user-defined file.

Patch by Michael F. Herbst!
Differential revision: https://reviews.llvm.org/D31326

Modified:
clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py

Modified: clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py?rev=308726=308725=308726=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/run-clang-tidy.py Fri Jul 21 
03:31:26 2017
@@ -36,6 +36,7 @@ http://clang.llvm.org/docs/HowToSetupToo
 
 from __future__ import print_function
 import argparse
+import glob
 import json
 import multiprocessing
 import os
@@ -47,6 +48,7 @@ import sys
 import tempfile
 import threading
 import traceback
+import yaml
 
 
 def find_compilation_database(path):
@@ -89,6 +91,31 @@ def get_tidy_invocation(f, clang_tidy_bi
   return start
 
 
+def merge_replacement_files(tmpdir, mergefile):
+  """Merge all replacement files in a directory into a single file"""
+  # The fixes suggested by clang-tidy >= 4.0.0 are given under
+  # the top level key 'Diagnostics' in the output yaml files
+  mergekey="Diagnostics"
+  merged=[]
+  for replacefile in glob.iglob(os.path.join(tmpdir, '*.yaml')):
+content = yaml.safe_load(open(replacefile, 'r'))
+if not content:
+  continue # Skip empty files.
+merged.extend(content.get(mergekey, []))
+
+  if merged:
+# MainSourceFile: The key is required by the definition inside
+# include/clang/Tooling/ReplacementsYaml.h, but the value
+# is actually never used inside clang-apply-replacements,
+# so we set it to '' here.
+output = { 'MainSourceFile': '', mergekey: merged }
+with open(mergefile, 'w') as out:
+  yaml.safe_dump(output, out)
+  else:
+# Empty the file:
+open(mergefile, 'w').close()
+
+
 def check_clang_apply_replacements_binary(args):
   """Checks if invoking supplied clang-apply-replacements binary works."""
   try:
@@ -101,7 +128,7 @@ def check_clang_apply_replacements_binar
 
 
 def apply_fixes(args, tmpdir):
-  """Calls clang-apply-fixes on a given directory. Deletes the dir when 
done."""
+  """Calls clang-apply-fixes on a given directory."""
   invocation = [args.clang_apply_replacements_binary]
   if args.format:
 invocation.append('-format')
@@ -143,6 +170,9 @@ def main():
   'headers to output diagnostics from. Diagnostics from '
   'the main file of each translation unit are always '
   'displayed.')
+  parser.add_argument('-export-fixes', metavar='filename', dest='export_fixes',
+  help='Create a yaml file to store suggested fixes in, '
+  'which can be applied with clang-apply-replacements.')
   parser.add_argument('-j', type=int, default=0,
   help='number of tidy instances to be run in parallel.')
   parser.add_argument('files', nargs='*', default=['.*'],
@@ -194,7 +224,7 @@ def main():
 max_task = multiprocessing.cpu_count()
 
   tmpdir = None
-  if args.fix:
+  if args.fix or args.export_fixes:
 check_clang_apply_replacements_binary(args)
 tmpdir = tempfile.mkdtemp()
 
@@ -222,24 +252,32 @@ def main():
 # This is a sad hack. Unfortunately subprocess goes
 # bonkers with ctrl-c and we start forking merrily.
 print('\nCtrl-C detected, goodbye.')
-if args.fix:
+if tmpdir:
   shutil.rmtree(tmpdir)
 os.kill(0, 9)
 
+  return_code = 0
+  if args.export_fixes:
+print('Writing fixes to ' + args.export_fixes + ' ...')
+try:
+  merge_replacement_files(tmpdir, args.export_fixes)
+except:
+  print('Error exporting fixes.\n', file=sys.stderr)
+  traceback.print_exc()
+  return_code=1
+
   if args.fix:
 print('Applying fixes ...')
-successfully_applied = False
-
 try:
   apply_fixes(args, tmpdir)
-  successfully_applied = True
 except:
   print('Error applying fixes.\n', file=sys.stderr)
   traceback.print_exc()
+  return_code=1
 
+  if tmpdir:
 shutil.rmtree(tmpdir)
-if not successfully_applied:
-  sys.exit(1)
+  sys.exit(return_code)
 
 if __name__ == '__main__':
   main()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D35485: [clang-format] Fix comment levels between '}' and PPDirective

2017-07-21 Thread Krasimir Georgiev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308725: [clang-format] Fix comment levels between '}' and 
PPDirective (authored by krasimir).

Repository:
  rL LLVM

https://reviews.llvm.org/D35485

Files:
  cfe/trunk/lib/Format/UnwrappedLineParser.cpp
  cfe/trunk/unittests/Format/FormatTestComments.cpp

Index: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
===
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp
@@ -486,14 +486,15 @@
 return;
   }
 
+  flushComments(isOnNewLine(*FormatTok));
+  Line->Level = InitialLevel;
   nextToken(); // Munch the closing brace.
 
   if (MacroBlock && FormatTok->is(tok::l_paren))
 parseParens();
 
   if (MunchSemi && FormatTok->Tok.is(tok::semi))
 nextToken();
-  Line->Level = InitialLevel;
   Line->MatchingOpeningBlockLineIndex = OpeningLineIndex;
   if (OpeningLineIndex != UnwrappedLine::kInvalidIndex) {
 // Update the opening line to add the forward reference as well
Index: cfe/trunk/unittests/Format/FormatTestComments.cpp
===
--- cfe/trunk/unittests/Format/FormatTestComments.cpp
+++ cfe/trunk/unittests/Format/FormatTestComments.cpp
@@ -836,6 +836,25 @@
"  int j;\n"
"}"));
 
+  EXPECT_EQ("int f(int i) {\n"
+"  if (true) {\n"
+"++i;\n"
+"  }\n"
+"  // comment\n"
+"#ifdef A\n"
+"  int j;\n"
+"#endif\n"
+"}",
+format("int f(int i) {\n"
+   "  if (true) {\n"
+   "++i;\n"
+   "  }\n"
+   "  // comment\n"
+   "#ifdef A\n"
+   "int j;\n"
+   "#endif\n"
+   "}"));
+
   // Keep the current level if there is an empty line between the comment and
   // the preprocessor directive.
   EXPECT_EQ("void f() {\n"
@@ -853,6 +872,46 @@
"  int j;\n"
"}"));
 
+  EXPECT_EQ("void f() {\n"
+"  int i;\n"
+"  return i;\n"
+"}\n"
+"// comment\n"
+"\n"
+"#ifdef A\n"
+"int i;\n"
+"#endif // A",
+format("void f() {\n"
+   "   int i;\n"
+   "  return i;\n"
+   "}\n"
+   "// comment\n"
+   "\n"
+   "#ifdef A\n"
+   "int i;\n"
+   "#endif // A"));
+
+  EXPECT_EQ("int f(int i) {\n"
+"  if (true) {\n"
+"++i;\n"
+"  }\n"
+"  // comment\n"
+"\n"
+"#ifdef A\n"
+"  int j;\n"
+"#endif\n"
+"}",
+format("int f(int i) {\n"
+   "   if (true) {\n"
+   "++i;\n"
+   "  }\n"
+   "  // comment\n"
+   "\n"
+   "#ifdef A\n"
+   "  int j;\n"
+   "#endif\n"
+   "}"));
+
   // Align with the preprocessor directive if the comment was originally aligned
   // with the preprocessor directive.
   EXPECT_EQ("void f() {\n"
@@ -867,6 +926,25 @@
"#ifdef A\n"
"  int j;\n"
"}"));
+
+  EXPECT_EQ("int f(int i) {\n"
+"  if (true) {\n"
+"++i;\n"
+"  }\n"
+"// comment\n"
+"#ifdef A\n"
+"  int j;\n"
+"#endif\n"
+"}",
+format("int f(int i) {\n"
+   "   if (true) {\n"
+   "++i;\n"
+   "  }\n"
+   "// comment\n"
+   "#ifdef A\n"
+   "  int j;\n"
+   "#endif\n"
+   "}"));
 }
 
 TEST_F(FormatTestComments, SplitsLongLinesInComments) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r308725 - [clang-format] Fix comment levels between '}' and PPDirective

2017-07-21 Thread Krasimir Georgiev via cfe-commits
Author: krasimir
Date: Fri Jul 21 03:26:13 2017
New Revision: 308725

URL: http://llvm.org/viewvc/llvm-project?rev=308725=rev
Log:
[clang-format] Fix comment levels between '}' and PPDirective

Summary:
This fixes a regression exposed by r307795 in which the level of a comment line
between '}' and a preprocessor directive is incorrectly set as the level of the
line before the '}'. In effect, this:
```
int f(int i) {
  int j = i;
  return i + j;
}
// comment

#ifdef A
#endif
```
was formatted as:
```
int f(int i) {
  int j = i;
  return i + j;
}
  // comment

#ifdef A
#endif
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTestComments.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=308725=308724=308725=diff
==
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Fri Jul 21 03:26:13 2017
@@ -486,6 +486,8 @@ void UnwrappedLineParser::parseBlock(boo
 return;
   }
 
+  flushComments(isOnNewLine(*FormatTok));
+  Line->Level = InitialLevel;
   nextToken(); // Munch the closing brace.
 
   if (MacroBlock && FormatTok->is(tok::l_paren))
@@ -493,7 +495,6 @@ void UnwrappedLineParser::parseBlock(boo
 
   if (MunchSemi && FormatTok->Tok.is(tok::semi))
 nextToken();
-  Line->Level = InitialLevel;
   Line->MatchingOpeningBlockLineIndex = OpeningLineIndex;
   if (OpeningLineIndex != UnwrappedLine::kInvalidIndex) {
 // Update the opening line to add the forward reference as well

Modified: cfe/trunk/unittests/Format/FormatTestComments.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestComments.cpp?rev=308725=308724=308725=diff
==
--- cfe/trunk/unittests/Format/FormatTestComments.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestComments.cpp Fri Jul 21 03:26:13 2017
@@ -836,6 +836,25 @@ TEST_F(FormatTestComments, KeepsLevelOfC
"  int j;\n"
"}"));
 
+  EXPECT_EQ("int f(int i) {\n"
+"  if (true) {\n"
+"++i;\n"
+"  }\n"
+"  // comment\n"
+"#ifdef A\n"
+"  int j;\n"
+"#endif\n"
+"}",
+format("int f(int i) {\n"
+   "  if (true) {\n"
+   "++i;\n"
+   "  }\n"
+   "  // comment\n"
+   "#ifdef A\n"
+   "int j;\n"
+   "#endif\n"
+   "}"));
+
   // Keep the current level if there is an empty line between the comment and
   // the preprocessor directive.
   EXPECT_EQ("void f() {\n"
@@ -853,6 +872,46 @@ TEST_F(FormatTestComments, KeepsLevelOfC
"  int j;\n"
"}"));
 
+  EXPECT_EQ("void f() {\n"
+"  int i;\n"
+"  return i;\n"
+"}\n"
+"// comment\n"
+"\n"
+"#ifdef A\n"
+"int i;\n"
+"#endif // A",
+format("void f() {\n"
+   "   int i;\n"
+   "  return i;\n"
+   "}\n"
+   "// comment\n"
+   "\n"
+   "#ifdef A\n"
+   "int i;\n"
+   "#endif // A"));
+
+  EXPECT_EQ("int f(int i) {\n"
+"  if (true) {\n"
+"++i;\n"
+"  }\n"
+"  // comment\n"
+"\n"
+"#ifdef A\n"
+"  int j;\n"
+"#endif\n"
+"}",
+format("int f(int i) {\n"
+   "   if (true) {\n"
+   "++i;\n"
+   "  }\n"
+   "  // comment\n"
+   "\n"
+   "#ifdef A\n"
+   "  int j;\n"
+   "#endif\n"
+   "}"));
+
   // Align with the preprocessor directive if the comment was originally 
aligned
   // with the preprocessor directive.
   EXPECT_EQ("void f() {\n"
@@ -867,6 +926,25 @@ TEST_F(FormatTestComments, KeepsLevelOfC
"#ifdef A\n"
"  int j;\n"
"}"));
+
+  EXPECT_EQ("int f(int i) {\n"
+"  if (true) {\n"
+"++i;\n"
+"  }\n"
+"// comment\n"
+"#ifdef A\n"
+"  int j;\n"
+"#endif\n"
+"}",
+format("int f(int i) {\n"
+   "   if (true) {\n"
+   "++i;\n"
+   "  }\n"
+   "// comment\n"
+   "#ifdef A\n"
+

[PATCH] D31326: Add option to export fixes to run-clang-tidy.py

2017-07-21 Thread Michael F. Herbst via Phabricator via cfe-commits
mfherbst added a comment.

Many thanks!


https://reviews.llvm.org/D31326



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


[PATCH] D34329: [clang-diff] Initial implementation.

2017-07-21 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added a comment.

I'll commit this on behalf of Johannes today as he didn't get his access yet


https://reviews.llvm.org/D34329



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


[PATCH] D31326: Add option to export fixes to run-clang-tidy.py

2017-07-21 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG. I'll commit the patch for you


https://reviews.llvm.org/D31326



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


[PATCH] D35427: [clang] Fix handling of "%zd" format specifier

2017-07-21 Thread Hans Wennborg via Phabricator via cfe-commits
hans added a comment.

Thanks for fixing this long-standing TODO :-)


Repository:
  rL LLVM

https://reviews.llvm.org/D35427



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


Re: r308722 - Fixed failing assert in code completion.

2017-07-21 Thread Alex L via cfe-commits
Hans, can you please merge this to the LLVM 5.0 branch?

AFAIK It's a recent regression that should get fixed in LLVM 5.0.

Cheers,
Alex

On 21 July 2017 at 10:24, Ilya Biryukov via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ibiryukov
> Date: Fri Jul 21 02:24:00 2017
> New Revision: 308722
>
> URL: http://llvm.org/viewvc/llvm-project?rev=308722=rev
> Log:
> Fixed failing assert in code completion.
>
> Summary:
> The code was accessing uninstantiated default argument.
> This resulted in failing assertion at ParmVarDecl::getDefaultArg().
>
> Reviewers: erikjv, klimek, bkramer, krasimir
>
> Reviewed By: krasimir
>
> Subscribers: cfe-commits
>
> Differential Revision: https://reviews.llvm.org/D35682
>
> Added:
> cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
> Modified:
> cfe/trunk/lib/Sema/SemaCodeComplete.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaC
> odeComplete.cpp?rev=308722=308721=308722=diff
> 
> ==
> --- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Jul 21 02:24:00 2017
> @@ -2401,10 +2401,7 @@ formatBlockPlaceholder(const PrintingPol
>  static std::string GetDefaultValueString(const ParmVarDecl *Param,
>   const SourceManager ,
>   const LangOptions ) {
> -  const Expr *defaultArg = Param->getDefaultArg();
> -  if (!defaultArg)
> -return "";
> -  const SourceRange SrcRange = defaultArg->getSourceRange();
> +  const SourceRange SrcRange = Param->getDefaultArgRange();
>CharSourceRange CharSrcRange = CharSourceRange::getTokenRange
> (SrcRange);
>bool Invalid = CharSrcRange.isInvalid();
>if (Invalid)
>
> Added: cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompl
> etion/uninstantiated_params.cpp?rev=308722=auto
> 
> ==
> --- cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp (added)
> +++ cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp Fri Jul 21
> 02:24:00 2017
> @@ -0,0 +1,13 @@
> +template 
> +struct unique_ptr {
> +  typedef T* pointer;
> +
> +  void reset(pointer ptr = pointer());
> +};
> +
> +void test() {
> +  unique_ptr x;
> +  x.
> +  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - |
> FileCheck -check-prefix=CHECK-CC1 %s
> +  // CHECK-CC1: [#void#]reset({#<#unique_ptr::pointer ptr =
> pointer()#>#})
> +}
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D35557: clang-format: merge short case labels with trailing comments

2017-07-21 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added inline comments.



Comment at: lib/Format/UnwrappedLineFormatter.cpp:405
+for (; J != E; ++J) {
+  const AnnotatedLine *Line = J[0];
+  if (Line->InPPDirective != InPPDirective)

I'd change `J[0]` to `*J` and rename `Line` to something else so that it 
doesn't shadow `Line`.



Comment at: lib/Format/UnwrappedLineFormatter.cpp:406
+  const AnnotatedLine *Line = J[0];
+  if (Line->InPPDirective != InPPDirective)
+break;

Please add a test for this if.



Comment at: unittests/Format/FormatTest.cpp:912
+   "  break;\n"
+   "}",
+   Style);

I'd suggest adding more cases here, like:
```
   "case 6: /* comment */ x = 1; break;\n"
   "case 7: x = /* comment */ 1; break;\n"
   "case 8:\n"
   "  x = 1; /* comment */\n"
   "  break;\n"
   "case 9:\n"
   "  break; // comment line 1\n"
   " // comment line 2\n"
   "case 10:\n"
   "  return; /* comment line 1\n"
   "   * comment line 2 */\n"
   "}",
```
I'm interested also why `case 10` here fails.



Comment at: unittests/Format/FormatTest.cpp:930
+   "}",
+   Style));
+  verifyFormat("switch (a) {\n"

I'd like to see tests where an overly long comment line appears, like:
```
  EXPECT_EQ("switch (a) {\n"
"case 0:\n"
"  return; // long long long long long long long long long long "
"long long comment\n"
"  // line\n"
"}",
format("switch (a) {\n"
   "case 0: return; // long long long long long long long "
   "long long long long long comment line\n"
   "}",
   Style));
  EXPECT_EQ("switch (a) {\n"
"case 0:\n"
"  return; /* long long long long long long long long long long "
"long long comment\n"
" line */\n"
"}",
format("switch (a) {\n"
   "case 0: return; /* long long long long long long long "
   "long long long long long comment line */\n"
   "}",
   Style));
```


https://reviews.llvm.org/D35557



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


[PATCH] D35682: Fixed failing assert in code completion.

2017-07-21 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL308722: Fixed failing assert in code completion. (authored 
by ibiryukov).

Repository:
  rL LLVM

https://reviews.llvm.org/D35682

Files:
  cfe/trunk/lib/Sema/SemaCodeComplete.cpp
  cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp


Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
===
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp
@@ -2401,10 +2401,7 @@
 static std::string GetDefaultValueString(const ParmVarDecl *Param,
  const SourceManager ,
  const LangOptions ) {
-  const Expr *defaultArg = Param->getDefaultArg();
-  if (!defaultArg)
-return "";
-  const SourceRange SrcRange = defaultArg->getSourceRange();
+  const SourceRange SrcRange = Param->getDefaultArgRange();
   CharSourceRange CharSrcRange = CharSourceRange::getTokenRange(SrcRange);
   bool Invalid = CharSrcRange.isInvalid();
   if (Invalid)
Index: cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
===
--- cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
+++ cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
@@ -0,0 +1,13 @@
+template 
+struct unique_ptr {
+  typedef T* pointer;
+
+  void reset(pointer ptr = pointer());
+};
+
+void test() {
+  unique_ptr x;
+  x.
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - | 
FileCheck -check-prefix=CHECK-CC1 %s
+  // CHECK-CC1: [#void#]reset({#<#unique_ptr::pointer ptr = pointer()#>#})
+}


Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
===
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp
@@ -2401,10 +2401,7 @@
 static std::string GetDefaultValueString(const ParmVarDecl *Param,
  const SourceManager ,
  const LangOptions ) {
-  const Expr *defaultArg = Param->getDefaultArg();
-  if (!defaultArg)
-return "";
-  const SourceRange SrcRange = defaultArg->getSourceRange();
+  const SourceRange SrcRange = Param->getDefaultArgRange();
   CharSourceRange CharSrcRange = CharSourceRange::getTokenRange(SrcRange);
   bool Invalid = CharSrcRange.isInvalid();
   if (Invalid)
Index: cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
===
--- cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
+++ cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
@@ -0,0 +1,13 @@
+template 
+struct unique_ptr {
+  typedef T* pointer;
+
+  void reset(pointer ptr = pointer());
+};
+
+void test() {
+  unique_ptr x;
+  x.
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+  // CHECK-CC1: [#void#]reset({#<#unique_ptr::pointer ptr = pointer()#>#})
+}
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r308722 - Fixed failing assert in code completion.

2017-07-21 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Fri Jul 21 02:24:00 2017
New Revision: 308722

URL: http://llvm.org/viewvc/llvm-project?rev=308722=rev
Log:
Fixed failing assert in code completion.

Summary:
The code was accessing uninstantiated default argument.
This resulted in failing assertion at ParmVarDecl::getDefaultArg().

Reviewers: erikjv, klimek, bkramer, krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

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

Added:
cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
Modified:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=308722=308721=308722=diff
==
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Jul 21 02:24:00 2017
@@ -2401,10 +2401,7 @@ formatBlockPlaceholder(const PrintingPol
 static std::string GetDefaultValueString(const ParmVarDecl *Param,
  const SourceManager ,
  const LangOptions ) {
-  const Expr *defaultArg = Param->getDefaultArg();
-  if (!defaultArg)
-return "";
-  const SourceRange SrcRange = defaultArg->getSourceRange();
+  const SourceRange SrcRange = Param->getDefaultArgRange();
   CharSourceRange CharSrcRange = CharSourceRange::getTokenRange(SrcRange);
   bool Invalid = CharSrcRange.isInvalid();
   if (Invalid)

Added: cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp?rev=308722=auto
==
--- cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp (added)
+++ cfe/trunk/test/CodeCompletion/uninstantiated_params.cpp Fri Jul 21 02:24:00 
2017
@@ -0,0 +1,13 @@
+template 
+struct unique_ptr {
+  typedef T* pointer;
+
+  void reset(pointer ptr = pointer());
+};
+
+void test() {
+  unique_ptr x;
+  x.
+  // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:5 %s -o - | 
FileCheck -check-prefix=CHECK-CC1 %s
+  // CHECK-CC1: [#void#]reset({#<#unique_ptr::pointer ptr = pointer()#>#})
+}


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


[PATCH] D35485: [clang-format] Fix comment levels between '}' and PPDirective

2017-07-21 Thread Daniel Jasper via Phabricator via cfe-commits
djasper accepted this revision.
djasper added a comment.
This revision is now accepted and ready to land.

Looks good.


https://reviews.llvm.org/D35485



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


[PATCH] D35682: Fixed failing assert in code completion.

2017-07-21 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir accepted this revision.
krasimir added a comment.
This revision is now accepted and ready to land.

Looks good!


https://reviews.llvm.org/D35682



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


[PATCH] D35674: [analyzer] Treat C++ throw as sink during CFG-based suppress-on-sink.

2017-07-21 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun accepted this revision.
xazax.hun added a comment.

One minor nit, otherwise looks good to me.




Comment at: lib/StaticAnalyzer/Core/BugReporter.cpp:
+})) {
+  // Throw-expressions are currently generating sinks during symbolic
+  // execution: they're not supported yet, and also often used for

For temporary solutions like this, I prefer to have a FIXME string in the 
comment. In general, I think it is good to be able to keep track of future 
tasks by grepping for FIXMEs in the code of the analyzer.


https://reviews.llvm.org/D35674



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


[clang-tools-extra] r308721 - [clangd] Specified --gcc-toolchain explicitly in VFS test.

2017-07-21 Thread Ilya Biryukov via cfe-commits
Author: ibiryukov
Date: Fri Jul 21 01:20:47 2017
New Revision: 308721

URL: http://llvm.org/viewvc/llvm-project?rev=308721=rev
Log:
[clangd] Specified --gcc-toolchain explicitly in VFS test.

In order to avoid platform-specific configuration quirks.
(Possible fix for https://bugs.llvm.org/show_bug.cgi?id=33842)

Modified:
clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp

Modified: clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp?rev=308721=308720=308721=diff
==
--- clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp Fri Jul 21 
01:20:47 2017
@@ -422,9 +422,9 @@ TEST_F(ClangdVFSTest, SearchLibDir) {
   MockFSProvider FS;
   ErrorCheckingDiagConsumer DiagConsumer;
   MockCompilationDatabase CDB(/*AddFreestandingFlag=*/true);
-  CDB.ExtraClangFlags.insert(
-  CDB.ExtraClangFlags.end(),
-  {"-xc++", "-target", "x86_64-linux-unknown", "-m64"});
+  CDB.ExtraClangFlags.insert(CDB.ExtraClangFlags.end(),
+ {"-xc++", "-target", "x86_64-linux-unknown",
+  "-m64", "--gcc-toolchain=/randomusr"});
   ClangdServer Server(CDB, DiagConsumer, FS,
   /*RunSynchronously=*/true);
 
@@ -432,7 +432,7 @@ TEST_F(ClangdVFSTest, SearchLibDir) {
   SmallString<8> Version("4.9.3");
 
   // A lib dir for gcc installation
-  SmallString<64> LibDir("/usr/lib/gcc/x86_64-linux-gnu");
+  SmallString<64> LibDir("/randomusr/lib/gcc/x86_64-linux-gnu");
   llvm::sys::path::append(LibDir, Version);
 
   // Put crtbegin.o into LibDir/64 to trick clang into thinking there's a gcc
@@ -441,7 +441,7 @@ TEST_F(ClangdVFSTest, SearchLibDir) {
   llvm::sys::path::append(DummyLibFile, LibDir, "64", "crtbegin.o");
   FS.Files[DummyLibFile] = "";
 
-  SmallString<64> IncludeDir("/usr/include/c++");
+  SmallString<64> IncludeDir("/randomusr/include/c++");
   llvm::sys::path::append(IncludeDir, Version);
 
   SmallString<64> StringPath;


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


Re: r308641 - [Docs] Regenerate the command line option reference.

2017-07-21 Thread Hans Wennborg via cfe-commits
Thanks for the reminder! I regenerated on the branch in r308720.

Cheers,
Hans

On Thu, Jul 20, 2017 at 7:59 PM, Craig Topper  wrote:
> Hans,
>
> This needs to be ported to the 5.0 branch. Not sure if any new options have
> been added to 6.0 since the branch that would make this patch not correct.
> Probably safest to just regenerate it in the 5.0 branch.
>
> ~Craig
>
> On Thu, Jul 20, 2017 at 10:52 AM, Craig Topper via cfe-commits
>  wrote:
>>
>> Author: ctopper
>> Date: Thu Jul 20 10:52:48 2017
>> New Revision: 308641
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=308641=rev
>> Log:
>> [Docs] Regenerate the command line option reference.
>>
>> Modified:
>> cfe/trunk/docs/ClangCommandLineReference.rst
>>
>> Modified: cfe/trunk/docs/ClangCommandLineReference.rst
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangCommandLineReference.rst?rev=308641=308640=308641=diff
>>
>> ==
>> --- cfe/trunk/docs/ClangCommandLineReference.rst (original)
>> +++ cfe/trunk/docs/ClangCommandLineReference.rst Thu Jul 20 10:52:48 2017
>> @@ -96,6 +96,8 @@ Emit ARC errors even if the migrator can
>>
>>  Output path for the plist report
>>
>> +.. option:: --autocomplete=
>> +
>>  .. option:: -bind\_at\_load
>>
>>  .. option:: -bundle
>> @@ -292,7 +294,7 @@ Disable builtin #include directories
>>
>>  .. option:: -nomultidefs
>>
>> -.. option:: -nopie
>> +.. option:: -nopie, -no-pie
>>
>>  .. option:: -noprebind
>>
>> @@ -704,6 +706,10 @@ Don't use blacklist file for sanitizers
>>
>>  Level of field padding for AddressSanitizer
>>
>> +.. option:: -fsanitize-address-globals-dead-stripping
>> +
>> +Enable linker dead stripping of globals in AddressSanitizer
>> +
>>  .. option:: -fsanitize-address-use-after-scope,
>> -fno-sanitize-address-use-after-scope
>>
>>  Enable use-after-scope detection in AddressSanitizer
>> @@ -1071,6 +1077,10 @@ Target-independent compilation options
>>
>>  Enable C++17 aligned allocation functions
>>
>> +.. option:: -fallow-editor-placeholders, -fno-allow-editor-placeholders
>> +
>> +Treat editor placeholders as valid source code
>> +
>>  .. option:: -fallow-unsupported
>>
>>  .. option:: -faltivec, -fno-altivec
>> @@ -1205,6 +1215,10 @@ Print absolute paths in diagnostics
>>  .. option:: -fdiagnostics-color=
>>  .. program:: clang
>>
>> +.. option:: -fdiagnostics-hotness-threshold=
>> +
>> +Prevent optimization remarks from being output if they do not have at
>> least this profile count
>> +
>>  .. option:: -fdiagnostics-show-hotness, -fno-diagnostics-show-hotness
>>
>>  Enable profile hotness information in diagnostic line
>> @@ -1585,6 +1599,8 @@ Turn on loop reroller
>>
>>  .. option:: -fretain-comments-from-system-headers
>>
>> +.. option:: -frewrite-imports, -fno-rewrite-imports
>> +
>>  .. option:: -frewrite-includes, -fno-rewrite-includes
>>
>>  .. option:: -frewrite-map-file 
>> @@ -1639,10 +1655,6 @@ Use SjLj style exceptions
>>
>>  Enable the superword-level parallelism vectorization passes
>>
>> -.. option:: -fslp-vectorize-aggressive, -fno-slp-vectorize-aggressive
>> -
>> -Enable the BB vectorization passes
>> -
>>  .. option:: -fspell-checking, -fno-spell-checking
>>
>>  .. option:: -fspell-checking-limit=
>> @@ -1911,6 +1923,8 @@ Link stack frames through backchain on S
>>
>>  .. option:: -mcpu=, -mv4 (equivalent to -mcpu=hexagonv4), -mv5
>> (equivalent to -mcpu=hexagonv5), -mv55 (equivalent to -mcpu=hexagonv55),
>> -mv60 (equivalent to -mcpu=hexagonv60), -mv62 (equivalent to
>> -mcpu=hexagonv62)
>>
>> +.. option:: -mdefault-build-attributes,
>> -mno-default-build-attributes
>> +
>>  .. option:: -mdll
>>
>>  .. option:: -mdouble-float
>> @@ -1947,6 +1961,10 @@ Use 64-bit floating point registers (MIP
>>
>>  Enable merging of globals
>>
>> +.. option:: -mgpopt, -mno-gpopt
>> +
>> +Use GP relative accesses for symbols known to be in a small data section
>> (MIPS)
>> +
>>  .. option:: -mhard-float
>>
>>  .. option:: -mhwdiv=, --mhwdiv , --mhwdiv=
>> @@ -1975,10 +1993,16 @@ Use Intel MCU ABI
>>
>>  Generate branches with extended addressability, usually via indirect
>> jumps.
>>
>> -.. option:: -mmacosx-version-min=
>> +.. option:: -mmacosx-version-min=, -mmacos-version-min=
>>
>>  Set Mac OS X deployment target
>>
>> +.. option:: -mmadd4, -mno-madd4
>> +
>> +Enable the generation of 4-operand madd.s, madd.d and related
>> instructions.
>> +
>> +.. option:: -mmcu=
>> +
>>  .. option:: -mmicromips, -mno-micromips
>>
>>  .. option:: -mms-bitfields, -mno-ms-bitfields
>> @@ -1989,6 +2013,10 @@ Set the default structure layout to be c
>>
>>  Enable MSA ASE (MIPS only)
>>
>> +.. option:: -mmt, -mno-mt
>> +
>> +Enable MT ASE (MIPS only)
>> +
>>  .. option:: -mnan=
>>
>>  .. option:: -mno-mips16
>> @@ -2203,6 +2231,8 @@ X86
>>
>>  .. option:: -mavx512vl, -mno-avx512vl
>>
>> +.. option:: -mavx512vpopcntdq, -mno-avx512vpopcntdq
>> +
>>  .. option:: -mbmi, 

[PATCH] D35674: [analyzer] Treat C++ throw as sink during CFG-based suppress-on-sink.

2017-07-21 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin accepted this revision.
a.sidorin added a comment.
This revision is now accepted and ready to land.

Looks good.


https://reviews.llvm.org/D35674



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


[PATCH] D35485: [clang-format] Fix comment levels between '}' and PPDirective

2017-07-21 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added a comment.

@djasper: ping


https://reviews.llvm.org/D35485



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


r308719 - [mips] Add `short_call` to the set of `long_call/far/near` attributes

2017-07-21 Thread Simon Atanasyan via cfe-commits
Author: atanasyan
Date: Fri Jul 21 01:10:57 2017
New Revision: 308719

URL: http://llvm.org/viewvc/llvm-project?rev=308719=rev
Log:
[mips] Add `short_call` to the set of `long_call/far/near` attributes

MIPS gcc supports `long_call/far/near` attributes only, but other
targets have the `short_call` attribut, so let's support it for MIPS
for consistency.

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/include/clang/Basic/AttrDocs.td
cfe/trunk/test/CodeGen/long-call-attr.c
cfe/trunk/test/Sema/attr-long-call.c

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=308719=308718=308719=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Jul 21 01:10:57 2017
@@ -1195,7 +1195,7 @@ def MipsLongCall : InheritableAttr, Targ
 }
 
 def MipsShortCall : InheritableAttr, TargetSpecificAttr {
-  let Spellings = [GCC<"near">];
+  let Spellings = [GCC<"short_call">, GCC<"near">];
   let Subjects = SubjectList<[Function]>;
   let Documentation = [MipsShortCallStyleDocs];
 }

Modified: cfe/trunk/include/clang/Basic/AttrDocs.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/AttrDocs.td?rev=308719=308718=308719=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Fri Jul 21 01:10:57 2017
@@ -1348,13 +1348,14 @@ def MipsShortCallStyleDocs : Documentati
   let Category = DocCatFunction;
   let Content = [{
 Clang supports the ``__attribute__((long_call))``, ``__attribute__((far))``,
-and ``__attribute__((near))`` attributes on MIPS targets. These attributes may
-only be added to function declarations and change the code generated
-by the compiler when directly calling the function. The ``near`` attribute
-allows calls to the function to be made using the ``jal`` instruction, which
-requires the function to be located in the same naturally aligned 256MB
-segment as the caller.  The ``long_call`` and ``far`` attributes are synonyms
-and require the use of a different call sequence that works regardless
+``__attribute__((short__call))``, and ``__attribute__((near))`` attributes
+on MIPS targets. These attributes may only be added to function declarations
+and change the code generated by the compiler when directly calling
+the function. The ``short_call`` and ``near`` attributes are synonyms and
+allow calls to the function to be made using the ``jal`` instruction, which
+requires the function to be located in the same naturally aligned 256MB segment
+as the caller.  The ``long_call`` and ``far`` attributes are synonyms and
+require the use of a different call sequence that works regardless
 of the distance between the functions.
 
 These attributes have no effect for position-independent code.

Modified: cfe/trunk/test/CodeGen/long-call-attr.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/long-call-attr.c?rev=308719=308718=308719=diff
==
--- cfe/trunk/test/CodeGen/long-call-attr.c (original)
+++ cfe/trunk/test/CodeGen/long-call-attr.c Fri Jul 21 01:10:57 2017
@@ -1,17 +1,20 @@
 // RUN: %clang_cc1 -triple mips-linux-gnu -emit-llvm  -o  - %s | FileCheck %s
 
 void __attribute__((long_call)) foo1 (void);
+void __attribute__((short_call)) foo4 (void);
 
 void __attribute__((far)) foo2 (void) {}
 
 // CHECK: define void @foo2() [[FAR:#[0-9]+]]
 
-void __attribute__((near)) foo3 (void) { foo1(); }
+void __attribute__((near)) foo3 (void) { foo1(); foo4(); }
 
 // CHECK: define void @foo3() [[NEAR:#[0-9]+]]
 
 // CHECK: declare void @foo1() [[LONGDECL:#[0-9]+]]
+// CHECK: declare void @foo4() [[SHORTDECL:#[0-9]+]]
 
 // CHECK: attributes [[FAR]] = { {{.*}} "long-call" {{.*}} }
 // CHECK: attributes [[NEAR]] = { {{.*}} "short-call" {{.*}} }
 // CHECK: attributes [[LONGDECL]] = { {{.*}} "long-call" {{.*}} }
+// CHECK: attributes [[SHORTDECL]] = { {{.*}} "short-call" {{.*}} }

Modified: cfe/trunk/test/Sema/attr-long-call.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-long-call.c?rev=308719=308718=308719=diff
==
--- cfe/trunk/test/Sema/attr-long-call.c (original)
+++ cfe/trunk/test/Sema/attr-long-call.c Fri Jul 21 01:10:57 2017
@@ -1,18 +1,25 @@
 // RUN: %clang_cc1 -triple mips-linux-gnu -fsyntax-only -verify %s
 
 __attribute__((long_call(0))) void foo1();  // expected-error {{'long_call' 
attribute takes no arguments}}
+__attribute__((short_call(0))) void foo9();  // expected-error {{'short_call' 
attribute takes no arguments}}
 __attribute__((far(0))) void foo2();  // expected-error {{'far' attribute 
takes no arguments}}
 __attribute__((near(0))) void foo3();