[PATCH] D30341: [analyzer] clarify error messages about uninitialized function arguments

2017-03-06 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Oh well, that's not good. Probably that's because we always highlight the 
current statement in path-sensitive reports. I guess we could improve upon that 
in the bug reporter.


Repository:
  rL LLVM

https://reviews.llvm.org/D30341



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


[PATCH] D30341: [analyzer] clarify error messages about uninitialized function arguments

2017-03-06 Thread Daniel Marjamäki via Phabricator via cfe-commits
danielmarjamaki added a comment.

No the argument is not shown with tilde/column number.

Code example:

  void f(int x, ...);
  
  void dostuff() {
int x[10];
f(12,3,4,5,x[3],6,7,8);
  }

Output:

  C:\Users\danielm>\llvm\build\Debug\bin\clang -cc1 -analyze 
-analyzer-checker=core test3.c
  test3.c:6:3: warning: Function call argument is an uninitialized value
f(12,3,4,5,x[3],6,7,8);
^~


Repository:
  rL LLVM

https://reviews.llvm.org/D30341



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


LLVM buildmaster will be restarted in few minutes

2017-03-06 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be restarted in few minutes.
Thank you for understanding.

Thanks

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


[PATCH] D30662: Update clang filtering for mxcsr

2017-03-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

In https://reviews.llvm.org/D30662#693609, @andrew.w.kaylor wrote:

> In https://reviews.llvm.org/D30662#693559, @ahatanak wrote:
>
> > Is it possible to add a test case (possibly in CodeGen)?
>
>
> This is covered by CodeGen/ms-inline-asm.c, which Reid added after I broke 
> this adding the mxcsr register a couple of weeks ago.


I see, thanks.


Repository:
  rL LLVM

https://reviews.llvm.org/D30662



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


Re: Patch for Bug 30413, including test case

2017-03-06 Thread Akira Hatanaka via cfe-commits

> On Mar 6, 2017, at 10:17 AM, Lobron, David  wrote:
> 
> Hi Akira,
> 
> Pardon my slowness in addressing your question.
> 
>> This patch changes the encoding of an id conforming to a protocol, which I 
>> think was not intended: For example:
>> 
>> @encode(id)
>> 
>> Would passing IVD to the call to getObjCEncodingForType in 
>> CGObjCGNU::GenerateClass solve the problem?
> 
> Are you suggesting that passing IVD instead of just IVD->getType() will tell 
> getObjCEncodingForType whether the code being compiled is a protocol, as 
> opposed to an object?  I'm a little confused here, because IVD is an object 
> of type ObjCIvarDecl, which is supposed to represent an instance variable, 
> not a protocol.  Also, I don't see anything in the definition of ObjCIvarDecl 
> (in AST/DeclObjC.h) that would tell us whether it represents an instance 
> variable or a protocol.  Can you explain the case you are concerned about a 
> little more?
> 

My concern is that the patch changes the encoding of @encode(id) on 
Darwin, which I think isn’t what you are trying to fix. If you compile the 
following code with command “clang -cc1 -triple x86_64-apple-macosx”, the type 
encoding changes after applying the patch.

const char *foo() {
  return @encode(id);
}

It seems like you can fix your problem without affecting Darwin by passing an 
extra argument to getObjCEncodingForType, just like 
CGObjCCommonMac::GetMethodVarType does.

> If IVD can in fact tell us whether the code being compiled is an object, then 
> we can make the EncodeClassNames argument of getObjCEncodingForTypeImpl true 
> for ivars and false for protocols.
> 
> Thanks!
> 
> --David

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


[PATCH] D30423: [ubsan] Detect UB loads from bitfields

2017-03-06 Thread Jonathan Roelofs via Phabricator via cfe-commits
jroelofs added a comment.

I think this might miss loads from bitfield ivars. Also, what about the 
conversion that happens for properties whose backing ivar is a bitfield? (or 
does that happen in the runtime? can't remember)




Comment at: test/CodeGenObjC/ubsan-bool.m:25
+  // OBJC:  [[ASHR:%.*]] = ashr i8 [[SHL]], 7
+  // OBJC:  [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+  // OBJC: call void @__ubsan_handle_load_invalid_value

vsk wrote:
> arphaman wrote:
> > One unrelated thing that I noticed in the IR, the `zext`s to `i64` are 
> > emitted before the branch, even though they are used only in the 
> > `invalid_value` blocks. I know that the optimizer can move those anyway, 
> > but would there any be any benefit in moving them into the blocks at the 
> > frontend IRGen level?
> I'm not sure. Maybe it would make the live range of the zext smaller at -O0? 
> I'll look into this and see if there's a real perf impact.
@arphaman if it can be done easily/eleganly during IRGen, then this is a 
compile-duration win.



Comment at: test/CodeGenObjC/ubsan-bool.m:26
+  // OBJC:  [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+  // OBJC: call void @__ubsan_handle_load_invalid_value
+

vsk wrote:
> arphaman wrote:
> > Is it possible to avoid the check here since the bitfield is just one bit 
> > wide?
> No, a user could do:
> 
> ```
> struct S1 s;
> s.b1 = 1;
> if (s.b1 == 1) // evaluates to false, s.b1 is negative
> ```
> 
> With this patch we get:
> ```
> runtime error: load of value -1, which is not a valid value for type 'BOOL' 
> (aka 'signed char')
> ```
What if BOOL is an `unsigned char`, or a `char` that's not signed?


https://reviews.llvm.org/D30423



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


[PATCH] D28952: [analyzer] Add new Z3 constraint manager backend

2017-03-06 Thread Dominic Chen via Phabricator via cfe-commits
ddcc added a comment.

Thanks for your help! Let me know when the buildbot is ready for this to land.


https://reviews.llvm.org/D28952



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


[PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2017-03-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added inline comments.



Comment at: test/libcxx/test/config.py:66
 self.env = {}
 self.use_target = False
 self.use_system_cxx_lib = False

mehdi_amini wrote:
> EricWF wrote:
> > Was the omission of `self.use_deployment` here intentional? Python linters 
> > typically get upset by this.
> I can see how it would be useful not to add it here: we'd want an exception 
> if it is used without being set since we don't expect it to happen.
> 
But if it is not considered "pythonic", I'm fine adding it as well :)


https://reviews.llvm.org/D17469



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


LLVM buildmaster will be updated and restarted tonight

2017-03-06 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted in the nearest hour.

Thanks

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


[PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2017-03-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini added inline comments.



Comment at: test/libcxx/test/config.py:66
 self.env = {}
 self.use_target = False
 self.use_system_cxx_lib = False

EricWF wrote:
> Was the omission of `self.use_deployment` here intentional? Python linters 
> typically get upset by this.
I can see how it would be useful not to add it here: we'd want an exception if 
it is used without being set since we don't expect it to happen.



https://reviews.llvm.org/D17469



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


[PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2017-03-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini updated this revision to Diff 90779.
mehdi_amini added a comment.

Add back the python changes (files were moved, I lost them in the rebase)


https://reviews.llvm.org/D17469

Files:
  test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
  
test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp
  
test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
  
test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp
  test/std/re/re.traits/translate_nocase.pass.cpp
  test/std/strings/string.conversions/stof.pass.cpp
  test/std/strings/string.conversions/stol.pass.cpp
  test/std/strings/string.conversions/stoll.pass.cpp
  test/std/strings/string.conversions/stoul.pass.cpp
  test/std/strings/string.conversions/stoull.pass.cpp
  test/std/thread/futures/futures.future_error/what.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
  test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
  test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
  test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
  utils/libcxx/test/config.py
  utils/libcxx/test/target_info.py

Index: utils/libcxx/test/target_info.py
===
--- utils/libcxx/test/target_info.py
+++ utils/libcxx/test/target_info.py
@@ -12,6 +12,7 @@
 import locale
 import os
 import platform
+import re
 import sys
 
 class DefaultTargetInfo(object):
@@ -70,12 +71,62 @@
 def __init__(self, full_config):
 super(DarwinLocalTI, self).__init__(full_config)
 
+def is_host_macosx(self):
+name = lit.util.capture(['sw_vers', '-productName']).strip()
+return name == "Mac OS X"
+
+def get_macosx_version(self):
+assert self.is_host_macosx()
+version = lit.util.capture(['sw_vers', '-productVersion']).strip()
+version = re.sub(r'([0-9]+\.[0-9]+)(\..*)?', r'\1', version)
+return version
+
+def get_sdk_version(self, name):
+assert self.is_host_macosx()
+cmd = ['xcrun', '--sdk', name, '--show-sdk-path']
+try:
+out = lit.util.capture(cmd).strip()
+except OSError:
+pass
+
+if not out:
+self.full_config.lit_config.fatal(
+"cannot infer sdk version with: %r" % cmd)
+
+return re.sub(r'.*/[^0-9]+([0-9.]+)\.sdk', r'\1', out)
+
+def get_platform(self):
+platform = self.full_config.get_lit_conf('platform')
+if platform:
+platform = re.sub(r'([^0-9]+)([0-9\.]*)', r'\1-\2', platform)
+name, version = tuple(platform.split('-', 1))
+else:
+name = 'macosx'
+version = None
+
+if version:
+return (False, name, version)
+
+# Infer the version, either from the SDK or the system itself.  For
+# macosx, ignore the SDK version; what matters is what's at
+# /usr/lib/libc++.dylib.
+if name == 'macosx':
+version = self.get_macosx_version()
+else:
+version = self.get_sdk_version(name)
+return (True, name, version)
+
 def add_locale_features(self, features):
 add_common_locales(features, self.full_config.lit_config)
 
 def add_cxx_compile_flags(self, flags):
+if self.full_config.use_deployment:
+_, name, _ = self.full_config.config.deployment
+cmd = ['xcrun', '--sdk', name, 

Buildbot numbers for the week of 02/19/2017 - 02/25/2017

2017-03-06 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the week of 02/19/2017 - 02/25/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
+-
 sanitizer-ppc64be-linux| 81:13:41
 clang-ppc64be-linux-multistage | 80:20:26
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 45:57:09
 clang-ppc64be-linux-lnt| 39:21:32
 sanitizer-x86_64-linux-bootstrap   | 37:38:21
 sanitizer-x86_64-linux-fast| 35:13:52
 clang-ppc64be-linux| 21:00:45
 lldb-x86_64-ubuntu-14.04-buildserver   | 18:54:19
 llvm-mips-linux| 17:02:13
 sanitizer-x86_64-linux | 15:46:57
 clang-lld-x86_64-2stage| 14:26:21
 sanitizer-ppc64le-linux| 13:38:17
 clang-with-thin-lto-ubuntu | 13:16:20
 clang-with-lto-ubuntu  | 13:08:11
 clang-cmake-armv7-a15  | 10:31:05
 lldb-windows7-android  | 10:11:50
 clang-cmake-thumbv7-a15| 09:49:33
 lld-x86_64-win7| 09:31:34
 clang-s390x-linux  | 09:04:07
 clang-cmake-mips   | 08:12:53
 clang-cmake-aarch64-lld| 07:56:15
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 06:58:49
 clang-cuda-build   | 06:56:26
 polly-arm-linux| 06:55:12
 clang-hexagon-elf  | 06:46:36
 polly-amd64-linux  | 06:33:29
 clang-cmake-mipsel | 05:16:43
 clang-atom-d525-fedora-rel | 05:10:06
 clang-ppc64le-linux-multistage | 05:09:03
 clang-x86_64-linux-selfhost-modules-2  | 04:55:19
 clang-x86_64-linux-selfhost-modules| 04:54:18
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 04:49:39
 clang-cmake-aarch64-42vma  | 04:30:25
 clang-3stage-ubuntu| 04:26:16
 clang-cmake-thumbv7-a15-full-sh| 04:10:34
 clang-cmake-armv7-a15-selfhost | 03:16:24
 libcxx-libcxxabi-libunwind-arm-linux   | 03:06:32
 clang-ppc64le-linux| 02:52:43
 clang-cmake-aarch64-full   | 02:46:44
 clang-x64-ninja-win7   | 02:37:46
 libcxx-libcxxabi-x86_64-linux-ubuntu-asan  | 02:35:02
 clang-cmake-armv7-a15-full | 02:20:56
 perf-x86_64-penryn-O3-polly-unprofitable   | 02:15:11
 llvm-hexagon-elf   | 02:14:11
 clang-cmake-aarch64-quick  | 02:12:33
 clang-cmake-aarch64-39vma  | 02:10:08
 sanitizer-x86_64-linux-autoconf| 01:51:50
 sanitizer-x86_64-linux-fuzzer  | 01:51:45
 lld-x86_64-darwin13| 01:33:26
 lldb-amd64-ninja-netbsd7   | 01:28:47
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 01:23:06
 libcxx-libcxxabi-libunwind-aarch64-linux   | 01:19:49
 lldb-x86_64-darwin-13.4| 01:17:49
 lld-x86_64-freebsd | 01:06:22
 lldb-amd64-ninja-freebsd11 | 01:01:49
 perf-x86_64-penryn-O3-polly-parallel-fast  | 00:48:38
 lld-sphinx-docs| 00:48:13
 lldb-x86_64-ubuntu-14.04-android   | 00:43:44
 lldb-x86_64-ubuntu-14.04-cmake | 00:38:03
 clang-tools-sphinx-docs  

Buildbot numbers for the week of 02/26/2017 - 03/04/2017

2017-03-06 Thread Galina Kistanova via cfe-commits
Hello everyone,

Below are some buildbot numbers for the last week of 02/26/2017 -
03/04/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
+--
 sanitizer-windows  | 130:46:38
 clang-x86-windows-msvc2015 | 78:20:10
 clang-ppc64le-linux-lnt| 75:51:23
 llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast   | 46:50:08
 libcxx-libcxxabi-x86_64-linux-ubuntu-ubsan | 31:29:46
 clang-x86_64-linux-selfhost-modules| 30:04:05
 clang-x86_64-linux-selfhost-modules-2  | 29:51:20
 clang-ppc64le-linux-multistage | 29:05:06
 clang-with-thin-lto-ubuntu | 28:49:56
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx1z | 28:06:33
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx11 | 27:43:03
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx14 | 27:42:46
 libcxx-libcxxabi-x86_64-linux-ubuntu-cxx03 | 27:30:39
 lldb-windows7-android  | 25:15:40
 perf-x86_64-penryn-O3-polly-parallel-fast  | 25:10:43
 sanitizer-x86_64-linux-autoconf| 22:55:44
 perf-x86_64-penryn-O3-polly-before-vectorizer-unprofitable | 22:04:59
 clang-3stage-ubuntu| 21:50:36
 sanitizer-x86_64-linux-fast| 20:45:55
 sanitizer-x86_64-linux-bootstrap   | 19:35:51
 perf-x86_64-penryn-O3-polly-before-vectorizer  | 16:35:34
 sanitizer-x86_64-linux | 11:01:32
 perf-x86_64-penryn-O3  | 09:10:37
 perf-x86_64-penryn-O3-polly| 09:08:34
 perf-x86_64-penryn-O3-polly-before-vectorizer-detect-only  | 08:27:29
 clang-cmake-armv7-a15-selfhost-neon| 07:29:12
 clang-cmake-armv7-a15-selfhost | 07:13:13
 sanitizer-ppc64le-linux| 06:09:17
 clang-cmake-aarch64-full   | 05:57:24
 polly-arm-linux| 05:36:38
 clang-ppc64be-linux-multistage | 05:30:26
 clang-cmake-thumbv7-a15-full-sh| 05:26:26
 sanitizer-ppc64be-linux| 05:23:18
 lldb-x86_64-ubuntu-14.04-buildserver   | 05:20:57
 polly-amd64-linux  | 05:13:48
 clang-cmake-aarch64-lld| 05:12:42
 llvm-mips-linux| 04:57:44
 clang-cmake-armv7-a15  | 04:40:30
 clang-with-lto-ubuntu  | 04:30:02
 clang-cmake-aarch64-39vma  | 04:24:12
 llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast | 04:19:50
 clang-cmake-mips   | 03:54:05
 perf-x86_64-penryn-O3-polly-unprofitable   | 03:51:47
 clang-ppc64be-linux-lnt| 03:15:31
 lldb-x86_64-ubuntu-14.04-android   | 03:15:22
 llvm-hexagon-elf   | 03:14:48
 clang-lld-x86_64-2stage| 03:05:52
 clang-x86_64-debian-fast   | 03:01:22
 clang-ppc64be-linux| 02:58:56
 libcxx-libcxxabi-x86_64-linux-ubuntu-msan  | 02:51:00
 clang-cmake-thumbv7-a15| 02:42:32
 clang-native-arm-lnt   | 02:37:02
 clang-cmake-armv7-a15-full | 02:11:20
 libcxx-libcxxabi-libunwind-arm-linux-noexceptions  | 02:09:38
 clang-s390x-linux  | 02:05:24
 clang-cmake-aarch64-42vma  | 02:03:49
 lldb-amd64-ninja-freebsd11 | 02:01:07
 clang-atom-d525-fedora-rel | 01:57:43
 clang-hexagon-elf  | 01:56:48
 

[PATCH] D30476: [clangd] Add a toy Eclipse integration for development purposes

2017-03-06 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson updated this revision to Diff 90776.

https://reviews.llvm.org/D30476

Files:
  clangd/clients/lsp4e-cpp/.gitignore
  clangd/clients/lsp4e-cpp/.mvn/extensions.xml
  clangd/clients/lsp4e-cpp/.travis.yml
  clangd/clients/lsp4e-cpp/LICENSE
  clangd/clients/lsp4e-cpp/README.md
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/.classpath
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/.gitignore
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/.project
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/.settings/org.eclipse.core.resources.prefs
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/.settings/org.eclipse.core.runtime.prefs
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/.settings/org.eclipse.jdt.core.prefs
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/.settings/org.eclipse.jdt.ui.prefs
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/.settings/org.eclipse.pde.prefs
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/META-INF/MANIFEST.MF
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/OSGI-INF/l10n/bundle.properties
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/build.properties
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/plugin.xml
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.language/src/org/eclipse/lsp4e/cpp/language/CPPLanguageServer.java
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.site/.project
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.site/.settings/org.eclipse.core.resources.prefs
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.site/.settings/org.eclipse.core.runtime.prefs
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.site/category.xml
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.site/pom.xml
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.target/.project
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.target/.settings/org.eclipse.core.resources.prefs
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.target/.settings/org.eclipse.core.runtime.prefs
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.target/lsp4e.cpp-staging.target
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp.target/pom.xml
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp/.project
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp/.settings/org.eclipse.core.resources.prefs
  
clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp/.settings/org.eclipse.core.runtime.prefs
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp/build.properties
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp/feature.properties
  clangd/clients/lsp4e-cpp/org.eclipse.lsp4e.cpp/feature.xml
  clangd/clients/lsp4e-cpp/pom.xml

Index: clangd/clients/lsp4e-cpp/pom.xml
===
--- /dev/null
+++ clangd/clients/lsp4e-cpp/pom.xml
@@ -0,0 +1,239 @@
+
+
+http://maven.apache.org/POM/4.0.0;
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd;>
+  4.0.0
+
+  
+${required-maven-version}
+  
+
+  org.eclipse.lsp4e.cpp.group
+  org.eclipse.lsp4e.cpp.parent
+  1.0.0-SNAPSHOT
+  pom
+  LSP4E C/C++ Support Parent
+
+  
+
+  University of Illinois Open Source License
+  
+This file is distributed under the University of Illinois Open Source
+License. See LICENSE.TXT for details.
+  
+
+  
+
+  
+3.3
+UTF-8
+UTF-8
+
+1.0.0
+lsp4e.cpp-staging
+  
+
+  
+org.eclipse.lsp4e.cpp
+org.eclipse.lsp4e.cpp.language
+org.eclipse.lsp4e.cpp.site
+org.eclipse.lsp4e.cpp.target
+  
+
+  
+
+  
+true
+org.apache.maven.plugins
+maven-enforcer-plugin
+1.4.1
+
+  
+enforce-maven-version
+
+  enforce
+
+
+  
+
+  ${required-maven-version}
+
+
+  1.8
+
+  
+  true
+
+  
+
+  
+
+  
+org.eclipse.tycho
+target-platform-configuration
+
+  true
+  
+
+win32
+win32
+x86
+
+
+win32
+win32
+x86_64
+
+
+macosx
+cocoa
+x86_64
+
+
+linux
+gtk
+x86
+
+
+linux
+gtk
+x86_64
+
+  
+  
+
+  org.eclipse.lsp4e.cpp.group
+  org.eclipse.lsp4e.cpp.target
+  ${target-platform}
+  1.0.0-SNAPSHOT
+
+  
+
+  
+
+  
+org.eclipse.tycho
+

[PATCH] D30476: [clangd] Add a toy Eclipse integration for development purposes

2017-03-06 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson added a comment.

Please disregard the last diff, I misused arc.


https://reviews.llvm.org/D30476



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


[PATCH] D30476: [clangd] Add a toy Eclipse integration for development purposes

2017-03-06 Thread Marc-Andre Laperle via Phabricator via cfe-commits
malaperle-ericsson updated this revision to Diff 90774.
malaperle-ericsson added a comment.

[clangd] Fix not being able to attach a debugger on macOS

Clangd is often waiting for input on getline as it awaits requests.
If the getline is interrupted, it causes the system call (read) to
fail and the EINTR error to be set. This can be seen when attaching
a debugger such as LLDB on macOS. On macOS (and possibly other
operating systems), this system call is not restarted after
interruption but on Linux it is restarted which is why attaching a
debugger does work correctly there.

The solution is to work around the non-restarting system call by
checking the errno for EINTR when the stream fails and try again.
This should be safe on all Unixish platforms.

See also http://bugs.llvm.org/show_bug.cgi?id=32149 for some background 
discussion.


https://reviews.llvm.org/D30476

Files:
  clangd/ClangDMain.cpp


Index: clangd/ClangDMain.cpp
===
--- clangd/ClangDMain.cpp
+++ clangd/ClangDMain.cpp
@@ -67,6 +67,12 @@
 // by \r\n.
 std::string Line;
 std::getline(std::cin, Line);
+#ifdef LLVM_ON_UNIX
+if (!std::cin.good() && errno == EINTR) {
+  std::cin.clear();
+  continue;
+}
+#endif
 
 // Skip empty lines.
 llvm::StringRef LineRef(Line);


Index: clangd/ClangDMain.cpp
===
--- clangd/ClangDMain.cpp
+++ clangd/ClangDMain.cpp
@@ -67,6 +67,12 @@
 // by \r\n.
 std::string Line;
 std::getline(std::cin, Line);
+#ifdef LLVM_ON_UNIX
+if (!std::cin.good() && errno == EINTR) {
+  std::cin.clear();
+  continue;
+}
+#endif
 
 // Skip empty lines.
 llvm::StringRef LineRef(Line);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2017-03-06 Thread Mehdi AMINI via Phabricator via cfe-commits
mehdi_amini updated this revision to Diff 90773.
mehdi_amini edited the summary of this revision.
mehdi_amini added a comment.

Rebase


https://reviews.llvm.org/D17469

Files:
  test/std/localization/locale.categories/category.ctype/ctype_base.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_1.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/tolower_many.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_1.pass.cpp
  
test/std/localization/locale.categories/category.ctype/locale.ctype.byname/toupper_many.pass.cpp
  
test/std/localization/locale.categories/category.monetary/locale.moneypunct/types.pass.cpp
  
test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp
  
test/std/localization/locales/locale/locale.types/locale.category/category.pass.cpp
  test/std/re/re.traits/translate_nocase.pass.cpp
  test/std/strings/string.conversions/stof.pass.cpp
  test/std/strings/string.conversions/stol.pass.cpp
  test/std/strings/string.conversions/stoll.pass.cpp
  test/std/strings/string.conversions/stoul.pass.cpp
  test/std/strings/string.conversions/stoull.pass.cpp
  test/std/thread/futures/futures.future_error/what.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
  test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
  test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
  test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp

Index: test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
===
--- test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
+++ test/std/utilities/time/time.clock/time.clock.system/consistency.pass.cpp
@@ -9,8 +9,8 @@
 //
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
-// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
-// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
+// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.7
+// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8
 
 // Due to C++17 inline variables ASAN flags this test as containing an ODR
 // violation because Clock::is_steady is defined in both the dylib and this TU.
Index: test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
===
--- test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
+++ test/std/utilities/time/time.clock/time.clock.steady/consistency.pass.cpp
@@ -9,8 +9,8 @@
 //
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
-// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
-// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
+// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.7
+// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8
 // UNSUPPORTED: libcpp-has-no-monotonic-clock
 
 // Due to C++17 inline variables ASAN flags this test as containing an ODR
Index: test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
===
--- test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
+++ test/std/utilities/time/time.clock/time.clock.hires/consistency.pass.cpp
@@ -9,8 +9,8 @@
 //
 // This test uses new symbols that were not defined in the libc++ shipped on
 // darwin11 and darwin12:
-// XFAIL: with_system_cxx_lib=x86_64-apple-darwin11
-// XFAIL: with_system_cxx_lib=x86_64-apple-darwin12
+// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.7
+// XFAIL: with_system_cxx_lib=x86_64-apple-macosx10.8
 
 // Due to C++17 inline variables ASAN flags this test as containing an ODR
 // violation because Clock::is_steady is defined in both the dylib and this TU.
Index: 

[PATCH] D30423: [ubsan] Detect UB loads from bitfields

2017-03-06 Thread Vedant Kumar via Phabricator via cfe-commits
vsk added a comment.

Thanks for the feedback!




Comment at: test/CodeGenCXX/ubsan-bitfields.cpp:21
+  // CHECK: call void @__ubsan_handle_load_invalid_value
+  return s->e1;
+}

arphaman wrote:
> Can we avoid the check if the bitfield is 2 bits wide?
I don't think so, because if the user memset()'s the memory backing the struct, 
we could still load a value outside of {1, 2, 3} from the bitfield.



Comment at: test/CodeGenObjC/ubsan-bool.m:25
+  // OBJC:  [[ASHR:%.*]] = ashr i8 [[SHL]], 7
+  // OBJC:  [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+  // OBJC: call void @__ubsan_handle_load_invalid_value

arphaman wrote:
> One unrelated thing that I noticed in the IR, the `zext`s to `i64` are 
> emitted before the branch, even though they are used only in the 
> `invalid_value` blocks. I know that the optimizer can move those anyway, but 
> would there any be any benefit in moving them into the blocks at the frontend 
> IRGen level?
I'm not sure. Maybe it would make the live range of the zext smaller at -O0? 
I'll look into this and see if there's a real perf impact.



Comment at: test/CodeGenObjC/ubsan-bool.m:26
+  // OBJC:  [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+  // OBJC: call void @__ubsan_handle_load_invalid_value
+

arphaman wrote:
> Is it possible to avoid the check here since the bitfield is just one bit 
> wide?
No, a user could do:

```
struct S1 s;
s.b1 = 1;
if (s.b1 == 1) // evaluates to false, s.b1 is negative
```

With this patch we get:
```
runtime error: load of value -1, which is not a valid value for type 'BOOL' 
(aka 'signed char')
```


https://reviews.llvm.org/D30423



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


[PATCH] D28670: [ObjC] Disallow vector parameters and return values in Objective-C methods on older X86 targets

2017-03-06 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

Hi Alex,




Comment at: lib/Sema/SemaDeclObjC.cpp:4312
+  for (const ParmVarDecl *P : Method->parameters()) {
+if (P->getType()->isVectorType()) {
+  Loc = P->getLocStart();

Assuming objc/c++ can pass/return these, the current check wouldn't be enough 
to cover x86_64 ABI cases where small (< 8 bytes) trivial classes containing 
vector types are directly passed / returned as vector types. You might want to 
check if that applies here.

See test/CodeGenCXX/x86_64-arguments-avx.cpp for examples (and x86_64 abi doc, 
item 3.2.3)



Comment at: test/SemaObjC/x86-method-vector-values.m:16
+
+typedef __attribute__((__ext_vector_type__(3))) float float3;
+

Can you also add to the testcase instances that use regular non-ext vector 
(`vector_type(...)`)?


Repository:
  rL LLVM

https://reviews.llvm.org/D28670



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


[PATCH] D30593: Add correct "-isystem"/"-isysroot" warning handling to static analysis' BugReporter.

2017-03-06 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment.

We add the suppression for libcxx issues in 
LikelyFalsePositiveSuppressionBRVisitor in BugReporterVisitors.cpp. It is 
ad-hoc pattern recognition of idioms we know cause false positives rather than 
an explicit database.


Repository:
  rL LLVM

https://reviews.llvm.org/D30593



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


[PATCH] D30593: Add correct "-isystem"/"-isysroot" warning handling to static analysis' BugReporter.

2017-03-06 Thread Kevin Marshall via Phabricator via cfe-commits
kmarshall added a comment.

Also, it looks like some instances of safe unique_ptr assignment using 
std::move() are tripping up the analyzer.

Error:

  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:190:4:
 warning: Potential memory leak

**C++ library code:**

  template::pointer,
   pointer>::value
   && !std::is_array<_Up>::value>::type>
unique_ptr&
operator=(unique_ptr<_Up, _Ep>&& __u)
{
  reset(__u.release());
  get_deleter() = std::forward<_Ep>(__u.get_deleter());
  return *this;  // <-- GENERATES WARNING
}

**Call site:**

  case Message::STRUCT: {
MessageReader sub_reader(NULL);
if (reader->PopStruct(_reader)) {
  std::unique_ptr list_value(new base::ListValue);
  if (PopListElements(_reader, list_value.get()))
result = std::move(list_value);  // <-- GENERATES WARNING. |result| is 
a std::unique_ptr, so the std::move should be safe.
}
break;
  }

**Analysis trace:**

  In file included from 
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/memory:85:
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:190:4:
 warning: Potential memory leak
return *this;
^
  ../../dbus/values_util.cc:94:3: note: Control jumps to 'case STRUCT:'  at 
line 197
switch (reader->GetDataType()) {
^
  ../../dbus/values_util.cc:199:11: note: Assuming the condition is true
if (reader->PopStruct(_reader)) {
^~
  ../../dbus/values_util.cc:199:7: note: Taking true branch
if (reader->PopStruct(_reader)) {
^
  ../../dbus/values_util.cc:200:53: note: Memory is allocated
  std::unique_ptr list_value(new base::ListValue);
  ^~~
  ../../dbus/values_util.cc:201:9: note: Taking true branch
  if (PopListElements(_reader, list_value.get()))
  ^
  ../../dbus/values_util.cc:202:11: note: Calling 'unique_ptr::operator='
result = std::move(list_value);
^~
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:190:4:
 note: Potential memory leak
return *this;
^


Repository:
  rL LLVM

https://reviews.llvm.org/D30593



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


[PATCH] D30593: Add correct "-isystem"/"-isysroot" warning handling to static analysis' BugReporter.

2017-03-06 Thread Kevin Marshall via Phabricator via cfe-commits
kmarshall added a comment.

That makes sense. In the cases that I'm finding, the original call site is in 
application source code, but the warning is generated from inside a system 
header. So, I suppose the suppressions are working as intended, and we just 
need to add one-off suppressions for the known noisy sources? Where is the 
suppression database located? FWIW, there aren't many unique error sources - I 
only counted 9 after running the warnings through "uniq | sort".

Re: specifics, here the most common one that I'm seeing. It seems like a bogus 
buffer overrun warning?

  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1258:9:
 note: Assigned value is garbage or undefined
  *__s++ = *__first++;
 ^ ~~

The error is generated from this trivial logging line 
:

  LOG(FATAL) << "Unknown type: " << type;  // |type| is an enum

The offending C++ library code snippet is here (note the line w/comment 
"GENERATES WARNING")

  template
_CharT*
__add_grouping(_CharT* __s, _CharT __sep,
   const char* __gbeg, size_t __gsize,
   const _CharT* __first, const _CharT* __last)
{
  size_t __idx = 0;
  size_t __ctr = 0;
  
  while (__last - __first > __gbeg[__idx]
 && static_cast(__gbeg[__idx]) > 0
 && __gbeg[__idx] != __gnu_cxx::__numeric_traits::__max)
{
  __last -= __gbeg[__idx];
  __idx < __gsize - 1 ? ++__idx : ++__ctr;
}
  
  while (__first != __last)
*__s++ = *__first++;  // <-- GENERATES WARNING
  
  while (__ctr--)
{
  *__s++ = __sep; 
  for (char __i = __gbeg[__idx]; __i > 0; --__i)
*__s++ = *__first++;
}
  
  while (__idx--)
{
  *__s++ = __sep; 
  for (char __i = __gbeg[__idx]; __i > 0; --__i)
*__s++ = *__first++;
}
  
  return __s;
}

Here's a full snippet of the analysis trace:

  ../../dbus/message.cc:233:9: note: Calling 'basic_ostream::operator<<'
  LOG(FATAL) << "Unknown type: " << type;
  ^~
  ../../base/logging.h:414:23: note: expanded from macro 'LOG'
  #define LOG(severity) LAZY_STREAM(LOG_STREAM(severity), LOG_IS_ON(severity))
^
  ../../base/logging.h:402:62: note: expanded from macro 'LAZY_STREAM'
!(condition) ? (void) 0 : ::logging::LogMessageVoidify() & (stream)
   ^
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:113:11:
 note: Assuming '__fmt' is not equal to 'oct'
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
^~
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:113:11:
 note: Left side of '||' is false
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:113:37:
 note: Assuming '__fmt' is not equal to 'hex'
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
  ^~
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:113:7:
 note: Taking false branch
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
^
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:116:9:
 note: Calling 'basic_ostream::_M_insert'
  return _M_insert(static_cast(__n));
 ^
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:69:2:
 note: Taking true branch
  if (__cerb)
  ^
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:75:7:
 note: Calling 'num_put::put'
  if (__np.put(*this, *this, this->fill(), __v).failed())
  ^
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.h:2336:16:
 note: Calling 'num_put::do_put'
{ return this->do_put(__s, __f, __fill, __v); }
 ^~~
  
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.h:2475:16:
 note: Calling 'num_put::_M_insert_int'
{ return _M_insert_int(__s, __io, __fill, __v); } 
 

r297106 - Define LLVM_ENABLE_WARNINGS when building standalone clang to ensure warnings get enabled

2017-03-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Mar  6 18:15:18 2017
New Revision: 297106

URL: http://llvm.org/viewvc/llvm-project?rev=297106=rev
Log:
Define LLVM_ENABLE_WARNINGS when building standalone clang to ensure warnings 
get enabled

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=297106=297105=297106=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Mon Mar  6 18:15:18 2017
@@ -82,6 +82,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
 set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
   endif()
 
+  option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
   option(LLVM_INSTALL_TOOLCHAIN_ONLY
 "Only include toolchain files in the 'install' target." OFF)
 


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


r297105 - Fix unused variable in SemaCoroutine.cpp

2017-03-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Mar  6 18:01:13 2017
New Revision: 297105

URL: http://llvm.org/viewvc/llvm-project?rev=297105=rev
Log:
Fix unused variable in SemaCoroutine.cpp

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

Modified: cfe/trunk/lib/Sema/SemaCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCoroutine.cpp?rev=297105=297104=297105=diff
==
--- cfe/trunk/lib/Sema/SemaCoroutine.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCoroutine.cpp Mon Mar  6 18:01:13 2017
@@ -326,7 +326,6 @@ static FunctionScopeInfo *checkCoroutine
 return nullptr;
 
   assert(isa(S.CurContext) && "not in a function scope");
-  auto *FD = cast(S.CurContext);
 
   auto *ScopeInfo = S.getCurFunction();
   assert(ScopeInfo && "missing function scope for function");


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


r297101 - Fix some widespread warnings in headers from the new coroutine code

2017-03-06 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Mon Mar  6 17:52:53 2017
New Revision: 297101

URL: http://llvm.org/viewvc/llvm-project?rev=297101=rev
Log:
Fix some widespread warnings in headers from the new coroutine code

Modified:
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/include/clang/Sema/ScopeInfo.h

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=297101=297100=297101=diff
==
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Mon Mar  6 17:52:53 2017
@@ -259,9 +259,6 @@ protected:
 unsigned : NumExprBits;
 
 unsigned IsImplicit : 1;
-
-/// \brief The number of arguments to this type trait.
-unsigned NumArgs : 32 - 1 - NumExprBits;
   };
 
   union {

Modified: cfe/trunk/include/clang/Sema/ScopeInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ScopeInfo.h?rev=297101=297100=297101=diff
==
--- cfe/trunk/include/clang/Sema/ScopeInfo.h (original)
+++ cfe/trunk/include/clang/Sema/ScopeInfo.h Mon Mar  6 17:52:53 2017
@@ -411,12 +411,12 @@ public:
   HasOMPDeclareReductionCombiner(false),
   HasFallthroughStmt(false),
   HasPotentialAvailabilityViolations(false),
-  NeedsCoroutineSuspends(true),
   ObjCShouldCallSuper(false),
   ObjCIsDesignatedInit(false),
   ObjCWarnForNoDesignatedInitChain(false),
   ObjCIsSecondaryInit(false),
   ObjCWarnForNoInitDelegation(false),
+  NeedsCoroutineSuspends(true),
   ErrorTrap(Diag) { }
 
   virtual ~FunctionScopeInfo();


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


r297099 - Relax stmtexpr.cpp checks for PPC64

2017-03-06 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Mon Mar  6 17:49:18 2017
New Revision: 297099

URL: http://llvm.org/viewvc/llvm-project?rev=297099=rev
Log:
Relax stmtexpr.cpp checks for PPC64

Modified:
cfe/trunk/test/CodeGenCXX/stmtexpr.cpp

Modified: cfe/trunk/test/CodeGenCXX/stmtexpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/stmtexpr.cpp?rev=297099=297098=297099=diff
==
--- cfe/trunk/test/CodeGenCXX/stmtexpr.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/stmtexpr.cpp Mon Mar  6 17:49:18 2017
@@ -97,10 +97,10 @@ extern "C" int cleanup_exit_scalar(bool
   return v;
 }
 
-// CHECK-LABEL: define i32 @cleanup_exit_scalar({{.*}})
+// CHECK-LABEL: define{{.*}} i32 @cleanup_exit_scalar({{.*}})
 // CHECK: call {{.*}} @_ZN1AC1Ei
 //Spill after bar.
-// CHECK: %[[v:[^ ]*]] = call i32 @_Z3bar1Ai({{.*}})
+// CHECK: %[[v:[^ ]*]] = call{{.*}} i32 @_Z3bar1Ai({{.*}})
 // CHECK-NEXT: store i32 %[[v]], i32* %[[tmp:[^, ]*]]
 //Do cleanup.
 // CHECK: call {{.*}} @_ZN1AD1Ev
@@ -116,7 +116,7 @@ extern "C" int cleanup_exit_scalar_const
   return v;
 }
 
-// CHECK-LABEL: define i32 @cleanup_exit_scalar_constant({{.*}})
+// CHECK-LABEL: define{{.*}} i32 @cleanup_exit_scalar_constant({{.*}})
 // CHECK: store i32 13, i32* %v
 
 // Check for the same bug for lvalue expression evaluation kind.
@@ -127,7 +127,7 @@ extern "C" int cleanup_exit_lvalue(bool
   int  = (A(1), ({ if (cond) return 0; (void)0; }), getref());
   return r;
 }
-// CHECK-LABEL: define i32 @cleanup_exit_lvalue({{.*}})
+// CHECK-LABEL: define{{.*}} i32 @cleanup_exit_lvalue({{.*}})
 // CHECK: call {{.*}} @_ZN1AC1Ei
 //Spill after bar.
 // CHECK: %[[v:[^ ]*]] = call dereferenceable(4) i32* @_Z6getrefv({{.*}})
@@ -148,7 +148,7 @@ extern "C" int cleanup_exit_complex(bool
   return v;
 }
 
-// CHECK-LABEL: define i32 @cleanup_exit_complex({{.*}})
+// CHECK-LABEL: define{{.*}} i32 @cleanup_exit_complex({{.*}})
 // CHECK: call {{.*}} @_ZN1AC1Ei
 //Spill after bar.
 // CHECK: call {{.*}} @_Z11bar_complex1Ai({{.*}})


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


r297098 - Set the Int64Type / IntMaxType types correctly for OpenBSD/mips64

2017-03-06 Thread Brad Smith via cfe-commits
Author: brad
Date: Mon Mar  6 17:48:31 2017
New Revision: 297098

URL: http://llvm.org/viewvc/llvm-project?rev=297098=rev
Log:
Set the Int64Type / IntMaxType types correctly for OpenBSD/mips64

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=297098=297097=297098=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Mar  6 17:48:31 2017
@@ -7578,7 +7578,11 @@ public:
 
   void setN64ABITypes() {
 setN32N64ABITypes();
-Int64Type = SignedLong;
+if (getTriple().getOS() == llvm::Triple::OpenBSD) {
+  Int64Type = SignedLongLong;
+} else {
+  Int64Type = SignedLong;
+}
 IntMaxType = Int64Type;
 LongWidth = LongAlign = 64;
 PointerWidth = PointerAlign = 64;

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=297098=297097=297098=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Mon Mar  6 17:48:31 2017
@@ -8766,6 +8766,8 @@
 // RUN: %clang_cc1 -E -dM -ffreestanding 
-triple=arm-unknown-openbsd6.1-gnueabi < /dev/null | FileCheck 
-match-full-lines -check-prefix OPENBSD %s
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=mips64el-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-unknown-openbsd6.1 < 
/dev/null | FileCheck -match-full-lines -check-prefix OPENBSD %s
 // OPENBSD:#define __ELF__ 1
 // OPENBSD:#define __INT16_TYPE__ short


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


[PATCH] D30465: [mips] Set the Int64Type / IntMaxType types correctly for OpenBSD/mips64

2017-03-06 Thread Brad Smith via Phabricator via cfe-commits
brad added a comment.

Good to know about the reviewer.

I am not familiar with phabricator and was just trying something with the 
addition of the subscriber.

I will keep the amount of context in mind for future diffs.

Thanks.


Repository:
  rL LLVM

https://reviews.llvm.org/D30465



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


r297093 - [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

2017-03-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Mar  6 17:38:15 2017
New Revision: 297093

URL: http://llvm.org/viewvc/llvm-project?rev=297093=rev
Log:
[coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

Summary:
The changes contained in this patch are:

1. Defines a new AST node `CoawaitDependentExpr` for representing co_await 
expressions while the promise type is still dependent.
2. Correctly detect and transform the 'co_await' operand to  
`p.await_transform()`  when possible.
3. Change the initial/final suspend points to build during the initial parse, 
so they have the correct operator co_await lookup results.
4.  Fix transformation of the CoroutineBodyStmt so that it doesn't re-build the 
final/initial suspends.


@rsmith: This change is a little big, but it's not trivial for me to split it 
up. Please let me know if you would prefer this submitted as multiple patches.



Reviewers: rsmith, GorNishanov

Reviewed By: rsmith

Subscribers: ABataev, rsmith, mehdi_amini, cfe-commits

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

Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/include/clang/AST/StmtCXX.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Basic/StmtNodes.td
cfe/trunk/include/clang/Sema/ScopeInfo.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprClassification.cpp
cfe/trunk/lib/AST/ExprConstant.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
cfe/trunk/lib/Sema/ScopeInfo.cpp
cfe/trunk/lib/Sema/SemaCoroutine.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaExceptionSpec.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/test/SemaCXX/coroutines.cpp
cfe/trunk/tools/libclang/CXCursor.cpp

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=297093=297092=297093=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Mon Mar  6 17:38:15 2017
@@ -4194,11 +4194,16 @@ class CoawaitExpr : public CoroutineSusp
   friend class ASTStmtReader;
 public:
   CoawaitExpr(SourceLocation CoawaitLoc, Expr *Operand, Expr *Ready,
-  Expr *Suspend, Expr *Resume)
+  Expr *Suspend, Expr *Resume, bool IsImplicit = false)
   : CoroutineSuspendExpr(CoawaitExprClass, CoawaitLoc, Operand, Ready,
- Suspend, Resume) {}
-  CoawaitExpr(SourceLocation CoawaitLoc, QualType Ty, Expr *Operand)
-  : CoroutineSuspendExpr(CoawaitExprClass, CoawaitLoc, Ty, Operand) {}
+ Suspend, Resume) {
+  CoawaitBits.IsImplicit = IsImplicit;
+  }
+  CoawaitExpr(SourceLocation CoawaitLoc, QualType Ty, Expr *Operand,
+  bool IsImplicit = false)
+  : CoroutineSuspendExpr(CoawaitExprClass, CoawaitLoc, Ty, Operand) {
+CoawaitBits.IsImplicit = IsImplicit;
+  }
   CoawaitExpr(EmptyShell Empty)
   : CoroutineSuspendExpr(CoawaitExprClass, Empty) {}
 
@@ -4207,11 +4212,57 @@ public:
 return getCommonExpr();
   }
 
+  bool isImplicit() const { return CoawaitBits.IsImplicit; }
+  void setIsImplicit(bool value = true) { CoawaitBits.IsImplicit = value; }
+
   static bool classof(const Stmt *T) {
 return T->getStmtClass() == CoawaitExprClass;
   }
 };
 
+/// \brief Represents a 'co_await' expression while the type of the promise
+/// is dependent.
+class DependentCoawaitExpr : public Expr {
+  SourceLocation KeywordLoc;
+  Stmt *SubExprs[2];
+
+  friend class ASTStmtReader;
+
+public:
+  DependentCoawaitExpr(SourceLocation KeywordLoc, QualType Ty, Expr *Op,
+   UnresolvedLookupExpr *OpCoawait)
+  : Expr(DependentCoawaitExprClass, Ty, VK_RValue, OK_Ordinary,
+ /*TypeDependent*/ true, /*ValueDependent*/ true,
+ /*InstantiationDependent*/ true,
+ Op->containsUnexpandedParameterPack()),
+KeywordLoc(KeywordLoc) {
+assert(Op->isTypeDependent() && Ty->isDependentType() &&
+   "wrong constructor for non-dependent co_await/co_yield expression");
+SubExprs[0] = Op;
+SubExprs[1] = OpCoawait;
+  }
+
+  DependentCoawaitExpr(EmptyShell Empty)
+  : Expr(DependentCoawaitExprClass, Empty) {}
+
+  Expr *getOperand() const { return cast(SubExprs[0]); }
+  UnresolvedLookupExpr *getOperatorCoawaitLookup() const {
+return cast(SubExprs[1]);
+  }
+  SourceLocation getKeywordLoc() const { return KeywordLoc; }
+
+  SourceLocation getLocStart() const LLVM_READONLY { 

[PATCH] D26057: [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

2017-03-06 Thread Richard Smith via Phabricator via cfe-commits
rsmith added inline comments.



Comment at: lib/Sema/TreeTransform.h:6802
+  return getDerived().RebuildDependentCoawaitExpr(
+  E->getKeywordLoc(), Result.get(), E->getOperatorCoawaitLookup());
+}

EricWF wrote:
> rsmith wrote:
> > You need to transform the UnresolvedLookupExpr here too. (Example: we might 
> > have a function-local declaration of `operator co_await` that needs to be 
> > transformed into the version in the instantiated function.)
> Ack. Fixed.
> 
> Do you have an example that doesn't use a function-local definition? Since 
> `operator co_await` cannot be defined locally.
It can't be defined locally, but it can be *declared* locally. Example:

```
template future f(T t) {
  future operator co_await(T);
  co_await t;
}
struct X {};
auto x = f(X{});
```

... which would require that `future operator co_await(X)` is defined 
somewhere in the program.


https://reviews.llvm.org/D26057



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


[PATCH] D26057: [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

2017-03-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: include/clang/Sema/ScopeInfo.h:138-140
+  /// \brief Whether this function has already built, or tried to build, the
+  /// the initial and final coroutine suspend points.
+  bool NeedsCoroutineSuspends : 1;

rsmith wrote:
> Is the comment here correct? It seems a slightly odd match for the member 
> name.
The comment should probably say "True only when this function has not already 
built, or attempted to build, the initial and final coroutine suspend points".



Comment at: lib/Sema/SemaCoroutine.cpp:99
+
+  auto buildNNS = [&]() {
 auto *NNS = NestedNameSpecifier::Create(S.Context, nullptr, StdExp);

rsmith wrote:
> `buildElaboratedType` would be a better name for what this does. I also 
> wonder if this is really necessary, or whether we can just use %q0 in the 
> diagnostic format to request a fully-qualified type name.
We can't use "%q0" in the diagnostic passed to `RequireCompleteType`, so we 
have to build up the elaborated `QualType` instead.



Comment at: lib/Sema/SemaCoroutine.cpp:112-116
+  if (S.RequireCompleteType(FuncLoc, buildNNS(),
+diag::err_coroutine_promise_type_incomplete))
+return QualType();
 
   return PromiseType;

rsmith wrote:
> We used to return the `ElaboratedType` and don't do so any more.
I don't think that's true. We only build the `ElaboratedType` before issuing a 
diagnostic and returning `QualType()` to signal failure. 



Comment at: lib/Sema/SemaCoroutine.cpp:33
 /// function type.
 static QualType lookupPromiseType(Sema , const FunctionProtoType *FnType,
+  SourceLocation KwLoc,

rsmith wrote:
> rsmith wrote:
> > EricWF wrote:
> > > The changes to this function are all unrelated cleanup/improvements.
> > Just go ahead and commit these separately then.
> Please commit these changes separately if they're cleanups unrelated to the 
> main purpose of the patch.
Ack.



Comment at: lib/Sema/TreeTransform.h:6802
+  return getDerived().RebuildDependentCoawaitExpr(
+  E->getKeywordLoc(), Result.get(), E->getOperatorCoawaitLookup());
+}

rsmith wrote:
> You need to transform the UnresolvedLookupExpr here too. (Example: we might 
> have a function-local declaration of `operator co_await` that needs to be 
> transformed into the version in the instantiated function.)
Ack. Fixed.

Do you have an example that doesn't use a function-local definition? Since 
`operator co_await` cannot be defined locally.


https://reviews.llvm.org/D26057



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


[PATCH] D26057: [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

2017-03-06 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 90752.
EricWF marked an inline comment as done.
EricWF added a comment.

- Address @rsmith's final review comments.


https://reviews.llvm.org/D26057

Files:
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/AST/Stmt.h
  include/clang/AST/StmtCXX.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/StmtNodes.td
  include/clang/Sema/ScopeInfo.h
  include/clang/Sema/Sema.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/Parse/ParseStmt.cpp
  lib/Sema/ScopeInfo.cpp
  lib/Sema/SemaCoroutine.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/SemaCXX/coroutines.cpp
  tools/libclang/CXCursor.cpp

Index: tools/libclang/CXCursor.cpp
===
--- tools/libclang/CXCursor.cpp
+++ tools/libclang/CXCursor.cpp
@@ -231,6 +231,7 @@
   case Stmt::TypeTraitExprClass:
   case Stmt::CoroutineBodyStmtClass:
   case Stmt::CoawaitExprClass:
+  case Stmt::DependentCoawaitExprClass:
   case Stmt::CoreturnStmtClass:
   case Stmt::CoyieldExprClass:
   case Stmt::CXXBindTemporaryExprClass:
Index: test/SemaCXX/coroutines.cpp
===
--- test/SemaCXX/coroutines.cpp
+++ test/SemaCXX/coroutines.cpp
@@ -73,7 +73,7 @@
 struct std::experimental::coroutine_traits {
   struct promise_type {};
 };
-double bad_promise_type_2(int) {
+double bad_promise_type_2(int) { // expected-error {{no member named 'initial_suspend'}}
   co_yield 0; // expected-error {{no member named 'yield_value' in 'std::experimental::coroutine_traits::promise_type'}}
 }
 
@@ -93,6 +93,7 @@
 }
 }
 
+// FIXME: This diagnostic is terrible.
 void undefined_promise() { // expected-error {{this function cannot be a coroutine: 'experimental::coroutine_traits::promise_type' (aka 'promise') is an incomplete type}}
   co_await a;
 }
@@ -213,6 +214,13 @@
 }
 
 struct outer {};
+struct await_arg_1 {};
+struct await_arg_2 {};
+
+namespace adl_ns {
+struct coawait_arg_type {};
+awaitable operator co_await(coawait_arg_type);
+}
 
 namespace dependent_operator_co_await_lookup {
   template void await_template(T t) {
@@ -235,6 +243,94 @@
   };
   template void await_template(outer); // expected-note {{instantiation}}
   template void await_template_2(outer);
+
+  struct transform_awaitable {};
+  struct transformed {};
+
+  struct transform_promise {
+typedef transform_awaitable await_arg;
+coro get_return_object();
+transformed initial_suspend();
+::adl_ns::coawait_arg_type final_suspend();
+transformed await_transform(transform_awaitable);
+  };
+  template 
+  struct basic_promise {
+typedef AwaitArg await_arg;
+coro get_return_object();
+awaitable initial_suspend();
+awaitable final_suspend();
+  };
+
+  awaitable operator co_await(await_arg_1);
+
+  template 
+  coro await_template_3(U t) {
+co_await t;
+  }
+
+  template coro await_template_3(await_arg_1);
+
+  template 
+  struct dependent_member {
+coro mem_fn() const {
+  co_await typename T::await_arg{}; // expected-error {{call to function 'operator co_await'}}}
+}
+template 
+coro dep_mem_fn(U t) {
+  co_await t;
+}
+  };
+
+  template <>
+  struct dependent_member {
+// FIXME this diagnostic is terrible
+coro mem_fn() const { // expected-error {{no member named 'await_ready' in 'dependent_operator_co_await_lookup::transformed'}}
+  // expected-note@-1 {{call to 'initial_suspend' implicitly required by the initial suspend point}}
+  // expected-note@+1 {{function is a coroutine due to use of 'co_await' here}}
+  co_await transform_awaitable{};
+  // expected-error@-1 {{no member named 'await_ready'}}
+}
+template 
+coro dep_mem_fn(U u) { co_await u; }
+  };
+
+  awaitable operator co_await(await_arg_2); // expected-note {{'operator co_await' should be declared prior to the call site}}
+
+  template struct dependent_member;
+  template struct dependent_member; // expected-note {{in instantiation}}
+
+  template <>
+  coro
+  // FIXME this diagnostic is terrible
+  dependent_member::dep_mem_fn(int) { // expected-error {{no member named 'await_ready' in 'dependent_operator_co_await_lookup::transformed'}}
+//expected-note@-1 {{call to 'initial_suspend' implicitly required by the initial suspend point}}
+//expected-note@+1 {{function is a coroutine due to use of 'co_await' here}}
+co_await transform_awaitable{};
+// expected-error@-1 {{no member named 'await_ready'}}
+  }
+
+  void operator co_await(transform_awaitable) = delete;
+  

[PATCH] D29117: SPARC: allow usage of floating-point registers in inline ASM

2017-03-06 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

Hi,

Thanks for working on this. Few questions:

- What happens with the validation if +soft-float is used?
- What about the 'e' mode, can you double check if the sparc backend support 
these instructions? If so it might be interesting to add it here.

Also, please attach patches with full context, it's easier to review.


https://reviews.llvm.org/D29117



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


[PATCH] D28218: Small optimizations for SourceManager::getFileID()

2017-03-06 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap added inline comments.



Comment at: lib/Basic/SourceManager.cpp:843
 if (E.getOffset() <= SLocOffset) {
   FileID Res = FileID::get(-int(I) - 2);
 

not particularly important (and unrelated to your changes) - nit - s /C-style 
cast / static_cast / ?


https://reviews.llvm.org/D28218



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


[PATCH] D28218: Small optimizations for SourceManager::getFileID()

2017-03-06 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

Hi Daniel,

This seems pretty nice. Can you share how much performance improvements you got 
by this / how did you test it?


https://reviews.llvm.org/D28218



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


r297084 - Don't assume cleanup emission preserves dominance in expr evaluation

2017-03-06 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Mon Mar  6 16:18:34 2017
New Revision: 297084

URL: http://llvm.org/viewvc/llvm-project?rev=297084=rev
Log:
Don't assume cleanup emission preserves dominance in expr evaluation

Summary:
Because of the existence branches out of GNU statement expressions, it
is possible that emitting cleanups for a full expression may cause the
new insertion point to not be dominated by the result of the inner
expression. Consider this example:

  struct Foo { Foo(); ~Foo(); int x; };
  int g(Foo, int);
  int f(bool cond) {
int n = g(Foo(), ({ if (cond) return 0; 42; }));
return n;
  }

Before this change, result of the call to 'g' did not dominate its use
in the store to 'n'. The early return exit from the statement expression
branches to a shared cleanup block, which ends in a switch between the
fallthrough destination (the assignment to 'n') or the function exit
block.

This change solves the problem by spilling and reloading expression
evaluation results when any of the active cleanups have branches.

I audited the other call sites of enterFullExpression, and they don't
appear to keep and Values live across the site of the cleanup, except in
ARC code. I wasn't able to create a test case for ARC that exhibits this
problem, though.

Reviewers: rjmccall, rsmith

Subscribers: cfe-commits

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

Modified:
cfe/trunk/lib/CodeGen/CGCleanup.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CGExprComplex.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/CodeGenCXX/stmtexpr.cpp

Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=297084=297083=297084=diff
==
--- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Mon Mar  6 16:18:34 2017
@@ -418,11 +418,15 @@ void CodeGenFunction::ResolveBranchFixup
 }
 
 /// Pops cleanup blocks until the given savepoint is reached.
-void CodeGenFunction::PopCleanupBlocks(EHScopeStack::stable_iterator Old) {
+void CodeGenFunction::PopCleanupBlocks(
+EHScopeStack::stable_iterator Old,
+std::initializer_list ValuesToReload) {
   assert(Old.isValid());
 
+  bool HadBranches = false;
   while (EHStack.stable_begin() != Old) {
 EHCleanupScope  = cast(*EHStack.begin());
+HadBranches |= Scope.hasBranches();
 
 // As long as Old strictly encloses the scope's enclosing normal
 // cleanup, we're going to emit another normal cleanup which
@@ -432,14 +436,41 @@ void CodeGenFunction::PopCleanupBlocks(E
 
 PopCleanupBlock(FallThroughIsBranchThrough);
   }
+
+  // If we didn't have any branches, the insertion point before cleanups must
+  // dominate the current insertion point and we don't need to reload any
+  // values.
+  if (!HadBranches)
+return;
+
+  // Spill and reload all values that the caller wants to be live at the 
current
+  // insertion point.
+  for (llvm::Value **ReloadedValue : ValuesToReload) {
+auto *Inst = dyn_cast_or_null(*ReloadedValue);
+if (!Inst)
+  continue;
+Address Tmp =
+CreateDefaultAlignTempAlloca(Inst->getType(), "tmp.exprcleanup");
+
+// Find an insertion point after Inst and spill it to the temporary.
+llvm::BasicBlock::iterator InsertBefore;
+if (auto *Invoke = dyn_cast(Inst))
+  InsertBefore = Invoke->getNormalDest()->getFirstInsertionPt();
+else
+  InsertBefore = std::next(Inst->getIterator());
+CGBuilderTy(CGM, &*InsertBefore).CreateStore(Inst, Tmp);
+
+// Reload the value at the current insertion point.
+*ReloadedValue = Builder.CreateLoad(Tmp);
+  }
 }
 
 /// Pops cleanup blocks until the given savepoint is reached, then add the
 /// cleanups from the given savepoint in the lifetime-extended cleanups stack.
-void
-CodeGenFunction::PopCleanupBlocks(EHScopeStack::stable_iterator Old,
-  size_t OldLifetimeExtendedSize) {
-  PopCleanupBlocks(Old);
+void CodeGenFunction::PopCleanupBlocks(
+EHScopeStack::stable_iterator Old, size_t OldLifetimeExtendedSize,
+std::initializer_list ValuesToReload) {
+  PopCleanupBlocks(Old, ValuesToReload);
 
   // Move our deferred cleanups onto the EH stack.
   for (size_t I = OldLifetimeExtendedSize,

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=297084=297083=297084=diff
==
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Mar  6 16:18:34 2017
@@ -1069,7 +1069,19 @@ LValue CodeGenFunction::EmitLValue(const
 const auto *cleanups = cast(E);
 enterFullExpression(cleanups);
 RunCleanupsScope Scope(*this);
-return EmitLValue(cleanups->getSubExpr());
+LValue LV = 

[PATCH] D30590: Don't assume cleanup emission preserves dominance in expr evaluation

2017-03-06 Thread Reid Kleckner via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297084: Don't assume cleanup emission preserves dominance in 
expr evaluation (authored by rnk).

Changed prior to commit:
  https://reviews.llvm.org/D30590?vs=90743=90747#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30590

Files:
  cfe/trunk/lib/CodeGen/CGCleanup.cpp
  cfe/trunk/lib/CodeGen/CGExpr.cpp
  cfe/trunk/lib/CodeGen/CGExprComplex.cpp
  cfe/trunk/lib/CodeGen/CGExprScalar.cpp
  cfe/trunk/lib/CodeGen/CodeGenFunction.h
  cfe/trunk/test/CodeGenCXX/stmtexpr.cpp

Index: cfe/trunk/test/CodeGenCXX/stmtexpr.cpp
===
--- cfe/trunk/test/CodeGenCXX/stmtexpr.cpp
+++ cfe/trunk/test/CodeGenCXX/stmtexpr.cpp
@@ -80,3 +80,85 @@
   y = ({ A a(1); if (b) goto G; a.i; });
   G: return y;
 }
+
+// When we emit a full expression with cleanups that contains branches out of
+// the full expression, the result of the inner expression (the call to
+// call_with_cleanups in this case) may not dominate the fallthrough destination
+// of the shared cleanup block.
+//
+// In this case the CFG will be a sequence of two diamonds, but the only
+// dynamically possible execution paths are both left hand branches and both
+// right hand branches. The first diamond LHS will call bar, and the second
+// diamond LHS will assign the result to v, but the call to bar does not
+// dominate the assignment.
+int bar(A, int);
+extern "C" int cleanup_exit_scalar(bool b) {
+  int v = bar(A(1), ({ if (b) return 42; 13; }));
+  return v;
+}
+
+// CHECK-LABEL: define i32 @cleanup_exit_scalar({{.*}})
+// CHECK: call {{.*}} @_ZN1AC1Ei
+//Spill after bar.
+// CHECK: %[[v:[^ ]*]] = call i32 @_Z3bar1Ai({{.*}})
+// CHECK-NEXT: store i32 %[[v]], i32* %[[tmp:[^, ]*]]
+//Do cleanup.
+// CHECK: call {{.*}} @_ZN1AD1Ev
+// CHECK: switch
+//Reload before v assignment.
+// CHECK: %[[v:[^ ]*]] = load i32, i32* %[[tmp]]
+// CHECK-NEXT: store i32 %[[v]], i32* %v
+
+// No need to spill when the expression result is a constant, constants don't
+// have dominance problems.
+extern "C" int cleanup_exit_scalar_constant(bool b) {
+  int v = (A(1), (void)({ if (b) return 42; 0; }), 13);
+  return v;
+}
+
+// CHECK-LABEL: define i32 @cleanup_exit_scalar_constant({{.*}})
+// CHECK: store i32 13, i32* %v
+
+// Check for the same bug for lvalue expression evaluation kind.
+// FIXME: What about non-reference lvalues, like bitfield lvalues and vector
+// lvalues?
+int ();
+extern "C" int cleanup_exit_lvalue(bool cond) {
+  int  = (A(1), ({ if (cond) return 0; (void)0; }), getref());
+  return r;
+}
+// CHECK-LABEL: define i32 @cleanup_exit_lvalue({{.*}})
+// CHECK: call {{.*}} @_ZN1AC1Ei
+//Spill after bar.
+// CHECK: %[[v:[^ ]*]] = call dereferenceable(4) i32* @_Z6getrefv({{.*}})
+// CHECK-NEXT: store i32* %[[v]], i32** %[[tmp:[^, ]*]]
+//Do cleanup.
+// CHECK: call {{.*}} @_ZN1AD1Ev
+// CHECK: switch
+//Reload before v assignment.
+// CHECK: %[[v:[^ ]*]] = load i32*, i32** %[[tmp]]
+// CHECK-NEXT: store i32* %[[v]], i32** %r
+
+
+// We handle ExprWithCleanups for complex evaluation type separately, and it had
+// the same bug.
+_Complex float bar_complex(A, int);
+extern "C" int cleanup_exit_complex(bool b) {
+  _Complex float v = bar_complex(A(1), ({ if (b) return 42; 13; }));
+  return v;
+}
+
+// CHECK-LABEL: define i32 @cleanup_exit_complex({{.*}})
+// CHECK: call {{.*}} @_ZN1AC1Ei
+//Spill after bar.
+// CHECK: call {{.*}} @_Z11bar_complex1Ai({{.*}})
+// CHECK: store float %{{.*}}, float* %[[tmp1:[^, ]*]]
+// CHECK: store float %{{.*}}, float* %[[tmp2:[^, ]*]]
+//Do cleanup.
+// CHECK: call {{.*}} @_ZN1AD1Ev
+// CHECK: switch
+//Reload before v assignment.
+// CHECK: %[[v1:[^ ]*]] = load float, float* %[[tmp1]]
+// CHECK: %[[v2:[^ ]*]] = load float, float* %[[tmp2]]
+// CHECK: store float %[[v1]], float* %v.realp
+// CHECK: store float %[[v2]], float* %v.imagp
Index: cfe/trunk/lib/CodeGen/CodeGenFunction.h
===
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h
@@ -580,14 +580,10 @@
   CGF.DidCallStackSave = false;
 }
 
-/// \brief Exit this cleanup scope, emitting any accumulated
-/// cleanups.
+/// \brief Exit this cleanup scope, emitting any accumulated cleanups.
 ~RunCleanupsScope() {
-  if (PerformCleanup) {
-CGF.DidCallStackSave = OldDidCallStackSave;
-CGF.PopCleanupBlocks(CleanupStackDepth,
- LifetimeExtendedCleanupStackSize);
-  }
+  if (PerformCleanup)
+ForceCleanup();
 }
 
 /// \brief Determine whether this scope requires any cleanups.
@@ -597,11 +593,15 @@
 
 /// \brief Force the emission of cleanups now, instead of waiting
 /// until this object is destroyed.
-void ForceCleanup() {
+/// \param ValuesToReload - A list of values that need to be available 

[PATCH] D30662: Update clang filtering for mxcsr

2017-03-06 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment.

I think we should really change this code to filter out clobber registers that 
do not name valid gcc inline asm clobbers. That's basically what we require 
later. I think if you change this condition to just check 
Target.isValidGCCRegisterName.


Repository:
  rL LLVM

https://reviews.llvm.org/D30662



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


[PATCH] D26057: [coroutines] Add DependentCoawaitExpr and fix re-building CoroutineBodyStmt.

2017-03-06 Thread Richard Smith via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.



Comment at: include/clang/Sema/ScopeInfo.h:138-140
+  /// \brief Whether this function has already built, or tried to build, the
+  /// the initial and final coroutine suspend points.
+  bool NeedsCoroutineSuspends : 1;

Is the comment here correct? It seems a slightly odd match for the member name.



Comment at: lib/Sema/SemaCoroutine.cpp:33
 /// function type.
 static QualType lookupPromiseType(Sema , const FunctionProtoType *FnType,
+  SourceLocation KwLoc,

rsmith wrote:
> EricWF wrote:
> > The changes to this function are all unrelated cleanup/improvements.
> Just go ahead and commit these separately then.
Please commit these changes separately if they're cleanups unrelated to the 
main purpose of the patch.



Comment at: lib/Sema/TreeTransform.h:6974-6975
+
+  // FIXME(EricWF): Remove this
+  assert(isa(LookupResult.get()) && "Expected lookup 
expr");
+

Remove this :) (This is already checked by the `cast` below.)


https://reviews.llvm.org/D26057



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


[PATCH] D25866: [Sema] Support implicit scalar to vector conversions

2017-03-06 Thread Bruno Cardoso Lopes via Phabricator via cfe-commits
bruno added a comment.

Hey, really sorry for the delay here.




Comment at: lib/Sema/SemaExpr.cpp:8007
+static bool canConvertIntToOtherIntTy(Sema , ExprResult *Int,
+   QualType OtherIntTy) {
+  QualType IntTy = Int->get()->getType().getUnqualifiedType();

This doesn't look clang-formated. 



Comment at: lib/Sema/SemaExpr.cpp:8034
+NumBits > S.Context.getIntWidth(OtherIntTy))
+  return true;
+  } else {

Instead of the else here, you can:
   
  return (IntSigned != OtherIntSigned &&
  NumBits > S.Context.getIntWidth(OtherIntTy))
   }

   return (Order < 0);



Comment at: lib/Sema/SemaExpr.cpp:8092
+ExprResult *Vector) {
+  QualType ScalarTy = Scalar->get()->getType().getUnqualifiedType();
+  QualType VectorTy = Vector->get()->getType().getUnqualifiedType();

Can you please add an assertion to the beginning of this function to guarantee 
that the vector is never a ext-vector type? I wanna make sure we don't 
accidentally use this in the future for ext-vectors. 



Comment at: test/Sema/vector-gcc-compat.c:61
+  //match.
+  v2i64_r = v2i64_a == 1; // expected-warning {{incompatible vector types 
assigning to 'v2i64' (vector of 2 'long long' values) from 'long 
__attribute__((ext_vector_type(2)))' (vector of 2 'long' values)}}
+  v2i64_r = v2i64_a != 1; // expected-warning {{incompatible vector types 
assigning to 'v2i64' (vector of 2 'long long' values) from 'long 
__attribute__((ext_vector_type(2)))' (vector of 2 'long' values)}}

Can you double check where 'long __attribute__((ext_vector_type(2)))' comes 
from?

We have regressed in the past year in the way ext-vector interacts with 
non-ext-vectors, and I don't wanna make it worse until we actually have time to 
fix that; there's a lot of code out there relying on bitcasts between 
ext-vectors and non-ext-vectors to bridge between intrinsics headers and 
ext-vector code.


https://reviews.llvm.org/D25866



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


[PATCH] D30590: Don't assume cleanup emission preserves dominance in expr evaluation

2017-03-06 Thread Reid Kleckner via Phabricator via cfe-commits
rnk updated this revision to Diff 90743.
rnk added a comment.

- comments


https://reviews.llvm.org/D30590

Files:
  lib/CodeGen/CGCleanup.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGExprComplex.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGenCXX/stmtexpr.cpp

Index: test/CodeGenCXX/stmtexpr.cpp
===
--- test/CodeGenCXX/stmtexpr.cpp
+++ test/CodeGenCXX/stmtexpr.cpp
@@ -80,3 +80,85 @@
   y = ({ A a(1); if (b) goto G; a.i; });
   G: return y;
 }
+
+// When we emit a full expression with cleanups that contains branches out of
+// the full expression, the result of the inner expression (the call to
+// call_with_cleanups in this case) may not dominate the fallthrough destination
+// of the shared cleanup block.
+//
+// In this case the CFG will be a sequence of two diamonds, but the only
+// dynamically possible execution paths are both left hand branches and both
+// right hand branches. The first diamond LHS will call bar, and the second
+// diamond LHS will assign the result to v, but the call to bar does not
+// dominate the assignment.
+int bar(A, int);
+extern "C" int cleanup_exit_scalar(bool b) {
+  int v = bar(A(1), ({ if (b) return 42; 13; }));
+  return v;
+}
+
+// CHECK-LABEL: define i32 @cleanup_exit_scalar({{.*}})
+// CHECK: call {{.*}} @_ZN1AC1Ei
+//Spill after bar.
+// CHECK: %[[v:[^ ]*]] = call i32 @_Z3bar1Ai({{.*}})
+// CHECK-NEXT: store i32 %[[v]], i32* %[[tmp:[^, ]*]]
+//Do cleanup.
+// CHECK: call {{.*}} @_ZN1AD1Ev
+// CHECK: switch
+//Reload before v assignment.
+// CHECK: %[[v:[^ ]*]] = load i32, i32* %[[tmp]]
+// CHECK-NEXT: store i32 %[[v]], i32* %v
+
+// No need to spill when the expression result is a constant, constants don't
+// have dominance problems.
+extern "C" int cleanup_exit_scalar_constant(bool b) {
+  int v = (A(1), (void)({ if (b) return 42; 0; }), 13);
+  return v;
+}
+
+// CHECK-LABEL: define i32 @cleanup_exit_scalar_constant({{.*}})
+// CHECK: store i32 13, i32* %v
+
+// Check for the same bug for lvalue expression evaluation kind.
+// FIXME: What about non-reference lvalues, like bitfield lvalues and vector
+// lvalues?
+int ();
+extern "C" int cleanup_exit_lvalue(bool cond) {
+  int  = (A(1), ({ if (cond) return 0; (void)0; }), getref());
+  return r;
+}
+// CHECK-LABEL: define i32 @cleanup_exit_lvalue({{.*}})
+// CHECK: call {{.*}} @_ZN1AC1Ei
+//Spill after bar.
+// CHECK: %[[v:[^ ]*]] = call dereferenceable(4) i32* @_Z6getrefv({{.*}})
+// CHECK-NEXT: store i32* %[[v]], i32** %[[tmp:[^, ]*]]
+//Do cleanup.
+// CHECK: call {{.*}} @_ZN1AD1Ev
+// CHECK: switch
+//Reload before v assignment.
+// CHECK: %[[v:[^ ]*]] = load i32*, i32** %[[tmp]]
+// CHECK-NEXT: store i32* %[[v]], i32** %r
+
+
+// We handle ExprWithCleanups for complex evaluation type separately, and it had
+// the same bug.
+_Complex float bar_complex(A, int);
+extern "C" int cleanup_exit_complex(bool b) {
+  _Complex float v = bar_complex(A(1), ({ if (b) return 42; 13; }));
+  return v;
+}
+
+// CHECK-LABEL: define i32 @cleanup_exit_complex({{.*}})
+// CHECK: call {{.*}} @_ZN1AC1Ei
+//Spill after bar.
+// CHECK: call {{.*}} @_Z11bar_complex1Ai({{.*}})
+// CHECK: store float %{{.*}}, float* %[[tmp1:[^, ]*]]
+// CHECK: store float %{{.*}}, float* %[[tmp2:[^, ]*]]
+//Do cleanup.
+// CHECK: call {{.*}} @_ZN1AD1Ev
+// CHECK: switch
+//Reload before v assignment.
+// CHECK: %[[v1:[^ ]*]] = load float, float* %[[tmp1]]
+// CHECK: %[[v2:[^ ]*]] = load float, float* %[[tmp2]]
+// CHECK: store float %[[v1]], float* %v.realp
+// CHECK: store float %[[v2]], float* %v.imagp
Index: lib/CodeGen/CodeGenFunction.h
===
--- lib/CodeGen/CodeGenFunction.h
+++ lib/CodeGen/CodeGenFunction.h
@@ -580,14 +580,10 @@
   CGF.DidCallStackSave = false;
 }
 
-/// \brief Exit this cleanup scope, emitting any accumulated
-/// cleanups.
+/// \brief Exit this cleanup scope, emitting any accumulated cleanups.
 ~RunCleanupsScope() {
-  if (PerformCleanup) {
-CGF.DidCallStackSave = OldDidCallStackSave;
-CGF.PopCleanupBlocks(CleanupStackDepth,
- LifetimeExtendedCleanupStackSize);
-  }
+  if (PerformCleanup)
+ForceCleanup();
 }
 
 /// \brief Determine whether this scope requires any cleanups.
@@ -597,11 +593,15 @@
 
 /// \brief Force the emission of cleanups now, instead of waiting
 /// until this object is destroyed.
-void ForceCleanup() {
+/// \param ValuesToReload - A list of values that need to be available at
+/// the insertion point after cleanup emission. If cleanup emission created
+/// a shared cleanup block, these value pointers will be rewritten.
+/// Otherwise, they not will be modified.
+void ForceCleanup(std::initializer_list ValuesToReload = {}) {
   assert(PerformCleanup && "Already forced 

[PATCH] D30590: Don't assume cleanup emission preserves dominance in expr evaluation

2017-03-06 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added inline comments.



Comment at: lib/CodeGen/CGExprComplex.cpp:204-206
+Scope.ensureDominatingValue();
+Scope.ensureDominatingValue();
+Scope.ForceCleanup();

rsmith wrote:
> I'm a little concerned about the loose connection between 
> `ensureDominatingValue` and `ForrceCleanup` here -- if you forget the 
> `ForceCleanup`, you get silent misbehavior. How about removing 
> `ensureDominatingValue` and instead passing a 
> `std::initializer_list` to `ForceCleanup`?
Done.



Comment at: lib/CodeGen/CodeGenFunction.h:539
   private:
+SmallVector ValuesToReload;
 

rsmith wrote:
> If you keep a `SmallVector` here, set its inline size to 2 to avoid 
> allocations for the `_Complex` case.
I removed it. Also, who wants to waste a whole pointer of stack space for 
_Complex expression evaluation. ;)


https://reviews.llvm.org/D30590



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


[PATCH] D30650: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-06 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment.

In https://reviews.llvm.org/D30650#693165, @Eugene.Zelenko wrote:

> I think we should refactor this check as part of Static Analyzer, since it's 
> path-sensitive.


We can think about trying this as a SA checker, but it's irrelevant to this 
patch.


https://reviews.llvm.org/D30650



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


[PATCH] D30662: Update clang filtering for mxcsr

2017-03-06 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor added a comment.

In https://reviews.llvm.org/D30662#693559, @ahatanak wrote:

> Is it possible to add a test case (possibly in CodeGen)?


This is covered by CodeGen/ms-inline-asm.c, which Reid added after I broke this 
adding the mxcsr register a couple of weeks ago.


Repository:
  rL LLVM

https://reviews.llvm.org/D30662



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


[libcxx] r297079 - Add list of filesystem NB comments to TODO.TXT so they can be tracked separately

2017-03-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Mar  6 15:23:36 2017
New Revision: 297079

URL: http://llvm.org/viewvc/llvm-project?rev=297079=rev
Log:
Add list of filesystem NB comments to TODO.TXT so they can be tracked separately

Modified:
libcxx/trunk/TODO.TXT

Modified: libcxx/trunk/TODO.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/TODO.TXT?rev=297079=297078=297079=diff
==
--- libcxx/trunk/TODO.TXT (original)
+++ libcxx/trunk/TODO.TXT Mon Mar  6 15:23:36 2017
@@ -17,6 +17,56 @@ Test Suite Tasks
 * Improve the quality and portability of the locale test data.
 * Convert failure tests to use Clang Verify.
 
+Filesystem Tasks
+
+* P0492r2 - Implement National body comments for Filesystem
+* INCOMPLETE - US 25: has_filename() is equivalent to just !empty()
+* INCOMPLETE - US 31: Everything is defined in terms of one implicit host 
system
+* INCOMPLETE - US 32: Meaning of 27.10.2.1 unclear
+* INCOMPLETE - US 33: Definition of canonical path problematic
+* INCOMPLETE - US 34: Are there attributes of a file that are not an 
aspect of the file system?
+* INCOMPLETE - US 35: What synchronization is required to avoid a file 
system race?
+* INCOMPLETE - US 36: Symbolic links themselves are attached to a 
directory via (hard) links
+* INCOMPLETE - US 37: The term “redundant current directory (dot) 
elements” is not defined
+* INCOMPLETE - US 38: Duplicates §17.3.16
+* INCOMPLETE - US 39: Remove note: Dot and dot-dot are not directories
+* INCOMPLETE - US 40: Not all directories have a parent.
+* INCOMPLETE - US 41: The term “parent directory” for a 
(non-directory) file is unusual
+* INCOMPLETE - US 42: Pathname resolution does not always resolve a symlink
+* INCOMPLETE - US 43: Concerns about encoded character types
+* INCOMPLETE - US 44: Definition of path in terms of a string requires 
leaky abstraction
+* INCOMPLETE - US 45: Generic format portability compromised by 
unspecified root-name
+* INCOMPLETE - US 46: filename can be empty so productions for 
relative-path are redundant
+* INCOMPLETE - US 47: “.” and “..” already match the name 
production
+* INCOMPLETE - US 48: Multiple separators are often meaningful in a 
root-name
+* INCOMPLETE - US 49: What does “method of conversion method” mean?
+* INCOMPLETE - US 50: 27.10.8.1 ¶ 1.4 largely redundant with ¶ 1.3
+* INCOMPLETE - US 51: Failing to add / when appending empty string 
prevents useful apps
+* INCOMPLETE - US 52: remove_filename() postcondition is not by itself a 
definition
+* INCOMPLETE - US 53: remove_filename()'s name does not correspond to its 
behavior
+* INCOMPLETE - US 54: remove_filename() is broken
+* INCOMPLETE - US 55: replace_extension()'s use of path as parameter is 
inappropriate
+* INCOMPLETE - US 56: Remove replace_extension()'s conditional addition of 
period
+* INCOMPLETE - US 57: On Windows, absolute paths will sort in among 
relative paths
+* INCOMPLETE - US 58: parent_path() behavior for root paths is useless
+* INCOMPLETE - US 59: filename() returning path for single path components 
is bizarre
+* INCOMPLETE - US 60: path("/foo/").filename()==path(".") is surprising
+* INCOMPLETE - US 61: Leading dots in filename() should not begin an 
extension
+* INCOMPLETE - US 62: It is important that stem()+extension()==filename()
+* INCOMPLETE - US 63: lexically_normal() inconsistently treats trailing 
"/" but not "/.." as directory
+* INCOMPLETE - US 73, CA 2: root-name is effectively implementation defined
+* INCOMPLETE - US 74, CA 3: The term “pathname” is ambiguous in some 
contexts
+* INCOMPLETE - US 75, CA 4: Extra flag in path constructors is needed
+* INCOMPLETE - US 76, CA 5: root-name definition is over-specified.
+* INCOMPLETE - US 77, CA 6: operator/ and other appends not useful if arg 
has root-name
+* INCOMPLETE - US 78, CA 7: Member absolute() in 27.10.4.1 is 
overspecified for non-POSIX-like O/S
+* INCOMPLETE - US 79, CA 8: Some operation functions are overspecified for 
implementation-defined file types
+* INCOMPLETE - US 185: Fold error_code and non-error_code signatures into 
one signature
+* INCOMPLETE - FI 14: directory_entry comparisons are members
+* INCOMPLETE - Late 36: permissions() error_code overload should be 
noexcept
+* INCOMPLETE - Late 37: permissions() actions should be separate parameter
+* INCOMPLETE - Late 42: resize_file() Postcondition missing argument
+
 Misc Tasks
 ==
 * Find all sequences of >2 underscores and eradicate them.


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


r297076 - [coroutines] Add co_return statement emission

2017-03-06 Thread Gor Nishanov via cfe-commits
Author: gornishanov
Date: Mon Mar  6 15:12:54 2017
New Revision: 297076

URL: http://llvm.org/viewvc/llvm-project?rev=297076=rev
Log:
[coroutines] Add co_return statement emission

Summary:
Added co_return statement emission.

Tweaked coro-alloc.cpp test to use co_return to trigger coroutine processing 
instead of co_await, since this change starts emitting the body of the 
coroutine and await expression handling has not been upstreamed yet.

Reviewers: rsmith, majnemer, EricWF, aaron.ballman

Reviewed By: rsmith

Subscribers: majnemer, llvm-commits, mehdi_amini

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

Added:
cfe/trunk/test/CodeGenCoroutines/coro-return.cpp
Modified:
cfe/trunk/lib/CodeGen/CGCoroutine.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/CodeGenCoroutines/coro-alloc.cpp

Modified: cfe/trunk/lib/CodeGen/CGCoroutine.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCoroutine.cpp?rev=297076=297075=297076=diff
==
--- cfe/trunk/lib/CodeGen/CGCoroutine.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCoroutine.cpp Mon Mar  6 15:12:54 2017
@@ -21,6 +21,13 @@ namespace clang {
 namespace CodeGen {
 
 struct CGCoroData {
+
+  // Stores the jump destination just before the final suspend. Coreturn
+  // statements jumps to this point after calling return_xxx promise member.
+  CodeGenFunction::JumpDest FinalJD;
+
+  unsigned CoreturnCount = 0;
+
   // Stores the llvm.coro.id emitted in the function so that we can supply it
   // as the first argument to coro.begin, coro.alloc and coro.free intrinsics.
   // Note: llvm.coro.id returns a token that cannot be directly expressed in a
@@ -59,19 +66,46 @@ static void createCoroData(CodeGenFuncti
   CurCoro.Data->CoroIdExpr = CoroIdExpr;
 }
 
+void CodeGenFunction::EmitCoreturnStmt(CoreturnStmt const ) {
+  ++CurCoro.Data->CoreturnCount;
+  EmitStmt(S.getPromiseCall());
+  EmitBranchThroughCleanup(CurCoro.Data->FinalJD);
+}
+
 void CodeGenFunction::EmitCoroutineBody(const CoroutineBodyStmt ) {
   auto *NullPtr = llvm::ConstantPointerNull::get(Builder.getInt8PtrTy());
   auto  = CGM.getContext().getTargetInfo();
   unsigned NewAlign = TI.getNewAlign() / TI.getCharWidth();
 
+  auto *FinalBB = createBasicBlock("coro.final");
+
   auto *CoroId = Builder.CreateCall(
   CGM.getIntrinsic(llvm::Intrinsic::coro_id),
   {Builder.getInt32(NewAlign), NullPtr, NullPtr, NullPtr});
   createCoroData(*this, CurCoro, CoroId);
 
   EmitScalarExpr(S.getAllocate());
-  // FIXME: Emit the rest of the coroutine.
+
+  // FIXME: Setup cleanup scopes.
+
+  EmitStmt(S.getPromiseDeclStmt());
+
+  CurCoro.Data->FinalJD = getJumpDestInCurrentScope(FinalBB);
+
+  // FIXME: Emit initial suspend and more before the body.
+
+  EmitStmt(S.getBody());
+
+  // See if we need to generate final suspend.
+  const bool CanFallthrough = Builder.GetInsertBlock();
+  const bool HasCoreturns = CurCoro.Data->CoreturnCount > 0;
+  if (CanFallthrough || HasCoreturns) {
+EmitBlock(FinalBB);
+// FIXME: Emit final suspend.
+  }
   EmitStmt(S.getDeallocate());
+
+  // FIXME: Emit return for the coroutine return object.
 }
 
 // Emit coroutine intrinsic and patch up arguments of the token type.

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=297076=297075=297076=diff
==
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Mar  6 15:12:54 2017
@@ -145,7 +145,7 @@ void CodeGenFunction::EmitStmt(const Stm
 EmitCoroutineBody(cast(*S));
 break;
   case Stmt::CoreturnStmtClass:
-CGM.ErrorUnsupported(S, "coroutine");
+EmitCoreturnStmt(cast(*S));
 break;
   case Stmt::CapturedStmtClass: {
 const CapturedStmt *CS = cast(S);

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=297076=297075=297076=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Mon Mar  6 15:12:54 2017
@@ -2506,6 +2506,7 @@ public:
   void EmitObjCAutoreleasePoolStmt(const ObjCAutoreleasePoolStmt );
 
   void EmitCoroutineBody(const CoroutineBodyStmt );
+  void EmitCoreturnStmt(const CoreturnStmt );
   RValue EmitCoroutineIntrinsic(const CallExpr *E, unsigned int IID);
 
   void EnterCXXTryStmt(const CXXTryStmt , bool IsFnTryBlock = false);

Modified: cfe/trunk/test/CodeGenCoroutines/coro-alloc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCoroutines/coro-alloc.cpp?rev=297076=297075=297076=diff
==
--- cfe/trunk/test/CodeGenCoroutines/coro-alloc.cpp 

[libcxx] r297074 - Mark LWG 2806 as complete. Libc++ speculatively shiped this change in 4.0

2017-03-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Mar  6 15:09:02 2017
New Revision: 297074

URL: http://llvm.org/viewvc/llvm-project?rev=297074=rev
Log:
Mark LWG 2806 as complete. Libc++ speculatively shiped this change in 4.0

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=297074=297073=297074=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Mar  6 15:09:02 2017
@@ -449,7 +449,7 @@
http://wg21.link/LWG2801;>2801Default-constructibility of 
unique_ptrKona
http://wg21.link/LWG2802;>2802shared_ptr 
constructor requirements for a deleterKona
http://wg21.link/LWG2804;>2804Unconditional constexpr 
default constructor for istream_iteratorKona
-   http://wg21.link/LWG2806;>2806Base class 
of bad_optional_accessKona
+   http://wg21.link/LWG2806;>2806Base class 
of bad_optional_accessKonaComplete
http://wg21.link/LWG2807;>2807std::invoke 
should use std::is_nothrow_callableKona
http://wg21.link/LWG2812;>2812Range 
access is available with string_viewKona
http://wg21.link/LWG2824;>2824list::sort 
should say that the order of elements is unspecified if an exception is 
thrownKona


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


[libcxx] r297073 - Mark LWG 2789 as complete. No changes required

2017-03-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Mar  6 15:07:18 2017
New Revision: 297073

URL: http://llvm.org/viewvc/llvm-project?rev=297073=rev
Log:
Mark LWG 2789 as complete. No changes required

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=297073=297072=297073=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Mar  6 15:07:18 2017
@@ -441,7 +441,7 @@
http://wg21.link/LWG2786;>2786Annex C 
should mention shared_ptr changes for array 
supportKona
http://wg21.link/LWG2787;>2787[file_status.cons] 
doesn't match class definitionKonaComplete
http://wg21.link/LWG2788;>2788basic_string range mutators 
unintentionally require a default constructible 
allocatorKona
-   http://wg21.link/LWG2789;>2789Equivalence 
of contained objectsKona
+   http://wg21.link/LWG2789;>2789Equivalence 
of contained objectsKonaComplete
http://wg21.link/LWG2790;>2790Missing 
specification of 
istreambuf_iterator::operator-Kona
http://wg21.link/LWG2794;>2794Missing 
requirements for allocator pointersKona
http://wg21.link/LWG2795;>2795[global.functions] 
provides incorrect example of ADL useKona


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


[libcxx] r297071 - Implement LWG 2787 - [file_status.cons] is inconsistent

2017-03-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Mar  6 15:02:06 2017
New Revision: 297071

URL: http://llvm.org/viewvc/llvm-project?rev=297071=rev
Log:
Implement LWG 2787 - [file_status.cons] is inconsistent

Modified:
libcxx/trunk/include/experimental/filesystem

libcxx/trunk/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/include/experimental/filesystem
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=297071=297070=297071=diff
==
--- libcxx/trunk/include/experimental/filesystem (original)
+++ libcxx/trunk/include/experimental/filesystem Mon Mar  6 15:02:06 2017
@@ -408,8 +408,10 @@ class _LIBCPP_TYPE_VIS file_status
 public:
 // constructors
 _LIBCPP_INLINE_VISIBILITY
-explicit file_status(file_type __ft = file_type::none,
- perms __prms   = perms::unknown) _NOEXCEPT
+file_status() _NOEXCEPT : file_status(file_type::none) {}
+_LIBCPP_INLINE_VISIBILITY
+explicit file_status(file_type __ft,
+ perms __prms = perms::unknown) _NOEXCEPT
   : __ft_(__ft), __prms_(__prms)
 {}
 

Modified: 
libcxx/trunk/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp?rev=297071=297070=297071=diff
==
--- 
libcxx/trunk/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/experimental/filesystem/class.file_status/file_status.cons.pass.cpp
 Mon Mar  6 15:02:06 2017
@@ -30,8 +30,8 @@ int main() {
   {
 static_assert(std::is_nothrow_default_constructible::value,
   "The default constructor must be noexcept");
-static_assert(!test_convertible(),
-  "The default constructor must be explicit");
+static_assert(test_convertible(),
+  "The default constructor must not be explicit");
 const file_status f;
 assert(f.type()  == file_type::none);
 assert(f.permissions() == perms::unknown);

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=297071=297070=297071=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Mar  6 15:02:06 2017
@@ -439,7 +439,7 @@
http://wg21.link/LWG2784;>2784Resolution 
to LWG 2484 is missing "otherwise, no effects" and is hard to 
parseKona
http://wg21.link/LWG2785;>2785quoted 
should work with basic_string_viewKona
http://wg21.link/LWG2786;>2786Annex C 
should mention shared_ptr changes for array 
supportKona
-   http://wg21.link/LWG2787;>2787[file_status.cons] 
doesn't match class definitionKona
+   http://wg21.link/LWG2787;>2787[file_status.cons] 
doesn't match class definitionKonaComplete
http://wg21.link/LWG2788;>2788basic_string range mutators 
unintentionally require a default constructible 
allocatorKona
http://wg21.link/LWG2789;>2789Equivalence 
of contained objectsKona
http://wg21.link/LWG2790;>2790Missing 
specification of 
istreambuf_iterator::operator-Kona


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


[PATCH] D30590: Don't assume cleanup emission preserves dominance in expr evaluation

2017-03-06 Thread Richard Smith via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Hal and I discussed exactly the same problem (in the context of coroutines) on 
Saturday and came up with exactly the same approach :) I think this is the 
right direction.




Comment at: lib/CodeGen/CGExprComplex.cpp:204-206
+Scope.ensureDominatingValue();
+Scope.ensureDominatingValue();
+Scope.ForceCleanup();

I'm a little concerned about the loose connection between 
`ensureDominatingValue` and `ForrceCleanup` here -- if you forget the 
`ForceCleanup`, you get silent misbehavior. How about removing 
`ensureDominatingValue` and instead passing a `std::initializer_list` 
to `ForceCleanup`?



Comment at: lib/CodeGen/CodeGenFunction.h:539
   private:
+SmallVector ValuesToReload;
 

If you keep a `SmallVector` here, set its inline size to 2 to avoid allocations 
for the `_Complex` case.


https://reviews.llvm.org/D30590



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


[libcxx] r297069 - Mark LWG 2781 as complete. No changes required

2017-03-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Mar  6 14:56:13 2017
New Revision: 297069

URL: http://llvm.org/viewvc/llvm-project?rev=297069=rev
Log:
Mark LWG 2781 as complete. No changes required

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=297069=297068=297069=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Mar  6 14:56:13 2017
@@ -434,7 +434,7 @@
http://wg21.link/LWG2676;>2676Provide 
filesystem::path overloads for File-based 
streamsKona
http://wg21.link/LWG2768;>2768any_cast 
and move semanticsKonaComplete
http://wg21.link/LWG2769;>2769Redundant 
const in the return type of any_cast(const 
any)KonaComplete
-   http://wg21.link/LWG2781;>2781Contradictory requirements for 
std::function and std::reference_wrapperKona
+   http://wg21.link/LWG2781;>2781Contradictory requirements for 
std::function and std::reference_wrapperKonaComplete
http://wg21.link/LWG2782;>2782scoped_allocator_adaptor 
constructors must be constrainedKona
http://wg21.link/LWG2784;>2784Resolution 
to LWG 2484 is missing "otherwise, no effects" and is hard to 
parseKona
http://wg21.link/LWG2785;>2785quoted 
should work with basic_string_viewKona


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


[libcxx] r297066 - Mark two any_cast issues as complete

2017-03-06 Thread Eric Fiselier via cfe-commits
Author: ericwf
Date: Mon Mar  6 14:49:42 2017
New Revision: 297066

URL: http://llvm.org/viewvc/llvm-project?rev=297066=rev
Log:
Mark two any_cast issues as complete

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=297066=297065=297066=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Mar  6 14:49:42 2017
@@ -432,8 +432,8 @@

http://wg21.link/LWG2260;>2260Missing 
requirement for Allocator::pointerKona
http://wg21.link/LWG2676;>2676Provide 
filesystem::path overloads for File-based 
streamsKona
-   http://wg21.link/LWG2768;>2768any_cast 
and move semanticsKona
-   http://wg21.link/LWG2769;>2769Redundant 
const in the return type of any_cast(const 
any)Kona
+   http://wg21.link/LWG2768;>2768any_cast 
and move semanticsKonaComplete
+   http://wg21.link/LWG2769;>2769Redundant 
const in the return type of any_cast(const 
any)KonaComplete
http://wg21.link/LWG2781;>2781Contradictory requirements for 
std::function and std::reference_wrapperKona
http://wg21.link/LWG2782;>2782scoped_allocator_adaptor 
constructors must be constrainedKona
http://wg21.link/LWG2784;>2784Resolution 
to LWG 2484 is missing "otherwise, no effects" and is hard to 
parseKona


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


[libcxx] r297065 - Updated email address in `CREDITS.txt`.

2017-03-06 Thread Michael Park via cfe-commits
Author: mpark
Date: Mon Mar  6 14:46:55 2017
New Revision: 297065

URL: http://llvm.org/viewvc/llvm-project?rev=297065=rev
Log:
Updated email address in `CREDITS.txt`.

Modified:
libcxx/trunk/CREDITS.TXT

Modified: libcxx/trunk/CREDITS.TXT
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CREDITS.TXT?rev=297065=297064=297065=diff
==
--- libcxx/trunk/CREDITS.TXT (original)
+++ libcxx/trunk/CREDITS.TXT Mon Mar  6 14:46:55 2017
@@ -81,7 +81,7 @@ E: andrew.c.mor...@gmail.com
 D: Minor patches and Linux fixes.
 
 N: Michael Park
-E: mp...@apache.org
+E: mcyp...@gmail.com
 D: Implementation of .
 
 N: Arvid Picciani


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


[PATCH] D19201: [clang-tidy] misc-throw-with-noexcept

2017-03-06 Thread Stanisław Barzowski via Phabricator via cfe-commits
sbarzowski added inline comments.



Comment at: clang-tidy/misc/ThrowWithNoexceptCheck.h:20
+///\brief Warns about using throw in function declared as noexcept.
+/// It complains about every throw, even if it is caught later.
+class ThrowWithNoexceptCheck : public ClangTidyCheck {

vmiklos wrote:
> Prazek wrote:
> > aaron.ballman wrote:
> > > What is the false positive rate with this check over a large codebase 
> > > that uses exceptions?
> > Do you know any good project to check it?
> LibreOffice might be a candidate, see 
>  for details on 
> how to generate a compile database for it (since it does not use cmake), then 
> you can start testing.
Thanks. However it's not just about using exception. To be meaningful I need a 
project that use noexcept in more than a few places.

Here are some projects that I found:
https://github.com/facebook/hhvm/search?utf8=%E2%9C%93=noexcept
https://github.com/facebook/folly/search?utf8=%E2%9C%93=noexcept
https://github.com/Tencent/mars/search?utf8=%E2%9C%93=noexcept
https://github.com/facebook/rocksdb/search?utf8=%E2%9C%93=noexcept
https://github.com/CRYTEK-CRYENGINE/CRYENGINE/search?utf8=%E2%9C%93=noexcept
https://github.com/SFTtech/openage/search?utf8=%E2%9C%93=noexcept
https://github.com/facebook/watchman/search?utf8=%E2%9C%93=noexcept
https://github.com/facebook/proxygen/search?utf8=%E2%9C%93=noexcept
https://github.com/philsquared/Catch/search?utf8=%E2%9C%93=noexcept
https://github.com/sandstorm-io/capnproto/search?utf8=%E2%9C%93=noexcept
https://github.com/miloyip/rapidjson/search?utf8=%E2%9C%93=noexcept

I've tried HHVM so far, and ran into some problems compiling it. Anyway I'm 
working on it.


https://reviews.llvm.org/D19201



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


[PATCH] D19201: [clang-tidy] misc-throw-with-noexcept

2017-03-06 Thread Miklos Vajna via Phabricator via cfe-commits
vmiklos added inline comments.



Comment at: clang-tidy/misc/ThrowWithNoexceptCheck.h:20
+///\brief Warns about using throw in function declared as noexcept.
+/// It complains about every throw, even if it is caught later.
+class ThrowWithNoexceptCheck : public ClangTidyCheck {

Prazek wrote:
> aaron.ballman wrote:
> > What is the false positive rate with this check over a large codebase that 
> > uses exceptions?
> Do you know any good project to check it?
LibreOffice might be a candidate, see 
 for details on how 
to generate a compile database for it (since it does not use cmake), then you 
can start testing.


https://reviews.llvm.org/D19201



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


Re: [PATCH] D30435: [clang-import-test] Lookup inside entities

2017-03-06 Thread Sean Callanan via cfe-commits
Gosh, I missed the reserve() call.  Sorry!  I'll be happy to implement this 
change.

Sean

> On Mar 6, 2017, at 10:05 AM, Sean Callanan  wrote:
> 
> Aleksei,
> 
> thank you for your comments!
> 
> I appreciate your comments in particular about source/destination confusion.  
> I can relate to this, as this was (a) an area that confused me while I was 
> working on this code in LLDB; and (b) it was something I had to keep straight 
> in my head even when doing the work here.  I will implement a type-system 
> based solution to this and update the patch, then you can have a look and 
> we'll decide if it looks better that way.
> The std::transform is more efficient than the for loop because it reallocates 
> the array once at the beginning, instead of progressively as we push_back.  
> This means the asymptotic runtime of this loop will be worse than the 
> std::transform.  Is that an acceptable trade?
> The other points are well-taken – in particular, I like your idea about 
> breaking the std::none_of block out into a function.  I'll apply them in an 
> updated patch.
> 
> Sean
> 
>> On Mar 6, 2017, at 9:48 AM, Aleksei Sidorin via Phabricator 
>> > wrote:
>> 
>> a.sidorin added a comment.
>> 
>> Hello Sean,
>> 
>> It is good to have the ability of recursive lookup. But for me (and I'm 
>> sorry), the code becomes very hard to understand: I need to track if the 
>> Decl/DC is in the source AST or in the AST being imported, if it was 
>> imported or if was in the AST before across lambdas and calls. Can we make 
>> this more clear?
>> 
>> 
>> 
>> 
>> Comment at: tools/clang-import-test/clang-import-test.cpp:201
>> +  Decl *Imported(Decl *From, Decl *To) override {
>> +if (auto ToTag = llvm::dyn_cast(To)) {
>> +  ToTag->setHasExternalLexicalStorage();
>> 
>> Can we make the usage of qualified and non-qualified casts consistent? 
>> Usually, casts are used as unqualified.
>> 
>> 
>> 
>> Comment at: tools/clang-import-test/clang-import-test.cpp:298
>> +
>> +std::vector CompleteDecls;
>> +std::vector ForwardDecls;
>> 
>> I guess we can use `SmallVector`s here too.
>> 
>> 
>> 
>> Comment at: tools/clang-import-test/clang-import-test.cpp:303
>> +  if (IsForwardDeclaration(C.first)) {
>> +if (std::none_of(ForwardDecls.begin(), ForwardDecls.end(),
>> + [](Candidate ) {
>> 
>> Nit: to make the code cleaner, we can extract this `std::none_of` to a 
>> separate function like `IsFoundAsForward()`. Nested lambdas are harder to 
>> read.
>> 
>> 
>> 
>> Comment at: tools/clang-import-test/clang-import-test.cpp:333
>> +Decls.resize(DeclsToReport.size());
>> +std::transform(DeclsToReport.begin(), DeclsToReport.end(), 
>> Decls.begin(),
>> +   [](Candidate ) {
>> 
>> The loop:
>> ```
>> Decls.reserve(DeclsToReport.size());
>> for (Candidate  : DeclsToReport)
>>  Decls.push_back(cast(C.second->Import(C.first)));
>> ```
>> will look a bit nicer here. What do you think?
>> 
>> 
>> Repository:
>>  rL LLVM
>> 
>> https://reviews.llvm.org/D30435 
>> 
>> 
>> 
> 

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


[PATCH] D30662: Update clang filtering for mxcsr

2017-03-06 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

Is it possible to add a test case (possibly in CodeGen)?


Repository:
  rL LLVM

https://reviews.llvm.org/D30662



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


[PATCH] D30663: Use filename in linemarker when compiling preprocessed source (Revised)

2017-03-06 Thread Taewook Oh via Phabricator via cfe-commits
twoh updated this revision to Diff 90735.
twoh added a comment.
Herald added a subscriber: mehdi_amini.

addressing comments from @inglorion


https://reviews.llvm.org/D30663

Files:
  include/clang/Frontend/FrontendOptions.h
  lib/Frontend/FrontendAction.cpp
  test/Frontend/preprocessed-input.i

Index: test/Frontend/preprocessed-input.i
===
--- /dev/null
+++ test/Frontend/preprocessed-input.i
@@ -0,0 +1,10 @@
+# 1 "preprocessed-input.c"
+# 1 "" 1
+# 1 "" 3
+# 318 "" 3
+# 1 "" 1
+# 1 "" 2
+# 1 "preprocessed-input.c" 2
+
+// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s
+// CHECK: source_filename = "preprocessed-input.c"{{$}}
Index: lib/Frontend/FrontendAction.cpp
===
--- lib/Frontend/FrontendAction.cpp
+++ lib/Frontend/FrontendAction.cpp
@@ -19,6 +19,7 @@
 #include "clang/Frontend/MultiplexConsumer.h"
 #include "clang/Frontend/Utils.h"
 #include "clang/Lex/HeaderSearch.h"
+#include "clang/Lex/LiteralSupport.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Parse/ParseAST.h"
@@ -187,6 +188,42 @@
   return llvm::make_unique(std::move(Consumers));
 }
 
+// For preprocessed files, if the first line is the linemarker and specifies
+// the original source file name, use that name as the input file name.
+static bool ReadOriginalFileName(CompilerInstance , std::string )
+{
+  bool Invalid = false;
+  auto  = CI.getSourceManager();
+  auto MainFileID = SourceMgr.getMainFileID();
+  const auto *MainFileBuf = SourceMgr.getBuffer(MainFileID, );
+  if (Invalid)
+return false;
+
+  std::unique_ptr RawLexer(
+  new Lexer(MainFileID, MainFileBuf, SourceMgr, CI.getLangOpts()));
+
+  // If the first line has the syntax of
+  //
+  // # NUM "FILENAME"
+  //
+  // we use FILENAME as the input file name.
+  Token T;
+  if (RawLexer->LexFromRawLexer(T) || T.getKind() != tok::hash)
+return false;
+  if (RawLexer->LexFromRawLexer(T) || T.isAtStartOfLine() ||
+  T.getKind() != tok::numeric_constant)
+return false;
+  RawLexer->LexFromRawLexer(T);
+  if (T.isAtStartOfLine() || T.getKind() != tok::string_literal)
+return false;
+
+  StringLiteralParser Literal(T, CI.getPreprocessor());
+  if (Literal.hadError)
+return false;
+  InputFile = Literal.GetString().str();
+  return true;
+}
+
 bool FrontendAction::BeginSourceFile(CompilerInstance ,
  const FrontendInputFile ) {
   assert(!Instance && "Already processing a source file!");
@@ -338,6 +375,13 @@
 if (!isModelParsingAction())
   CI.createASTContext();
 
+// For preprocessed files, check if the first line specifies the original
+// source file name with a linemarker.
+std::string OrigFile;
+if (Input.isPreprocessed())
+  if (ReadOriginalFileName(CI, OrigFile))
+InputFile = OrigFile;
+
 std::unique_ptr Consumer =
 CreateWrappedASTConsumer(CI, InputFile);
 if (!Consumer)
@@ -430,9 +474,9 @@
 
   // If there is a layout overrides file, attach an external AST source that
   // provides the layouts from that file.
-  if (!CI.getFrontendOpts().OverrideRecordLayoutsFile.empty() && 
+  if (!CI.getFrontendOpts().OverrideRecordLayoutsFile.empty() &&
   CI.hasASTContext() && !CI.getASTContext().getExternalSource()) {
-IntrusiveRefCntPtr 
+IntrusiveRefCntPtr
   Override(new LayoutOverrideSource(
  CI.getFrontendOpts().OverrideRecordLayoutsFile));
 CI.getASTContext().setExternalSource(Override);
Index: include/clang/Frontend/FrontendOptions.h
===
--- include/clang/Frontend/FrontendOptions.h
+++ include/clang/Frontend/FrontendOptions.h
@@ -81,7 +81,7 @@
   IK_LLVM_IR
 };
 
-  
+
 /// \brief An input file for the front end.
 class FrontendInputFile {
   /// \brief The file name, or "-" to read from standard input.
@@ -109,6 +109,13 @@
   bool isEmpty() const { return File.empty() && Buffer == nullptr; }
   bool isFile() const { return !isBuffer(); }
   bool isBuffer() const { return Buffer != nullptr; }
+  bool isPreprocessed() const {
+return Kind == IK_PreprocessedC ||
+   Kind == IK_PreprocessedCXX ||
+   Kind == IK_PreprocessedObjC ||
+   Kind == IK_PreprocessedObjCXX ||
+   Kind == IK_PreprocessedCuda;
+  }
 
   StringRef getFile() const {
 assert(isFile());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30427: Fix whitespace before token-paste of an argument.

2017-03-06 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment.

Ping


https://reviews.llvm.org/D30427



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


[PATCH] D26316: [coroutines] Build and pass coroutine_handle to await_suspend.

2017-03-06 Thread Gor Nishanov via Phabricator via cfe-commits
GorNishanov commandeered this revision.
GorNishanov edited reviewers, added: EricWF; removed: GorNishanov.
GorNishanov added a comment.

Comandeering this patch.
Last week Richard gave me some feedback in person on this code (in the full 
coroutine implementation not this patch in particular). I am going to implement 
the feedback and adjust this patch and resubmit for review.


https://reviews.llvm.org/D26316



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


r297057 - [MS] Add support for __ud2 and __int2c MSVC intrinsics

2017-03-06 Thread Reid Kleckner via cfe-commits
Author: rnk
Date: Mon Mar  6 13:43:16 2017
New Revision: 297057

URL: http://llvm.org/viewvc/llvm-project?rev=297057=rev
Log:
[MS] Add support for __ud2 and __int2c MSVC intrinsics

This was requested in PR31958 and elsewhere.

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp
cfe/trunk/lib/Headers/intrin.h
cfe/trunk/test/CodeGen/ms-intrinsics.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=297057=297056=297057=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Mon Mar  6 13:43:16 2017
@@ -1829,6 +1829,8 @@ TARGET_HEADER_BUILTIN(__emulu, "ULLiUiUi
 TARGET_HEADER_BUILTIN(_AddressOfReturnAddress, "v*", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 
 TARGET_HEADER_BUILTIN(__stosb, "vUc*Ucz", "nh", "intrin.h", ALL_MS_LANGUAGES, 
"")
+TARGET_HEADER_BUILTIN(__int2c, "v",   "nr", "intrin.h", ALL_MS_LANGUAGES, 
"")
+TARGET_HEADER_BUILTIN(__ud2,   "v",   "nr", "intrin.h", ALL_MS_LANGUAGES, 
"")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=297057=297056=297057=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Mar  6 13:43:16 2017
@@ -7982,6 +7982,21 @@ Value *CodeGenFunction::EmitX86BuiltinEx
 // instruction, but it will create a memset that won't be optimized away.
 return Builder.CreateMemSet(Ops[0], Ops[1], Ops[2], 1, true);
   }
+  case X86::BI__ud2:
+// llvm.trap makes a ud2a instruction on x86.
+return EmitTrapCall(Intrinsic::trap);
+  case X86::BI__int2c: {
+// This syscall signals a driver assertion failure in x86 NT kernels.
+llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, false);
+llvm::InlineAsm *IA =
+llvm::InlineAsm::get(FTy, "int $$0x2c", "", /*SideEffects=*/true);
+llvm::AttributeSet NoReturnAttr =
+AttributeSet::get(getLLVMContext(), llvm::AttributeSet::FunctionIndex,
+  llvm::Attribute::NoReturn);
+CallSite CS = Builder.CreateCall(IA);
+CS.setAttributes(NoReturnAttr);
+return CS.getInstruction();
+  }
   }
 }
 

Modified: cfe/trunk/lib/Headers/intrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=297057=297056=297057=diff
==
--- cfe/trunk/lib/Headers/intrin.h (original)
+++ cfe/trunk/lib/Headers/intrin.h Mon Mar  6 13:43:16 2017
@@ -79,7 +79,6 @@ void __incfsdword(unsigned long);
 void __incfsword(unsigned long);
 unsigned long __indword(unsigned short);
 void __indwordstring(unsigned short, unsigned long *, unsigned long);
-void __int2c(void);
 void __invlpg(void *);
 unsigned short __inword(unsigned short);
 void __inwordstring(unsigned short, unsigned short *, unsigned long);
@@ -141,7 +140,6 @@ void __svm_stgi(void);
 void __svm_vmload(size_t);
 void __svm_vmrun(size_t);
 void __svm_vmsave(size_t);
-void __ud2(void);
 unsigned __int64 __ull_rshift(unsigned __int64, int);
 void __vmx_off(void);
 void __vmx_vmptrst(unsigned __int64 *);

Modified: cfe/trunk/test/CodeGen/ms-intrinsics.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-intrinsics.c?rev=297057=297056=297057=diff
==
--- cfe/trunk/test/CodeGen/ms-intrinsics.c (original)
+++ cfe/trunk/test/CodeGen/ms-intrinsics.c Mon Mar  6 13:43:16 2017
@@ -28,6 +28,20 @@ void test__stosb(unsigned char *Dest, un
 // CHECK-X64:   tail call void @llvm.memset.p0i8.i64(i8* %Dest, i8 %Data, i64 
%Count, i32 1, i1 true)
 // CHECK-X64:   ret void
 // CHECK-X64: }
+
+void test__ud2(void) {
+  __ud2();
+}
+// CHECK-INTEL-LABEL: define{{.*}} void @test__ud2()
+// CHECK-INTEL: call void @llvm.trap()
+
+void test__int2c(void) {
+  __int2c();
+}
+// CHECK-INTEL-LABEL: define{{.*}} void @test__int2c()
+// CHECK-INTEL: call void asm sideeffect "int $$0x2c", ""() 
#[[NORETURN:[0-9]+]]
+
+
 #endif
 
 void *test_ReturnAddress() {
@@ -425,7 +439,7 @@ void test__fastfail() {
 }
 // CHECK-LABEL: define{{.*}} void @test__fastfail()
 // CHECK-ARM: call void asm sideeffect "udf #251", "{r0}"(i32 42) 
#[[NORETURN:[0-9]+]]
-// CHECK-INTEL: call void asm sideeffect "int $$0x29", "{cx}"(i32 42) 
#[[NORETURN:[0-9]+]]
+// CHECK-INTEL: call void asm sideeffect "int $$0x29", "{cx}"(i32 42) 
#[[NORETURN]]
 
 // Attributes come last.
 


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


[PATCH] D30663: Use filename in linemarker when compiling preprocessed source (Revised)

2017-03-06 Thread Taewook Oh via Phabricator via cfe-commits
twoh added inline comments.



Comment at: test/Frontend/preprocessed-input.c:3
+// RUN: %clang -emit-llvm -S -o - %t.i | FileCheck %s
+// CHECK: source_filename = {{.*}}preprocessed-input.c"{{$}}

inglorion wrote:
> Actually, I think you don't even have to run the preprocessor - you can just 
> put the file with the linemarker here and check that the name from the 
> linemarker is propagated, right?
> 
> Also, it seems that there is a similar issue to the one you're trying to fix 
> when going from .ll to .o (or .ll to .s, for that matter) - the name is taken 
> from the file you're reading from, not from the source_filename directive in 
> that file. Of course, that doesn't differ from gcc (given that gcc doesn't 
> handle .ll files), but you may want to address that, too, for consistency.
@inglorion Thanks for the comments! Putting preprocessed file makes sense to 
me. 

I recognize the second issue. If I do something like

```
clang -E -o test.i /abspath/test.c
clang -g -c -o test.o test.i
```

DW_AT_name is still test.i (for gcc, it is taken from the linemarker as well). 

Moreover, if we use the absolute path of test.i for clang, i.e.

```
clang -g -c -o test.o /abspath/test.i
```

DW_AT_name becomes /abspath/test.i where DW_AT_comp_dir is /abspath. I think 
this could be a problem if the user of the object file assumes that DW_AT_name 
is a relative to DW_AT_comp_dir. I'm planning to address this with a separate 
patch.


https://reviews.llvm.org/D30663



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


Re: Patch for Bug 30413, including test case

2017-03-06 Thread Lobron, David via cfe-commits
Hi Akira,

Pardon my slowness in addressing your question.

> This patch changes the encoding of an id conforming to a protocol, which I 
> think was not intended: For example:
> 
> @encode(id)
> 
> Would passing IVD to the call to getObjCEncodingForType in 
> CGObjCGNU::GenerateClass solve the problem?

Are you suggesting that passing IVD instead of just IVD->getType() will tell 
getObjCEncodingForType whether the code being compiled is a protocol, as 
opposed to an object?  I'm a little confused here, because IVD is an object of 
type ObjCIvarDecl, which is supposed to represent an instance variable, not a 
protocol.  Also, I don't see anything in the definition of ObjCIvarDecl (in 
AST/DeclObjC.h) that would tell us whether it represents an instance variable 
or a protocol.  Can you explain the case you are concerned about a little more?

If IVD can in fact tell us whether the code being compiled is an object, then 
we can make the EncodeClassNames argument of getObjCEncodingForTypeImpl true 
for ivars and false for protocols.

Thanks!

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


r297050 - Further fixes and improvements to the ConstantInitBuilder API.

2017-03-06 Thread John McCall via cfe-commits
Author: rjmccall
Date: Mon Mar  6 13:04:16 2017
New Revision: 297050

URL: http://llvm.org/viewvc/llvm-project?rev=297050=rev
Log:
Further fixes and improvements to the ConstantInitBuilder API.

Added:
cfe/trunk/include/clang/CodeGen/ConstantInitFuture.h
Modified:
cfe/trunk/include/clang/CodeGen/ConstantInitBuilder.h
cfe/trunk/lib/CodeGen/ConstantInitBuilder.cpp

Modified: cfe/trunk/include/clang/CodeGen/ConstantInitBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/ConstantInitBuilder.h?rev=297050=297049=297050=diff
==
--- cfe/trunk/include/clang/CodeGen/ConstantInitBuilder.h (original)
+++ cfe/trunk/include/clang/CodeGen/ConstantInitBuilder.h Mon Mar  6 13:04:16 
2017
@@ -21,6 +21,7 @@
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/GlobalValue.h"
 #include "clang/AST/CharUnits.h"
+#include "clang/CodeGen/ConstantInitFuture.h"
 
 #include 
 
@@ -60,18 +61,17 @@ class ConstantInitBuilderBase {
   std::vector SelfReferences;
   bool Frozen = false;
 
+  friend class ConstantInitFuture;
   friend class ConstantAggregateBuilderBase;
   template 
   friend class ConstantAggregateBuilderTemplateBase;
 
-  // The rule for CachedOffset is that anything which removes elements
-  // from the Buffer
-
 protected:
   explicit ConstantInitBuilderBase(CodeGenModule ) : CGM(CGM) {}
 
   ~ConstantInitBuilderBase() {
 assert(Buffer.empty() && "didn't claim all values out of buffer");
+assert(SelfReferences.empty() && "didn't apply all self-references");
   }
 
 private:
@@ -83,10 +83,14 @@ private:
= llvm::GlobalValue::InternalLinkage,
  unsigned addressSpace = 0);
 
+  ConstantInitFuture createFuture(llvm::Constant *initializer);
+
   void setGlobalInitializer(llvm::GlobalVariable *GV,
 llvm::Constant *initializer);
 
   void resolveSelfReferences(llvm::GlobalVariable *GV);
+
+  void abandon(size_t newEnd);
 };
 
 /// A concrete base class for struct and array aggregate
@@ -99,6 +103,7 @@ protected:
   mutable size_t CachedOffsetEnd = 0;
   bool Finished = false;
   bool Frozen = false;
+  bool Packed = false;
   mutable CharUnits CachedOffsetFromGlobal;
 
   llvm::SmallVectorImpl () {
@@ -150,17 +155,32 @@ public:
   // properly to satisfy the assert in the destructor.
   ConstantAggregateBuilderBase(ConstantAggregateBuilderBase &)
 : Builder(other.Builder), Parent(other.Parent), Begin(other.Begin),
-  Finished(other.Finished), Frozen(other.Frozen) {
+  CachedOffsetEnd(other.CachedOffsetEnd),
+  Finished(other.Finished), Frozen(other.Frozen), Packed(other.Packed),
+  CachedOffsetFromGlobal(other.CachedOffsetFromGlobal) {
 other.Finished = true;
   }
   ConstantAggregateBuilderBase =(ConstantAggregateBuilderBase &)
 = delete;
 
+  /// Return the number of elements that have been added to
+  /// this struct or array.
+  size_t size() const {
+assert(!this->Finished && "cannot query after finishing builder");
+assert(!this->Frozen && "cannot query while sub-builder is active");
+assert(this->Begin <= this->getBuffer().size());
+return this->getBuffer().size() - this->Begin;
+  }
+
+  /// Return true if no elements have yet been added to this struct or array.
+  bool empty() const {
+return size() == 0;
+  }
+
   /// Abandon this builder completely.
   void abandon() {
 markFinished();
-auto  = Builder.Buffer;
-buffer.erase(buffer.begin() + Begin, buffer.end());
+Builder.abandon(Begin);
   }
 
   /// Add a new value to this initializer.
@@ -224,6 +244,9 @@ public:
 
   /// Return the offset from the start of the initializer to the
   /// next position, assuming no padding is required prior to it.
+  ///
+  /// This operation will not succeed if any unsized placeholders are
+  /// currently in place in the initializer.
   CharUnits getNextOffsetFromGlobal() const {
 assert(!Finished && "cannot add more values after finishing builder");
 assert(!Frozen && "cannot add values while subbuilder is active");
@@ -253,6 +276,9 @@ public:
 return Builder.Buffer.size() - 1;
   }
 
+  /// Add a placeholder, giving the expected type that will be filled in.
+  PlaceholderPosition addPlaceholderWithSize(llvm::Type *expectedType);
+
   /// Fill a previously-added placeholder.
   void fillPlaceholderWithInt(PlaceholderPosition position,
   llvm::IntegerType *type, uint64_t value,
@@ -354,6 +380,19 @@ public:
 assert(!this->Parent && "finishing non-root builder");
 return this->Builder.setGlobalInitializer(global, asImpl().finishImpl());
   }
+
+  /// Given that this builder was created by beginning an array or struct
+  /// directly on a ConstantInitBuilder, finish the array/struct and
+  /// return a future which can be used to install the initializer in
+  /// a 

[PATCH] D17469: [libcxx] Add deployment knobs to tests (for Apple platforms)

2017-03-06 Thread Duncan P. N. Exon Smith via Phabricator via cfe-commits
dexonsmith added a subscriber: mehdi_amini.
dexonsmith added a comment.

Mehdi, are you interested in rebasing this?


https://reviews.llvm.org/D17469



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


[PATCH] D30663: Use filename in linemarker when compiling preprocessed source (Revised)

2017-03-06 Thread Bob Haarman via Phabricator via cfe-commits
inglorion added inline comments.



Comment at: test/Frontend/preprocessed-input.c:3
+// RUN: %clang -emit-llvm -S -o - %t.i | FileCheck %s
+// CHECK: source_filename = {{.*}}preprocessed-input.c"{{$}}

Actually, I think you don't even have to run the preprocessor - you can just 
put the file with the linemarker here and check that the name from the 
linemarker is propagated, right?

Also, it seems that there is a similar issue to the one you're trying to fix 
when going from .ll to .o (or .ll to .s, for that matter) - the name is taken 
from the file you're reading from, not from the source_filename directive in 
that file. Of course, that doesn't differ from gcc (given that gcc doesn't 
handle .ll files), but you may want to address that, too, for consistency.


https://reviews.llvm.org/D30663



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


Re: r296927 - Add arch-specific directory to search path

2017-03-06 Thread Benjamin Kramer via cfe-commits
On Mon, Mar 6, 2017 at 7:00 PM, Pirama Arumuga Nainar  wrote:
> Adding Reid, Michal
>
>
> On Mon, Mar 6, 2017 at 5:01 AM, Benjamin Kramer  wrote:
>>
>> On Sat, Mar 4, 2017 at 12:20 AM, Pirama Arumuga Nainar via cfe-commits
>>  wrote:
>> > Author: pirama
>> > Date: Fri Mar  3 17:20:49 2017
>> > New Revision: 296927
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=296927=rev
>> > Log:
>> > Add arch-specific directory to search path
>> >
>> > Summary:
>> >
>> > This change adds an arch-specific subdirectory in /lib/
>> > to the linker search path.  This path also gets added as '-rpath' for
>> > native compilation if a runtime is linked in as a shared object.  This
>> > allows arch-specific libraries to be installed alongside clang.
>> >
>> > Reviewers: danalbert, cbergstrom, javed.absar
>> >
>> > Subscribers: srhines
>> >
>> > Differential Revision: https://reviews.llvm.org/D30015
>> >
>> > Added:
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/
>> >
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/
>> >
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64/
>> >
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/aarch64/.keep
>> >
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/arm/
>> >
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/arm/.keep
>> >
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/i386/
>> >
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/i386/.keep
>> >
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64/
>> >
>> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/linux/x86_64/.keep
>> > cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
>> > cfe/trunk/test/Driver/arch-specific-libdir.c
>> > Modified:
>> > cfe/trunk/include/clang/Driver/ToolChain.h
>> > cfe/trunk/lib/Driver/ToolChain.cpp
>> > cfe/trunk/lib/Driver/Tools.cpp
>> > cfe/trunk/test/lit.cfg
>> >
>> > Modified: cfe/trunk/include/clang/Driver/ToolChain.h
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=296927=296926=296927=diff
>> >
>> > ==
>> > --- cfe/trunk/include/clang/Driver/ToolChain.h (original)
>> > +++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Mar  3 17:20:49 2017
>> > @@ -299,6 +299,11 @@ public:
>> >const char *getCompilerRTArgString(const llvm::opt::ArgList ,
>> >   StringRef Component,
>> >   bool Shared = false) const;
>> > +
>> > +  // Returns /lib//.  This is used by
>> > runtimes (such
>> > +  // as OpenMP) to find arch-specific libraries.
>> > +  std::string getArchSpecificLibPath() const;
>> > +
>> >/// needsProfileRT - returns true if instrumentation profile is on.
>> >static bool needsProfileRT(const llvm::opt::ArgList );
>> >
>> >
>> > Modified: cfe/trunk/lib/Driver/ToolChain.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=296927=296926=296927=diff
>> >
>> > ==
>> > --- cfe/trunk/lib/Driver/ToolChain.cpp (original)
>> > +++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Mar  3 17:20:49 2017
>> > @@ -10,6 +10,7 @@
>> >  #include "clang/Driver/ToolChain.h"
>> >  #include "Tools.h"
>> >  #include "clang/Basic/ObjCRuntime.h"
>> > +#include "clang/Basic/VirtualFileSystem.h"
>> >  #include "clang/Config/config.h"
>> >  #include "clang/Driver/Action.h"
>> >  #include "clang/Driver/Driver.h"
>> > @@ -74,6 +75,10 @@ ToolChain::ToolChain(const Driver , co
>> >  if (!isThreadModelSupported(A->getValue()))
>> >D.Diag(diag::err_drv_invalid_thread_model_for_target)
>> ><< A->getValue() << A->getAsString(Args);
>> > +
>> > +  std::string CandidateLibPath = getArchSpecificLibPath();
>> > +  if (getVFS().exists(CandidateLibPath))
>> > +getFilePaths().push_back(CandidateLibPath);
>> >  }
>> >
>> >  ToolChain::~ToolChain() {
>> > @@ -320,6 +325,14 @@ const char *ToolChain::getCompilerRTArgS
>> >return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
>> >  }
>> >
>> > +std::string ToolChain::getArchSpecificLibPath() const {
>> > +  SmallString<128> Path(getDriver().ResourceDir);
>> > +  StringRef OSLibName = getTriple().isOSFreeBSD() ? "freebsd" :
>> > getOS();
>> > +  llvm::sys::path::append(Path, "lib", OSLibName,
>> > +  llvm::Triple::getArchTypeName(getArch()));
>> > +  return Path.str();
>> > +}
>> > +
>> >  bool ToolChain::needsProfileRT(const ArgList ) {
>> >if (Args.hasFlag(options::OPT_fprofile_arcs,
>> > 

[PATCH] D30489: [analyzer] catch out of bounds for VLA

2017-03-06 Thread Anna Zaks via Phabricator via cfe-commits
zaks.anna requested changes to this revision.
zaks.anna added a comment.
This revision now requires changes to proceed.

Following Gabor's suggestion, we should investigate if ArrayBoundCheckerV2 
supports this. If not it's possible that we are hitting the Constraint Solver 
limitations.


Repository:
  rL LLVM

https://reviews.llvm.org/D30489



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


Re: [PATCH] D30435: [clang-import-test] Lookup inside entities

2017-03-06 Thread Sean Callanan via cfe-commits
Aleksei,

thank you for your comments!

I appreciate your comments in particular about source/destination confusion.  I 
can relate to this, as this was (a) an area that confused me while I was 
working on this code in LLDB; and (b) it was something I had to keep straight 
in my head even when doing the work here.  I will implement a type-system based 
solution to this and update the patch, then you can have a look and we'll 
decide if it looks better that way.
The std::transform is more efficient than the for loop because it reallocates 
the array once at the beginning, instead of progressively as we push_back.  
This means the asymptotic runtime of this loop will be worse than the 
std::transform.  Is that an acceptable trade?
The other points are well-taken – in particular, I like your idea about 
breaking the std::none_of block out into a function.  I'll apply them in an 
updated patch.

Sean

> On Mar 6, 2017, at 9:48 AM, Aleksei Sidorin via Phabricator 
> > wrote:
> 
> a.sidorin added a comment.
> 
> Hello Sean,
> 
> It is good to have the ability of recursive lookup. But for me (and I'm 
> sorry), the code becomes very hard to understand: I need to track if the 
> Decl/DC is in the source AST or in the AST being imported, if it was imported 
> or if was in the AST before across lambdas and calls. Can we make this more 
> clear?
> 
> 
> 
> 
> Comment at: tools/clang-import-test/clang-import-test.cpp:201
> +  Decl *Imported(Decl *From, Decl *To) override {
> +if (auto ToTag = llvm::dyn_cast(To)) {
> +  ToTag->setHasExternalLexicalStorage();
> 
> Can we make the usage of qualified and non-qualified casts consistent? 
> Usually, casts are used as unqualified.
> 
> 
> 
> Comment at: tools/clang-import-test/clang-import-test.cpp:298
> +
> +std::vector CompleteDecls;
> +std::vector ForwardDecls;
> 
> I guess we can use `SmallVector`s here too.
> 
> 
> 
> Comment at: tools/clang-import-test/clang-import-test.cpp:303
> +  if (IsForwardDeclaration(C.first)) {
> +if (std::none_of(ForwardDecls.begin(), ForwardDecls.end(),
> + [](Candidate ) {
> 
> Nit: to make the code cleaner, we can extract this `std::none_of` to a 
> separate function like `IsFoundAsForward()`. Nested lambdas are harder to 
> read.
> 
> 
> 
> Comment at: tools/clang-import-test/clang-import-test.cpp:333
> +Decls.resize(DeclsToReport.size());
> +std::transform(DeclsToReport.begin(), DeclsToReport.end(), Decls.begin(),
> +   [](Candidate ) {
> 
> The loop:
> ```
> Decls.reserve(DeclsToReport.size());
> for (Candidate  : DeclsToReport)
>  Decls.push_back(cast(C.second->Import(C.first)));
> ```
> will look a bit nicer here. What do you think?
> 
> 
> Repository:
>  rL LLVM
> 
> https://reviews.llvm.org/D30435 
> 
> 
> 

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


[PATCH] D30663: Use filename in linemarker when compiling preprocessed source (Revised)

2017-03-06 Thread Taewook Oh via Phabricator via cfe-commits
twoh created this revision.

This is a revised version of https://reviews.llvm.org/D28796. Included test is 
changed to
resolve the target compatibility issue reported 
(https://reviews.llvm.org/rL293032).


https://reviews.llvm.org/D30663

Files:
  include/clang/Frontend/FrontendOptions.h
  lib/Frontend/FrontendAction.cpp
  test/Frontend/preprocessed-input.c

Index: test/Frontend/preprocessed-input.c
===
--- /dev/null
+++ test/Frontend/preprocessed-input.c
@@ -0,0 +1,3 @@
+// RUN: %clang -E -o %t.i %s
+// RUN: %clang -emit-llvm -S -o - %t.i | FileCheck %s
+// CHECK: source_filename = {{.*}}preprocessed-input.c"{{$}}
Index: lib/Frontend/FrontendAction.cpp
===
--- lib/Frontend/FrontendAction.cpp
+++ lib/Frontend/FrontendAction.cpp
@@ -19,6 +19,7 @@
 #include "clang/Frontend/MultiplexConsumer.h"
 #include "clang/Frontend/Utils.h"
 #include "clang/Lex/HeaderSearch.h"
+#include "clang/Lex/LiteralSupport.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Parse/ParseAST.h"
@@ -187,6 +188,42 @@
   return llvm::make_unique(std::move(Consumers));
 }
 
+// For preprocessed files, if the first line is the linemarker and specifies
+// the original source file name, use that name as the input file name.
+static bool ReadOriginalFileName(CompilerInstance , std::string )
+{
+  bool Invalid = false;
+  auto  = CI.getSourceManager();
+  auto MainFileID = SourceMgr.getMainFileID();
+  const auto *MainFileBuf = SourceMgr.getBuffer(MainFileID, );
+  if (Invalid)
+return false;
+
+  std::unique_ptr RawLexer(
+  new Lexer(MainFileID, MainFileBuf, SourceMgr, CI.getLangOpts()));
+
+  // If the first line has the syntax of
+  //
+  // # NUM "FILENAME"
+  //
+  // we use FILENAME as the input file name.
+  Token T;
+  if (RawLexer->LexFromRawLexer(T) || T.getKind() != tok::hash)
+return false;
+  if (RawLexer->LexFromRawLexer(T) || T.isAtStartOfLine() ||
+  T.getKind() != tok::numeric_constant)
+return false;
+  RawLexer->LexFromRawLexer(T);
+  if (T.isAtStartOfLine() || T.getKind() != tok::string_literal)
+return false;
+
+  StringLiteralParser Literal(T, CI.getPreprocessor());
+  if (Literal.hadError)
+return false;
+  InputFile = Literal.GetString().str();
+  return true;
+}
+
 bool FrontendAction::BeginSourceFile(CompilerInstance ,
  const FrontendInputFile ) {
   assert(!Instance && "Already processing a source file!");
@@ -338,6 +375,13 @@
 if (!isModelParsingAction())
   CI.createASTContext();
 
+// For preprocessed files, check if the first line specifies the original
+// source file name with a linemarker.
+std::string OrigFile;
+if (Input.isPreprocessed())
+  if (ReadOriginalFileName(CI, OrigFile))
+InputFile = OrigFile;
+
 std::unique_ptr Consumer =
 CreateWrappedASTConsumer(CI, InputFile);
 if (!Consumer)
@@ -430,9 +474,9 @@
 
   // If there is a layout overrides file, attach an external AST source that
   // provides the layouts from that file.
-  if (!CI.getFrontendOpts().OverrideRecordLayoutsFile.empty() && 
+  if (!CI.getFrontendOpts().OverrideRecordLayoutsFile.empty() &&
   CI.hasASTContext() && !CI.getASTContext().getExternalSource()) {
-IntrusiveRefCntPtr 
+IntrusiveRefCntPtr
   Override(new LayoutOverrideSource(
  CI.getFrontendOpts().OverrideRecordLayoutsFile));
 CI.getASTContext().setExternalSource(Override);
Index: include/clang/Frontend/FrontendOptions.h
===
--- include/clang/Frontend/FrontendOptions.h
+++ include/clang/Frontend/FrontendOptions.h
@@ -81,7 +81,7 @@
   IK_LLVM_IR
 };
 
-  
+
 /// \brief An input file for the front end.
 class FrontendInputFile {
   /// \brief The file name, or "-" to read from standard input.
@@ -109,6 +109,13 @@
   bool isEmpty() const { return File.empty() && Buffer == nullptr; }
   bool isFile() const { return !isBuffer(); }
   bool isBuffer() const { return Buffer != nullptr; }
+  bool isPreprocessed() const {
+return Kind == IK_PreprocessedC ||
+   Kind == IK_PreprocessedCXX ||
+   Kind == IK_PreprocessedObjC ||
+   Kind == IK_PreprocessedObjCXX ||
+   Kind == IK_PreprocessedCuda;
+  }
 
   StringRef getFile() const {
 assert(isFile());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r296927 - Add arch-specific directory to search path

2017-03-06 Thread Pirama Arumuga Nainar via cfe-commits
Adding Reid, Michal


On Mon, Mar 6, 2017 at 5:01 AM, Benjamin Kramer  wrote:

> On Sat, Mar 4, 2017 at 12:20 AM, Pirama Arumuga Nainar via cfe-commits
>  wrote:
> > Author: pirama
> > Date: Fri Mar  3 17:20:49 2017
> > New Revision: 296927
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=296927=rev
> > Log:
> > Add arch-specific directory to search path
> >
> > Summary:
> >
> > This change adds an arch-specific subdirectory in /lib/
> > to the linker search path.  This path also gets added as '-rpath' for
> > native compilation if a runtime is linked in as a shared object.  This
> > allows arch-specific libraries to be installed alongside clang.
> >
> > Reviewers: danalbert, cbergstrom, javed.absar
> >
> > Subscribers: srhines
> >
> > Differential Revision: https://reviews.llvm.org/D30015
> >
> > Added:
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/lib/
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> lib/linux/
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> lib/linux/aarch64/
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> lib/linux/aarch64/.keep
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> lib/linux/arm/
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> lib/linux/arm/.keep
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> lib/linux/i386/
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> lib/linux/i386/.keep
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> lib/linux/x86_64/
> > cfe/trunk/test/Driver/Inputs/resource_dir_with_arch_subdir/
> lib/linux/x86_64/.keep
> > cfe/trunk/test/Driver/arch-specific-libdir-rpath.c
> > cfe/trunk/test/Driver/arch-specific-libdir.c
> > Modified:
> > cfe/trunk/include/clang/Driver/ToolChain.h
> > cfe/trunk/lib/Driver/ToolChain.cpp
> > cfe/trunk/lib/Driver/Tools.cpp
> > cfe/trunk/test/lit.cfg
> >
> > Modified: cfe/trunk/include/clang/Driver/ToolChain.h
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/
> clang/Driver/ToolChain.h?rev=296927=296926=296927=diff
> > 
> ==
> > --- cfe/trunk/include/clang/Driver/ToolChain.h (original)
> > +++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Mar  3 17:20:49 2017
> > @@ -299,6 +299,11 @@ public:
> >const char *getCompilerRTArgString(const llvm::opt::ArgList ,
> >   StringRef Component,
> >   bool Shared = false) const;
> > +
> > +  // Returns /lib//.  This is used by
> runtimes (such
> > +  // as OpenMP) to find arch-specific libraries.
> > +  std::string getArchSpecificLibPath() const;
> > +
> >/// needsProfileRT - returns true if instrumentation profile is on.
> >static bool needsProfileRT(const llvm::opt::ArgList );
> >
> >
> > Modified: cfe/trunk/lib/Driver/ToolChain.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> ToolChain.cpp?rev=296927=296926=296927=diff
> > 
> ==
> > --- cfe/trunk/lib/Driver/ToolChain.cpp (original)
> > +++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Mar  3 17:20:49 2017
> > @@ -10,6 +10,7 @@
> >  #include "clang/Driver/ToolChain.h"
> >  #include "Tools.h"
> >  #include "clang/Basic/ObjCRuntime.h"
> > +#include "clang/Basic/VirtualFileSystem.h"
> >  #include "clang/Config/config.h"
> >  #include "clang/Driver/Action.h"
> >  #include "clang/Driver/Driver.h"
> > @@ -74,6 +75,10 @@ ToolChain::ToolChain(const Driver , co
> >  if (!isThreadModelSupported(A->getValue()))
> >D.Diag(diag::err_drv_invalid_thread_model_for_target)
> ><< A->getValue() << A->getAsString(Args);
> > +
> > +  std::string CandidateLibPath = getArchSpecificLibPath();
> > +  if (getVFS().exists(CandidateLibPath))
> > +getFilePaths().push_back(CandidateLibPath);
> >  }
> >
> >  ToolChain::~ToolChain() {
> > @@ -320,6 +325,14 @@ const char *ToolChain::getCompilerRTArgS
> >return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
> >  }
> >
> > +std::string ToolChain::getArchSpecificLibPath() const {
> > +  SmallString<128> Path(getDriver().ResourceDir);
> > +  StringRef OSLibName = getTriple().isOSFreeBSD() ? "freebsd" : getOS();
> > +  llvm::sys::path::append(Path, "lib", OSLibName,
> > +  llvm::Triple::getArchTypeName(getArch()));
> > +  return Path.str();
> > +}
> > +
> >  bool ToolChain::needsProfileRT(const ArgList ) {
> >if (Args.hasFlag(options::OPT_fprofile_arcs,
> options::OPT_fno_profile_arcs,
> > false) ||
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> 

[PATCH] D27092: Add RecursionChecker for finding infinite recursion

2017-03-06 Thread Anna Zaks via Phabricator via cfe-commits
zaks.anna added a comment.

This is waiting for a resolution on a CallEvent API patch as described in 
https://reviews.llvm.org/D27091.

This is blocked on https://reviews.llvm.org/D27091.




Comment at: lib/StaticAnalyzer/Checkers/RecursionChecker.cpp:29
+// this patch.
+REGISTER_SET_WITH_PROGRAMSTATE(DirtyStackFrames,
+   const clang::StackFrameContext *)

 


https://reviews.llvm.org/D27092



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


r297037 - [modules] Add missing test from r297030.

2017-03-06 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Mon Mar  6 11:47:57 2017
New Revision: 297037

URL: http://llvm.org/viewvc/llvm-project?rev=297037=rev
Log:
[modules] Add missing test from r297030.

Added:
cfe/trunk/test/Modules/Inputs/gnumode-non-benign/
cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.h
cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.modulemap
cfe/trunk/test/Modules/gnumode-non-benign.cpp

Added: cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.h?rev=297037=auto
==
--- cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.h (added)
+++ cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.h Mon Mar  6 
11:47:57 2017
@@ -0,0 +1,5 @@
+// Check for GNUMode = 1 by looking for the "linux" define which only exists
+// for GNUMode = 1.
+#ifdef linux
+ #error "Submodule has GNUMode=1"
+#endif

Added: cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.modulemap
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.modulemap?rev=297037=auto
==
--- cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.modulemap (added)
+++ cfe/trunk/test/Modules/Inputs/gnumode-non-benign/module.modulemap Mon Mar  
6 11:47:57 2017
@@ -0,0 +1 @@
+module "module.h" { header "module.h"}

Added: cfe/trunk/test/Modules/gnumode-non-benign.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/gnumode-non-benign.cpp?rev=297037=auto
==
--- cfe/trunk/test/Modules/gnumode-non-benign.cpp (added)
+++ cfe/trunk/test/Modules/gnumode-non-benign.cpp Mon Mar  6 11:47:57 2017
@@ -0,0 +1,11 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -std=c++11 -fmodules -fimplicit-module-maps 
-fmodules-cache-path=%t -I%S/Inputs/gnumode-non-benign -verify %s
+
+// expected-no-diagnostics
+
+// This test ensures that submodules have the same GNUMode language option
+// setting as the main clang invocation.
+// Note that we set GNUMode = 0 with -std=c++11 for this file.
+
+// This module fails to compile with GNUMode = 1.
+#include "module.h"


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


Re: r297034 - [clang-format] Add tests for ambiguous namespaces to the comment fixer

2017-03-06 Thread Daniel Jasper via cfe-commits
On Mon, Mar 6, 2017 at 6:29 PM, Krasimir Georgiev via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: krasimir
> Date: Mon Mar  6 11:29:25 2017
> New Revision: 297034
>
> URL: http://llvm.org/viewvc/llvm-project?rev=297034=rev
> Log:
> [clang-format] Add tests for ambiguous namespaces to the comment fixer
>
> Modified:
> cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
>
> Modified: cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/
> NamespaceEndCommentsFixerTest.cpp?rev=297034=297033=297034=diff
> 
> ==
> --- cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
> (original)
> +++ cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp Mon Mar
> 6 11:29:25 2017
> @@ -406,6 +406,86 @@ TEST_F(NamespaceEndCommentsFixerTest,
>  "#else\n"
>  "  int j;\n"
>  "#endif"));
> +  EXPECT_EQ("#if A\n"
> +"namespace A {\n"
> +"#else\n"
> +"namespace B {\n"
> +"#endif\n"
> +"int i;\n"
> +"int j;\n"
> +"}",
> +fixNamespaceEndComments("#if A\n"
> +"namespace A {\n"
> +"#else\n"
> +"namespace B {\n"
> +"#endif\n"
> +"int i;\n"
> +"int j;\n"
> +"}"));
>

I don't understand why we aren't adding "// namespace A" here. I mean I
don't think it matters much, but it seems weird to me.


> +  EXPECT_EQ("#if A\n"
> +"namespace A {\n"
> +"#else\n"
> +"namespace B {\n"
> +"#endif\n"
> +"int i;\n"
> +"int j;\n"
> +"} // namespace A",
> +fixNamespaceEndComments("#if A\n"
> +"namespace A {\n"
> +"#else\n"
> +"namespace B {\n"
> +"#endif\n"
> +"int i;\n"
> +"int j;\n"
> +"} // namespace A"));
>

I'd consider merging this test with the previous one. Might make it more
obvious what the difference is. But I am not sure.


> +  EXPECT_EQ("#if A\n"
> +"namespace A {\n"
> +"#else\n"
> +"namespace B {\n"
> +"#endif\n"
> +"int i;\n"
> +"int j;\n"
> +"} // namespace B",
> +fixNamespaceEndComments("#if A\n"
> +"namespace A {\n"
> +"#else\n"
> +"namespace B {\n"
> +"#endif\n"
> +"int i;\n"
> +"int j;\n"
> +"} // namespace B"));
> +  EXPECT_EQ("namespace A\n"
> +"int i;\n"
> +"int j;\n"
> +"#if A\n"
> +"}\n"
> +"#else\n"
> +"}\n"
> +"#endif",
> +fixNamespaceEndComments("namespace A\n"
> +"int i;\n"
> +"int j;\n"
> +"#if A\n"
> +"}\n"
> +"#else\n"
> +"}\n"
> +"#endif"));
>

Similarly, I would have expected us to insert "//namespace A" here. Why
don't we. Is that related to the missing "{" after "namespace A"?


> +  EXPECT_EQ("namespace A\n"
> +"int i;\n"
> +"int j;\n"
> +"#if A\n"
> +"} // namespace A\n"
> +"#else\n"
> +"} // namespace A\n"
> +"#endif",
> +fixNamespaceEndComments("namespace A\n"
> +"int i;\n"
> +"int j;\n"
> +"#if A\n"
> +"} // namespace A\n"
> +"#else\n"
> +"} // namespace A\n"
> +"#endif"));
>  }
>
>  TEST_F(NamespaceEndCommentsFixerTest,
>
>
> ___
> 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

[PATCH] D30435: [clang-import-test] Lookup inside entities

2017-03-06 Thread Aleksei Sidorin via Phabricator via cfe-commits
a.sidorin added a comment.

Hello Sean,

It is good to have the ability of recursive lookup. But for me (and I'm sorry), 
the code becomes very hard to understand: I need to track if the Decl/DC is in 
the source AST or in the AST being imported, if it was imported or if was in 
the AST before across lambdas and calls. Can we make this more clear?




Comment at: tools/clang-import-test/clang-import-test.cpp:201
+  Decl *Imported(Decl *From, Decl *To) override {
+if (auto ToTag = llvm::dyn_cast(To)) {
+  ToTag->setHasExternalLexicalStorage();

Can we make the usage of qualified and non-qualified casts consistent? Usually, 
casts are used as unqualified.



Comment at: tools/clang-import-test/clang-import-test.cpp:298
+
+std::vector CompleteDecls;
+std::vector ForwardDecls;

I guess we can use `SmallVector`s here too.



Comment at: tools/clang-import-test/clang-import-test.cpp:303
+  if (IsForwardDeclaration(C.first)) {
+if (std::none_of(ForwardDecls.begin(), ForwardDecls.end(),
+ [](Candidate ) {

Nit: to make the code cleaner, we can extract this `std::none_of` to a separate 
function like `IsFoundAsForward()`. Nested lambdas are harder to read.



Comment at: tools/clang-import-test/clang-import-test.cpp:333
+Decls.resize(DeclsToReport.size());
+std::transform(DeclsToReport.begin(), DeclsToReport.end(), Decls.begin(),
+   [](Candidate ) {

The loop:
```
Decls.reserve(DeclsToReport.size());
for (Candidate  : DeclsToReport)
  Decls.push_back(cast(C.second->Import(C.first)));
```
will look a bit nicer here. What do you think?


Repository:
  rL LLVM

https://reviews.llvm.org/D30435



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


[PATCH] D30662: Update clang filtering for mxcsr

2017-03-06 Thread Andy Kaylor via Phabricator via cfe-commits
andrew.w.kaylor created this revision.

This patch updates the clang function that filters the mxcsr register name to 
recognize that mxcsr is being split into two pseduo-registers that model the 
control and status bits separately.


Repository:
  rL LLVM

https://reviews.llvm.org/D30662

Files:
  lib/Parse/ParseStmtAsm.cpp


Index: lib/Parse/ParseStmtAsm.cpp
===
--- lib/Parse/ParseStmtAsm.cpp
+++ lib/Parse/ParseStmtAsm.cpp
@@ -623,8 +623,9 @@
 
   // Filter out "fpsw" and "mxcsr". They aren't valid GCC asm clobber
   // constraints. Clang always adds fpsr to the clobber list anyway.
+  // Note that mxcsr is modeled as two separate registers.
   llvm::erase_if(Clobbers, [](const std::string ) {
-return C == "fpsw" || C == "mxcsr";
+return C == "fpsw" || C == "mxcsr_c" || C == "mxcsr_s";
   });
 
   // Build the vector of clobber StringRefs.


Index: lib/Parse/ParseStmtAsm.cpp
===
--- lib/Parse/ParseStmtAsm.cpp
+++ lib/Parse/ParseStmtAsm.cpp
@@ -623,8 +623,9 @@
 
   // Filter out "fpsw" and "mxcsr". They aren't valid GCC asm clobber
   // constraints. Clang always adds fpsr to the clobber list anyway.
+  // Note that mxcsr is modeled as two separate registers.
   llvm::erase_if(Clobbers, [](const std::string ) {
-return C == "fpsw" || C == "mxcsr";
+return C == "fpsw" || C == "mxcsr_c" || C == "mxcsr_s";
   });
 
   // Build the vector of clobber StringRefs.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r297034 - [clang-format] Add tests for ambiguous namespaces to the comment fixer

2017-03-06 Thread Krasimir Georgiev via cfe-commits
Author: krasimir
Date: Mon Mar  6 11:29:25 2017
New Revision: 297034

URL: http://llvm.org/viewvc/llvm-project?rev=297034=rev
Log:
[clang-format] Add tests for ambiguous namespaces to the comment fixer

Modified:
cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp

Modified: cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp?rev=297034=297033=297034=diff
==
--- cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp (original)
+++ cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp Mon Mar  6 
11:29:25 2017
@@ -406,6 +406,86 @@ TEST_F(NamespaceEndCommentsFixerTest,
 "#else\n"
 "  int j;\n"
 "#endif"));
+  EXPECT_EQ("#if A\n"
+"namespace A {\n"
+"#else\n"
+"namespace B {\n"
+"#endif\n"
+"int i;\n"
+"int j;\n"
+"}",
+fixNamespaceEndComments("#if A\n"
+"namespace A {\n"
+"#else\n"
+"namespace B {\n"
+"#endif\n"
+"int i;\n"
+"int j;\n"
+"}"));
+  EXPECT_EQ("#if A\n"
+"namespace A {\n"
+"#else\n"
+"namespace B {\n"
+"#endif\n"
+"int i;\n"
+"int j;\n"
+"} // namespace A",
+fixNamespaceEndComments("#if A\n"
+"namespace A {\n"
+"#else\n"
+"namespace B {\n"
+"#endif\n"
+"int i;\n"
+"int j;\n"
+"} // namespace A"));
+  EXPECT_EQ("#if A\n"
+"namespace A {\n"
+"#else\n"
+"namespace B {\n"
+"#endif\n"
+"int i;\n"
+"int j;\n"
+"} // namespace B",
+fixNamespaceEndComments("#if A\n"
+"namespace A {\n"
+"#else\n"
+"namespace B {\n"
+"#endif\n"
+"int i;\n"
+"int j;\n"
+"} // namespace B"));
+  EXPECT_EQ("namespace A\n"
+"int i;\n"
+"int j;\n"
+"#if A\n"
+"}\n"
+"#else\n"
+"}\n"
+"#endif",
+fixNamespaceEndComments("namespace A\n"
+"int i;\n"
+"int j;\n"
+"#if A\n"
+"}\n"
+"#else\n"
+"}\n"
+"#endif"));
+  EXPECT_EQ("namespace A\n"
+"int i;\n"
+"int j;\n"
+"#if A\n"
+"} // namespace A\n"
+"#else\n"
+"} // namespace A\n"
+"#endif",
+fixNamespaceEndComments("namespace A\n"
+"int i;\n"
+"int j;\n"
+"#if A\n"
+"} // namespace A\n"
+"#else\n"
+"} // namespace A\n"
+"#endif"));
 }
 
 TEST_F(NamespaceEndCommentsFixerTest,


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


[PATCH] D30423: [ubsan] Detect UB loads from bitfields

2017-03-06 Thread Alex Lorenz via Phabricator via cfe-commits
arphaman added inline comments.



Comment at: test/CodeGenCXX/ubsan-bitfields.cpp:21
+  // CHECK: call void @__ubsan_handle_load_invalid_value
+  return s->e1;
+}

Can we avoid the check if the bitfield is 2 bits wide?



Comment at: test/CodeGenObjC/ubsan-bool.m:25
+  // OBJC:  [[ASHR:%.*]] = ashr i8 [[SHL]], 7
+  // OBJC:  [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+  // OBJC: call void @__ubsan_handle_load_invalid_value

One unrelated thing that I noticed in the IR, the `zext`s to `i64` are emitted 
before the branch, even though they are used only in the `invalid_value` 
blocks. I know that the optimizer can move those anyway, but would there any be 
any benefit in moving them into the blocks at the frontend IRGen level?



Comment at: test/CodeGenObjC/ubsan-bool.m:26
+  // OBJC:  [[ICMP:%.*]] = icmp ule i8 [[ASHR]], 1, !nosanitize
+  // OBJC: call void @__ubsan_handle_load_invalid_value
+

Is it possible to avoid the check here since the bitfield is just one bit wide?


https://reviews.llvm.org/D30423



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


[PATCH] D26065: Improve diagnostics if friend function redefines file-level function.

2017-03-06 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff added a comment.

Ping.


https://reviews.llvm.org/D26065



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


r297030 - [modules] Make GNUMode a normal language option to fix module compilation.

2017-03-06 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Mon Mar  6 10:54:40 2017
New Revision: 297030

URL: http://llvm.org/viewvc/llvm-project?rev=297030=rev
Log:
[modules] Make GNUMode a normal language option to fix module compilation.

GNUMode shouldn't be a benign language option because it influences the
resulting AST when checking for the existence of GNUMode-specific macro
"linux" (e.g. by having code inside #ifdef linux). This patch marks it as a
normal language option so it gets correctly passed to the compiler invocation
for the used modules.

The added test case illustrated this because it compiles without modules, but
fails when using modules.

Patch by Raphael Isemann (D30496)!

Modified:
cfe/trunk/include/clang/Basic/LangOptions.def

Modified: cfe/trunk/include/clang/Basic/LangOptions.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=297030=297029=297030=diff
==
--- cfe/trunk/include/clang/Basic/LangOptions.def (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.def Mon Mar  6 10:54:40 2017
@@ -107,7 +107,7 @@ LANGOPT(WChar , 1, CPlusPlus
 LANGOPT(DeclSpecKeyword   , 1, 0, "__declspec keyword")
 BENIGN_LANGOPT(DollarIdents   , 1, 1, "'$' in identifiers")
 BENIGN_LANGOPT(AsmPreprocessor, 1, 0, "preprocessor in asm mode")
-BENIGN_LANGOPT(GNUMode, 1, 1, "GNU extensions")
+LANGOPT(GNUMode   , 1, 1, "GNU extensions")
 LANGOPT(GNUKeywords   , 1, 1, "GNU keywords")
 BENIGN_LANGOPT(ImplicitInt, 1, !C99 && !CPlusPlus, "C89 implicit 'int'")
 LANGOPT(Digraphs  , 1, 0, "digraphs")


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


r297028 - [clang-format] Make NamespaceEndCommentFixer add at most one comment

2017-03-06 Thread Krasimir Georgiev via cfe-commits
Author: krasimir
Date: Mon Mar  6 10:44:45 2017
New Revision: 297028

URL: http://llvm.org/viewvc/llvm-project?rev=297028=rev
Log:
[clang-format] Make NamespaceEndCommentFixer add at most one comment

Summary:
Until now, NamespaceEndCommentFixer was adding missing comments for every run,
which results in multiple end comments for:
```
namespace {
  int i;
  int j;
}
#if A
  int a = 1;
#else
  int a = 2;
#endif
```
result before:

```
namespace {
  int i;
  int j;
}// namespace // namespace
#if A
  int a = 1;
#else
  int a = 2;
#endif
```
result after:
```
namespace {
  int i;
  int j;
}// namespace
#if A
  int a = 1;
#else
  int a = 2;
#endif
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

Modified:
cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp
cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp

Modified: cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp?rev=297028=297027=297028=diff
==
--- cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp (original)
+++ cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp Mon Mar  6 10:44:45 2017
@@ -135,7 +135,10 @@ tooling::Replacements NamespaceEndCommen
   NamespaceTok = NamespaceTok->getNextNonComment();
 if (NamespaceTok->isNot(tok::kw_namespace))
   continue;
-const FormatToken *RBraceTok = EndLine->First;
+FormatToken *RBraceTok = EndLine->First;
+if (RBraceTok->Finalized)
+  continue;
+RBraceTok->Finalized = true;
 const std::string NamespaceName = computeName(NamespaceTok);
 bool AddNewline = (I + 1 < E) &&
   AnnotatedLines[I + 1]->First->NewlinesBefore == 0 &&

Modified: cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp?rev=297028=297027=297028=diff
==
--- cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp (original)
+++ cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp Mon Mar  6 
10:44:45 2017
@@ -388,6 +388,24 @@ TEST_F(NamespaceEndCommentsFixerTest,
 "  int i;\n"
 "}\n"
 "}\n"));
+  EXPECT_EQ("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}// namespace\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif",
+fixNamespaceEndComments("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif"));
 }
 
 TEST_F(NamespaceEndCommentsFixerTest,


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


[PATCH] D30659: [clang-format] Make NamespaceEndCommentFixer add at most one comment

2017-03-06 Thread Krasimir Georgiev via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297028: [clang-format] Make NamespaceEndCommentFixer add at 
most one comment (authored by krasimir).

Changed prior to commit:
  https://reviews.llvm.org/D30659?vs=90715=90716#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30659

Files:
  cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp
  cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp


Index: cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp
===
--- cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp
+++ cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -135,7 +135,10 @@
   NamespaceTok = NamespaceTok->getNextNonComment();
 if (NamespaceTok->isNot(tok::kw_namespace))
   continue;
-const FormatToken *RBraceTok = EndLine->First;
+FormatToken *RBraceTok = EndLine->First;
+if (RBraceTok->Finalized)
+  continue;
+RBraceTok->Finalized = true;
 const std::string NamespaceName = computeName(NamespaceTok);
 bool AddNewline = (I + 1 < E) &&
   AnnotatedLines[I + 1]->First->NewlinesBefore == 0 &&
Index: cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -388,6 +388,24 @@
 "  int i;\n"
 "}\n"
 "}\n"));
+  EXPECT_EQ("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}// namespace\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif",
+fixNamespaceEndComments("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif"));
 }
 
 TEST_F(NamespaceEndCommentsFixerTest,


Index: cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp
===
--- cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp
+++ cfe/trunk/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -135,7 +135,10 @@
   NamespaceTok = NamespaceTok->getNextNonComment();
 if (NamespaceTok->isNot(tok::kw_namespace))
   continue;
-const FormatToken *RBraceTok = EndLine->First;
+FormatToken *RBraceTok = EndLine->First;
+if (RBraceTok->Finalized)
+  continue;
+RBraceTok->Finalized = true;
 const std::string NamespaceName = computeName(NamespaceTok);
 bool AddNewline = (I + 1 < E) &&
   AnnotatedLines[I + 1]->First->NewlinesBefore == 0 &&
Index: cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ cfe/trunk/unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -388,6 +388,24 @@
 "  int i;\n"
 "}\n"
 "}\n"));
+  EXPECT_EQ("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}// namespace\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif",
+fixNamespaceEndComments("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif"));
 }
 
 TEST_F(NamespaceEndCommentsFixerTest,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30659: [clang-format] Make NamespaceEndCommentFixer add at most one comment

2017-03-06 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir updated this revision to Diff 90715.
krasimir added a comment.

- Added missing newline


https://reviews.llvm.org/D30659

Files:
  lib/Format/NamespaceEndCommentsFixer.cpp
  unittests/Format/NamespaceEndCommentsFixerTest.cpp


Index: unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -388,6 +388,24 @@
 "  int i;\n"
 "}\n"
 "}\n"));
+  EXPECT_EQ("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}// namespace\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif",
+fixNamespaceEndComments("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif"));
 }
 
 TEST_F(NamespaceEndCommentsFixerTest,
Index: lib/Format/NamespaceEndCommentsFixer.cpp
===
--- lib/Format/NamespaceEndCommentsFixer.cpp
+++ lib/Format/NamespaceEndCommentsFixer.cpp
@@ -135,7 +135,10 @@
   NamespaceTok = NamespaceTok->getNextNonComment();
 if (NamespaceTok->isNot(tok::kw_namespace))
   continue;
-const FormatToken *RBraceTok = EndLine->First;
+FormatToken *RBraceTok = EndLine->First;
+if (RBraceTok->Finalized)
+  continue;
+RBraceTok->Finalized = true;
 const std::string NamespaceName = computeName(NamespaceTok);
 bool AddNewline = (I + 1 < E) &&
   AnnotatedLines[I + 1]->First->NewlinesBefore == 0 &&


Index: unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -388,6 +388,24 @@
 "  int i;\n"
 "}\n"
 "}\n"));
+  EXPECT_EQ("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}// namespace\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif",
+fixNamespaceEndComments("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif"));
 }
 
 TEST_F(NamespaceEndCommentsFixerTest,
Index: lib/Format/NamespaceEndCommentsFixer.cpp
===
--- lib/Format/NamespaceEndCommentsFixer.cpp
+++ lib/Format/NamespaceEndCommentsFixer.cpp
@@ -135,7 +135,10 @@
   NamespaceTok = NamespaceTok->getNextNonComment();
 if (NamespaceTok->isNot(tok::kw_namespace))
   continue;
-const FormatToken *RBraceTok = EndLine->First;
+FormatToken *RBraceTok = EndLine->First;
+if (RBraceTok->Finalized)
+  continue;
+RBraceTok->Finalized = true;
 const std::string NamespaceName = computeName(NamespaceTok);
 bool AddNewline = (I + 1 < E) &&
   AnnotatedLines[I + 1]->First->NewlinesBefore == 0 &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r297027 - [Docs] Add missing quotes to the language literal in the

2017-03-06 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Mon Mar  6 10:37:06 2017
New Revision: 297027

URL: http://llvm.org/viewvc/llvm-project?rev=297027=rev
Log:
[Docs] Add missing quotes to the language literal in the
external_source_symbol attribute docs

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=297027=297026=297027=diff
==
--- cfe/trunk/include/clang/Basic/AttrDocs.td (original)
+++ cfe/trunk/include/clang/Basic/AttrDocs.td Mon Mar  6 10:37:06 2017
@@ -987,7 +987,7 @@ that ``SwiftProtocol`` actually originat
 
 .. code-block:: objc
 
-  __attribute__((external_source_symbol(language=Swift,defined_in="module")))
+  __attribute__((external_source_symbol(language="Swift",defined_in="module")))
   @protocol SwiftProtocol
   @required
   - (void) method;


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


r297025 - Add examples to clang-format configuration

2017-03-06 Thread Sylvestre Ledru via cfe-commits
Author: sylvestre
Date: Mon Mar  6 10:35:28 2017
New Revision: 297025

URL: http://llvm.org/viewvc/llvm-project?rev=297025=rev
Log:
Add examples to clang-format configuration

Reviewers: klimek, djasper

Reviewed By: djasper

Subscribers: krasimir, kimgr, cfe-commits

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

Modified:
cfe/trunk/docs/ClangFormatStyleOptions.rst
cfe/trunk/include/clang/Format/Format.h

Modified: cfe/trunk/docs/ClangFormatStyleOptions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormatStyleOptions.rst?rev=297025=297024=297025=diff
==
--- cfe/trunk/docs/ClangFormatStyleOptions.rst (original)
+++ cfe/trunk/docs/ClangFormatStyleOptions.rst Mon Mar  6 10:35:28 2017
@@ -213,6 +213,20 @@ the configuration (without a prefix: ``A
   If ``true``, aligns escaped newlines as far left as possible.
   Otherwise puts them into the right-most column.
 
+  .. code-block:: c++
+
+true:
+#define A   \
+  int ; \
+  int b;\
+  int dd;
+
+false:
+#define A  
\
+  int ;
\
+  int b;   
\
+  int dd;
+
 **AlignOperands** (``bool``)
   If ``true``, horizontally align operands of binary and ternary
   expressions.
@@ -228,6 +242,12 @@ the configuration (without a prefix: ``A
 **AlignTrailingComments** (``bool``)
   If ``true``, aligns trailing comments.
 
+  .. code-block:: c++
+
+true:   false:
+int a; // My comment a  vs. int a; // My comment a
+int b = 2; // comment  bint b = 2; // comment about b
+
 **AllowAllParametersOfDeclarationOnNextLine** (``bool``)
   Allow putting all parameters of a function declaration onto
   the next line even if ``BinPackParameters`` is ``false``.
@@ -240,6 +260,17 @@ the configuration (without a prefix: ``A
 **AllowShortCaseLabelsOnASingleLine** (``bool``)
   If ``true``, short case labels will be contracted to a single line.
 
+  .. code-block:: c++
+
+true:   false:
+switch (a) {vs. switch (a) {
+case 1: x = 1; break;   case 1:
+case 2: return;   x = 1;
+} break;
+case 2:
+  return;
+}
+
 **AllowShortFunctionsOnASingleLine** (``ShortFunctionStyle``)
   Dependent on the value, ``int f() { return 0; }`` can be put on a
   single line.
@@ -316,10 +347,23 @@ the configuration (without a prefix: ``A
   the string at that point leads to it being indented
   ``ContinuationIndentWidth`` spaces from the start of the line.
 
+  .. code-block:: c++
+
+ true:  false:
+  = vs.  = ""
+ """";
+ "";
+
 **AlwaysBreakTemplateDeclarations** (``bool``)
   If ``true``, always break after the ``template<...>`` of a template
   declaration.
 
+  .. code-block:: c++
+
+ true:  false:
+ template   vs. template  class C {};
+ class C {};
+
 **BinPackArguments** (``bool``)
   If ``false``, a function call's arguments will either be all on the
   same line or will have one line each.
@@ -411,6 +455,14 @@ the configuration (without a prefix: ``A
   Always break constructor initializers before commas and align
   the commas with the colon.
 
+  .. code-block:: c++
+
+ true:  false:
+ SomeClass::Constructor()   vs. SomeClass::Constructor() : a(a),
+ : a(a)   b(b),
+ , b(b)   c(c) {}
+ , c(c) {}
+
 **BreakStringLiterals** (``bool``)
   Allow breaking string literals when formatting.
 
@@ -475,6 +527,13 @@ the configuration (without a prefix: ``A
   If ``true``, clang-format adds missing namespace end comments and
   fixes invalid existing ones.
 
+  .. code-block:: c++
+
+ true:  false:
+ namespace a {  vs. namespace a {
+ foo(); foo();
+ } // namespace a;  }
+
 **ForEachMacros** (``std::vector``)
   A vector of macros that should be interpreted as foreach loops
   instead of as function calls.
@@ -683,9 +742,20 @@ the configuration (without a prefix: ``A
 **SpaceAfterTemplateKeyword** (``bool``)
   If ``true``, a space will be inserted after the 'template' keyword.
 
+  .. code-block:: c++
+
+   

[PATCH] D30659: [clang-format] Make NamespaceEndCommentFixer add at most one comment

2017-03-06 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.

Would probably be interesting to add these test cases:

  #if A
  namespace A {
  #else
  namespace B {
  #endif
  int i;
  int j;
  }//namespace A

and:

  namespace A {
  int i;
  int j;
  #if A
  }//namespace A
  #else
  }//namespace A
  #endif




Comment at: lib/Format/NamespaceEndCommentsFixer.cpp:139
+FormatToken *RBraceTok = EndLine->First;
+if (RBraceTok->Finalized) continue;
+RBraceTok->Finalized = true;

Use clang-format :). (there should be a linebreak before "continue".


https://reviews.llvm.org/D30659



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


[PATCH] D30659: [clang-format] Make NamespaceEndCommentFixer add at most one comment

2017-03-06 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir created this revision.
Herald added a subscriber: klimek.

Until now, NamespaceEndCommentFixer was adding missing comments for every run,
which results in multiple end comments for:

  namespace {
int i;
int j;
  }
  #if A
int a = 1;
  #else
int a = 2;
  #endif

result before:

  namespace {
int i;
int j;
  }// namespace // namespace
  #if A
int a = 1;
  #else
int a = 2;
  #endif

result after:

  namespace {
int i;
int j;
  }// namespace
  #if A
int a = 1;
  #else
int a = 2;
  #endif


https://reviews.llvm.org/D30659

Files:
  lib/Format/NamespaceEndCommentsFixer.cpp
  unittests/Format/NamespaceEndCommentsFixerTest.cpp


Index: unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -388,6 +388,24 @@
 "  int i;\n"
 "}\n"
 "}\n"));
+  EXPECT_EQ("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}// namespace\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif",
+fixNamespaceEndComments("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif"));
 }
 
 TEST_F(NamespaceEndCommentsFixerTest,
Index: lib/Format/NamespaceEndCommentsFixer.cpp
===
--- lib/Format/NamespaceEndCommentsFixer.cpp
+++ lib/Format/NamespaceEndCommentsFixer.cpp
@@ -135,7 +135,9 @@
   NamespaceTok = NamespaceTok->getNextNonComment();
 if (NamespaceTok->isNot(tok::kw_namespace))
   continue;
-const FormatToken *RBraceTok = EndLine->First;
+FormatToken *RBraceTok = EndLine->First;
+if (RBraceTok->Finalized) continue;
+RBraceTok->Finalized = true;
 const std::string NamespaceName = computeName(NamespaceTok);
 bool AddNewline = (I + 1 < E) &&
   AnnotatedLines[I + 1]->First->NewlinesBefore == 0 &&


Index: unittests/Format/NamespaceEndCommentsFixerTest.cpp
===
--- unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -388,6 +388,24 @@
 "  int i;\n"
 "}\n"
 "}\n"));
+  EXPECT_EQ("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}// namespace\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif",
+fixNamespaceEndComments("namespace {\n"
+"  int i;\n"
+"  int j;\n"
+"}\n"
+"#if A\n"
+"  int i;\n"
+"#else\n"
+"  int j;\n"
+"#endif"));
 }
 
 TEST_F(NamespaceEndCommentsFixerTest,
Index: lib/Format/NamespaceEndCommentsFixer.cpp
===
--- lib/Format/NamespaceEndCommentsFixer.cpp
+++ lib/Format/NamespaceEndCommentsFixer.cpp
@@ -135,7 +135,9 @@
   NamespaceTok = NamespaceTok->getNextNonComment();
 if (NamespaceTok->isNot(tok::kw_namespace))
   continue;
-const FormatToken *RBraceTok = EndLine->First;
+FormatToken *RBraceTok = EndLine->First;
+if (RBraceTok->Finalized) continue;
+RBraceTok->Finalized = true;
 const std::string NamespaceName = computeName(NamespaceTok);
 bool AddNewline = (I + 1 < E) &&
   AnnotatedLines[I + 1]->First->NewlinesBefore == 0 &&
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D30639: [clang-tidy] Ignore substituted template types in modernize-use-nullptr check.

2017-03-06 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments.



Comment at: 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp:254
+
+  void h(T *default_value = 0) {}
+

alexfh wrote:
> xazax.hun wrote:
> > Maybe as a separate patch, but I think it might be worth to warn here. 
> > WDYT? (Sorry for the double post, the previous one is disappeared after the 
> > commit.)
> Seems reasonable, but probably not an extremely frequent case. Deserves a 
> FIXME at least.
+1, patch are welcome.


Repository:
  rL LLVM

https://reviews.llvm.org/D30639



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


[PATCH] D30345: [CodeGen][Blocks] Refactor capture handling in code that generates block copy/destroy routines

2017-03-06 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297023: [CodeGen][Blocks] Refactor capture handling in code 
that generates (authored by arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D30345?vs=90197=90712#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30345

Files:
  cfe/trunk/lib/CodeGen/CGBlocks.cpp

Index: cfe/trunk/lib/CodeGen/CGBlocks.cpp
===
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp
@@ -1373,6 +1373,103 @@
   return fn;
 }
 
+namespace {
+
+/// Represents a type of copy/destroy operation that should be performed for an
+/// entity that's captured by a block.
+enum class BlockCaptureEntityKind {
+  CXXRecord, // Copy or destroy
+  ARCWeak,
+  ARCStrong,
+  BlockObject, // Assign or release
+  None
+};
+
+/// Represents a captured entity that requires extra operations in order for
+/// this entity to be copied or destroyed correctly.
+struct BlockCaptureManagedEntity {
+  BlockCaptureEntityKind Kind;
+  BlockFieldFlags Flags;
+  const BlockDecl::Capture 
+  const CGBlockInfo::Capture 
+
+  BlockCaptureManagedEntity(BlockCaptureEntityKind Type, BlockFieldFlags Flags,
+const BlockDecl::Capture ,
+const CGBlockInfo::Capture )
+  : Kind(Type), Flags(Flags), CI(CI), Capture(Capture) {}
+};
+
+} // end anonymous namespace
+
+static std::pair
+computeCopyInfoForBlockCapture(const BlockDecl::Capture , QualType T,
+   const LangOptions ) {
+  if (CI.getCopyExpr()) {
+assert(!CI.isByRef());
+// don't bother computing flags
+return std::make_pair(BlockCaptureEntityKind::CXXRecord, BlockFieldFlags());
+  }
+  BlockFieldFlags Flags;
+  if (CI.isByRef()) {
+Flags = BLOCK_FIELD_IS_BYREF;
+if (T.isObjCGCWeak())
+  Flags |= BLOCK_FIELD_IS_WEAK;
+return std::make_pair(BlockCaptureEntityKind::BlockObject, Flags);
+  }
+  if (!T->isObjCRetainableType())
+// For all other types, the memcpy is fine.
+return std::make_pair(BlockCaptureEntityKind::None, Flags);
+
+  Flags = BLOCK_FIELD_IS_OBJECT;
+  bool isBlockPointer = T->isBlockPointerType();
+  if (isBlockPointer)
+Flags = BLOCK_FIELD_IS_BLOCK;
+
+  // Special rules for ARC captures:
+  Qualifiers QS = T.getQualifiers();
+
+  // We need to register __weak direct captures with the runtime.
+  if (QS.getObjCLifetime() == Qualifiers::OCL_Weak)
+return std::make_pair(BlockCaptureEntityKind::ARCWeak, Flags);
+
+  // We need to retain the copied value for __strong direct captures.
+  if (QS.getObjCLifetime() == Qualifiers::OCL_Strong) {
+// If it's a block pointer, we have to copy the block and
+// assign that to the destination pointer, so we might as
+// well use _Block_object_assign.  Otherwise we can avoid that.
+return std::make_pair(!isBlockPointer ? BlockCaptureEntityKind::ARCStrong
+  : BlockCaptureEntityKind::BlockObject,
+  Flags);
+  }
+
+  // Non-ARC captures of retainable pointers are strong and
+  // therefore require a call to _Block_object_assign.
+  if (!QS.getObjCLifetime() && !LangOpts.ObjCAutoRefCount)
+return std::make_pair(BlockCaptureEntityKind::BlockObject, Flags);
+
+  // Otherwise the memcpy is fine.
+  return std::make_pair(BlockCaptureEntityKind::None, Flags);
+}
+
+/// Find the set of block captures that need to be explicitly copied or destroy.
+static void findBlockCapturedManagedEntities(
+const CGBlockInfo , const LangOptions ,
+SmallVectorImpl ,
+llvm::function_ref(
+const BlockDecl::Capture &, QualType, const LangOptions &)>
+Predicate) {
+  for (const auto  : BlockInfo.getBlockDecl()->captures()) {
+const VarDecl *Variable = CI.getVariable();
+const CGBlockInfo::Capture  = BlockInfo.getCapture(Variable);
+if (Capture.isConstant())
+  continue;
+
+auto Info = Predicate(CI, Variable->getType(), LangOpts);
+if (Info.first != BlockCaptureEntityKind::None)
+  ManagedCaptures.emplace_back(Info.first, Info.second, CI, Capture);
+  }
+}
+
 /// Generate the copy-helper function for a block closure object:
 ///   static void block_copy_helper(block_t *dst, block_t *src);
 /// The runtime will have previously initialized 'dst' by doing a
@@ -1431,78 +1528,28 @@
   dst = Address(Builder.CreateLoad(dst), blockInfo.BlockAlign);
   dst = Builder.CreateBitCast(dst, structPtrTy, "block.dest");
 
-  const BlockDecl *blockDecl = blockInfo.getBlockDecl();
-
-  for (const auto  : blockDecl->captures()) {
-const VarDecl *variable = CI.getVariable();
-QualType type = variable->getType();
-
-const CGBlockInfo::Capture  = blockInfo.getCapture(variable);
-if (capture.isConstant()) continue;
-
-const Expr *copyExpr = 

r297023 - [CodeGen][Blocks] Refactor capture handling in code that generates

2017-03-06 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Mon Mar  6 10:23:04 2017
New Revision: 297023

URL: http://llvm.org/viewvc/llvm-project?rev=297023=rev
Log:
[CodeGen][Blocks] Refactor capture handling in code that generates
block copy/destroy routines

This is a preparation commit for work on merging unique block copy/destroy
helper functions.

rdar://22950898

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

Modified:
cfe/trunk/lib/CodeGen/CGBlocks.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=297023=297022=297023=diff
==
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Mon Mar  6 10:23:04 2017
@@ -1373,6 +1373,103 @@ CodeGenFunction::GenerateBlockFunction(G
   return fn;
 }
 
+namespace {
+
+/// Represents a type of copy/destroy operation that should be performed for an
+/// entity that's captured by a block.
+enum class BlockCaptureEntityKind {
+  CXXRecord, // Copy or destroy
+  ARCWeak,
+  ARCStrong,
+  BlockObject, // Assign or release
+  None
+};
+
+/// Represents a captured entity that requires extra operations in order for
+/// this entity to be copied or destroyed correctly.
+struct BlockCaptureManagedEntity {
+  BlockCaptureEntityKind Kind;
+  BlockFieldFlags Flags;
+  const BlockDecl::Capture 
+  const CGBlockInfo::Capture 
+
+  BlockCaptureManagedEntity(BlockCaptureEntityKind Type, BlockFieldFlags Flags,
+const BlockDecl::Capture ,
+const CGBlockInfo::Capture )
+  : Kind(Type), Flags(Flags), CI(CI), Capture(Capture) {}
+};
+
+} // end anonymous namespace
+
+static std::pair
+computeCopyInfoForBlockCapture(const BlockDecl::Capture , QualType T,
+   const LangOptions ) {
+  if (CI.getCopyExpr()) {
+assert(!CI.isByRef());
+// don't bother computing flags
+return std::make_pair(BlockCaptureEntityKind::CXXRecord, 
BlockFieldFlags());
+  }
+  BlockFieldFlags Flags;
+  if (CI.isByRef()) {
+Flags = BLOCK_FIELD_IS_BYREF;
+if (T.isObjCGCWeak())
+  Flags |= BLOCK_FIELD_IS_WEAK;
+return std::make_pair(BlockCaptureEntityKind::BlockObject, Flags);
+  }
+  if (!T->isObjCRetainableType())
+// For all other types, the memcpy is fine.
+return std::make_pair(BlockCaptureEntityKind::None, Flags);
+
+  Flags = BLOCK_FIELD_IS_OBJECT;
+  bool isBlockPointer = T->isBlockPointerType();
+  if (isBlockPointer)
+Flags = BLOCK_FIELD_IS_BLOCK;
+
+  // Special rules for ARC captures:
+  Qualifiers QS = T.getQualifiers();
+
+  // We need to register __weak direct captures with the runtime.
+  if (QS.getObjCLifetime() == Qualifiers::OCL_Weak)
+return std::make_pair(BlockCaptureEntityKind::ARCWeak, Flags);
+
+  // We need to retain the copied value for __strong direct captures.
+  if (QS.getObjCLifetime() == Qualifiers::OCL_Strong) {
+// If it's a block pointer, we have to copy the block and
+// assign that to the destination pointer, so we might as
+// well use _Block_object_assign.  Otherwise we can avoid that.
+return std::make_pair(!isBlockPointer ? BlockCaptureEntityKind::ARCStrong
+  : 
BlockCaptureEntityKind::BlockObject,
+  Flags);
+  }
+
+  // Non-ARC captures of retainable pointers are strong and
+  // therefore require a call to _Block_object_assign.
+  if (!QS.getObjCLifetime() && !LangOpts.ObjCAutoRefCount)
+return std::make_pair(BlockCaptureEntityKind::BlockObject, Flags);
+
+  // Otherwise the memcpy is fine.
+  return std::make_pair(BlockCaptureEntityKind::None, Flags);
+}
+
+/// Find the set of block captures that need to be explicitly copied or 
destroy.
+static void findBlockCapturedManagedEntities(
+const CGBlockInfo , const LangOptions ,
+SmallVectorImpl ,
+llvm::function_ref(
+const BlockDecl::Capture &, QualType, const LangOptions &)>
+Predicate) {
+  for (const auto  : BlockInfo.getBlockDecl()->captures()) {
+const VarDecl *Variable = CI.getVariable();
+const CGBlockInfo::Capture  = BlockInfo.getCapture(Variable);
+if (Capture.isConstant())
+  continue;
+
+auto Info = Predicate(CI, Variable->getType(), LangOpts);
+if (Info.first != BlockCaptureEntityKind::None)
+  ManagedCaptures.emplace_back(Info.first, Info.second, CI, Capture);
+  }
+}
+
 /// Generate the copy-helper function for a block closure object:
 ///   static void block_copy_helper(block_t *dst, block_t *src);
 /// The runtime will have previously initialized 'dst' by doing a
@@ -1431,78 +1528,28 @@ CodeGenFunction::GenerateCopyHelperFunct
   dst = Address(Builder.CreateLoad(dst), blockInfo.BlockAlign);
   dst = Builder.CreateBitCast(dst, structPtrTy, "block.dest");
 
-  const BlockDecl *blockDecl = 

[PATCH] D30639: [clang-tidy] Ignore substituted template types in modernize-use-nullptr check.

2017-03-06 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added inline comments.



Comment at: 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp:254
+
+  void h(T *default_value = 0) {}
+

xazax.hun wrote:
> Maybe as a separate patch, but I think it might be worth to warn here. WDYT? 
> (Sorry for the double post, the previous one is disappeared after the commit.)
Seems reasonable, but probably not an extremely frequent case. Deserves a FIXME 
at least.


Repository:
  rL LLVM

https://reviews.llvm.org/D30639



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


[libcxx] r297022 - Header update with info about the current status of C++17

2017-03-06 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Mar  6 10:09:02 2017
New Revision: 297022

URL: http://llvm.org/viewvc/llvm-project?rev=297022=rev
Log:
Header update with info about the current status of C++17

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=297022=297021=297022=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Mar  6 10:09:02 2017
@@ -35,7 +35,8 @@
   libc++ C++1z Status
   
 
-  In November 2014, the C++ standard committee created a draft for the next 
version of the C++ standard, known here as "C++1z" (probably to be C++17)
+  In November 2014, the C++ standard committee created a draft for the next 
version of the C++ standard, known here as "C++1z" (probably to be C++17).
+  In February 2017, the C++ standard committee approved this draft, and 
sent it to ISO for approval as C++17
   This page shows the status of libc++; the status of clang's support of 
the language features is http://clang.llvm.org/cxx_status.html#cxx17;>here.
 
   The groups that have contributed papers:


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


r297019 - [Sema][ObjC] Warn about 'performSelector' calls with selectors

2017-03-06 Thread Alex Lorenz via cfe-commits
Author: arphaman
Date: Mon Mar  6 09:58:34 2017
New Revision: 297019

URL: http://llvm.org/viewvc/llvm-project?rev=297019=rev
Log:
[Sema][ObjC] Warn about 'performSelector' calls with selectors
that return record or vector types

The performSelector family of methods from Foundation use objc_msgSend to
dispatch the selector invocations to objects. However, method calls to methods
that return record types might have to use the objc_msgSend_stret as the return
value won't find into the register. This is also supported by this sentence from
performSelector documentation: "The method should not have a significant return
value and should take a single argument of type id, or no arguments". This
commit adds a new warning that warns when a selector which corresponds to a
method that returns a record type is passed into performSelector.

rdar://12056271

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

Added:
cfe/trunk/test/SemaObjC/unsafe-perform-selector.m
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/Basic/IdentifierTable.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=297019=297018=297019=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Mar  6 09:58:34 
2017
@@ -6016,6 +6016,12 @@ def warn_objc_circular_container : Warni
   "adding '%0' to '%1' might cause circular dependency in container">,
   InGroup>;
 def note_objc_circular_container_declared_here : Note<"'%0' declared here">;
+def warn_objc_unsafe_perform_selector : Warning<
+  "%0 is incompatible with selectors that return a "
+  "%select{struct|union|vector}1 type">,
+  InGroup>;
+def note_objc_unsafe_perform_selector_method_declared_here :  Note<
+  "method %0 that returns %1 declared here">;
 
 def warn_setter_getter_impl_required : Warning<
   "property %0 requires method %1 to be defined - "

Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=297019=297018=297019=diff
==
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Mon Mar  6 09:58:34 2017
@@ -979,11 +979,12 @@ ObjCMethodFamily ObjCMethodDecl::getMeth
 break;
   
   case OMF_performSelector:
-if (!isInstanceMethod() || !getReturnType()->isObjCIdType())
+if (!isInstanceMethod() ||
+!(getReturnType()->isObjCIdType() || getReturnType()->isVoidType()))
   family = OMF_None;
 else {
   unsigned noParams = param_size();
-  if (noParams < 1 || noParams > 3)
+  if (noParams < 1 || noParams > 5)
 family = OMF_None;
   else {
 ObjCMethodDecl::param_type_iterator it = param_type_begin();
@@ -992,10 +993,11 @@ ObjCMethodFamily ObjCMethodDecl::getMeth
   family = OMF_None;
   break;
 }
-while (--noParams) {
-  it++;
-  ArgT = (*it);
-  if (!ArgT->isObjCIdType()) {
+// The first type should generally always be 'id' or 'Thread *', the
+// other types can vary.
+if (noParams > 1) {
+  ArgT = *(it + 1);
+  if (!ArgT->isObjCObjectPointerType()) {
 family = OMF_None;
 break;
   }

Modified: cfe/trunk/lib/Basic/IdentifierTable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/IdentifierTable.cpp?rev=297019=297018=297019=diff
==
--- cfe/trunk/lib/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/lib/Basic/IdentifierTable.cpp Mon Mar  6 09:58:34 2017
@@ -487,8 +487,10 @@ ObjCMethodFamily Selector::getMethodFami
 if (name == "self") return OMF_self;
 if (name == "initialize") return OMF_initialize;
   }
- 
-  if (name == "performSelector") return OMF_performSelector;
+
+  if (name == "performSelector" || name == "performSelectorInBackground" ||
+  name == "performSelectorOnMainThread")
+return OMF_performSelector;
 
   // The other method families may begin with a prefix of underscores.
   while (!name.empty() && name.front() == '_')

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=297019=297018=297019=diff
==
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Mon Mar  6 09:58:34 2017
@@ -2266,6 +2266,52 @@ static void checkCocoaAPI(Sema , const
  

[libcxx] r297021 - Update list with changes from Kona meeting

2017-03-06 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Mon Mar  6 10:06:02 2017
New Revision: 297021

URL: http://llvm.org/viewvc/llvm-project?rev=297021=rev
Log:
Update list with changes from Kona meeting

Modified:
libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/www/cxx1z_status.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=297021=297020=297021=diff
==
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Mar  6 10:06:02 2017
@@ -105,7 +105,7 @@
http://wg21.link/p0174r2;>p0174r2LWGDeprecating 
Vestigial Library Parts in C++17Oulu
http://wg21.link/p0175r1;>p0175r1LWGSynopses for 
the C libraryOulu
http://wg21.link/p0180r2;>p0180r2LWGReserve a New 
Library Namespace for Future StandardizationOuluNothing to 
don/a
-   http://wg21.link/p0181r1;>p0181r1LWGOrdered by 
DefaultOulu
+   http://wg21.link/p0181r1;>p0181r1LWGOrdered by 
DefaultOuluRemoved in Konan/a
http://wg21.link/p0209r2;>p0209r2LWGmake_from_tuple:
 apply for constructionOuluComplete3.9
http://wg21.link/p0219r1;>p0219r1LWGRelative Paths 
for FilesystemOulu
http://wg21.link/p0254r2;>p0254r2LWGIntegrating 
std::string_view and 
std::stringOuluComplete4.0
@@ -140,6 +140,24 @@
http://wg21.link/P0516R0;>P0516R0LWGClarify That 
shared_future’s Copy Operations have Wide 
ContractsIssaquahComplete4.0
http://wg21.link/P0517R0;>P0517R0LWGMake 
future_error 
ConstructibleIssaquahComplete4.0
http://wg21.link/P0521R0;>P0521R0LWGProposed 
Resolution for CA 14 (shared_ptr 
use_count/unique)IssaquahNothing to 
don/a
+   
+   http://wg21.link/P0317R1;>P0317R1LWGDirectory Entry 
Caching for FilesystemKona
+   http://wg21.link/P0492R2;>P0492R2LWGProposed 
Resolution of C++17 National Body Comments for 
FilesystemsKona
+   http://wg21.link/P0430R2;>P0430R2LWGFile system 
library on non-POSIX-like operating 
systemsKona
+   http://wg21.link/P0452R1;>P0452R1LWGUnifying 
numeric Parallel AlgorithmsKona
+   http://wg21.link/P0518R1;>P0518R1LWGAllowing copies 
as arguments to function objects given to parallel algorithms in response to 
CH11Kona
+   http://wg21.link/P0523R1;>P0523R1LWGWording for CH 
10: Complexity of parallel algorithmsKona
+   http://wg21.link/P0574R1;>P0574R1LWGAlgorithm 
Complexity Constraints and Parallel 
OverloadsKona
+   http://wg21.link/P0467R2;>P0467R2LWGIterator 
Concerns for Parallel AlgorithmsKona
+   http://wg21.link/P0623R0;>P0623R0LWGFinal C++17 
Parallel Algorithms FixesKona
+   http://wg21.link/P0604R0;>P0604R0LWGResolving GB 
55, US 84, US 85, US 86Kona
+   http://wg21.link/P0607R0;>P0607R0LWGInline 
Variables for the Standard LibraryKona
+   http://wg21.link/P0618R0;>P0618R0LWGDeprecating 
codecvtKona
+   http://wg21.link/P0156R2;>P0156R2LWGVariadic Lock 
guardKona
+   http://wg21.link/P0599R1;>P0599R1LWGnoexcept for 
hash functionsKona
+   http://wg21.link/P0433R2;>P0433R2LWGToward a 
resolution of US7 and US14: Integrating template deduction for class templates 
into the standard libraryKona
+   http://wg21.link/P0558R1;>P0558R1LWGResolving 
atomicT named base class 
inconsistenciesKona
+   http://wg21.link/P0548R1;>P0548R1LWGcommon_type and 
durationKona
 
 
   
@@ -332,7 +350,7 @@
http://wg21.link/LWG2726;>2726[recursive_]directory_iterator::increment(error_code&)
 is underspecifiedOuluComplete
http://wg21.link/LWG2727;>2727Parallel 
algorithms with constexpr specifierOulu
http://wg21.link/LWG2728;>2728status(p).permissions() and 
symlink_status(p).permissions() are not 
specifiedOuluComplete
-
+   
http://wg21.link/LWG2062;>2062Effect 
contradictions w/o no-throw guarantee of std::function 
swapsIssaquahComplete
http://wg21.link/LWG2166;>2166Heap 
property underspecified?Issaquah
http://wg21.link/LWG2221;>2221No 
formatted output operator for nullptrIssaquah
@@ -410,14 +428,65 @@
http://wg21.link/LWG2773;>2773Making 
std::ignore constexprIssaquahComplete
http://wg21.link/LWG2777;>2777basic_string_view::copy should 
use char_traits::copyIssaquahComplete
http://wg21.link/LWG2778;>2778basic_string_view is missing 
constexprIssaquahComplete
-
+   
+   http://wg21.link/LWG2260;>2260Missing 
requirement for Allocator::pointerKona
+   http://wg21.link/LWG2676;>2676Provide 
filesystem::path overloads for File-based 
streamsKona
+   http://wg21.link/LWG2768;>2768any_cast 
and move semanticsKona
+   http://wg21.link/LWG2769;>2769Redundant 
const in the return type of any_cast(const 
any)Kona
+   http://wg21.link/LWG2781;>2781Contradictory requirements for 
std::function and std::reference_wrapperKona
+   http://wg21.link/LWG2782;>2782scoped_allocator_adaptor 
constructors must be constrainedKona
+   http://wg21.link/LWG2784;>2784Resolution 
to 

[PATCH] D30532: Add examples to clang-format configuration

2017-03-06 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. Thank you for doing this!


https://reviews.llvm.org/D30532



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


[PATCH] D30174: [Sema][ObjC] Warn about 'performSelector' calls with selectors that return record types

2017-03-06 Thread Alex Lorenz via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL297019: [Sema][ObjC] Warn about 'performSelector' calls with 
selectors (authored by arphaman).

Changed prior to commit:
  https://reviews.llvm.org/D30174?vs=90473=90709#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30174

Files:
  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
  cfe/trunk/lib/AST/DeclObjC.cpp
  cfe/trunk/lib/Basic/IdentifierTable.cpp
  cfe/trunk/lib/Sema/SemaExprObjC.cpp
  cfe/trunk/test/SemaObjC/unsafe-perform-selector.m

Index: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6016,6 +6016,12 @@
   "adding '%0' to '%1' might cause circular dependency in container">,
   InGroup>;
 def note_objc_circular_container_declared_here : Note<"'%0' declared here">;
+def warn_objc_unsafe_perform_selector : Warning<
+  "%0 is incompatible with selectors that return a "
+  "%select{struct|union|vector}1 type">,
+  InGroup>;
+def note_objc_unsafe_perform_selector_method_declared_here :  Note<
+  "method %0 that returns %1 declared here">;
 
 def warn_setter_getter_impl_required : Warning<
   "property %0 requires method %1 to be defined - "
Index: cfe/trunk/test/SemaObjC/unsafe-perform-selector.m
===
--- cfe/trunk/test/SemaObjC/unsafe-perform-selector.m
+++ cfe/trunk/test/SemaObjC/unsafe-perform-selector.m
@@ -0,0 +1,127 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -verify %s
+// rdar://12056271
+
+@class Thread;
+
+__attribute__((objc_root_class))
+@interface NSObject
+
+- (id)performSelector:(SEL)sel;
+- (void)performSelectorInBackground:(SEL)sel withObject:(id)arg;
+- (void)performSelectorOnMainThread:(SEL)sel;
+
+- (void)performSelectorOnMainThread:(SEL)aSelector
+   onThread:(Thread *)thread
+ withObject:(id)arg
+  waitUntilDone:(int)wait
+  modes:(id *)array;
+
+@end
+
+typedef struct { int x; int y; int width; int height; } Rectangle;
+
+struct Struct { Rectangle r; };
+
+typedef union { int x; float f; } Union;
+
+@interface Base : NSObject
+
+- (struct Struct)returnsStruct2; // expected-note {{method 'returnsStruct2' that returns 'struct Struct' declared here}}
+- (Union)returnsId;
+
+@end
+
+@protocol IP
+
+- (Union)returnsUnion; // expected-note 2 {{method 'returnsUnion' that returns 'Union' declared here}}
+
+@end
+
+typedef __attribute__((__ext_vector_type__(3))) float float3;
+typedef int int4 __attribute__ ((vector_size (16)));
+
+@interface I : Base
+
+- (Rectangle)returnsStruct; // expected-note 4 {{method 'returnsStruct' that returns 'Rectangle' declared here}}
+- (id)returnsId; // shadows base 'returnsId'
+- (int)returnsInt;
+- (I *)returnPtr;
+- (float3)returnsExtVector; // expected-note {{method 'returnsExtVector' that returns 'float3' (vector of 3 'float' values) declared here}}
+- (int4)returnsVector; // expected-note {{method 'returnsVector' that returns 'int4' (vector of 4 'int' values) declared here}}
+
++ (Rectangle)returnsStructClass; // expected-note 2 {{method 'returnsStructClass' that returns 'Rectangle' declared here}}
++ (void)returnsUnion; // Not really
+
+@end
+
+void foo(I *i) {
+  [i performSelector: @selector(returnsStruct)]; // expected-warning {{'performSelector:' is incompatible with selectors that return a struct type}}
+  [i performSelectorInBackground: @selector(returnsStruct) withObject:0]; // expected-warning {{'performSelectorInBackground:withObject:' is incompatible with selectors that return a struct type}}
+  [i performSelector: ((@selector(returnsUnion)))]; // expected-warning {{'performSelector:' is incompatible with selectors that return a union type}}
+  [i performSelectorOnMainThread: @selector(returnsStruct2)]; // expected-warning {{'performSelectorOnMainThread:' is incompatible with selectors that return a struct type}}
+  [I performSelector: (@selector(returnsStructClass))]; // expected-warning {{'performSelector:' is incompatible with selectors that return a struct type}}
+
+  [i performSelector: @selector(returnsId)];
+  [i performSelector: @selector(returnsInt)];
+  [i performSelector: @selector(returnsPtr)];
+  [I performSelector: @selector(returnsUnion)]; // No warning expected
+
+  id obj = i;
+  [obj performSelector: @selector(returnsId)];
+  [obj performSelector: @selector(returnsStruct)];
+}
+
+@interface SubClass: I
+
+@end
+
+@interface SubClass ()
+- (struct Struct)returnsSubStructExt; // expected-note {{method 'returnsSubStructExt' that returns 'struct Struct' declared here}} expected-note {{method 'returnsSubStructExt' declared here}}
+@end
+
+@implementation SubClass // 

[PATCH] D30650: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-06 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added a comment.

I think we should refactor this check as part of Static Analyzer, since it's 
path-sensitive.


https://reviews.llvm.org/D30650



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


[PATCH] D30650: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-06 Thread Martin Böhme via Phabricator via cfe-commits
mboehme added a comment.

In https://reviews.llvm.org/D30650#693136, @alexfh wrote:

> LG. So you won the flappy column game? ;)


I hope so... ;)


https://reviews.llvm.org/D30650



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


[PATCH] D30639: [clang-tidy] Ignore substituted template types in modernize-use-nullptr check.

2017-03-06 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added inline comments.



Comment at: 
clang-tools-extra/trunk/test/clang-tidy/modernize-use-nullptr.cpp:254
+
+  void h(T *default_value = 0) {}
+

Maybe as a separate patch, but I think it might be worth to warn here. WDYT? 
(Sorry for the double post, the previous one is disappeared after the commit.)


Repository:
  rL LLVM

https://reviews.llvm.org/D30639



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


[PATCH] D30650: [clang-tidy] misc-use-after-move: Fix failing assertion

2017-03-06 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. So you won the flappy column game? ;)


https://reviews.llvm.org/D30650



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


  1   2   >