[PATCH] D34607: [Bash-autocompletion] Check clang version in Bash

2017-06-25 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor accepted this revision.
teemperor added a comment.

Works as intended, good job!


https://reviews.llvm.org/D34607



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


r306270 - Testcase missed from r306075.

2017-06-25 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Sun Jun 25 21:41:22 2017
New Revision: 306270

URL: http://llvm.org/viewvc/llvm-project?rev=306270=rev
Log:
Testcase missed from r306075.

Added:
cfe/trunk/test/Modules/interface-visibility.m

Added: cfe/trunk/test/Modules/interface-visibility.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/interface-visibility.m?rev=306270=auto
==
--- cfe/trunk/test/Modules/interface-visibility.m (added)
+++ cfe/trunk/test/Modules/interface-visibility.m Sun Jun 25 21:41:22 2017
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -fmodules -fobjc-arc -x objective-c-module-map %s 
-fmodule-name=Foo -verify
+
+module Foo {}
+
+#pragma clang module contents
+#pragma clang module begin Foo
+
+// expected-no-diagnostics
+
+#pragma clang module build Foundation
+module Foundation {}
+#pragma clang module contents
+#pragma clang module begin Foundation
+@interface NSIndexSet
+@end
+#pragma clang module end
+#pragma clang module endbuild
+
+#pragma clang module import Foundation
+
+@interface NSIndexSet (Testing)
+- (int)foo;
+@end
+
+static inline int test(NSIndexSet *obj) {
+  return [obj foo];
+}
+
+#pragma clang module end


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


[PATCH] D34523: AST: mangle BlockDecls under MS ABI

2017-06-25 Thread David Majnemer via Phabricator via cfe-commits
majnemer added inline comments.



Comment at: lib/AST/MicrosoftMangle.cpp:993-994
+  Out << "YAX";
+  // struct __block_literal *
+  Out << "PA";
+  mangleArtificalTagType(TTK_Struct,

compnerd wrote:
> majnemer wrote:
> > Shouldn't we also mangle an 'E' in here on 64-bit platforms?
> I suppose that the default handling in x86_64 would give that.  I don't have 
> a strong enough opinion on that.  I can add that if you think it makes a 
> difference.
It is consistent with other pointer manglings; I think it'd be best to mangle 
pointer types as being 64-bit consistently.


Repository:
  rL LLVM

https://reviews.llvm.org/D34523



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


[libcxx] r306269 - Updated for the Toronto meeting

2017-06-25 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Sun Jun 25 21:25:15 2017
New Revision: 306269

URL: http://llvm.org/viewvc/llvm-project?rev=306269=rev
Log:
Updated for the Toronto meeting

Modified:
libcxx/trunk/www/upcoming_meeting.html

Modified: libcxx/trunk/www/upcoming_meeting.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=306269=306268=306269=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Sun Jun 25 21:25:15 2017
@@ -36,7 +36,7 @@
   
 
   This is a temporary page; please check the c++1z status http://libcxx.llvm.org/cxx1z_status.html;>here
-  This page shows the status of the papers and issues that are expected to 
be adopted in Issaquah.
+  This page shows the status of the papers and issues that are expected to 
be adopted in Toronto.
 
   The groups that have contributed papers:
   
@@ -45,7 +45,7 @@
 SG1 - Study group #1 (Concurrency working group)
   
   
-  
+
   Paper Status
   
Paper #GroupPaper 
NameMeetingStatusFirst released version
@@ -59,71 +59,41 @@
   
Issue #Issue 
NameMeetingStatus
 
-   http://wg21.link/LWG2260;>2260Missing 
requirement for Allocator::pointerKona
-   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 LWG 2484 is missing "otherwise, no effects" and is hard to 
parseKonaPatch Ready
-   http://wg21.link/LWG2785;>2785quoted 
should work with basic_string_viewKonaWe do this 
already
-   http://wg21.link/LWG2786;>2786Annex C 
should mention shared_ptr changes for array 
supportKonaNothing to do
-   http://wg21.link/LWG2787;>2787[file_status.cons] 
doesn't match class definitionKona
-   http://wg21.link/LWG2789;>2789Equivalence 
of contained objectsKona
-   http://wg21.link/LWG2794;>2794Missing 
requirements for allocator pointersKona
-   http://wg21.link/LWG2795;>2795[global.functions] 
provides incorrect example of ADL useKonaNothing to 
do
-   http://wg21.link/LWG2804;>2804Unconditional constexpr 
default constructor for istream_iteratorKonaWe do this 
already
-   http://wg21.link/LWG2812;>2812Range 
access is available with string_viewKonaWe do this 
already
-   http://wg21.link/LWG2824;>2824list::sort 
should say that the order of elements is unspecified if an exception is 
thrownKona
-   http://wg21.link/LWG2826;>2826string_view 
iterators use old wordingKonaNothing to do
-   http://wg21.link/LWG2834;>2834Resolution 
LWG 2223 is missing wording about end iteratorsKonaNothing 
to do
-   http://wg21.link/LWG2835;>2835LWG 2536 
seems to misspecify tgmath.hKona
-   http://wg21.link/LWG2837;>2837gcd and lcm 
should support a wider range of input valuesKonaWe do this 
already
-   http://wg21.link/LWG2838;>2838is_literal_type specification 
needs a little cleanupKonaNothing to do
-   http://wg21.link/LWG2842;>2842in_place_t 
check for optional::optional(U) should decay 
UKona
-   http://wg21.link/LWG2850;>2850std::function move constructor 
does unnecessary workKona
-   http://wg21.link/LWG2853;>2853Possible 
inconsistency in specification of erase in 
[vector.modifiers]Kona
-   http://wg21.link/LWG2855;>2855std::throw_with_nested("string_literal")Kona
+   http://wg21.link/LWG2444;>2444Inconsistent complexity for 
std::sort_heapToronto
+   http://wg21.link/LWG2593;>2593Moved-from 
state of AllocatorsToronto
+   http://wg21.link/LWG2597;>2597std::log 
misspecified for complex numbersToronto
+   http://wg21.link/LWG2783;>2783stack::emplace() and 
queue::emplace() should return decltype(auto)Toronto
+   http://wg21.link/LWG2932;>2932Constraints 
on parallel algorithm implementations are 
underspecifiedToronto
+   http://wg21.link/LWG2937;>2937Is 
equivalent("existing_thing", "not_existing_thing") an 
error?Toronto
+   http://wg21.link/LWG2940;>2940result_of 
specification also needs a little cleanupToronto
+   http://wg21.link/LWG2942;>2942LWG 2873's 
resolution missed weak_ptr::owner_beforeToronto
+   http://wg21.link/LWG2954;>2954Specialization of the 
convenience variable templates should be 
prohibitedToronto
+   http://wg21.link/LWG2961;>2961Bad 
postcondition for set_default_resourceToronto
+   http://wg21.link/LWG2966;>2966Incomplete 
resolution of US 74Toronto
+   http://wg21.link/LWG2974;>2974Diagnose 
out of bounds 
tuple_element/variant_alternativeToronto
 
Priority 1 
Bugs
http://wg21.link/LWG2665;>2665remove_filename() post 
condition is incorrectKonaWe do this already
-   

[PATCH] D34523: AST: mangle BlockDecls under MS ABI

2017-06-25 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd updated this revision to Diff 103887.
compnerd added a comment.

Some more comments, add test case.


Repository:
  rL LLVM

https://reviews.llvm.org/D34523

Files:
  lib/AST/MicrosoftMangle.cpp
  test/CodeGenCXX/msabi-blocks.cpp

Index: test/CodeGenCXX/msabi-blocks.cpp
===
--- /dev/null
+++ test/CodeGenCXX/msabi-blocks.cpp
@@ -0,0 +1,78 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -o - -emit-llvm %s | FileCheck %s
+
+extern int e(void);
+
+void (^b)() = ^{
+  static int i = 0;
+};
+
+// CHECK-DAG: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" ={{.*}} global i32 0
+
+void f(void) {
+  static int i = 0;
+  ^{ static int i = e(); }();
+
+// CHECK-DAG: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0
+
+  ^{ static int i = e(); }();
+
+// CHECK-DAG: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0
+
+  ^{ ^{ static int i = e(); }(); }();
+
+// CHECK-DAG: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0
+}
+
+
+template 
+void g(void) {
+  ^{ static int i = e(); }();
+}
+
+template void g(void);
+
+// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@D@@YAXXZ@4HA" ={{.*}} global i32 0
+
+template void g(void);
+
+// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@H@@YAXXZ@4HA" ={{.*}} global i32 0
+
+inline void h(void) {
+  ^{ static int i = e(); }();
+}
+
+// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2??h@@YAXXZ@4HA" ={{.*}} global i32 0
+
+struct s {
+  int i = ^{ static int i = e(); return ++i; }();
+
+// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0
+
+  int j = ^{ static int i = e(); return ++i; }();
+
+// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Zj@@4HA" ={{.*}} global i32 0
+
+  void m(int i = ^{ static int i = e(); return ++i; }(),
+ int j = ^{ static int i = e(); return ++i; }()) {}
+
+// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Zj@?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0
+// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Z0?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0
+
+};
+
+struct t {
+  struct u {
+int i = ^{ static int i = e(); return ++i; }();
+
+// CHECK-DAG: @"\01?i@?0??_block_invoke_1@u@t@@YAXPAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0
+
+  };
+};
+
+void j(void) {
+  h();
+  struct s s;
+  s.m();
+  struct t::u t;
+}
+
Index: lib/AST/MicrosoftMangle.cpp
===
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -966,16 +966,48 @@
 }
 
 if (const BlockDecl *BD = dyn_cast(DC)) {
-  DiagnosticsEngine  = Context.getDiags();
-  unsigned DiagID =
-  Diags.getCustomDiagID(DiagnosticsEngine::Error,
-"cannot mangle a local inside this block yet");
-  Diags.Report(BD->getLocation(), DiagID);
-
-  // FIXME: This is completely, utterly, wrong; see ItaniumMangle
-  // for how this should be done.
-  Out << "__block_invoke" << Context.getBlockId(BD, false);
-  Out << '@';
+  auto Discriminate = [](StringRef Name,
+ const unsigned Discriminator) -> std::string {
+std::string Buffer;
+llvm::raw_string_ostream Stream(Buffer);
+Stream << Name;
+if (Discriminator)
+  Stream << '_' << Discriminator;
+return Stream.str();
+  };
+
+  unsigned Discriminator = BD->getBlockManglingNumber();
+  if (!Discriminator)
+Discriminator = Context.getBlockId(BD, /*Local=*/false);
+
+  DC = getEffectiveDeclContext(BD);
+
+  Out << '?';
+  mangleSourceName(Discriminate("_block_invoke", Discriminator));
+  if (const auto *RD = dyn_cast(DC))
+mangleName(RD);
+  else
+Out << '@';
+  // void __cdecl
+  Out << "YAX";
+  // struct __block_literal *
+  Out << "PA";
+  mangleArtificalTagType(TTK_Struct,
+ Discriminate("__block_literal", Discriminator));
+  Out << "@Z";
+
+  // If we have a block mangling context, encode that now.  Although the
+  // mangling is not perfect, it allows us to discriminate between multiple
+  // instances in the same scope.
+  if (const auto *MC = BD->getBlockManglingContextDecl())
+if (const auto *ND = dyn_cast(MC))
+  mangleUnqualifiedName(ND);
+
+  // If the effective context was a Record, we have fully mangled the
+  // qualified name and do not need to continue.
+  if (isa(DC))
+break;
+  continue;
 } else if (const ObjCMethodDecl *Method = dyn_cast(DC)) {
   

[PATCH] D34523: AST: mangle BlockDecls under MS ABI

2017-06-25 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added a comment.

I can add the nested/nested classes.  What were other nested concepts you 
thinking of?




Comment at: lib/AST/MicrosoftMangle.cpp:980-981
+  unsigned Discriminator = BD->getBlockManglingNumber();
+  if (!Discriminator)
+Discriminator = Context.getBlockId(BD, /*Local=*/false);
+

majnemer wrote:
> Why isn't it local?
This code path is global blocks only AFAIK.



Comment at: lib/AST/MicrosoftMangle.cpp:991-992
+Out << '@';
+  // void __cdecl
+  Out << "YAX";
+  // struct __block_literal *

majnemer wrote:
> Can blocks not be given a specific calling convention?
Not AFAIK.  The synthetic function here is dispatched through the BlocksRuntime 
and is assumed to be cdecl.



Comment at: lib/AST/MicrosoftMangle.cpp:993-994
+  Out << "YAX";
+  // struct __block_literal *
+  Out << "PA";
+  mangleArtificalTagType(TTK_Struct,

majnemer wrote:
> Shouldn't we also mangle an 'E' in here on 64-bit platforms?
I suppose that the default handling in x86_64 would give that.  I don't have a 
strong enough opinion on that.  I can add that if you think it makes a 
difference.


Repository:
  rL LLVM

https://reviews.llvm.org/D34523



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


r306266 - clang-format - Also reference the list of style option of clang-format in Libformat

2017-06-25 Thread Sylvestre Ledru via cfe-commits
Author: sylvestre
Date: Sun Jun 25 20:19:05 2017
New Revision: 306266

URL: http://llvm.org/viewvc/llvm-project?rev=306266=rev
Log:
clang-format - Also reference the list of style option of clang-format in 
Libformat

Modified:
cfe/trunk/docs/LibFormat.rst

Modified: cfe/trunk/docs/LibFormat.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibFormat.rst?rev=306266=306265=306266=diff
==
--- cfe/trunk/docs/LibFormat.rst (original)
+++ cfe/trunk/docs/LibFormat.rst Sun Jun 25 20:19:05 2017
@@ -28,7 +28,9 @@ The core routine of LibFormat is ``refor
 
 This reads a token stream out of the lexer ``Lex`` and reformats all the code
 ranges in ``Ranges``. The ``FormatStyle`` controls basic decisions made during
-formatting. A list of options can be found under :ref:`style-options`. 
+formatting. A list of options can be found under :ref:`style-options`.
+
+The style options are described in :doc:`ClangFormatStyleOptions`.
 
 
 .. _style-options:


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


[clang-tools-extra] r306263 - Remove the script dump_check_docs.py. It was a one-shot migration script.

2017-06-25 Thread Sylvestre Ledru via cfe-commits
Author: sylvestre
Date: Sun Jun 25 19:56:57 2017
New Revision: 306263

URL: http://llvm.org/viewvc/llvm-project?rev=306263=rev
Log:
Remove the script dump_check_docs.py. It was a one-shot migration script.

Sign off from Alexander Kornienko by email


Removed:
clang-tools-extra/trunk/docs/clang-tidy/tools/dump_check_docs.py

Removed: clang-tools-extra/trunk/docs/clang-tidy/tools/dump_check_docs.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/tools/dump_check_docs.py?rev=306262=auto
==
--- clang-tools-extra/trunk/docs/clang-tidy/tools/dump_check_docs.py (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/tools/dump_check_docs.py (removed)
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-
-r"""
-Create stubs for check documentation files.
-"""
-
-import os
-import re
-import sys
-
-def main():
-  clang_tidy_dir = os.path.normpath(
-  os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..',
-   'clang-tidy'))
-
-  checks_doc_dir = os.path.normpath(
-  os.path.join(clang_tidy_dir, '..', 'docs', 'clang-tidy', 'checks'))
-
-  registered_checks = {}
-  defined_checks = {}
-
-  for dir_name, subdir_list, file_list in os.walk(clang_tidy_dir):
-print('Processing directory ' + dir_name + '...')
-for file_name in file_list:
-  full_name = os.path.join(dir_name, file_name)
-  if file_name.endswith('Module.cpp'):
-print('Module ' + file_name)
-with open(full_name, 'r') as f:
-  text = f.read()
-for class_name, check_name in re.findall(
-r'\.\s*registerCheck\s*<\s*([A-Za-z0-9:]+)\s*>\(\s*"([a-z0-9-]+)"',
-text):
-  registered_checks[check_name] = class_name
-  elif file_name.endswith('.h'):
-print('' + file_name + '...')
-with open(full_name, 'r') as f:
-  text = f.read()
-for comment, _, _, class_name in re.findall(
-r'((([\r\n]//)[^\r\n]*)*)\s+class (\w+)\s*:' +
-'\s*public\s+ClangTidyCheck\s*\{', text):
-  defined_checks[class_name] = comment
-
-  print('Registered checks [%s]: [%s]' %
-(len(registered_checks), registered_checks))
-  print('Check implementations: %s' % len(defined_checks))
-
-  checks = registered_checks.keys()
-  checks.sort()
-
-  for check_name in checks:
-doc_file_name = os.path.join(checks_doc_dir, check_name + '.rst')
-#if os.path.exists(doc_file_name):
-#  print('Skipping existing file %s...')
-#  continue
-print('Updating %s...' % doc_file_name)
-with open(doc_file_name, 'w') as f:
-  class_name = re.sub(r'.*:', '', registered_checks[check_name])
-  f.write(check_name + '\n' + ('=' * len(check_name)) + '\n\n')
-  if class_name in defined_checks:
-text = defined_checks[class_name]
-text = re.sub(r'\n//+ ?(\\brief )?', r'\n', text)
-text = re.sub(r'(\n *)\\code\n', r'\1.. code:: c++\n\n', text)
-text = re.sub(r'(\n *)\\endcode(\n|$)', r'\n', text)
-text = re.sub(r'`', r'``', text)
-f.write(text + '\n')
-  else:
-f.write('TODO: add docs\n')
-
-  with open(os.path.join(checks_doc_dir, 'list.rst'), 'w') as f:
-f.write(
-r"""List of clang-tidy Checks
-=
-
-.. toctree::
-   """ + '\n   '.join(checks))
-
-
-if __name__ == '__main__':
-  main()


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


r306261 - Fix a typo

2017-06-25 Thread Sylvestre Ledru via cfe-commits
Author: sylvestre
Date: Sun Jun 25 19:45:08 2017
New Revision: 306261

URL: http://llvm.org/viewvc/llvm-project?rev=306261=rev
Log:
Fix a typo

Modified:
cfe/trunk/docs/MemorySanitizer.rst

Modified: cfe/trunk/docs/MemorySanitizer.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/MemorySanitizer.rst?rev=306261=306260=306261=diff
==
--- cfe/trunk/docs/MemorySanitizer.rst (original)
+++ cfe/trunk/docs/MemorySanitizer.rst Sun Jun 25 19:45:08 2017
@@ -27,7 +27,7 @@ executable, so make sure to use ``clang`
 link step. When linking shared libraries, the MemorySanitizer run-time
 is not linked, so ``-Wl,-z,defs`` may cause link errors (don't use it
 with MemorySanitizer). To get a reasonable performance add ``-O1`` or
-higher. To get meaninful stack traces in error messages add
+higher. To get meaningful stack traces in error messages add
 ``-fno-omit-frame-pointer``. To get perfect stack traces you may need
 to disable inlining (just use ``-O1``) and tail call elimination
 (``-fno-optimize-sibling-calls``).


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


[PATCH] D33932: [clang-format] Add support for case-insensitive header matching and use it to improve support for LLVM-style include sorting.

2017-06-25 Thread Chandler Carruth via Phabricator via cfe-commits
chandlerc updated this revision to Diff 103885.
chandlerc marked an inline comment as done.
chandlerc added a comment.

Update based on review comments.


https://reviews.llvm.org/D33932

Files:
  include/clang/Format/Format.h
  lib/Format/Format.cpp
  unittests/Format/SortIncludesTest.cpp

Index: unittests/Format/SortIncludesTest.cpp
===
--- unittests/Format/SortIncludesTest.cpp
+++ unittests/Format/SortIncludesTest.cpp
@@ -266,6 +266,47 @@
  "a.cc"));
 }
 
+TEST_F(SortIncludesTest, SupportCaseInsensitiveMatching) {
+  // Setup an regex for main includes so we can cover those as well.
+  Style.IncludeIsMainRegex = "([-_](test|unittest))?$";
+
+  // First check that case sensitive matching works correctly by having both
+  // main header and grouping that depend on case.
+  Style.IncludeRegexCaseInsensitive = false;
+  EXPECT_EQ("#include \"GTest/GTest.h\"\n"
+"#include \"LLVM/z.h\"\n"
+"#include \"b.h\"\n"
+"#include \"c.h\"\n"
+"#include \"llvm/A.h\"\n"
+"#include \"gmock/gmock.h\"\n",
+sort("#include \"c.h\"\n"
+ "#include \"b.h\"\n"
+ "#include \"GTest/GTest.h\"\n"
+ "#include \"llvm/A.h\"\n"
+ "#include \"gmock/gmock.h\"\n"
+ "#include \"LLVM/z.h\"\n",
+ "a_TEST.cc"));
+
+  // Now turn insitive matching on and ensure both main header detection and
+  // grouping work in a case insensitive manner.
+  Style.IncludeRegexCaseInsensitive = true;
+  EXPECT_EQ("#include \"llvm/A.h\"\n"
+"#include \"b.h\"\n"
+"#include \"c.h\"\n"
+"#include \"LLVM/z.h\"\n"
+"#include \"llvm/X.h\"\n"
+"#include \"GTest/GTest.h\"\n"
+"#include \"gmock/gmock.h\"\n",
+sort("#include \"c.h\"\n"
+ "#include \"b.h\"\n"
+ "#include \"GTest/GTest.h\"\n"
+ "#include \"llvm/A.h\"\n"
+ "#include \"gmock/gmock.h\"\n"
+ "#include \"llvm/X.h\"\n"
+ "#include \"LLVM/z.h\"\n",
+ "a_TEST.cc"));
+}
+
 TEST_F(SortIncludesTest, NegativePriorities) {
   Style.IncludeCategories = {{".*important_os_header.*", -1}, {".*", 1}};
   EXPECT_EQ("#include \"important_os_header.h\"\n"
Index: lib/Format/Format.cpp
===
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -349,6 +349,8 @@
 IO.mapOptional("ForEachMacros", Style.ForEachMacros);
 IO.mapOptional("IncludeCategories", Style.IncludeCategories);
 IO.mapOptional("IncludeIsMainRegex", Style.IncludeIsMainRegex);
+IO.mapOptional("IncludeRegexCaseInsensitive",
+   Style.IncludeRegexCaseInsensitive);
 IO.mapOptional("IndentCaseLabels", Style.IndentCaseLabels);
 IO.mapOptional("IndentWidth", Style.IndentWidth);
 IO.mapOptional("IndentWrappedFunctionNames",
@@ -579,9 +581,10 @@
   LLVMStyle.ForEachMacros.push_back("Q_FOREACH");
   LLVMStyle.ForEachMacros.push_back("BOOST_FOREACH");
   LLVMStyle.IncludeCategories = {{"^\"(llvm|llvm-c|clang|clang-c)/", 2},
- {"^(<|\"(gtest|isl|json)/)", 3},
+ {"^(<|\"(gtest|gmock|isl|json)/)", 3},
  {".*", 1}};
-  LLVMStyle.IncludeIsMainRegex = "$";
+  LLVMStyle.IncludeIsMainRegex = "(Test)?$";
+  LLVMStyle.IncludeRegexCaseInsensitive = true;
   LLVMStyle.IndentCaseLabels = false;
   LLVMStyle.IndentWrappedFunctionNames = false;
   LLVMStyle.IndentWidth = 2;
@@ -1409,7 +1412,10 @@
   : Style(Style), FileName(FileName) {
 FileStem = llvm::sys::path::stem(FileName);
 for (const auto  : Style.IncludeCategories)
-  CategoryRegexs.emplace_back(Category.Regex);
+  CategoryRegexs.emplace_back(Category.Regex,
+  Style.IncludeRegexCaseInsensitive
+  ? llvm::Regex::IgnoreCase
+  : llvm::Regex::NoFlags);
 IsMainFile = FileName.endswith(".c") || FileName.endswith(".cc") ||
  FileName.endswith(".cpp") || FileName.endswith(".c++") ||
  FileName.endswith(".cxx") || FileName.endswith(".m") ||
@@ -1437,9 +1443,13 @@
   return false;
 StringRef HeaderStem =
 llvm::sys::path::stem(IncludeName.drop_front(1).drop_back(1));
-if (FileStem.startswith(HeaderStem)) {
+if (FileStem.startswith(HeaderStem) ||
+(Style.IncludeRegexCaseInsensitive &&
+ FileStem.startswith_lower(HeaderStem))) {
   llvm::Regex MainIncludeRegex(
-  (HeaderStem + Style.IncludeIsMainRegex).str());
+  (HeaderStem + Style.IncludeIsMainRegex).str(),
+  Style.IncludeRegexCaseInsensitive ? llvm::Regex::IgnoreCase
+: 

[PATCH] D34607: [Bash-autocompletion] Check clang version in Bash

2017-06-25 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D34607



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


[PATCH] D34556: [libcxx] Annotate c++17 aligned new/delete operators with availability attribute

2017-06-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 103883.
ahatanak added a comment.

Fix line number and remove #else.


https://reviews.llvm.org/D34556

Files:
  include/__config
  include/new
  
test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp


Index: 
test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp
===
--- /dev/null
+++ 
test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp
@@ -0,0 +1,36 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: availability=macosx10.12
+
+// test availability of new/delete operators introduced in c++17.
+
+#include 
+
+int main () {
+  int *p0 = new ((std::align_val_t)16) int(1);
+  (void)p0;
+  int *p1 = new ((std::align_val_t)16) int[1];
+  (void)p1;
+  // expected-error@-4 {{call to unavailable function 'operator new': 
introduced in macOS 10.13}}
+  // expected-note@new:* {{candidate function has been explicitly made 
unavailable}}
+  // expected-note@new:* {{candidate function not viable: no known conversion 
from 'std::align_val_t' to 'const std::nothrow_t' for 2nd argument}}
+  // expected-note@new:* {{candidate function not viable: no known conversion 
from 'std::align_val_t' to 'void *' for 2nd argument}}
+  // expected-note@new:* {{candidate function not viable: requires single 
argument '__sz', but 2 arguments were provided}}
+  // expected-note@new:* {{candidate function not viable: requires 3 
arguments, but 2 were provided}}
+
+  // expected-error@-9 {{call to unavailable function 'operator new[]': 
introduced in macOS 10.13}}
+  // expected-note@new:* {{candidate function has been explicitly made 
unavailable}}
+  // expected-note@new:* {{candidate function not viable: no known conversion 
from 'std::align_val_t' to 'const std::nothrow_t' for 2nd argument}}
+  // expected-note@new:* {{candidate function not viable: no known conversion 
from 'std::align_val_t' to 'void *' for 2nd argument}}
+  // expected-note@new:* {{candidate function not viable: requires single 
argument '__sz', but 2 arguments were provided}}
+  // expected-note@new:* {{candidate function not viable: requires 3 
arguments, but 2 were provided}}
+  return 0;
+}
Index: include/new
===
--- include/new
+++ include/new
@@ -193,20 +193,20 @@
 #endif
 
 #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
-_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, 
std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, 
std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p, 
std::align_val_t) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p, 
std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void* 
operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void* 
operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) 
_NOEXCEPT _NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void  
operator delete(void* __p, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void  
operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
 #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
-_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void  
operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void  
operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
 #endif
 
-_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, 
std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, 
std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p, 
std::align_val_t) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p, 
std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void* 
operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void* 
operator new[](std::size_t __sz, 

[PATCH] D34607: [Bash-autocompletion] Check clang version in Bash

2017-06-25 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi updated this revision to Diff 103884.
yamaguchi added a comment.

Update patch.


https://reviews.llvm.org/D34607

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,7 +1,7 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use 
this.
 _clang()
 {
-  local cur prev words cword arg
+  local cur prev words cword arg flags
   _init_completion -n : || return
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.
@@ -24,7 +24,14 @@
 arg="$w2=,$cur"
   fi
 
-  local flags=$( clang --autocomplete="$arg" )
+  flags=$( clang --autocomplete="$arg" 2>/dev/null )
+  # If clang is old that it does not support --autocomplete,
+  # fall back to the filename completion.
+  if [[ "$?" != 0 ]]; then
+_filedir
+return
+  fi
+
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,7 +1,7 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
 _clang()
 {
-  local cur prev words cword arg
+  local cur prev words cword arg flags
   _init_completion -n : || return
 
   # bash always separates '=' as a token even if there's no space before/after '='.
@@ -24,7 +24,14 @@
 arg="$w2=,$cur"
   fi
 
-  local flags=$( clang --autocomplete="$arg" )
+  flags=$( clang --autocomplete="$arg" 2>/dev/null )
+  # If clang is old that it does not support --autocomplete,
+  # fall back to the filename completion.
+  if [[ "$?" != 0 ]]; then
+_filedir
+return
+  fi
+
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34607: [Bash-autocompletion] Check clang version in Bash

2017-06-25 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added inline comments.



Comment at: clang/utils/bash-autocomplete.sh:28
+  flags=$( clang --autocomplete="$arg" 2>/dev/null )
+  # Check if --autocomplete is supported in user's clang version.
+  if [[ "$?" != 0 ]]; then

It is probably a bit better if you mention that it falls back to the default 
filename completion if --autocomplete is not available. How about this: If 
clang is old that it does not support --autocomplete, fall back to the filename 
completion.



Comment at: clang/utils/bash-autocomplete.sh:31
+_filedir
+return 0
+  fi

If it is the same as just `return`, please remove `0`.



Comment at: clang/utils/bash-autocomplete.sh:33
+  fi
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )

nit: it is a bit easier to read if you insert a newline here to separate code 
blocks.


https://reviews.llvm.org/D34607



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


[PATCH] D34607: [Bash-autocompletion] Check clang version in Bash

2017-06-25 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi created this revision.

Add check if user's clang version supports --autocomplete or not.
If not, we just autocomplete files.


https://reviews.llvm.org/D34607

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,7 +1,7 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use 
this.
 _clang()
 {
-  local cur prev words cword arg
+  local cur prev words cword arg flags
   _init_completion -n : || return
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.
@@ -24,7 +24,12 @@
 arg="$w2=,$cur"
   fi
 
-  local flags=$( clang --autocomplete="$arg" )
+  flags=$( clang --autocomplete="$arg" 2>/dev/null )
+  # Check if --autocomplete is supported in user's clang version.
+  if [[ "$?" != 0 ]]; then
+_filedir
+return 0
+  fi
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,7 +1,7 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
 _clang()
 {
-  local cur prev words cword arg
+  local cur prev words cword arg flags
   _init_completion -n : || return
 
   # bash always separates '=' as a token even if there's no space before/after '='.
@@ -24,7 +24,12 @@
 arg="$w2=,$cur"
   fi
 
-  local flags=$( clang --autocomplete="$arg" )
+  flags=$( clang --autocomplete="$arg" 2>/dev/null )
+  # Check if --autocomplete is supported in user's clang version.
+  if [[ "$?" != 0 ]]; then
+_filedir
+return 0
+  fi
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D32411: [libcxx] Provide #include_next alternative for MSVC

2017-06-25 Thread Ben Craig via Phabricator via cfe-commits
bcraig added a comment.

ping


https://reviews.llvm.org/D32411



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


[PATCH] D34574: [Sema] Disable c++17 aligned new and delete operators if not implemented in the deployment target's c++ standard library

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

I suppose it's possible to define a new driver option that can be used to tell 
clang to annotate the implicit declarations with an availability attribute, 
which will enable the link time error to be caught at compile time. 
Alternatively, it's also possible to put the availability attributes by default 
and use the driver option to remove the attributes, but this will cause clang 
to error out on a valid code when the users have provided their own 
implementations of the aligned operators.


https://reviews.llvm.org/D34574



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


r306258 - [bash-autocompletion] Delete space after flags which has '=' prefix

2017-06-25 Thread Yuka Takahashi via cfe-commits
Author: yamaguchi
Date: Sun Jun 25 17:35:36 2017
New Revision: 306258

URL: http://llvm.org/viewvc/llvm-project?rev=306258=rev
Log:
[bash-autocompletion] Delete space after flags which has '=' prefix

Summary:
This is patch for bash completion for clang project.
We don't need space when completing options like "-stdlib=".

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

Modified:
cfe/trunk/utils/bash-autocomplete.sh

Modified: cfe/trunk/utils/bash-autocomplete.sh
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/bash-autocomplete.sh?rev=306258=306257=306258=diff
==
--- cfe/trunk/utils/bash-autocomplete.sh (original)
+++ cfe/trunk/utils/bash-autocomplete.sh Sun Jun 25 17:35:36 2017
@@ -22,16 +22,17 @@ _clang()
   elif [[ "$w2" == -* && "$w1" == '=' ]]; then
 # -foo=bar
 arg="$w2=,$cur"
-  else
-_filedir
   fi
 
   local flags=$( clang --autocomplete="$arg" )
-  if [[ "$cur" == "=" ]]; then
+  if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
-  elif [[ "$flags" == "" ]]; then
+  elif [[ "$flags" == "" || "$arg" == "" ]]; then
 _filedir
   else
+# Bash automatically appends a space after '=' by default.
+# Disable it so that it works nicely for options in the form of -foo=bar.
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }


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


[PATCH] D34523: AST: mangle BlockDecls under MS ABI

2017-06-25 Thread David Majnemer via Phabricator via cfe-commits
majnemer added a comment.

We need tests that show that it does the right thing in blocks defined in 
classes in classes and other nested concepts.




Comment at: lib/AST/MicrosoftMangle.cpp:980-981
+  unsigned Discriminator = BD->getBlockManglingNumber();
+  if (!Discriminator)
+Discriminator = Context.getBlockId(BD, /*Local=*/false);
+

Why isn't it local?



Comment at: lib/AST/MicrosoftMangle.cpp:991-992
+Out << '@';
+  // void __cdecl
+  Out << "YAX";
+  // struct __block_literal *

Can blocks not be given a specific calling convention?



Comment at: lib/AST/MicrosoftMangle.cpp:993-994
+  Out << "YAX";
+  // struct __block_literal *
+  Out << "PA";
+  mangleArtificalTagType(TTK_Struct,

Shouldn't we also mangle an 'E' in here on 64-bit platforms?



Comment at: lib/AST/MicrosoftMangle.cpp:999-1001
+  if (const auto *MC = BD->getBlockManglingContextDecl())
+if (const auto *ND = dyn_cast(MC))
+  mangleUnqualifiedName(ND);

This logic should be explained.



Comment at: lib/AST/MicrosoftMangle.cpp:1003-1005
+  if (isa(DC))
+break;
+  continue;

This logic should be explained.


Repository:
  rL LLVM

https://reviews.llvm.org/D34523



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


[PATCH] D34556: [libcxx] Annotate c++17 aligned new/delete operators with availability attribute

2017-06-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added inline comments.



Comment at: 
test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp:12-16
+// test availability of new/delete operators introduced in c++17.
+
+#ifdef __APPLE__
+#undef _LIBCPP_DISABLE_AVAILABILITY
+#endif

dexonsmith wrote:
> There is a lit configuration to choose whether to run with availability or 
> not.  We should just mark the test unsupported when we don't want it to run.
> 
> It's also important to run the rest of the suite with availability turned on, 
> to see which other tests start to fail.
I added "REQUIRES: availability=macosx10.12" to avoid running this test when 
availability is turned off or we are targeting 10.13 or later.

I ran the tests with availability turned on and they all passed.


https://reviews.llvm.org/D34556



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


[PATCH] D34556: [libcxx] Annotate c++17 aligned new/delete operators with availability attribute

2017-06-25 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 103880.
ahatanak marked an inline comment as done.
ahatanak added a comment.

Address review comments.


https://reviews.llvm.org/D34556

Files:
  include/__config
  include/new
  
test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp

Index: test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp
===
--- /dev/null
+++ test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp
@@ -0,0 +1,38 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+// REQUIRES: availability=macosx10.12
+
+// test availability of new/delete operators introduced in c++17.
+
+#include 
+
+int main () {
+  int *p0 = new ((std::align_val_t)16) int(1);
+  (void)p0;
+  int *p1 = new ((std::align_val_t)16) int[1];
+  (void)p1;
+  // expected-error@-4 {{call to unavailable function 'operator new': introduced in macOS 10.13}}
+  // expected-note@new:* {{candidate function has been explicitly made unavailable}}
+  // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'const std::nothrow_t' for 2nd argument}}
+  // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'void *' for 2nd argument}}
+  // expected-note@new:* {{candidate function not viable: requires single argument '__sz', but 2 arguments were provided}}
+  // expected-note@new:* {{candidate function not viable: requires 3 arguments, but 2 were provided}}
+
+  // expected-error@-10 {{call to unavailable function 'operator new[]': introduced in macOS 10.13}}
+  // expected-note@new:* {{candidate function has been explicitly made unavailable}}
+  // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'const std::nothrow_t' for 2nd argument}}
+  // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'void *' for 2nd argument}}
+  // expected-note@new:* {{candidate function not viable: requires single argument '__sz', but 2 arguments were provided}}
+  // expected-note@new:* {{candidate function not viable: requires 3 arguments, but 2 were provided}}
+#else
+// expected-no-diagnostics
+  return 0;
+}
Index: include/new
===
--- include/new
+++ include/new
@@ -193,20 +193,20 @@
 #endif
 
 #ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
-_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p, std::align_val_t) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void* operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void  operator delete(void* __p, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void  operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
 #ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
-_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void  operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void  operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
 #endif
 
-_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
-_LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_ALIGNED_ALLOCATION void* operator 

[PATCH] D34523: AST: mangle BlockDecls under MS ABI

2017-06-25 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd updated this revision to Diff 103879.
compnerd marked 2 inline comments as done.
compnerd added a comment.

Use `mangleSourceName`


Repository:
  rL LLVM

https://reviews.llvm.org/D34523

Files:
  lib/AST/MicrosoftMangle.cpp
  test/CodeGenCXX/msabi-blocks.cpp

Index: test/CodeGenCXX/msabi-blocks.cpp
===
--- /dev/null
+++ test/CodeGenCXX/msabi-blocks.cpp
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -o - -emit-llvm %s | FileCheck %s
+
+extern int e(void);
+
+void (^b)() = ^{
+  static int i = 0;
+};
+
+// CHECK-DAG: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" ={{.*}} global i32 0
+
+void f(void) {
+  static int i = 0;
+  ^{ static int i = e(); }();
+
+// CHECK-DAG: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0
+
+  ^{ static int i = e(); }();
+
+// CHECK-DAG: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0
+
+  ^{ ^{ static int i = e(); }(); }();
+
+// CHECK-DAG: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0
+}
+
+
+template 
+void g(void) {
+  ^{ static int i = e(); }();
+}
+
+template void g(void);
+
+// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@D@@YAXXZ@4HA" ={{.*}} global i32 0
+
+template void g(void);
+
+// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@H@@YAXXZ@4HA" ={{.*}} global i32 0
+
+inline void h(void) {
+  ^{ static int i = e(); }();
+}
+
+// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2??h@@YAXXZ@4HA" ={{.*}} global i32 0
+
+struct s {
+  int i = ^{ static int i = e(); return ++i; }();
+
+// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0
+
+  int j = ^{ static int i = e(); return ++i; }();
+
+// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Zj@@4HA" ={{.*}} global i32 0
+
+  void m(int i = ^{ static int i = e(); return ++i; }(),
+ int j = ^{ static int i = e(); return ++i; }()) {}
+
+// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Zj@?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0
+// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Z0?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0
+
+};
+
+void j(void) {
+  h();
+  struct s s;
+  s.m();
+}
+
Index: lib/AST/MicrosoftMangle.cpp
===
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -966,16 +966,43 @@
 }
 
 if (const BlockDecl *BD = dyn_cast(DC)) {
-  DiagnosticsEngine  = Context.getDiags();
-  unsigned DiagID =
-  Diags.getCustomDiagID(DiagnosticsEngine::Error,
-"cannot mangle a local inside this block yet");
-  Diags.Report(BD->getLocation(), DiagID);
-
-  // FIXME: This is completely, utterly, wrong; see ItaniumMangle
-  // for how this should be done.
-  Out << "__block_invoke" << Context.getBlockId(BD, false);
-  Out << '@';
+  auto Discriminate = [](StringRef Name,
+ const unsigned Discriminator) -> std::string {
+std::string Buffer;
+llvm::raw_string_ostream Stream(Buffer);
+Stream << Name;
+if (Discriminator)
+  Stream << '_' << Discriminator;
+return Stream.str();
+  };
+
+  unsigned Discriminator = BD->getBlockManglingNumber();
+  if (!Discriminator)
+Discriminator = Context.getBlockId(BD, /*Local=*/false);
+
+  DC = getEffectiveDeclContext(BD);
+
+  Out << '?';
+  mangleSourceName(Discriminate("_block_invoke", Discriminator));
+  if (const auto *RD = dyn_cast(DC))
+mangleName(RD);
+  else
+Out << '@';
+  // void __cdecl
+  Out << "YAX";
+  // struct __block_literal *
+  Out << "PA";
+  mangleArtificalTagType(TTK_Struct,
+ Discriminate("__block_literal", Discriminator));
+  Out << "@Z";
+
+  if (const auto *MC = BD->getBlockManglingContextDecl())
+if (const auto *ND = dyn_cast(MC))
+  mangleUnqualifiedName(ND);
+
+  if (isa(DC))
+break;
+  continue;
 } else if (const ObjCMethodDecl *Method = dyn_cast(DC)) {
   mangleObjCMethodName(Method);
 } else if (isa(DC)) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r303735 - Modify test so that it looks for patterns in stderr as well

2017-06-25 Thread David Blaikie via cfe-commits
Ah, I see now then.

I have a symlink from the root of my source directory pointing to the
compile_commands.json in my build directory.

I have this so that the vim YouCompleteMe plugin (& any other clang tools)
can find it, as they usually should, for using tools with the llvm/clang
project...

Sounds like this test is incompatible with using the tooling infrastructure
in the llvm/clang project?

On Sun, Jun 25, 2017, 10:24 AM Serge Pavlov  wrote:

> 2017-06-25 0:52 GMT+07:00 David Blaikie :
>
>>
>>
>> On Sat, Jun 24, 2017 at 10:08 AM Serge Pavlov 
>> wrote:
>>
>>> With CMAKE_EXPORT_COMPILE_COMMANDS the file compile_commands.json is
>>> created in the directory
>>> /tools/clang/tools/extra/test/clang-tidy/Output,
>>>
>>
>> I'd be really surprised if this is the case - why would
>> cmake/ninja/makefiles put the compile commands for the whole LLVM
>> project/build in that somewhat random subdirectory?
>>
>
> I was wrong, these json files were not created by cmake run but appear
> during test run. The file created by cmake is in the build root.
>
>
>>
>>
>>> but the tests from
>>> /llvm/tools/clang/tools/extra/test/clang-tidy run in the
>>> directory /tools/clang/tools/extra/test/clang-tidy, which does
>>> not contain json files. So the test passes successfully. Ubuntu 16.04,
>>> cmake 3.5.1.
>>>
>>
>> Ah, perhaps you found a compile_commands for one of the test cases, not
>> the one generated by CMake. CMake 3.5.1 doesn't support
>> CMAKE_EXPORT_COMPILE_COMMANDS.
>>
>> It was added in 3.5.2, according to the documentation:
>> https://cmake.org/cmake/help/v3.5/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html
>>
>>
>
> It was added in 2.8.5 according to documentation (
> http://clang.llvm.org/docs/JSONCompilationDatabase.html#supported-systems),
> at least the version 3.5.1 creates compilation databases.
>
> clang-tidy tries to create compilation database from source path, looking
> for compile_commands.json in the directory where provided source file
> resides and in all its parent directories. If source tree is in a
> subdirectory of build tree, then compile_commands.json in the build
> directory would be found and the test would fail. Is it your case?
>
>
>>> Thanks,
>>> --Serge
>>>
>>> 2017-06-24 9:42 GMT+07:00 David Blaikie :
>>>
 Ping (+Manuel, perhaps he's got some ideas about this, given background
 in the tooling & compilation database work, or could point this to someone
 who does?)


 On Thu, Jun 15, 2017 at 10:40 AM David Blaikie 
 wrote:

> https://sarcasm.github.io/notes/dev/compilation-database.html#cmake
>
> If you enable the CMAKE_EXPORT_COMPILE_COMMANDS option in cmake (&
> have a sufficiently recent cmake), then CMake will generate a
> compile_commands.json in the root of the build tree. The test finds this &
> fails, instead of finding no compilation database & succeeding.
>
> (to use this, you can then symlink from the root of the source tree to
> point to this in your build tree - this is how I get YCM to work for my
> LLVM builds & could work for other clang tools as well)
>
> On Thu, Jun 15, 2017 at 7:51 AM Serge Pavlov 
> wrote:
>
>> 2017-06-15 2:43 GMT+07:00 David Blaikie :
>>
>>>
>>>
>>> On Wed, Jun 14, 2017, 8:17 AM Serge Pavlov 
>>> wrote:
>>>
 2017-06-14 4:24 GMT+07:00 David Blaikie :

> Ah, I find that the test passes if I remove the
> compile_commands.json file from my build directory (I have Ninja 
> configured
> to generate a compile_commands.json file).
>
> Looks like what happens is it finds the compilation database and
> fails hard when the database doesn't contain a compile command for 
> the file
> in question. If the database is not found, it falls back to some basic
> command behavior, perhaps?
>
>
 You are right, constructor of `CommonOptionsParser` calls
 `autoDetectFromSource` or `autoDetectFromDirectory` prior to final
 construction of `FixedCompilationDatabase.

 Is there some way this test could be fixed to cope with this,
> otherwise it seems to get in the way of people actually using clang 
> tools
> in their LLVM/Clang build environment?
>
>
 IIUC, presence of stale compilation database file in test directory
 could break many tests. I don't understand why only diagnostic.cpp 
 fails,
 probably there is something wrong with the clang-tidy application 
 cleanup
 in this case?

>>>
>>> Except it's neither stale nor in the test directory.
>>>
>>> It's the up to date/useful/used compile_commands.json generated by

Re: [clang-tools-extra] r303735 - Modify test so that it looks for patterns in stderr as well

2017-06-25 Thread Serge Pavlov via cfe-commits
2017-06-25 0:52 GMT+07:00 David Blaikie :

>
>
> On Sat, Jun 24, 2017 at 10:08 AM Serge Pavlov  wrote:
>
>> With CMAKE_EXPORT_COMPILE_COMMANDS the file compile_commands.json is
>> created in the directory 
>> /tools/clang/tools/extra/test/clang-tidy/Output,
>>
>>
>
> I'd be really surprised if this is the case - why would
> cmake/ninja/makefiles put the compile commands for the whole LLVM
> project/build in that somewhat random subdirectory?
>

I was wrong, these json files were not created by cmake run but appear
during test run. The file created by cmake is in the build root.


>
>
>> but the tests from /llvm/tools/clang/tools/extra/test/clang-tidy
>> run in the directory /tools/clang/tools/extra/test/clang-tidy,
>> which does not contain json files. So the test passes successfully. Ubuntu
>> 16.04, cmake 3.5.1.
>>
>
> Ah, perhaps you found a compile_commands for one of the test cases, not
> the one generated by CMake. CMake 3.5.1 doesn't support
> CMAKE_EXPORT_COMPILE_COMMANDS.
>
> It was added in 3.5.2, according to the documentation: https://cmake.
> org/cmake/help/v3.5/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html
>
>

It was added in 2.8.5 according to documentation (
http://clang.llvm.org/docs/JSONCompilationDatabase.html#supported-systems),
at least the version 3.5.1 creates compilation databases.

clang-tidy tries to create compilation database from source path, looking
for compile_commands.json in the directory where provided source file
resides and in all its parent directories. If source tree is in a
subdirectory of build tree, then compile_commands.json in the build
directory would be found and the test would fail. Is it your case?


>> Thanks,
>> --Serge
>>
>> 2017-06-24 9:42 GMT+07:00 David Blaikie :
>>
>>> Ping (+Manuel, perhaps he's got some ideas about this, given background
>>> in the tooling & compilation database work, or could point this to someone
>>> who does?)
>>>
>>>
>>> On Thu, Jun 15, 2017 at 10:40 AM David Blaikie 
>>> wrote:
>>>
 https://sarcasm.github.io/notes/dev/compilation-database.html#cmake

 If you enable the CMAKE_EXPORT_COMPILE_COMMANDS option in cmake (& have
 a sufficiently recent cmake), then CMake will generate a
 compile_commands.json in the root of the build tree. The test finds this &
 fails, instead of finding no compilation database & succeeding.

 (to use this, you can then symlink from the root of the source tree to
 point to this in your build tree - this is how I get YCM to work for my
 LLVM builds & could work for other clang tools as well)

 On Thu, Jun 15, 2017 at 7:51 AM Serge Pavlov 
 wrote:

> 2017-06-15 2:43 GMT+07:00 David Blaikie :
>
>>
>>
>> On Wed, Jun 14, 2017, 8:17 AM Serge Pavlov 
>> wrote:
>>
>>> 2017-06-14 4:24 GMT+07:00 David Blaikie :
>>>
 Ah, I find that the test passes if I remove the
 compile_commands.json file from my build directory (I have Ninja 
 configured
 to generate a compile_commands.json file).

 Looks like what happens is it finds the compilation database and
 fails hard when the database doesn't contain a compile command for the 
 file
 in question. If the database is not found, it falls back to some basic
 command behavior, perhaps?


>>> You are right, constructor of `CommonOptionsParser` calls
>>> `autoDetectFromSource` or `autoDetectFromDirectory` prior to final
>>> construction of `FixedCompilationDatabase.
>>>
>>> Is there some way this test could be fixed to cope with this,
 otherwise it seems to get in the way of people actually using clang 
 tools
 in their LLVM/Clang build environment?


>>> IIUC, presence of stale compilation database file in test directory
>>> could break many tests. I don't understand why only diagnostic.cpp 
>>> fails,
>>> probably there is something wrong with the clang-tidy application 
>>> cleanup
>>> in this case?
>>>
>>
>> Except it's neither stale nor in the test directory.
>>
>> It's the up to date/useful/used compile_commands.json generated by
>> ninja in the root of the build tree.
>>
>
> I miss something. If I could reproduce the problem, I would
> investigate it.
>
>
>>
>>
>>>
 On Tue, Jun 13, 2017 at 7:41 AM Serge Pavlov 
 wrote:

> I cannot reproduce such fail, so I can only guess how changes made
> in https://reviews.llvm.org/rL303756 and https://reviews.llvm.org/
> rL303741 could cause such problem. Behavior of
> `Driver::BuildCompilation` is changed so that it returns null pointer 
> if
> errors 

[PATCH] D34158: to support gcc 4.8 (and newer) compatibility on Linux, preinclude

2017-06-25 Thread Melanie Blower via Phabricator via cfe-commits
mibintc updated this revision to Diff 103871.
mibintc added a comment.

Here's  a modified revision which checks if stdc-predef.h exists before adding 
a -include option to that file.  this is only for Linux using gcc 4.8 and 
higher.  Several tests needed to be fixed because of this change - i fixed them 
by suppressing the preinclude using ffreestanding or nostdinc.  Also i need to 
change about 10 clang/tools/extra/test/clang-tidy tests.  Those test changes 
aren't in this patch.  Please tell me: what's the correct procedure for getting 
those tests reviewed? Thanks Fedor for your reviews!
--Melanie


Repository:
  rL LLVM

https://reviews.llvm.org/D34158

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains/Gnu.cpp
  lib/Driver/ToolChains/Gnu.h
  lib/Driver/ToolChains/Linux.cpp
  lib/Driver/ToolChains/Linux.h
  test/Driver/clang_cpp.c
  test/Driver/crash-report.c
  test/Driver/gcc-predef.c
  test/Index/IBOutletCollection.m
  test/Index/annotate-macro-args.m
  test/Index/annotate-tokens-pp.c
  test/Index/annotate-tokens.c
  test/Index/c-index-getCursor-test.m
  test/Index/get-cursor-macro-args.m
  test/Index/get-cursor.cpp
  unittests/Tooling/TestVisitor.h

Index: lib/Driver/ToolChains/Linux.h
===
--- lib/Driver/ToolChains/Linux.h
+++ lib/Driver/ToolChains/Linux.h
@@ -31,6 +31,8 @@
   void addLibStdCxxIncludePaths(
   const llvm::opt::ArgList ,
   llvm::opt::ArgStringList ) const override;
+  void AddGnuIncludeArgs(const llvm::opt::ArgList ,
+  llvm::opt::ArgStringList ) const;
   void AddCudaIncludeArgs(const llvm::opt::ArgList ,
   llvm::opt::ArgStringList ) const override;
   void AddIAMCUIncludeArgs(const llvm::opt::ArgList ,
Index: lib/Driver/ToolChains/Gnu.cpp
===
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -2329,6 +2329,24 @@
   }
 }
 
+void Generic_GCC::addGnuIncludeArgs(const ArgList , 
+ArgStringList ) const {
+  const Generic_GCC::GCCVersion  = GCCInstallation.getVersion();
+  if (!DriverArgs.hasArg(options::OPT_ffreestanding) &&
+  !DriverArgs.hasArg(clang::driver::options::OPT_nostdinc) &&
+  !Version.isOlderThan(4, 8, 0)) {
+// If stdc-predef.h exists in the sytem includes, then -include it.
+for (const auto Path : DriverArgs.getAllArgValues(options::OPT_isystem)) {
+  const auto FilePath = Path + "stdc-predef.h";
+  if (llvm::sys::fs::exists(Path)) {
+CC1Args.push_back("-include");
+CC1Args.push_back(FilePath.c_str());
+break;
+  }
+}
+  }
+}
+
 void Generic_GCC::AddClangCXXStdlibIncludeArgs(const ArgList ,
ArgStringList ) const {
   if (DriverArgs.hasArg(options::OPT_nostdlibinc) ||
Index: lib/Driver/ToolChains/Linux.cpp
===
--- lib/Driver/ToolChains/Linux.cpp
+++ lib/Driver/ToolChains/Linux.cpp
@@ -705,6 +705,8 @@
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include");
 
   addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include");
+
+  AddGnuIncludeArgs(DriverArgs, CC1Args);
 }
 
 static std::string DetectLibcxxIncludePath(StringRef base) {
@@ -743,6 +745,13 @@
   return "";
 }
 
+void Linux::AddGnuIncludeArgs(const llvm::opt::ArgList ,
+  llvm::opt::ArgStringList ) const {
+  if (GCCInstallation.isValid())
+addGnuIncludeArgs(DriverArgs, CC1Args);
+}
+
+
 void Linux::addLibStdCxxIncludePaths(const llvm::opt::ArgList ,
  llvm::opt::ArgStringList ) const {
   // We need a detected GCC installation on Linux to provide libstdc++'s
Index: lib/Driver/ToolChains/Gnu.h
===
--- lib/Driver/ToolChains/Gnu.h
+++ lib/Driver/ToolChains/Gnu.h
@@ -325,6 +325,9 @@
 const llvm::opt::ArgList ,
 llvm::opt::ArgStringList ) const;
 
+  void addGnuIncludeArgs(const llvm::opt::ArgList ,
+ llvm::opt::ArgStringList ) const;
+
   /// @}
 
 private:
Index: lib/Driver/ToolChain.cpp
===
--- lib/Driver/ToolChain.cpp
+++ lib/Driver/ToolChain.cpp
@@ -716,6 +716,9 @@
   return Res;
 }
 
+void ToolChain::AddGnuIncludeArgs(const ArgList ,
+   ArgStringList ) const {}
+
 void ToolChain::AddCudaIncludeArgs(const ArgList ,
ArgStringList ) const {}
 
Index: unittests/Tooling/TestVisitor.h
===
--- unittests/Tooling/TestVisitor.h
+++ unittests/Tooling/TestVisitor.h
@@ -52,6 +52,7 @@
   /// \brief Runs the current AST visitor over the given 

[PATCH] D34158: to support gcc 4.8 (and newer) compatibility on Linux, preinclude

2017-06-25 Thread Melanie Blower via Phabricator via cfe-commits
mibintc abandoned this revision.
mibintc added a comment.

I want to submit a modified patch


Repository:
  rL LLVM

https://reviews.llvm.org/D34158



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


[PATCH] D34158: to support gcc 4.8 (and newer) compatibility on Linux, preinclude

2017-06-25 Thread Melanie Blower via Phabricator via cfe-commits
mibintc planned changes to this revision.
mibintc added a comment.

I'm submitting another revision which checks for the existence of stdc-predef.h 
before inserting the -include option.


Repository:
  rL LLVM

https://reviews.llvm.org/D34158



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


[PATCH] D34606: [libcxx] Link MinGW libs for shared build

2017-06-25 Thread Mateusz MikuĊ‚a via Phabricator via cfe-commits
mati865 created this revision.
Herald added a subscriber: mgorny.

Another small step for libc++ with MinGW-w64.


Repository:
  rL LLVM

https://reviews.llvm.org/D34606

Files:
  lib/CMakeLists.txt


Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -126,6 +126,26 @@
   # Required for standards-complaint wide character formatting functions
   # (e.g. `printfw`/`scanfw`)
   add_library_flags(iso_stdio_wide_specifiers)
+elseif(MINGW)
+  if (LIBCXX_USE_COMPILER_RT)
+set(MINGW_RUNTIME ${LIBCXX_BUILTINS_LIBRARY})
+  else ()
+set(MINGW_RUNTIME gcc_s gcc)
+  endif()
+  add_library_flags(mingw32)
+  add_library_flags(${MINGW_RUNTIME})
+  add_library_flags(moldname)
+  add_library_flags(mingwex)
+  add_library_flags(msvcrt)
+  add_library_flags(advapi32)
+  add_library_flags(shell32)
+  add_library_flags(user32)
+  add_library_flags(kernel32)
+  add_library_flags(mingw32)
+  add_library_flags(${MINGW_RUNTIME})
+  add_library_flags(moldname)
+  add_library_flags(mingwex)
+  add_library_flags(msvcrt)
 endif()
 
 if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY)


Index: lib/CMakeLists.txt
===
--- lib/CMakeLists.txt
+++ lib/CMakeLists.txt
@@ -126,6 +126,26 @@
   # Required for standards-complaint wide character formatting functions
   # (e.g. `printfw`/`scanfw`)
   add_library_flags(iso_stdio_wide_specifiers)
+elseif(MINGW)
+  if (LIBCXX_USE_COMPILER_RT)
+set(MINGW_RUNTIME ${LIBCXX_BUILTINS_LIBRARY})
+  else ()
+set(MINGW_RUNTIME gcc_s gcc)
+  endif()
+  add_library_flags(mingw32)
+  add_library_flags(${MINGW_RUNTIME})
+  add_library_flags(moldname)
+  add_library_flags(mingwex)
+  add_library_flags(msvcrt)
+  add_library_flags(advapi32)
+  add_library_flags(shell32)
+  add_library_flags(user32)
+  add_library_flags(kernel32)
+  add_library_flags(mingw32)
+  add_library_flags(${MINGW_RUNTIME})
+  add_library_flags(moldname)
+  add_library_flags(mingwex)
+  add_library_flags(msvcrt)
 endif()
 
 if (LIBCXX_OSX_REEXPORT_SYSTEM_ABI_LIBRARY)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r306239 - Add support for Ananas platform

2017-06-25 Thread Ed Schouten via cfe-commits
Author: ed
Date: Sun Jun 25 01:29:09 2017
New Revision: 306239

URL: http://llvm.org/viewvc/llvm-project?rev=306239=rev
Log:
Add support for Ananas platform

Ananas is a home-brew operating system, mainly for amd64 machines. After
using GCC for quite some time, it has switched to clang and never looked
back - yet, having to manually patch things is annoying, so it'd be much
nicer if this was in the official tree.

More information:

https://github.com/zhmu/ananas/
https://rink.nu/projects/ananas.html

Submitted by:   Rink Springer
Differential Revision:  https://reviews.llvm.org/D32936

Added:
cfe/trunk/lib/Driver/ToolChains/Ananas.cpp
cfe/trunk/lib/Driver/ToolChains/Ananas.h
cfe/trunk/test/Driver/ananas.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/CMakeLists.txt
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=306239=306238=306239=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sun Jun 25 01:29:09 2017
@@ -111,6 +111,21 @@ public:
   : OSTargetInfo(Triple, Opts) {}
 };
 
+// Ananas target
+template
+class AnanasTargetInfo : public OSTargetInfo {
+protected:
+  void getOSDefines(const LangOptions , const llvm::Triple ,
+MacroBuilder ) const override {
+// Ananas defines
+Builder.defineMacro("__Ananas__");
+Builder.defineMacro("__ELF__");
+  }
+public:
+  AnanasTargetInfo(const llvm::Triple , const TargetOptions )
+  : OSTargetInfo(Triple, Opts) {}
+};
+
 static void getDarwinDefines(MacroBuilder , const LangOptions ,
  const llvm::Triple ,
  StringRef ,
@@ -9530,6 +9545,8 @@ static TargetInfo *AllocateTarget(const
   return new DarwinI386TargetInfo(Triple, Opts);
 
 switch (os) {
+case llvm::Triple::Ananas:
+  return new AnanasTargetInfo(Triple, Opts);
 case llvm::Triple::CloudABI:
   return new CloudABITargetInfo(Triple, Opts);
 case llvm::Triple::Linux: {
@@ -9585,6 +9602,8 @@ static TargetInfo *AllocateTarget(const
   return new DarwinX86_64TargetInfo(Triple, Opts);
 
 switch (os) {
+case llvm::Triple::Ananas:
+  return new AnanasTargetInfo(Triple, Opts);
 case llvm::Triple::CloudABI:
   return new CloudABITargetInfo(Triple, Opts);
 case llvm::Triple::Linux: {

Modified: cfe/trunk/lib/Driver/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=306239=306238=306239=diff
==
--- cfe/trunk/lib/Driver/CMakeLists.txt (original)
+++ cfe/trunk/lib/Driver/CMakeLists.txt Sun Jun 25 01:29:09 2017
@@ -28,6 +28,7 @@ add_clang_library(clangDriver
   ToolChains/Arch/Sparc.cpp
   ToolChains/Arch/SystemZ.cpp
   ToolChains/Arch/X86.cpp
+  ToolChains/Ananas.cpp
   ToolChains/AMDGPU.cpp
   ToolChains/AVR.cpp
   ToolChains/Bitrig.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=306239=306238=306239=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Sun Jun 25 01:29:09 2017
@@ -11,6 +11,7 @@
 #include "InputInfo.h"
 #include "ToolChains/AMDGPU.h"
 #include "ToolChains/AVR.h"
+#include "ToolChains/Ananas.h"
 #include "ToolChains/Bitrig.h"
 #include "ToolChains/Clang.h"
 #include "ToolChains/CloudABI.h"
@@ -3749,6 +3750,9 @@ const ToolChain ::getToolChain(co
 case llvm::Triple::Haiku:
   TC = llvm::make_unique(*this, Target, Args);
   break;
+case llvm::Triple::Ananas:
+  TC = llvm::make_unique(*this, Target, Args);
+  break;
 case llvm::Triple::CloudABI:
   TC = llvm::make_unique(*this, Target, Args);
   break;

Added: cfe/trunk/lib/Driver/ToolChains/Ananas.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Ananas.cpp?rev=306239=auto
==
--- cfe/trunk/lib/Driver/ToolChains/Ananas.cpp (added)
+++ cfe/trunk/lib/Driver/ToolChains/Ananas.cpp Sun Jun 25 01:29:09 2017
@@ -0,0 +1,120 @@
+//===--- Ananas.cpp - Ananas ToolChain Implementations --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "Ananas.h"
+#include "InputInfo.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/Options.h"
+#include "llvm/ADT/SmallString.h"
+#include 

[PATCH] D32642: [Analyzer] Iterator Checker - Part 2: Increment, decrement operators and ahead-of-begin checks

2017-06-25 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

In https://reviews.llvm.org/D32642#789004, @baloghadamsoftware wrote:

> Now I can improve `SValBuilder` to compare `{conj_X}+n` to `conj_X}+m`, but I 
> am not sure if it helps to simplify `compare()` much. How to handle cases 
> where I have to compare `{conj_X}+n` to `{conj_Y}+m`, an we have a range 
> `[k..k]` for `{conj_X}-{conj_Y}` in the constraint manager. I still need to 
> decompose the two expressions, retrieve the single length range and adjust 
> one of the sides of the comparison. I think I should not add such complicated 
> code (i.e. retrieving single length range from the constrain manager) to 
> `SValBuilder`.


`SValBuilder` simplifies the symbolic expressions to a certain "canonical" form 
- collapses `($x op N) op M` to single-op expressions, reorders `N op $x` to 
`$x op N`, unpacks `!$x` into `$x == 0`, etc.), and `ConstraintManager` makes 
assumptions over such "canonical" symbolic expressions (but unable to handle 
non-canonical symbolic expressions).

I propose to canonicalize `($x + N) == ($y + M)` to `($x - $y) == (M - N)` in 
`SValBuilder`, and then `ConstraintManager` should be able to assume over it, 
as long as it has a range for `($x - $y)`. `ConstraintManager` would also need 
an update to support reversing the range when he only has a range for `($y - 
$x)` but not for `($x - $y)`.


https://reviews.llvm.org/D32642



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


[PATCH] D16403: Add scope information to CFG

2017-06-25 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment.

Maxim, totally thanks for picking this up!

Could you explain the idea behind `shouldDeferScopeEnd`, maybe in a code 
comment before the function?

In https://reviews.llvm.org/D16403#788926, @m.ostapenko wrote:

> Current patch should support basic {If, While, For, Compound, Switch}Stmts as 
> well as their interactions with {Break, Continue, Return}Stmts.
>  GotoStmt and CXXForRangeStmt are not supported at this moment.


`SwitchStmt` isn't much easier than `GotoStmt`; it doesn't jump backwards, but 
it can still jump into multiple different scopes. Does your code handle Duff's 
device (1)  (2) 
 correctly? We should probably add 
it as a test, or split out switch support into a separate patch together with 
goto, if such test isn't yet supported.


Repository:
  rL LLVM

https://reviews.llvm.org/D16403



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