[PATCH] D21058: [Clang][AVX512][BUILTIN]Adding missing intrinsics srl and sll

2016-06-07 Thread michael zuckerman via cfe-commits
m_zuckerman created this revision.
m_zuckerman added reviewers: AsafBadouh, igorb, delena.
m_zuckerman added a subscriber: cfe-commits.

http://reviews.llvm.org/D21058

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/Headers/avx512bwintrin.h
  test/CodeGen/avx512bw-builtins.c

Index: test/CodeGen/avx512bw-builtins.c
===
--- test/CodeGen/avx512bw-builtins.c
+++ test/CodeGen/avx512bw-builtins.c
@@ -1505,8 +1505,6 @@
return _mm512_maskz_alignr_epi8(__U, __A, __B, 2); 
 }
 
-
-
 __m512i test_mm512_mm_dbsad_epu8(__m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_mm_dbsad_epu8
   // CHECK: @llvm.x86.avx512.mask.dbpsadbw.512
@@ -1537,3 +1535,15 @@
   return _mm512_movepi16_mask(__A); 
 }
 
+__m512i test_mm512_bslli_epi128 (__m512i __A){
+  // CHECK-LABEL: @test_mm512_bslli_epi128
+  // CHECK: @lvm.x86.avx512.psll.dq.512(
+  return (__m512i) __builtin_ia32_pslldq512 (__A, 4);
+}
+
+__m512i test_mm512_bsrli_epi128 (__m512i __A){
+  // CHECK-LABEL: @test_mm512_bsrli_epi128
+  // CHECK: @lvm.x86.avx512.psrl.dq.512(
+  return (__m512i) __builtin_ia32_psrldq512 (__A, 4);
+}
+
Index: lib/Headers/avx512bwintrin.h
===
--- lib/Headers/avx512bwintrin.h
+++ lib/Headers/avx512bwintrin.h
@@ -2186,6 +2186,14 @@
(__v64qi) __B);
 }
 
+#define _mm512_bslli_epi128 (__A,__N)({\
+  return (__m512i) __builtin_ia32_pslldq512 ((__m512i)__A,(int) __N);\
+})
+
+#define _mm512_bsrli_epi128 ( __A, __N)({\
+  return (__m512i) __builtin_ia32_psrldq512 ((__m512i)__A, (int)__N);\
+})
+
 
 
 #undef __DEFAULT_FN_ATTRS
Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -2255,6 +2255,8 @@
 TARGET_BUILTIN(__builtin_ia32_vpmultishiftqb512_mask, 
"V64cV64cV64cV64cULLi","","avx512vbmi")
 TARGET_BUILTIN(__builtin_ia32_vpmultishiftqb128_mask, 
"V16cV16cV16cV16cUs","","avx512vbmi,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_vpmultishiftqb256_mask, 
"V32cV32cV32cV32cUi","","avx512vbmi,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pslldq512, "V8dV8dIi","","avx512bw")
+TARGET_BUILTIN(__builtin_ia32_psrldq512, "V8dV8dIi","","avx512bw")
 
 // MONITORX/MWAITX
 TARGET_BUILTIN(__builtin_ia32_monitorx, "vv*UiUi", "", "mwaitx")


Index: test/CodeGen/avx512bw-builtins.c
===
--- test/CodeGen/avx512bw-builtins.c
+++ test/CodeGen/avx512bw-builtins.c
@@ -1505,8 +1505,6 @@
return _mm512_maskz_alignr_epi8(__U, __A, __B, 2); 
 }
 
-
-
 __m512i test_mm512_mm_dbsad_epu8(__m512i __A, __m512i __B) {
   // CHECK-LABEL: @test_mm512_mm_dbsad_epu8
   // CHECK: @llvm.x86.avx512.mask.dbpsadbw.512
@@ -1537,3 +1535,15 @@
   return _mm512_movepi16_mask(__A); 
 }
 
+__m512i test_mm512_bslli_epi128 (__m512i __A){
+  // CHECK-LABEL: @test_mm512_bslli_epi128
+  // CHECK: @lvm.x86.avx512.psll.dq.512(
+  return (__m512i) __builtin_ia32_pslldq512 (__A, 4);
+}
+
+__m512i test_mm512_bsrli_epi128 (__m512i __A){
+  // CHECK-LABEL: @test_mm512_bsrli_epi128
+  // CHECK: @lvm.x86.avx512.psrl.dq.512(
+  return (__m512i) __builtin_ia32_psrldq512 (__A, 4);
+}
+
Index: lib/Headers/avx512bwintrin.h
===
--- lib/Headers/avx512bwintrin.h
+++ lib/Headers/avx512bwintrin.h
@@ -2186,6 +2186,14 @@
(__v64qi) __B);
 }
 
+#define _mm512_bslli_epi128 (__A,__N)({\
+  return (__m512i) __builtin_ia32_pslldq512 ((__m512i)__A,(int) __N);\
+})
+
+#define _mm512_bsrli_epi128 ( __A, __N)({\
+  return (__m512i) __builtin_ia32_psrldq512 ((__m512i)__A, (int)__N);\
+})
+
 
 
 #undef __DEFAULT_FN_ATTRS
Index: include/clang/Basic/BuiltinsX86.def
===
--- include/clang/Basic/BuiltinsX86.def
+++ include/clang/Basic/BuiltinsX86.def
@@ -2255,6 +2255,8 @@
 TARGET_BUILTIN(__builtin_ia32_vpmultishiftqb512_mask, "V64cV64cV64cV64cULLi","","avx512vbmi")
 TARGET_BUILTIN(__builtin_ia32_vpmultishiftqb128_mask, "V16cV16cV16cV16cUs","","avx512vbmi,avx512vl")
 TARGET_BUILTIN(__builtin_ia32_vpmultishiftqb256_mask, "V32cV32cV32cV32cUi","","avx512vbmi,avx512vl")
+TARGET_BUILTIN(__builtin_ia32_pslldq512, "V8dV8dIi","","avx512bw")
+TARGET_BUILTIN(__builtin_ia32_psrldq512, "V8dV8dIi","","avx512bw")
 
 // MONITORX/MWAITX
 TARGET_BUILTIN(__builtin_ia32_monitorx, "vv*UiUi", "", "mwaitx")
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20467: [include-fixer] Mention more details in the document.

2016-06-07 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 59838.
hokein added a comment.

Fix typo.


http://reviews.llvm.org/D20467

Files:
  docs/ReleaseNotes.rst
  docs/include-fixer.rst

Index: docs/include-fixer.rst
===
--- docs/include-fixer.rst
+++ docs/include-fixer.rst
@@ -41,14 +41,16 @@
 .. code-block:: console
 
   $ cd path/to/llvm-build
+  $ ninja find-all-symbols // build find-all-symbols tool.
+  $ ninja clang-include-fixer // build clang-include-fixer tool.
   $ ls compile_commands.json # Make sure compile_commands.json exists.
 compile_commands.json
   $ 
path/to/llvm/source/tools/clang/tools/extra/include-fixer/find-all-symbols/tool/run-find-all-symbols.py
 ... wait as clang indexes the code base ...
   $ ln -s $PWD/find_all_symbols_db.yaml path/to/llvm/source/ # Link database 
into the source tree.
   $ ln -s $PWD/compile_commands.json path/to/llvm/source/ # Also link 
compilation database if it's not there already.
   $ cd path/to/llvm/source
-  $ clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
+  $ /path/to/clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
 Added #include "foo.h"
 
 Integrate with Vim
@@ -63,6 +65,14 @@
 This enables `clang-include-fixer` for NORMAL and VISUAL mode. Change ``,cf`` 
to
 another binding if you need clang-include-fixer on a different key.
 
+Make sure vim can find :program:`clang-include-fixer`:
+
+- Add the path to :program:`clang-include-fixer` to the PATH environment 
variable.
+- Or set ``g:clang_include_fixer_path`` in vimrc: ``let 
g:clang_include_fixer_path=path/to/clang-include-fixer``
+
+You can customize the number of headers being shown by setting
+``let g:clang_include_fixer_maximum_suggested_headers=5``
+
 See ``clang-include-fixer.py`` for more details.
 
 How it Works
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -44,7 +44,8 @@
 Major New Features
 --
 
-- Feature1...
+- :program:`clang-include-fixer`, a tool that provides an automated way of
+  adding ``#include`` directives for missing symbols in one translation unit.
 
 Improvements to clang-query
 ---


Index: docs/include-fixer.rst
===
--- docs/include-fixer.rst
+++ docs/include-fixer.rst
@@ -41,14 +41,16 @@
 .. code-block:: console
 
   $ cd path/to/llvm-build
+  $ ninja find-all-symbols // build find-all-symbols tool.
+  $ ninja clang-include-fixer // build clang-include-fixer tool.
   $ ls compile_commands.json # Make sure compile_commands.json exists.
 compile_commands.json
   $ path/to/llvm/source/tools/clang/tools/extra/include-fixer/find-all-symbols/tool/run-find-all-symbols.py
 ... wait as clang indexes the code base ...
   $ ln -s $PWD/find_all_symbols_db.yaml path/to/llvm/source/ # Link database into the source tree.
   $ ln -s $PWD/compile_commands.json path/to/llvm/source/ # Also link compilation database if it's not there already.
   $ cd path/to/llvm/source
-  $ clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
+  $ /path/to/clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
 Added #include "foo.h"
 
 Integrate with Vim
@@ -63,6 +65,14 @@
 This enables `clang-include-fixer` for NORMAL and VISUAL mode. Change ``,cf`` to
 another binding if you need clang-include-fixer on a different key.
 
+Make sure vim can find :program:`clang-include-fixer`:
+
+- Add the path to :program:`clang-include-fixer` to the PATH environment variable.
+- Or set ``g:clang_include_fixer_path`` in vimrc: ``let g:clang_include_fixer_path=path/to/clang-include-fixer``
+
+You can customize the number of headers being shown by setting
+``let g:clang_include_fixer_maximum_suggested_headers=5``
+
 See ``clang-include-fixer.py`` for more details.
 
 How it Works
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -44,7 +44,8 @@
 Major New Features
 --
 
-- Feature1...
+- :program:`clang-include-fixer`, a tool that provides an automated way of
+  adding ``#include`` directives for missing symbols in one translation unit.
 
 Improvements to clang-query
 ---
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r271989 - [include-fixer] Mention more details in the document.

2016-06-07 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Tue Jun  7 02:50:48 2016
New Revision: 271989

URL: http://llvm.org/viewvc/llvm-project?rev=271989&view=rev
Log:
[include-fixer] Mention more details in the document.

Reviewers: bkramer

Subscribers: Eugene.Zelenko, cfe-commits, ioeric

Differential Revision: http://reviews.llvm.org/D20467

Modified:
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/include-fixer.rst

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=271989&r1=271988&r2=271989&view=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Tue Jun  7 02:50:48 2016
@@ -44,7 +44,8 @@ infrastructure are described first, foll
 Major New Features
 --
 
-- Feature1...
+- :program:`clang-include-fixer`, a tool that provides an automated way of
+  adding ``#include`` directives for missing symbols in one translation unit.
 
 Improvements to clang-query
 ---

Modified: clang-tools-extra/trunk/docs/include-fixer.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/include-fixer.rst?rev=271989&r1=271988&r2=271989&view=diff
==
--- clang-tools-extra/trunk/docs/include-fixer.rst (original)
+++ clang-tools-extra/trunk/docs/include-fixer.rst Tue Jun  7 02:50:48 2016
@@ -41,6 +41,8 @@ database for LLVM, any project built by
 .. code-block:: console
 
   $ cd path/to/llvm-build
+  $ ninja find-all-symbols // build find-all-symbols tool.
+  $ ninja clang-include-fixer // build clang-include-fixer tool.
   $ ls compile_commands.json # Make sure compile_commands.json exists.
 compile_commands.json
   $ 
path/to/llvm/source/tools/clang/tools/extra/include-fixer/find-all-symbols/tool/run-find-all-symbols.py
@@ -48,7 +50,7 @@ database for LLVM, any project built by
   $ ln -s $PWD/find_all_symbols_db.yaml path/to/llvm/source/ # Link database 
into the source tree.
   $ ln -s $PWD/compile_commands.json path/to/llvm/source/ # Also link 
compilation database if it's not there already.
   $ cd path/to/llvm/source
-  $ clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
+  $ /path/to/clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
 Added #include "foo.h"
 
 Integrate with Vim
@@ -63,6 +65,14 @@ following key binding to your ``.vimrc``
 This enables `clang-include-fixer` for NORMAL and VISUAL mode. Change ``,cf`` 
to
 another binding if you need clang-include-fixer on a different key.
 
+Make sure vim can find :program:`clang-include-fixer`:
+
+- Add the path to :program:`clang-include-fixer` to the PATH environment 
variable.
+- Or set ``g:clang_include_fixer_path`` in vimrc: ``let 
g:clang_include_fixer_path=path/to/clang-include-fixer``
+
+You can customize the number of headers being shown by setting
+``let g:clang_include_fixer_maximum_suggested_headers=5``
+
 See ``clang-include-fixer.py`` for more details.
 
 How it Works


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


Re: [PATCH] D20467: [include-fixer] Mention more details in the document.

2016-06-07 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271989: [include-fixer] Mention more details in the 
document. (authored by hokein).

Changed prior to commit:
  http://reviews.llvm.org/D20467?vs=59838&id=59839#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20467

Files:
  clang-tools-extra/trunk/docs/ReleaseNotes.rst
  clang-tools-extra/trunk/docs/include-fixer.rst

Index: clang-tools-extra/trunk/docs/include-fixer.rst
===
--- clang-tools-extra/trunk/docs/include-fixer.rst
+++ clang-tools-extra/trunk/docs/include-fixer.rst
@@ -41,14 +41,16 @@
 .. code-block:: console
 
   $ cd path/to/llvm-build
+  $ ninja find-all-symbols // build find-all-symbols tool.
+  $ ninja clang-include-fixer // build clang-include-fixer tool.
   $ ls compile_commands.json # Make sure compile_commands.json exists.
 compile_commands.json
   $ 
path/to/llvm/source/tools/clang/tools/extra/include-fixer/find-all-symbols/tool/run-find-all-symbols.py
 ... wait as clang indexes the code base ...
   $ ln -s $PWD/find_all_symbols_db.yaml path/to/llvm/source/ # Link database 
into the source tree.
   $ ln -s $PWD/compile_commands.json path/to/llvm/source/ # Also link 
compilation database if it's not there already.
   $ cd path/to/llvm/source
-  $ clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
+  $ /path/to/clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
 Added #include "foo.h"
 
 Integrate with Vim
@@ -63,6 +65,14 @@
 This enables `clang-include-fixer` for NORMAL and VISUAL mode. Change ``,cf`` 
to
 another binding if you need clang-include-fixer on a different key.
 
+Make sure vim can find :program:`clang-include-fixer`:
+
+- Add the path to :program:`clang-include-fixer` to the PATH environment 
variable.
+- Or set ``g:clang_include_fixer_path`` in vimrc: ``let 
g:clang_include_fixer_path=path/to/clang-include-fixer``
+
+You can customize the number of headers being shown by setting
+``let g:clang_include_fixer_maximum_suggested_headers=5``
+
 See ``clang-include-fixer.py`` for more details.
 
 How it Works
Index: clang-tools-extra/trunk/docs/ReleaseNotes.rst
===
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst
@@ -44,7 +44,8 @@
 Major New Features
 --
 
-- Feature1...
+- :program:`clang-include-fixer`, a tool that provides an automated way of
+  adding ``#include`` directives for missing symbols in one translation unit.
 
 Improvements to clang-query
 ---


Index: clang-tools-extra/trunk/docs/include-fixer.rst
===
--- clang-tools-extra/trunk/docs/include-fixer.rst
+++ clang-tools-extra/trunk/docs/include-fixer.rst
@@ -41,14 +41,16 @@
 .. code-block:: console
 
   $ cd path/to/llvm-build
+  $ ninja find-all-symbols // build find-all-symbols tool.
+  $ ninja clang-include-fixer // build clang-include-fixer tool.
   $ ls compile_commands.json # Make sure compile_commands.json exists.
 compile_commands.json
   $ path/to/llvm/source/tools/clang/tools/extra/include-fixer/find-all-symbols/tool/run-find-all-symbols.py
 ... wait as clang indexes the code base ...
   $ ln -s $PWD/find_all_symbols_db.yaml path/to/llvm/source/ # Link database into the source tree.
   $ ln -s $PWD/compile_commands.json path/to/llvm/source/ # Also link compilation database if it's not there already.
   $ cd path/to/llvm/source
-  $ clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
+  $ /path/to/clang-include-fixer -db=yaml path/to/file/with/missing/include.cpp
 Added #include "foo.h"
 
 Integrate with Vim
@@ -63,6 +65,14 @@
 This enables `clang-include-fixer` for NORMAL and VISUAL mode. Change ``,cf`` to
 another binding if you need clang-include-fixer on a different key.
 
+Make sure vim can find :program:`clang-include-fixer`:
+
+- Add the path to :program:`clang-include-fixer` to the PATH environment variable.
+- Or set ``g:clang_include_fixer_path`` in vimrc: ``let g:clang_include_fixer_path=path/to/clang-include-fixer``
+
+You can customize the number of headers being shown by setting
+``let g:clang_include_fixer_maximum_suggested_headers=5``
+
 See ``clang-include-fixer.py`` for more details.
 
 How it Works
Index: clang-tools-extra/trunk/docs/ReleaseNotes.rst
===
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst
@@ -44,7 +44,8 @@
 Major New Features
 --
 
-- Feature1...
+- :program:`clang-include-fixer`, a tool that provides an automated way of
+  adding ``#include`` directives for missing symbols in one translation unit.
 
 Improvements to clang-query
 ---
_

[PATCH] D21059: [clang-tidy] Ignore the deleted function in misc-definitions-in-headers.

2016-06-07 Thread Haojian Wu via cfe-commits
hokein created this revision.
hokein added a reviewer: alexfh.
hokein added a subscriber: cfe-commits.

http://reviews.llvm.org/D21059

Files:
  clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  test/clang-tidy/misc-definitions-in-headers-cxx11.hpp

Index: test/clang-tidy/misc-definitions-in-headers-cxx11.hpp
===
--- /dev/null
+++ test/clang-tidy/misc-definitions-in-headers-cxx11.hpp
@@ -0,0 +1,7 @@
+// RUN: clang-tidy %s -checks="-*,misc-definitions-in-headers" -- 
-extra-arg="-std=c++11" | FileCheck -allow-empty %s
+
+// Note: This test verifies that the checker does not emit any warning for the
+// function being marked delete.
+
+int f() = delete;
+// CHECK-NOT: [misc-definitions-in-headers]
Index: clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -53,15 +53,17 @@
 void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
 return;
+  auto DefinitionMatcher =
+  anyOf(functionDecl(isDefinition(), unless(isDeleted())),
+varDecl(isDefinition()));
   if (UseHeaderFileExtension) {
-Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
-  usesHeaderFileExtension(HeaderFileExtensions))
-.bind("name-decl"),
-this);
+Finder->addMatcher(namedDecl(DefinitionMatcher,
+ usesHeaderFileExtension(HeaderFileExtensions))
+   .bind("name-decl"),
+   this);
   } else {
 Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
+namedDecl(DefinitionMatcher,
   anyOf(usesHeaderFileExtension(HeaderFileExtensions),
 unless(isExpansionInMainFile(
 .bind("name-decl"),


Index: test/clang-tidy/misc-definitions-in-headers-cxx11.hpp
===
--- /dev/null
+++ test/clang-tidy/misc-definitions-in-headers-cxx11.hpp
@@ -0,0 +1,7 @@
+// RUN: clang-tidy %s -checks="-*,misc-definitions-in-headers" -- -extra-arg="-std=c++11" | FileCheck -allow-empty %s
+
+// Note: This test verifies that the checker does not emit any warning for the
+// function being marked delete.
+
+int f() = delete;
+// CHECK-NOT: [misc-definitions-in-headers]
Index: clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -53,15 +53,17 @@
 void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
 return;
+  auto DefinitionMatcher =
+  anyOf(functionDecl(isDefinition(), unless(isDeleted())),
+varDecl(isDefinition()));
   if (UseHeaderFileExtension) {
-Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
-  usesHeaderFileExtension(HeaderFileExtensions))
-.bind("name-decl"),
-this);
+Finder->addMatcher(namedDecl(DefinitionMatcher,
+ usesHeaderFileExtension(HeaderFileExtensions))
+   .bind("name-decl"),
+   this);
   } else {
 Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
+namedDecl(DefinitionMatcher,
   anyOf(usesHeaderFileExtension(HeaderFileExtensions),
 unless(isExpansionInMainFile(
 .bind("name-decl"),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21060: [AVX512] Emit select instruction instead of using x86 specific instrinsics.

2016-06-07 Thread Igor Breger via cfe-commits
igorb created this revision.
igorb added reviewers: craig.topper, delena.
igorb added a subscriber: cfe-commits.
igorb set the repository for this revision to rL LLVM.

[AVX512] Emit select instruction instead of using x86 specific instrinsics. 

This will allow us to remove the x86 instrinics from the backend.

Repository:
  rL LLVM

http://reviews.llvm.org/D21060

Files:
  include/clang/Basic/BuiltinsX86.def
  lib/CodeGen/CGBuiltin.cpp
  lib/Headers/avx512bwintrin.h
  lib/Headers/avx512fintrin.h
  lib/Headers/avx512vlbwintrin.h
  lib/Headers/avx512vlintrin.h
  test/CodeGen/avx512bw-builtins.c
  test/CodeGen/avx512f-builtins.c
  test/CodeGen/avx512vl-builtins.c
  test/CodeGen/avx512vlbw-builtins.c

Index: test/CodeGen/avx512vlbw-builtins.c
===
--- test/CodeGen/avx512vlbw-builtins.c
+++ test/CodeGen/avx512vlbw-builtins.c
@@ -800,24 +800,24 @@
 
 __m128i test_mm_mask_blend_epi8(__mmask16 __U, __m128i __A, __m128i __W) {
   // CHECK-LABEL: @test_mm_mask_blend_epi8
-  // CHECK: @llvm.x86.avx512.mask.blend.b.128
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}
   return _mm_mask_blend_epi8(__U,__A,__W); 
 }
 __m256i test_mm256_mask_blend_epi8(__mmask32 __U, __m256i __A, __m256i __W) {
   // CHECK-LABEL: @test_mm256_mask_blend_epi8
-  // CHECK: @llvm.x86.avx512.mask.blend.b.256
+  // CHECK: select <32 x i1> %{{.*}}, <32 x i8> %{{.*}}, <32 x i8> %{{.*}}
   return _mm256_mask_blend_epi8(__U,__A,__W); 
 }
 
 __m128i test_mm_mask_blend_epi16(__mmask8 __U, __m128i __A, __m128i __W) {
   // CHECK-LABEL: @test_mm_mask_blend_epi16
-  // CHECK: @llvm.x86.avx512.mask.blend.w.128
+  // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
   return _mm_mask_blend_epi16(__U,__A,__W); 
 }
 
 __m256i test_mm256_mask_blend_epi16(__mmask16 __U, __m256i __A, __m256i __W) {
   // CHECK-LABEL: @test_mm256_mask_blend_epi16
-  // CHECK: @llvm.x86.avx512.mask.blend.w.256
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
   return _mm256_mask_blend_epi16(__U,__A,__W); 
 }
 
@@ -1959,49 +1959,49 @@
 
 __m128i test_mm_mask_mov_epi16(__m128i __W, __mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_mov_epi16
-  // CHECK: @llvm.x86.avx512.mask.movu.w.128
+  // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
   return _mm_mask_mov_epi16(__W, __U, __A); 
 }
 
 __m128i test_mm_maskz_mov_epi16(__mmask8 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_maskz_mov_epi16
-  // CHECK: @llvm.x86.avx512.mask.movu.w.128
+  // CHECK: select <8 x i1> %{{.*}}, <8 x i16> %{{.*}}, <8 x i16> %{{.*}}
   return _mm_maskz_mov_epi16(__U, __A); 
 }
 
 __m256i test_mm256_mask_mov_epi16(__m256i __W, __mmask16 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_mov_epi16
-  // CHECK: @llvm.x86.avx512.mask.movu.w.256
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
   return _mm256_mask_mov_epi16(__W, __U, __A); 
 }
 
 __m256i test_mm256_maskz_mov_epi16(__mmask16 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_maskz_mov_epi16
-  // CHECK: @llvm.x86.avx512.mask.movu.w.256
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i16> %{{.*}}, <16 x i16> %{{.*}}
   return _mm256_maskz_mov_epi16(__U, __A); 
 }
 
 __m128i test_mm_mask_mov_epi8(__m128i __W, __mmask16 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_mask_mov_epi8
-  // CHECK: @llvm.x86.avx512.mask.movu.b.128
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}
   return _mm_mask_mov_epi8(__W, __U, __A); 
 }
 
 __m128i test_mm_maskz_mov_epi8(__mmask16 __U, __m128i __A) {
   // CHECK-LABEL: @test_mm_maskz_mov_epi8
-  // CHECK: @llvm.x86.avx512.mask.movu.b.128
+  // CHECK: select <16 x i1> %{{.*}}, <16 x i8> %{{.*}}, <16 x i8> %{{.*}}
   return _mm_maskz_mov_epi8(__U, __A); 
 }
 
 __m256i test_mm256_mask_mov_epi8(__m256i __W, __mmask32 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_mask_mov_epi8
-  // CHECK: @llvm.x86.avx512.mask.movu.b.256
+  // CHECK: select <32 x i1> %{{.*}}, <32 x i8> %{{.*}}, <32 x i8> %{{.*}}
   return _mm256_mask_mov_epi8(__W, __U, __A); 
 }
 
 __m256i test_mm256_maskz_mov_epi8(__mmask32 __U, __m256i __A) {
   // CHECK-LABEL: @test_mm256_maskz_mov_epi8
-  // CHECK: @llvm.x86.avx512.mask.movu.b.256
+  // CHECK: select <32 x i1> %{{.*}}, <32 x i8> %{{.*}}, <32 x i8> %{{.*}}
   return _mm256_maskz_mov_epi8(__U, __A); 
 }
 
Index: test/CodeGen/avx512vl-builtins.c
===
--- test/CodeGen/avx512vl-builtins.c
+++ test/CodeGen/avx512vl-builtins.c
@@ -1467,42 +1467,42 @@
 }
 __m128i test_mm_mask_blend_epi32(__mmask8 __U, __m128i __A, __m128i __W) {
   // CHECK-LABEL: @test_mm_mask_blend_epi32
-  // CHECK: @llvm.x86.avx512.mask.blend.d.128
+  // CHECK: select <4 x i1> %{{.*}}, <4 x i32> %{{.*}}, <4 x i32> %{{.*}}
   return _mm_mask_blend_epi32(__U,__A,__W); 
 }
 __m256i test_mm256_mask_blend_epi32(__mmask8 __U, __m256i __A, _

Re: [PATCH] D20382: Add postorder support to RecursiveASTVisitor

2016-06-07 Thread Benjamin Kramer via cfe-commits
bkramer added a comment.

IMO a 20% release binary size increase is not acceptable. Is there a way to 
compile in support only if it's actually used? Maybe some constexpr or template 
magic?


http://reviews.llvm.org/D20382



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


Re: [PATCH] D21058: [Clang][AVX512][BUILTIN]Adding missing intrinsics srl and sll

2016-06-07 Thread Igor Breger via cfe-commits
igorb accepted this revision.
igorb added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D21058



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


Re: [PATCH] D21019: [include-fixer] try to make vim header selection more friendly.

2016-06-07 Thread Benjamin Kramer via cfe-commits
bkramer added a comment.

Nice! Can we somehow make the user not press enter after putting in the number? 
getchar() maybe?


http://reviews.llvm.org/D21019



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


Re: [PATCH] D21059: [clang-tidy] Ignore the deleted function in misc-definitions-in-headers.

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

LG with one comment.



Comment at: test/clang-tidy/misc-definitions-in-headers-cxx11.hpp:6
@@ +5,3 @@
+
+int f() = delete;
+// CHECK-NOT: [misc-definitions-in-headers]

Just add this to the existing test file, the testing script uses -std=c++11 by 
default.


http://reviews.llvm.org/D21059



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


Re: [PATCH] D21059: [clang-tidy] Ignore the deleted function in misc-definitions-in-headers.

2016-06-07 Thread Haojian Wu via cfe-commits
hokein updated this revision to Diff 59843.
hokein marked an inline comment as done.
hokein added a comment.

Use the existing test file.


http://reviews.llvm.org/D21059

Files:
  clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  test/clang-tidy/misc-definitions-in-headers.hpp

Index: test/clang-tidy/misc-definitions-in-headers.hpp
===
--- test/clang-tidy/misc-definitions-in-headers.hpp
+++ test/clang-tidy/misc-definitions-in-headers.hpp
@@ -103,6 +103,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: function 'f7' defined in a header 
file;
 }
 
+int f8() = delete; // OK: the function being marked delete is not callable.
+
 int a = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'a' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
 CA a1;
Index: clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -53,15 +53,17 @@
 void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
 return;
+  auto DefinitionMatcher =
+  anyOf(functionDecl(isDefinition(), unless(isDeleted())),
+varDecl(isDefinition()));
   if (UseHeaderFileExtension) {
-Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
-  usesHeaderFileExtension(HeaderFileExtensions))
-.bind("name-decl"),
-this);
+Finder->addMatcher(namedDecl(DefinitionMatcher,
+ usesHeaderFileExtension(HeaderFileExtensions))
+   .bind("name-decl"),
+   this);
   } else {
 Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
+namedDecl(DefinitionMatcher,
   anyOf(usesHeaderFileExtension(HeaderFileExtensions),
 unless(isExpansionInMainFile(
 .bind("name-decl"),


Index: test/clang-tidy/misc-definitions-in-headers.hpp
===
--- test/clang-tidy/misc-definitions-in-headers.hpp
+++ test/clang-tidy/misc-definitions-in-headers.hpp
@@ -103,6 +103,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: function 'f7' defined in a header file;
 }
 
+int f8() = delete; // OK: the function being marked delete is not callable.
+
 int a = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'a' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
 CA a1;
Index: clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -53,15 +53,17 @@
 void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
 return;
+  auto DefinitionMatcher =
+  anyOf(functionDecl(isDefinition(), unless(isDeleted())),
+varDecl(isDefinition()));
   if (UseHeaderFileExtension) {
-Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
-  usesHeaderFileExtension(HeaderFileExtensions))
-.bind("name-decl"),
-this);
+Finder->addMatcher(namedDecl(DefinitionMatcher,
+ usesHeaderFileExtension(HeaderFileExtensions))
+   .bind("name-decl"),
+   this);
   } else {
 Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
+namedDecl(DefinitionMatcher,
   anyOf(usesHeaderFileExtension(HeaderFileExtensions),
 unless(isExpansionInMainFile(
 .bind("name-decl"),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21059: [clang-tidy] Ignore the deleted function in misc-definitions-in-headers.

2016-06-07 Thread Haojian Wu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271991: [clang-tidy] Ignore the deleted function in 
misc-definitions-in-headers. (authored by hokein).

Changed prior to commit:
  http://reviews.llvm.org/D21059?vs=59843&id=59845#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21059

Files:
  clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp

Index: clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
===
--- clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
@@ -103,6 +103,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: function 'f7' defined in a header 
file;
 }
 
+int f8() = delete; // OK: the function being marked delete is not callable.
+
 int a = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'a' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
 CA a1;
Index: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -53,15 +53,17 @@
 void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
 return;
+  auto DefinitionMatcher =
+  anyOf(functionDecl(isDefinition(), unless(isDeleted())),
+varDecl(isDefinition()));
   if (UseHeaderFileExtension) {
-Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
-  usesHeaderFileExtension(HeaderFileExtensions))
-.bind("name-decl"),
-this);
+Finder->addMatcher(namedDecl(DefinitionMatcher,
+ usesHeaderFileExtension(HeaderFileExtensions))
+   .bind("name-decl"),
+   this);
   } else {
 Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
+namedDecl(DefinitionMatcher,
   anyOf(usesHeaderFileExtension(HeaderFileExtensions),
 unless(isExpansionInMainFile(
 .bind("name-decl"),


Index: clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
===
--- clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
+++ clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
@@ -103,6 +103,8 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: function 'f7' defined in a header file;
 }
 
+int f8() = delete; // OK: the function being marked delete is not callable.
+
 int a = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'a' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]
 CA a1;
Index: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -53,15 +53,17 @@
 void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
 return;
+  auto DefinitionMatcher =
+  anyOf(functionDecl(isDefinition(), unless(isDeleted())),
+varDecl(isDefinition()));
   if (UseHeaderFileExtension) {
-Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
-  usesHeaderFileExtension(HeaderFileExtensions))
-.bind("name-decl"),
-this);
+Finder->addMatcher(namedDecl(DefinitionMatcher,
+ usesHeaderFileExtension(HeaderFileExtensions))
+   .bind("name-decl"),
+   this);
   } else {
 Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
+namedDecl(DefinitionMatcher,
   anyOf(usesHeaderFileExtension(HeaderFileExtensions),
 unless(isExpansionInMainFile(
 .bind("name-decl"),
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r271991 - [clang-tidy] Ignore the deleted function in misc-definitions-in-headers.

2016-06-07 Thread Haojian Wu via cfe-commits
Author: hokein
Date: Tue Jun  7 03:55:38 2016
New Revision: 271991

URL: http://llvm.org/viewvc/llvm-project?rev=271991&view=rev
Log:
[clang-tidy] Ignore the deleted function in misc-definitions-in-headers.

Reviewers: alexfh

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D21059

Modified:
clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp?rev=271991&r1=271990&r2=271991&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/misc/DefinitionsInHeadersCheck.cpp Tue 
Jun  7 03:55:38 2016
@@ -53,15 +53,17 @@ void DefinitionsInHeadersCheck::storeOpt
 void DefinitionsInHeadersCheck::registerMatchers(MatchFinder *Finder) {
   if (!getLangOpts().CPlusPlus)
 return;
+  auto DefinitionMatcher =
+  anyOf(functionDecl(isDefinition(), unless(isDeleted())),
+varDecl(isDefinition()));
   if (UseHeaderFileExtension) {
-Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
-  usesHeaderFileExtension(HeaderFileExtensions))
-.bind("name-decl"),
-this);
+Finder->addMatcher(namedDecl(DefinitionMatcher,
+ usesHeaderFileExtension(HeaderFileExtensions))
+   .bind("name-decl"),
+   this);
   } else {
 Finder->addMatcher(
-namedDecl(anyOf(functionDecl(isDefinition()), varDecl(isDefinition())),
+namedDecl(DefinitionMatcher,
   anyOf(usesHeaderFileExtension(HeaderFileExtensions),
 unless(isExpansionInMainFile(
 .bind("name-decl"),

Modified: 
clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp?rev=271991&r1=271990&r2=271991&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-definitions-in-headers.hpp Tue 
Jun  7 03:55:38 2016
@@ -103,6 +103,8 @@ namespace {
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: function 'f7' defined in a header 
file;
 }
 
+int f8() = delete; // OK: the function being marked delete is not callable.
+
 int a = 1;
 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: variable 'a' defined in a header 
file; variable definitions in header files can lead to ODR violations 
[misc-definitions-in-headers]
 CA a1;


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


Re: [PATCH] D21050: [clang-tidy] correct clang-tidy-diff.py help message

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

Looks good. Thank you for fixing the copy-paste failures!

Do you need me to commit the patch for you?



Comment at: clang-tidy/tool/clang-tidy-diff.py:42
@@ -41,3 +41,3 @@
   help='path to clang-tidy binary')
   parser.add_argument('-p', metavar='NUM', default=0,
   help='strip the smallest prefix containing P slashes')

sugak wrote:
> Eugene.Zelenko wrote:
> > Shouldn't -p be used to specify compile database as in run-clang-tidy.py?
> From the test plan it looks like this script doesn't support compilation 
> database input:
> ```lang=bash
> git diff -U0 HEAD^ | clang-tidy-diff.py -checks=-*,misc-use-override -p1 -- 
> -std=gnu++14
> ```
> It is similar to `patch`-like tools that process unified diff input -- uses 
> `-p` to adjust file path. I can fix it in a separate diff, just need a better 
> name for the current function of `-p`.
The -p flag (compilation database path) to clang-tidy can be specified after 
the `--`:

  git diff -U0 HEAD^ | clang-tidy-diff.py -checks=-*,misc-use-override -p1 -- 
-p path/to/compile_commands.json

It might be slightly confusing to have two -p flags, but both make sense.


http://reviews.llvm.org/D21050



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


Re: [PATCH] D21021: [Clang][AVX512][BuiltIn]Adding intrinsics move_{sd|ss} to clang

2016-06-07 Thread Elena Demikhovsky via cfe-commits
delena added inline comments.


Comment at: lib/Headers/avx512fintrin.h:9124
@@ +9123,3 @@
+{
+  return (__m128) __builtin_ia32_movss_mask ((__v4sf) __A, (__v4sf) __B,
+   (__v4sf) __W,

please try the following:
if (__U)
  return __builtin_shuffle(A, B, (0, 5, 6, 7)); // may be you need to swap A 
and B 
 return W;

I know that the immediate code will be less optimal, but we can optimize it 
later.


http://reviews.llvm.org/D21021



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


[clang-tools-extra] r271992 - [clang-tidy] readability-identifier-naming - Support for Type Aliases

2016-06-07 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Jun  7 04:11:19 2016
New Revision: 271992

URL: http://llvm.org/viewvc/llvm-project?rev=271992&view=rev
Log:
[clang-tidy] readability-identifier-naming - Support for Type Aliases

Summary: Added support for Type Alias declarations.

Reviewers: alexfh

Subscribers: cfe-commits

Patch by James Reynolds!

Differential Revision: http://reviews.llvm.org/D20856

Modified:
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp

Modified: 
clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp?rev=271992&r1=271991&r2=271992&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp 
Tue Jun  7 04:11:19 2016
@@ -65,6 +65,7 @@ namespace readability {
 m(ValueTemplateParameter) \
 m(TemplateTemplateParameter) \
 m(TemplateParameter) \
+m(TypeAlias) \
 
 enum StyleKind {
 #define ENUMERATE(v) SK_ ## v,
@@ -258,6 +259,9 @@ static StyleKind findStyleKind(
   if (isa(D) && NamingStyles[SK_Typedef].isSet())
 return SK_Typedef;
 
+  if (isa(D) && NamingStyles[SK_TypeAlias].isSet())
+return SK_TypeAlias;
+
   if (const auto *Decl = dyn_cast(D)) {
 if (Decl->isAnonymousNamespace())
   return SK_Invalid;

Modified: 
clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp?rev=271992&r1=271991&r2=271992&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp 
(original)
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp 
Tue Jun  7 04:11:19 2016
@@ -61,6 +61,8 @@
 // RUN: {key: readability-identifier-naming.VariableCase, value: 
lower_case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: 
UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 
'v_'}, \
+// RUN: {key: readability-identifier-naming.TypeAliasCase, value: 
lower_case}, \
+// RUN: {key: readability-identifier-naming.TypeAliasSuffix, value: '_t'}, 
\
 // RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0} \
 // RUN:   ]}' -- -std=c++11 -fno-delayed-template-parsing \
 // RUN:   -I%S/Inputs/readability-identifier-naming \
@@ -191,8 +193,8 @@ class my_other_templated_class : my_temp
 // CHECK-FIXES: {{^}}class CMyOtherTemplatedClass : CMyTemplatedClass<  
CMyClass>, private CMyDerivedClass {};{{$}}
 
 template
-using MYSUPER_TPL = my_other_templated_class  <:: FOO_NS  ::my_class>;
-// CHECK-FIXES: {{^}}using MYSUPER_TPL = CMyOtherTemplatedClass  <:: foo_ns  
::CMyClass>;{{$}}
+using mysuper_tpl_t = my_other_templated_class  <:: FOO_NS  ::my_class>;
+// CHECK-FIXES: {{^}}using mysuper_tpl_t = CMyOtherTemplatedClass  <:: foo_ns  
::CMyClass>;{{$}}
 
 const int global_Constant = 6;
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global 
constant 'global_Constant'
@@ -305,6 +307,15 @@ typedef THIS___Structure struct_type;
 // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for typedef 
'struct_type'
 // CHECK-FIXES: {{^}}typedef this_structure struct_type_t;{{$}}
 
+using my_struct_type = THIS___Structure;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 
'my_struct_type'
+// CHECK-FIXES: {{^}}using my_struct_type_t = this_structure;{{$}}
+
+template
+using SomeOtherTemplate = my_other_templated_class  <:: FOO_NS  ::my_class>;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 
'SomeOtherTemplate'
+// CHECK-FIXES: {{^}}using some_other_template_t = CMyOtherTemplatedClass  <:: 
foo_ns  ::CMyClass>;{{$}}
+
 static void static_Function() {
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for function 
'static_Function'
 // CHECK-FIXES: {{^}}static void staticFunction() {{{$}}


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


Re: [PATCH] D20856: [clang-tidy] readability-identifier-naming - Support for Type Aliases

2016-06-07 Thread Alexander Kornienko via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271992: [clang-tidy] readability-identifier-naming - Support 
for Type Aliases (authored by alexfh).

Changed prior to commit:
  http://reviews.llvm.org/D20856?vs=59189&id=59847#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20856

Files:
  clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp

Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -65,6 +65,7 @@
 m(ValueTemplateParameter) \
 m(TemplateTemplateParameter) \
 m(TemplateParameter) \
+m(TypeAlias) \
 
 enum StyleKind {
 #define ENUMERATE(v) SK_ ## v,
@@ -258,6 +259,9 @@
   if (isa(D) && NamingStyles[SK_Typedef].isSet())
 return SK_Typedef;
 
+  if (isa(D) && NamingStyles[SK_TypeAlias].isSet())
+return SK_TypeAlias;
+
   if (const auto *Decl = dyn_cast(D)) {
 if (Decl->isAnonymousNamespace())
   return SK_Invalid;
Index: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
@@ -61,6 +61,8 @@
 // RUN: {key: readability-identifier-naming.VariableCase, value: 
lower_case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: 
UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 
'v_'}, \
+// RUN: {key: readability-identifier-naming.TypeAliasCase, value: 
lower_case}, \
+// RUN: {key: readability-identifier-naming.TypeAliasSuffix, value: '_t'}, 
\
 // RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0} \
 // RUN:   ]}' -- -std=c++11 -fno-delayed-template-parsing \
 // RUN:   -I%S/Inputs/readability-identifier-naming \
@@ -191,8 +193,8 @@
 // CHECK-FIXES: {{^}}class CMyOtherTemplatedClass : CMyTemplatedClass<  
CMyClass>, private CMyDerivedClass {};{{$}}
 
 template
-using MYSUPER_TPL = my_other_templated_class  <:: FOO_NS  ::my_class>;
-// CHECK-FIXES: {{^}}using MYSUPER_TPL = CMyOtherTemplatedClass  <:: foo_ns  
::CMyClass>;{{$}}
+using mysuper_tpl_t = my_other_templated_class  <:: FOO_NS  ::my_class>;
+// CHECK-FIXES: {{^}}using mysuper_tpl_t = CMyOtherTemplatedClass  <:: foo_ns  
::CMyClass>;{{$}}
 
 const int global_Constant = 6;
 // CHECK-MESSAGES: :[[@LINE-1]]:11: warning: invalid case style for global 
constant 'global_Constant'
@@ -305,6 +307,15 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for typedef 
'struct_type'
 // CHECK-FIXES: {{^}}typedef this_structure struct_type_t;{{$}}
 
+using my_struct_type = THIS___Structure;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 
'my_struct_type'
+// CHECK-FIXES: {{^}}using my_struct_type_t = this_structure;{{$}}
+
+template
+using SomeOtherTemplate = my_other_templated_class  <:: FOO_NS  ::my_class>;
+// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 
'SomeOtherTemplate'
+// CHECK-FIXES: {{^}}using some_other_template_t = CMyOtherTemplatedClass  <:: 
foo_ns  ::CMyClass>;{{$}}
+
 static void static_Function() {
 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: invalid case style for function 
'static_Function'
 // CHECK-FIXES: {{^}}static void staticFunction() {{{$}}


Index: clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -65,6 +65,7 @@
 m(ValueTemplateParameter) \
 m(TemplateTemplateParameter) \
 m(TemplateParameter) \
+m(TypeAlias) \
 
 enum StyleKind {
 #define ENUMERATE(v) SK_ ## v,
@@ -258,6 +259,9 @@
   if (isa(D) && NamingStyles[SK_Typedef].isSet())
 return SK_Typedef;
 
+  if (isa(D) && NamingStyles[SK_TypeAlias].isSet())
+return SK_TypeAlias;
+
   if (const auto *Decl = dyn_cast(D)) {
 if (Decl->isAnonymousNamespace())
   return SK_Invalid;
Index: clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
===
--- clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/readability-identifier-naming.cpp
@@ -61,6 +61,8 @@
 // RUN: {key: readability-identifier-naming.VariableCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: UPPER_CASE}, \
 // RU

Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Haojian Wu via cfe-commits
hokein added inline comments.


Comment at: test/clang-tidy/misc-misplaced-const.c:17
@@ +16,3 @@
+  const ip i3 = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i3' declared with a 
const-qualified typedef type; results in the type being 'int *const' instead of 
'const int *'
+

Will the check show the warning on `ip const i3 = 0;`? Technically, `const ip 
i3 = 0` is exactly the same with `ip const i3 = 0;`.


http://reviews.llvm.org/D21036



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


Re: [PATCH] D20966: [include-fixer] Add the missing header to the file where the unidentified symbol comes from.

2016-06-07 Thread Haojian Wu via cfe-commits
hokein added inline comments.


Comment at: include-fixer/IncludeFixer.cpp:104
@@ -103,3 @@
-//   class Bar;
-//   Foo foo;
-//

bkramer wrote:
> Does this patch do the right thing for the test case in the comment? 
> Otherwise we'll try add includes to system headers all the time, which both 
> wrong and invisible to the user.
No, the patch doesn't handle this case :(. Currently it is hard to figure out 
this case. For the system headers, we can probably blacklist them? 


http://reviews.llvm.org/D20966



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


r271995 - Reapply [Coverage] Fix an assertion failure if the definition of an unused function spans multiple files.

2016-06-07 Thread Igor Kudrin via cfe-commits
Author: ikudrin
Date: Tue Jun  7 05:07:51 2016
New Revision: 271995

URL: http://llvm.org/viewvc/llvm-project?rev=271995&view=rev
Log:
Reapply [Coverage] Fix an assertion failure if the definition of an unused 
function spans multiple files.

We have an assertion failure if, for example, the definition of an unused
inline function starts in one macro and ends in another. This patch fixes
the issue by finding the common ancestor of the start and end locations
of that function's body and changing the locations accordingly.

Thanks to NAKAMURA Takumi for helping with fixing the test failure on Windows.

Differential Revision: http://reviews.llvm.org/D20997

Added:
cfe/trunk/test/CoverageMapping/Inputs/ends_a_scope_only
cfe/trunk/test/CoverageMapping/Inputs/starts_a_scope_only
cfe/trunk/test/CoverageMapping/unused_function.cpp
Modified:
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp

Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=271995&r1=271994&r2=271995&view=diff
==
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Tue Jun  7 05:07:51 2016
@@ -130,6 +130,16 @@ public:
 return strcmp(SM.getBufferName(SM.getSpellingLoc(Loc)), "") == 0;
   }
 
+  /// \brief Check whether \c Loc is included or expanded from \c Parent.
+  bool isNestedIn(SourceLocation Loc, FileID Parent) {
+do {
+  Loc = getIncludeOrExpansionLoc(Loc);
+  if (Loc.isInvalid())
+return false;
+} while (!SM.isInFileID(Loc, Parent));
+return true;
+  }
+
   /// \brief Get the start of \c S ignoring macro arguments and builtin macros.
   SourceLocation getStart(const Stmt *S) {
 SourceLocation Loc = S->getLocStart();
@@ -310,7 +320,27 @@ struct EmptyCoverageMappingBuilder : pub
 if (!D->hasBody())
   return;
 auto Body = D->getBody();
-SourceRegions.emplace_back(Counter(), getStart(Body), getEnd(Body));
+SourceLocation Start = getStart(Body);
+SourceLocation End = getEnd(Body);
+if (!SM.isWrittenInSameFile(Start, End)) {
+  // Walk up to find the common ancestor.
+  // Correct the locations accordingly.
+  FileID StartFileID = SM.getFileID(Start);
+  FileID EndFileID = SM.getFileID(End);
+  while (StartFileID != EndFileID && !isNestedIn(End, StartFileID)) {
+Start = getIncludeOrExpansionLoc(Start);
+assert(Start.isValid() &&
+   "Declaration start location not nested within a known region");
+StartFileID = SM.getFileID(Start);
+  }
+  while (StartFileID != EndFileID) {
+End = getPreciseTokenLocEnd(getIncludeOrExpansionLoc(End));
+assert(End.isValid() &&
+   "Declaration end location not nested within a known region");
+EndFileID = SM.getFileID(End);
+  }
+}
+SourceRegions.emplace_back(Counter(), Start, End);
   }
 
   /// \brief Write the mapping data to the output stream
@@ -471,16 +501,6 @@ struct CounterCoverageMappingBuilder
   MostRecentLocation = getIncludeOrExpansionLoc(MostRecentLocation);
   }
 
-  /// \brief Check whether \c Loc is included or expanded from \c Parent.
-  bool isNestedIn(SourceLocation Loc, FileID Parent) {
-do {
-  Loc = getIncludeOrExpansionLoc(Loc);
-  if (Loc.isInvalid())
-return false;
-} while (!SM.isInFileID(Loc, Parent));
-return true;
-  }
-
   /// \brief Adjust regions and state when \c NewLoc exits a file.
   ///
   /// If moving from our most recently tracked location to \c NewLoc exits any

Added: cfe/trunk/test/CoverageMapping/Inputs/ends_a_scope_only
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/Inputs/ends_a_scope_only?rev=271995&view=auto
==
--- cfe/trunk/test/CoverageMapping/Inputs/ends_a_scope_only (added)
+++ cfe/trunk/test/CoverageMapping/Inputs/ends_a_scope_only Tue Jun  7 05:07:51 
2016
@@ -0,0 +1 @@
+}

Added: cfe/trunk/test/CoverageMapping/Inputs/starts_a_scope_only
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/Inputs/starts_a_scope_only?rev=271995&view=auto
==
--- cfe/trunk/test/CoverageMapping/Inputs/starts_a_scope_only (added)
+++ cfe/trunk/test/CoverageMapping/Inputs/starts_a_scope_only Tue Jun  7 
05:07:51 2016
@@ -0,0 +1 @@
+{

Added: cfe/trunk/test/CoverageMapping/unused_function.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/unused_function.cpp?rev=271995&view=auto
==
--- cfe/trunk/test/CoverageMapping/unused_function.cpp (added)
+++ cfe/trunk/test/CoverageMapping/unused_function.cpp Tue Jun  7 05:07:51 2016
@@ -0,0 +1,37 @@
+// RUN: %clan

Re: [PATCH] D21019: [include-fixer] try to make vim header selection more friendly.

2016-06-07 Thread Eric Liu via cfe-commits
ioeric updated this revision to Diff 59858.
ioeric added a comment.

- fixed a bug with index.


http://reviews.llvm.org/D21019

Files:
  include-fixer/tool/clang-include-fixer.py

Index: include-fixer/tool/clang-include-fixer.py
===
--- include-fixer/tool/clang-include-fixer.py
+++ include-fixer/tool/clang-include-fixer.py
@@ -35,12 +35,30 @@
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
 
-def ShowDialog(message, choices, default_choice_index=0):
-  to_eval = "confirm('{0}', '{1}', '{2}')".format(message,
-  choices.strip(),
-  default_choice_index)
-  return int(vim.eval(to_eval));
-
+def GetUserSelection(message, headers, maximum_suggested_headers):
+  eval_message = message + '\n'
+  for idx, header in enumerate(headers[0:maximum_suggested_headers]):
+eval_message += "({0}). {1}\n".format(idx+1, header)
+  eval_message += "Enter (q) to quit;"
+  if maximum_suggested_headers < len(headers):
+eval_message += " (a) to show all candidates.";
+  eval_message += "\nSelect (default 1): "
+  res = vim.eval("input('{0}')".format(eval_message))
+  if res == '':
+# choose the top ranked header by default
+idx = 1
+  elif res == 'q':
+raise Exception('   Insertion cancelled...')
+  elif res == 'a' and maximum_suggested_headers < len(headers):
+return GetUserSelection(message, headers, len(headers))
+  else:
+try:
+  idx = int(res)
+  if idx <= 0 or idx > len(headers):
+raise Exception()
+except Exception:
+raise Exception('   ERROR: Invalid option "{0}"...Abort!'.format(res))
+  return headers[idx-1]
 
 def execute(command, text):
   p = subprocess.Popen(command,
@@ -88,7 +106,7 @@
 
   if not symbol:
 print "The file is fine, no need to add a header.\n"
-return;
+return
 
   if not headers:
 print "Couldn't find a header for {0}.\n".format(symbol)
@@ -102,19 +120,16 @@
 print "Added #include {0} for {1}.\n".format(headers[0], symbol)
 return
 
-  choices_message = ""
-  index = 1;
-  for header in headers[0:maximum_suggested_headers]:
-choices_message += "&{0} {1}\n".format(index, header)
-index += 1
-
-  select = ShowDialog("choose a header file for {0}.".format(symbol),
-  choices_message)
-  # Insert a selected header.
-  InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
-   "Headers":[headers[select-1]]}, text)
-  print "Added #include {0} for {1}.\n".format(headers[select-1], symbol)
-  return;
+  try:
+selected = GetUserSelection("choose a header file for {0}.".format(symbol),
+headers, maximum_suggested_headers)
+# Insert a selected header.
+InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
+ "Headers":[selected]}, text)
+print "Added #include {0} for {1}.\n".format(selected, symbol)
+  except Exception as error:
+print >> sys.stderr, error.message
+  return
 
 
 if __name__ == '__main__':


Index: include-fixer/tool/clang-include-fixer.py
===
--- include-fixer/tool/clang-include-fixer.py
+++ include-fixer/tool/clang-include-fixer.py
@@ -35,12 +35,30 @@
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
 
-def ShowDialog(message, choices, default_choice_index=0):
-  to_eval = "confirm('{0}', '{1}', '{2}')".format(message,
-  choices.strip(),
-  default_choice_index)
-  return int(vim.eval(to_eval));
-
+def GetUserSelection(message, headers, maximum_suggested_headers):
+  eval_message = message + '\n'
+  for idx, header in enumerate(headers[0:maximum_suggested_headers]):
+eval_message += "({0}). {1}\n".format(idx+1, header)
+  eval_message += "Enter (q) to quit;"
+  if maximum_suggested_headers < len(headers):
+eval_message += " (a) to show all candidates.";
+  eval_message += "\nSelect (default 1): "
+  res = vim.eval("input('{0}')".format(eval_message))
+  if res == '':
+# choose the top ranked header by default
+idx = 1
+  elif res == 'q':
+raise Exception('   Insertion cancelled...')
+  elif res == 'a' and maximum_suggested_headers < len(headers):
+return GetUserSelection(message, headers, len(headers))
+  else:
+try:
+  idx = int(res)
+  if idx <= 0 or idx > len(headers):
+raise Exception()
+except Exception:
+raise Exception('   ERROR: Invalid option "{0}"...Abort!'.format(res))
+  return headers[idx-1]
 
 def execute(command, text):
   p = subprocess.Popen(command,
@@ -88,7 +106,7 @@
 
   if not symbol:
 print "The file is fine, no need to add a header.\n"
-return;
+return
 
   if not headers:
 print "Couldn't find a header for {0}.\n".format(symbol)
@@ -102,

Re: [PATCH] D21019: [include-fixer] try to make vim header selection more friendly.

2016-06-07 Thread Eric Liu via cfe-commits
ioeric added a comment.

As per our offline discussion, `getchar()` does not work with options with more 
than 2 digits (e.g. index number > 9). I'll keep it as it is now until we come 
up with a better solution.


http://reviews.llvm.org/D21019



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


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-07 Thread James Reynolds via cfe-commits
JamesReynolds updated this revision to Diff 59857.
JamesReynolds added a comment.

Thanks Eugene, I've added a comment into docs/ReleaseNotes.rst to say this is 
in. I'll create a BugZilla account to update PR.

I've also added a new test and code to create FixIts for uses of the Macros as 
well as the definitions themselves.


http://reviews.llvm.org/D21020

Files:
  clang-tidy/readability/IdentifierNamingCheck.cpp
  clang-tidy/readability/IdentifierNamingCheck.h
  docs/ReleaseNotes.rst
  test/clang-tidy/readability-identifier-naming.cpp

Index: test/clang-tidy/readability-identifier-naming.cpp
===
--- test/clang-tidy/readability-identifier-naming.cpp
+++ test/clang-tidy/readability-identifier-naming.cpp
@@ -61,6 +61,7 @@
 // RUN: {key: readability-identifier-naming.VariableCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodCase, value: UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.VirtualMethodPrefix, value: 'v_'}, \
+// RUN: {key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE}, \
 // RUN: {key: readability-identifier-naming.TypeAliasCase, value: lower_case}, \
 // RUN: {key: readability-identifier-naming.TypeAliasSuffix, value: '_t'}, \
 // RUN: {key: readability-identifier-naming.IgnoreFailedSplit, value: 0} \
@@ -307,6 +308,12 @@
 // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: invalid case style for typedef 'struct_type'
 // CHECK-FIXES: {{^}}typedef this_structure struct_type_t;{{$}}
 
+struct_type GlobalTypedefTestFunction(struct_type a_argument1) {
+// CHECK-FIXES: {{^}}struct_type_t GlobalTypedefTestFunction(struct_type_t a_argument1) {
+struct_type typedef_test_1;
+// CHECK-FIXES: {{^}}struct_type_t typedef_test_1;
+}
+
 using my_struct_type = THIS___Structure;
 // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: invalid case style for type alias 'my_struct_type'
 // CHECK-FIXES: {{^}}using my_struct_type_t = this_structure;{{$}}
@@ -329,5 +336,11 @@
 // CHECK-FIXES: {{^}}  using ::foo_ns::inline_namespace::ce_function;{{$}}
 }
 
+#define MY_TEST_Macro(X) X()
+// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for macro definition 'MY_TEST_Macro'
+// CHECK-FIXES: {{^}}#define MY_TEST_MACRO(X) X()
+
+void MY_TEST_Macro(function) {}
+// CHECK-FIXES: {{^}}void MY_TEST_MACRO(function) {}
 }
 }
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -259,6 +259,11 @@
   Does not only checks for correct signature but also for correct ``return``
   statements (returning ``*this``)
 
+- Updated `readability-identifier-naming-check
+  `_
+
+  Added support for enforcing the case of macro statements.
+
 Fixed bugs:
 
 - Crash when running on compile database with relative source files paths.
Index: clang-tidy/readability/IdentifierNamingCheck.h
===
--- clang-tidy/readability/IdentifierNamingCheck.h
+++ clang-tidy/readability/IdentifierNamingCheck.h
@@ -13,6 +13,9 @@
 #include "../ClangTidy.h"
 
 namespace clang {
+
+class MacroInfo;
+
 namespace tidy {
 namespace readability {
 
@@ -36,6 +39,7 @@
   void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+  void registerPPCallbacks(CompilerInstance &Compiler) override;
   void onEndOfTranslationUnit() override;
 
   enum CaseType {
@@ -64,7 +68,7 @@
 
   /// \brief Holds an identifier name check failure, tracking the kind of the
   /// identifer, its possible fixup and the starting locations of all the
-  /// idenfiier usages.
+  /// identifier usages.
   struct NamingCheckFailure {
 std::string KindName;
 std::string Fixup;
@@ -81,9 +85,22 @@
 
 NamingCheckFailure() : ShouldFix(true) {}
   };
-  typedef llvm::DenseMap
+
+  struct NamingCheckId : std::pair {
+typedef std::pair Parent;
+using Parent::Parent;
+  };
+
+  typedef llvm::DenseMap
   NamingCheckFailureMap;
 
+  /// Check Macros for style violations
+  void checkMacro(SourceManager &sourceMgr, const Token &MacroNameTok,
+  const MacroInfo *MI);
+
+  /// Add a usage of a macro if it already has a violation
+  void expandMacro(const Token &MacroNameTok, const MacroInfo *MI);
+
 private:
   std::vector NamingStyles;
   bool IgnoreFailedSplit;
Index: clang-tidy/readability/IdentifierNamingCheck.cpp
===
--- clang-tidy/readability/IdentifierNamingCheck.cpp
+++ clang-tidy/readability/IdentifierNamingCheck.cpp
@@ -12,11 +12,53 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+

Re: [PATCH] D18035: [GCC] PR23529 Mangler part of attrbute abi_tag support

2016-06-07 Thread Dmitry Polukhin via cfe-commits
DmitryPolukhin added a comment.

In http://reviews.llvm.org/D18035#450258, @rsmith wrote:

> Yes, I definitely want us to implement this for GCC compatibility. And now 
> that we have a specification for this feature, we can evaluate whether this 
> is doing the right thing. On that basis:
>
> I still want this refactored so that the normally-mangled part of a function 
> name is only mangled once, rather than being mangled twice (once to find the 
> implicit tag set and once to actually produce the mangled name). As 
> suggested, you can achieve this by first computing the set of tags from the 
> return type, then mangling the encoding to a separate buffer (collecting tags 
> as you go) if the set is non-empty, and finally writing any remaining tags 
> and the buffer contents.
>
> Please factor out a function to mangle the source name and ABI tags for a 
> `NamedDecl` rather than duplicating that pair of calls throughout the patch.
>
> Current discussion on the ABI list suggests that it is not correct to mangle 
> the return type / variable type to get the implicit tag set. The set of 
> available attributes should be determined by a recursive walk of the original 
> type (prior to any substitution), not by mangling it and seeing what it 
> references. It's not yet clear whether that's the actual design intent or 
> just the emergent behavior of the GCC implementation, however.


I'm monitoring the discussion and will try to rewrite this patch according to 
the guidance and avoid double mangling.


http://reviews.llvm.org/D18035



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


[PATCH] D21066: Pass MCSubtargetInfo instead of CPU and Triple to createMCAsmBackend

2016-06-07 Thread Andrey Turetskiy via cfe-commits
aturetsk created this revision.
aturetsk added reviewers: bruno, echristo, ahatanak, RKSimon.
aturetsk added a subscriber: cfe-commits.
Herald added a subscriber: mehdi_amini.

Pass MCSubtargetInfo instead of CPU and Triple to AsmBackend in order to be 
able to reach feature bits there (e.g. for ckecking of long nop support).
CPU and Triple are taken from MCSubtargetInfo.

http://reviews.llvm.org/D21066

Files:
  tools/driver/cc1as_main.cpp

Index: tools/driver/cc1as_main.cpp
===
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -381,7 +381,7 @@
 MCAsmBackend *MAB = nullptr;
 if (Opts.ShowEncoding) {
   CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
-  MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple, Opts.CPU);
+  MAB = TheTarget->createMCAsmBackend(*STI, *MRI);
 }
 auto FOut = llvm::make_unique(*Out);
 Str.reset(TheTarget->createAsmStreamer(
@@ -398,8 +398,8 @@
 }
 
 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
-MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple,
-  Opts.CPU);
+MCAsmBackend *MAB =
+TheTarget->createMCAsmBackend(*STI, *MRI);
 Triple T(Opts.Triple);
 Str.reset(TheTarget->createMCObjectStreamer(
 T, Ctx, *MAB, *Out, CE, *STI, Opts.RelaxAll,


Index: tools/driver/cc1as_main.cpp
===
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -381,7 +381,7 @@
 MCAsmBackend *MAB = nullptr;
 if (Opts.ShowEncoding) {
   CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
-  MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple, Opts.CPU);
+  MAB = TheTarget->createMCAsmBackend(*STI, *MRI);
 }
 auto FOut = llvm::make_unique(*Out);
 Str.reset(TheTarget->createAsmStreamer(
@@ -398,8 +398,8 @@
 }
 
 MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
-MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple,
-  Opts.CPU);
+MCAsmBackend *MAB =
+TheTarget->createMCAsmBackend(*STI, *MRI);
 Triple T(Opts.Triple);
 Str.reset(TheTarget->createMCObjectStreamer(
 T, Ctx, *MAB, *Out, CE, *STI, Opts.RelaxAll,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Aaron Ballman via cfe-commits
aaron.ballman marked an inline comment as done.


Comment at: test/clang-tidy/misc-misplaced-const.c:17
@@ +16,3 @@
+  const ip i3 = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i3' declared with a 
const-qualified typedef type; results in the type being 'int *const' instead of 
'const int *'
+

hokein wrote:
> Will the check show the warning on `ip const i3 = 0;`? Technically, `const ip 
> i3 = 0` is exactly the same with `ip const i3 = 0;`.
Yes, it will, but I should add a test case for it just the same.


http://reviews.llvm.org/D21036



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


Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 59868.
aaron.ballman marked an inline comment as done.
aaron.ballman added a comment.

Updated based on review feedback:

- Added another two test cases (one for templates and one for const binding to 
the right of the typedef type).
- Updated test cases to be less verbose in message checking
- Corrected case for a static function


http://reviews.llvm.org/D21036

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/MisplacedConstCheck.cpp
  clang-tidy/misc/MisplacedConstCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-misplaced-const.rst
  test/clang-tidy/misc-misplaced-const.c
  test/clang-tidy/misc-misplaced-const.cpp

Index: test/clang-tidy/misc-misplaced-const.cpp
===
--- test/clang-tidy/misc-misplaced-const.cpp
+++ test/clang-tidy/misc-misplaced-const.cpp
@@ -0,0 +1,29 @@
+// RUN: %check_clang_tidy %s misc-misplaced-const %t
+
+typedef int plain_i;
+typedef int *ip;
+typedef const int *cip;
+
+void func() {
+  if (const int *i = 0)
+;
+  if (const plain_i *i = 0)
+;
+  if (const cip i = 0)
+;
+
+  // CHECK-MESSAGES: :[[@LINE+1]]:16: warning: 'i' declared with a const-qualified typedef type; results in the type being 'int *const' instead of 'const int *'
+  if (const ip i = 0)
+;
+}
+
+template 
+struct S {
+  const Ty *i;
+  const Ty &i2;
+};
+
+template struct S;
+template struct S; // ok
+template struct S;
+template struct S; // ok
Index: test/clang-tidy/misc-misplaced-const.c
===
--- test/clang-tidy/misc-misplaced-const.c
+++ test/clang-tidy/misc-misplaced-const.c
@@ -0,0 +1,45 @@
+// RUN: %check_clang_tidy %s misc-misplaced-const %t
+
+typedef int plain_i;
+typedef int *ip;
+typedef const int *cip;
+
+typedef void (*func_ptr)(void);
+
+void func(void) {
+  // ok
+  const int *i0 = 0;
+  const plain_i *i1 = 0;
+  const cip i2 = 0; // const applies to both pointer and pointee.
+
+  // Not ok
+  const ip i3 = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i3' declared with a const-qualified typedef type; results in the type being 'int *const' instead of 'const int *'
+
+  ip const i4 = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i4' declared with a const-qualified
+
+  const volatile ip i5 = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 'i5' declared with a const-qualified typedef type; results in the type being 'int *const volatile' instead of 'const int *volatile'
+}
+
+void func2(const plain_i *i1,
+   const cip i2,
+   const ip i3,
+   // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 'i3' declared with a const-qualified
+   const int *i4) {
+}
+
+struct S {
+  const int *i0;
+  const plain_i *i1;
+  const cip i2;
+  const ip i3;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i3' declared with a const-qualified
+};
+
+// Function pointers should not be diagnosed because a function
+// pointer type can never be const.
+void func3(const func_ptr fp) {
+  const func_ptr fp2 = fp;
+}
Index: docs/clang-tidy/checks/misc-misplaced-const.rst
===
--- docs/clang-tidy/checks/misc-misplaced-const.rst
+++ docs/clang-tidy/checks/misc-misplaced-const.rst
@@ -0,0 +1,21 @@
+.. title:: clang-tidy - misc-misplaced-const
+
+misc-misplaced-const
+
+
+This check diagnoses when a const qualifier is applied to a typedef to a pointer
+type rather than to the pointee, because such constructs are often misleading to
+developers because the const applies to the pointer rather than the pointee.
+
+For instance, in the following code, the resulting type is `int *` const rather
+than `const int *`:
+
+.. code:: c++
+
+  typedef int *int_ptr;
+  void f(const int_ptr ptr);
+
+The check does not diagnose when the underlying typedef type is a pointer to a
+const type or a function pointer type. This is because the const qualifier is
+less likely to be mistaken because it would be redundant (or disallowed) on the
+underlying pointee type.
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -4,7 +4,6 @@
 =
 
 .. toctree::
-
boost-use-to-string
cert-dcl03-c (redirects to misc-static-assert) 
cert-dcl50-cpp
@@ -63,6 +62,7 @@
misc-inefficient-algorithm
misc-macro-parentheses
misc-macro-repeated-side-effects
+   misc-misplaced-const
misc-misplaced-widening-cast
misc-move-const-arg
misc-move-constructor-init
Index: clang-tidy/misc/MisplacedConstCheck.h
===
--- clang-tidy/misc/MisplacedConstCheck.h
+++ clang-tidy/misc/MisplacedConstCheck.h
@@ -0,0 +1,36 @@
+//===--- MisplacedConstCheck.h - clang-tidy---

Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Aaron Ballman via cfe-commits
aaron.ballman marked 2 inline comments as done.
aaron.ballman added a comment.

In http://reviews.llvm.org/D21036#450106, @sbenza wrote:

> I think this would be more interesting with macros.
>  Eg triggering in code like this:
>
>   #define FOO(type, op) const type& X = op()
>   FOO(int*, bar);


Sorry, I originally missed this comment.

That might be a reasonable addition to this check, but strikes me as a future 
enhancement. Are you looking for the patch to cover this case initially, or is 
it fine for a follow-up?


http://reviews.llvm.org/D21036



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


Re: [PATCH] D20512: [PATCH] Bug 27475 - Request header guard check processes .hpp files as well as .h files

2016-06-07 Thread Haojian Wu via cfe-commits
hokein added inline comments.


Comment at: clang-tidy/llvm/HeaderGuardCheck.h:19
@@ -18,3 +18,3 @@
 
 /// Finds and fixes header guards that do not adhere to LLVM style.
 class LLVMHeaderGuardCheck : public utils::HeaderGuardCheck {

hokein wrote:
> madsravn wrote:
> > hokein wrote:
> > > You should add a document for the option `HeaderFileExtensions` here.
> > I'm not sure what you mean here. What is "a document" in this context?
> Sorry for the unclear comment. You actually add an option 
> `HeaderFileExtensions` in `LLVMHeaderGuardCheck`, so you need to add a 
> document to describe it. See the file `DefinitionsInHeadersCheck.h` for 
> details.
You need to add a comment here, like:

```
/// Finds and fixes header guards that do not adhere to LLVM style.
///
///  The check supports these options:
///   - `HeaderFileExtensions`: a comma-separated list of filename extensions of
/// header files (The filename extension should not contain "." prefix).
/// ",h,hh,hpp,hxx" by default.
```


http://reviews.llvm.org/D20512



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


Re: [PATCH] D21019: [include-fixer] try to make vim header selection more friendly.

2016-06-07 Thread Benjamin Kramer via cfe-commits
bkramer accepted this revision.
bkramer added a comment.
This revision is now accepted and ready to land.

lg then.


http://reviews.llvm.org/D21019



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


Re: [PATCH] D21022: [ARM] Fix linker emulation for arm 32 big endian

2016-06-07 Thread Strahinja Petrovic via cfe-commits
spetrovic updated this revision to Diff 59870.
spetrovic marked an inline comment as done.
spetrovic added a comment.

Comment addressed.


http://reviews.llvm.org/D21022

Files:
  lib/Driver/Tools.cpp
  test/Driver/linux-ld.c

Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -1561,13 +1561,13 @@
 // RUN:   | FileCheck --check-prefix=CHECK-ARMEB %s
 // CHECK-ARMEB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-ARMEB-NOT: "--be8"
-// CHECK-ARMEB: "-m" "armebelf_linux_eabi"
+// CHECK-ARMEB: "-m" "armelfb_linux_eabi"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=armebv7-unknown-linux \
 // RUN: --gcc-toolchain="" \
 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-ARMV7EB %s
 // CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-ARMV7EB: "--be8"
-// CHECK-ARMV7EB: "-m" "armebelf_linux_eabi"
+// CHECK-ARMV7EB: "-m" "armelfb_linux_eabi"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9095,7 +9095,7 @@
 return "armelf_linux_eabi";
   case llvm::Triple::armeb:
   case llvm::Triple::thumbeb:
-return "armebelf_linux_eabi"; /* TODO: check which NAME.  */
+return "armelfb_linux_eabi";
   case llvm::Triple::ppc:
 return "elf32ppclinux";
   case llvm::Triple::ppc64:


Index: test/Driver/linux-ld.c
===
--- test/Driver/linux-ld.c
+++ test/Driver/linux-ld.c
@@ -1561,13 +1561,13 @@
 // RUN:   | FileCheck --check-prefix=CHECK-ARMEB %s
 // CHECK-ARMEB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-ARMEB-NOT: "--be8"
-// CHECK-ARMEB: "-m" "armebelf_linux_eabi"
+// CHECK-ARMEB: "-m" "armelfb_linux_eabi"
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: --target=armebv7-unknown-linux \
 // RUN: --gcc-toolchain="" \
 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-ARMV7EB %s
 // CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
 // CHECK-ARMV7EB: "--be8"
-// CHECK-ARMV7EB: "-m" "armebelf_linux_eabi"
+// CHECK-ARMV7EB: "-m" "armelfb_linux_eabi"
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9095,7 +9095,7 @@
 return "armelf_linux_eabi";
   case llvm::Triple::armeb:
   case llvm::Triple::thumbeb:
-return "armebelf_linux_eabi"; /* TODO: check which NAME.  */
+return "armelfb_linux_eabi";
   case llvm::Triple::ppc:
 return "elf32ppclinux";
   case llvm::Triple::ppc64:
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r272004 - [include-fixer] try to make vim header selection more friendly.

2016-06-07 Thread Eric Liu via cfe-commits
Author: ioeric
Date: Tue Jun  7 07:21:43 2016
New Revision: 272004

URL: http://llvm.org/viewvc/llvm-project?rev=272004&view=rev
Log:
[include-fixer] try to make vim header selection more friendly.

Summary: use 'input()' to get user's input so that we can support more options.

Reviewers: hokein, bkramer

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D21019

Modified:
clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py

Modified: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py?rev=272004&r1=272003&r2=272004&view=diff
==
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py (original)
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py Tue Jun  
7 07:21:43 2016
@@ -35,12 +35,30 @@ if vim.eval('exists("g:clang_include_fix
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
 
-def ShowDialog(message, choices, default_choice_index=0):
-  to_eval = "confirm('{0}', '{1}', '{2}')".format(message,
-  choices.strip(),
-  default_choice_index)
-  return int(vim.eval(to_eval));
-
+def GetUserSelection(message, headers, maximum_suggested_headers):
+  eval_message = message + '\n'
+  for idx, header in enumerate(headers[0:maximum_suggested_headers]):
+eval_message += "({0}). {1}\n".format(idx+1, header)
+  eval_message += "Enter (q) to quit;"
+  if maximum_suggested_headers < len(headers):
+eval_message += " (a) to show all candidates.";
+  eval_message += "\nSelect (default 1): "
+  res = vim.eval("input('{0}')".format(eval_message))
+  if res == '':
+# choose the top ranked header by default
+idx = 1
+  elif res == 'q':
+raise Exception('   Insertion cancelled...')
+  elif res == 'a' and maximum_suggested_headers < len(headers):
+return GetUserSelection(message, headers, len(headers))
+  else:
+try:
+  idx = int(res)
+  if idx <= 0 or idx > len(headers):
+raise Exception()
+except Exception:
+raise Exception('   ERROR: Invalid option "{0}"...Abort!'.format(res))
+  return headers[idx-1]
 
 def execute(command, text):
   p = subprocess.Popen(command,
@@ -88,7 +106,7 @@ def main():
 
   if not symbol:
 print "The file is fine, no need to add a header.\n"
-return;
+return
 
   if not headers:
 print "Couldn't find a header for {0}.\n".format(symbol)
@@ -102,19 +120,16 @@ def main():
 print "Added #include {0} for {1}.\n".format(headers[0], symbol)
 return
 
-  choices_message = ""
-  index = 1;
-  for header in headers[0:maximum_suggested_headers]:
-choices_message += "&{0} {1}\n".format(index, header)
-index += 1
-
-  select = ShowDialog("choose a header file for {0}.".format(symbol),
-  choices_message)
-  # Insert a selected header.
-  InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
-   "Headers":[headers[select-1]]}, text)
-  print "Added #include {0} for {1}.\n".format(headers[select-1], symbol)
-  return;
+  try:
+selected = GetUserSelection("choose a header file for {0}.".format(symbol),
+headers, maximum_suggested_headers)
+# Insert a selected header.
+InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
+ "Headers":[selected]}, text)
+print "Added #include {0} for {1}.\n".format(selected, symbol)
+  except Exception as error:
+print >> sys.stderr, error.message
+  return
 
 
 if __name__ == '__main__':


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


Re: [PATCH] D21019: [include-fixer] try to make vim header selection more friendly.

2016-06-07 Thread Eric Liu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272004: [include-fixer] try to make vim header selection 
more friendly. (authored by ioeric).

Changed prior to commit:
  http://reviews.llvm.org/D21019?vs=59858&id=59871#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21019

Files:
  clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py

Index: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
===
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
@@ -35,12 +35,30 @@
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
 
-def ShowDialog(message, choices, default_choice_index=0):
-  to_eval = "confirm('{0}', '{1}', '{2}')".format(message,
-  choices.strip(),
-  default_choice_index)
-  return int(vim.eval(to_eval));
-
+def GetUserSelection(message, headers, maximum_suggested_headers):
+  eval_message = message + '\n'
+  for idx, header in enumerate(headers[0:maximum_suggested_headers]):
+eval_message += "({0}). {1}\n".format(idx+1, header)
+  eval_message += "Enter (q) to quit;"
+  if maximum_suggested_headers < len(headers):
+eval_message += " (a) to show all candidates.";
+  eval_message += "\nSelect (default 1): "
+  res = vim.eval("input('{0}')".format(eval_message))
+  if res == '':
+# choose the top ranked header by default
+idx = 1
+  elif res == 'q':
+raise Exception('   Insertion cancelled...')
+  elif res == 'a' and maximum_suggested_headers < len(headers):
+return GetUserSelection(message, headers, len(headers))
+  else:
+try:
+  idx = int(res)
+  if idx <= 0 or idx > len(headers):
+raise Exception()
+except Exception:
+raise Exception('   ERROR: Invalid option "{0}"...Abort!'.format(res))
+  return headers[idx-1]
 
 def execute(command, text):
   p = subprocess.Popen(command,
@@ -88,7 +106,7 @@
 
   if not symbol:
 print "The file is fine, no need to add a header.\n"
-return;
+return
 
   if not headers:
 print "Couldn't find a header for {0}.\n".format(symbol)
@@ -102,19 +120,16 @@
 print "Added #include {0} for {1}.\n".format(headers[0], symbol)
 return
 
-  choices_message = ""
-  index = 1;
-  for header in headers[0:maximum_suggested_headers]:
-choices_message += "&{0} {1}\n".format(index, header)
-index += 1
-
-  select = ShowDialog("choose a header file for {0}.".format(symbol),
-  choices_message)
-  # Insert a selected header.
-  InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
-   "Headers":[headers[select-1]]}, text)
-  print "Added #include {0} for {1}.\n".format(headers[select-1], symbol)
-  return;
+  try:
+selected = GetUserSelection("choose a header file for {0}.".format(symbol),
+headers, maximum_suggested_headers)
+# Insert a selected header.
+InsertHeaderToVimBuffer({"SymbolIdentifier": symbol,
+ "Headers":[selected]}, text)
+print "Added #include {0} for {1}.\n".format(selected, symbol)
+  except Exception as error:
+print >> sys.stderr, error.message
+  return
 
 
 if __name__ == '__main__':


Index: clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
===
--- clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
+++ clang-tools-extra/trunk/include-fixer/tool/clang-include-fixer.py
@@ -35,12 +35,30 @@
   vim.eval('g:clang_include_fixer_maximum_suggested_headers'))
 
 
-def ShowDialog(message, choices, default_choice_index=0):
-  to_eval = "confirm('{0}', '{1}', '{2}')".format(message,
-  choices.strip(),
-  default_choice_index)
-  return int(vim.eval(to_eval));
-
+def GetUserSelection(message, headers, maximum_suggested_headers):
+  eval_message = message + '\n'
+  for idx, header in enumerate(headers[0:maximum_suggested_headers]):
+eval_message += "({0}). {1}\n".format(idx+1, header)
+  eval_message += "Enter (q) to quit;"
+  if maximum_suggested_headers < len(headers):
+eval_message += " (a) to show all candidates.";
+  eval_message += "\nSelect (default 1): "
+  res = vim.eval("input('{0}')".format(eval_message))
+  if res == '':
+# choose the top ranked header by default
+idx = 1
+  elif res == 'q':
+raise Exception('   Insertion cancelled...')
+  elif res == 'a' and maximum_suggested_headers < len(headers):
+return GetUserSelection(message, headers, len(headers))
+  else:
+try:
+  idx = int(res)
+  if idx <= 0 or idx > len(headers):
+raise Exception()
+except Exception:
+raise Exc

Re: [PATCH] D18761: [mips] Enable IAS by default for 32-bit MIPS targets (O32).

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders closed this revision.
dsanders added a comment.

This has already been committed. I'm not sure why it didn't auto-close.


http://reviews.llvm.org/D18761



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


[PATCH] D21070: Pass the ABI in the triple when appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a subscriber: cfe-commits.
dsanders added a dependency: D21069: [mips] Require that ABI's are passed in 
the triple within LLVM..
Herald added subscribers: srhines, danalbert, tberghammer.

'clang -cc1' and 'clang -cc1as' will mutate the triple to account for
-target-abi if such a conversion is defined by Triple::getABIVariant().
Otherwise, the ABI will continue to be passed via MCTargetOptions::ABIName.

Additionally, 'clang -cc1as' now applies the effect of -target-abi. Previously
it was ignored.

Depends on D21069

http://reviews.llvm.org/D21070

Files:
  lib/Basic/Targets.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  tools/driver/cc1as_main.cpp

Index: tools/driver/cc1as_main.cpp
===
--- tools/driver/cc1as_main.cpp
+++ tools/driver/cc1as_main.cpp
@@ -71,6 +71,10 @@
   /// The name of the target triple to assemble for.
   std::string Triple;
 
+  /// The name of the ABI to assembler for or the empty string for the default
+  /// ABI.
+  std::string ABI;
+
   /// If given, the name of the target CPU to determine which instructions
   /// are legal.
   std::string CPU;
@@ -136,6 +140,7 @@
 public:
   AssemblerInvocation() {
 Triple = "";
+ABI = "";
 NoInitialTextSection = 0;
 InputFile = "-";
 OutputPath = "-";
@@ -187,13 +192,20 @@
 
   // Target Options
   Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple));
+  Opts.ABI = Args.getLastArgValue(OPT_target_abi);
   Opts.CPU = Args.getLastArgValue(OPT_target_cpu);
   Opts.Features = Args.getAllArgValues(OPT_target_feature);
 
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
 
+  llvm::Triple ABITriple = llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() != llvm::Triple::UnknownArch) {
+Opts.Triple = ABITriple.str();
+Opts.ABI = "";
+  }
+
   // Language Options
   Opts.IncludePaths = Args.getAllArgValues(OPT_I);
   Opts.NoInitialTextSection = Args.hasArg(OPT_n);
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -2253,6 +2253,14 @@
   // Use the default target triple if unspecified.
   if (Opts.Triple.empty())
 Opts.Triple = llvm::sys::getDefaultTargetTriple();
+
+  // Pass the ABI in the triple if the target prefers this, otherwise
+  // pass it in Opts.ABI.
+  llvm::Triple ABITriple = llvm::Triple(Opts.Triple).getABIVariant(Opts.ABI);
+  if (ABITriple.getArch() != llvm::Triple::UnknownArch) {
+Opts.Triple = ABITriple.str();
+Opts.ABI = "";
+  }
 }
 
 bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1177,7 +1177,7 @@
   // MIPS32r6 is the default for mips(el)?-img-linux-gnu and MIPS64r6 is the
   // default for mips64(el)?-img-linux-gnu.
   if (Triple.getVendor() == llvm::Triple::ImaginationTechnologies &&
-  Triple.getEnvironment() == llvm::Triple::GNU) {
+  Triple.isGNUEnvironment()) {
 DefMips32CPU = "mips32r6";
 DefMips64CPU = "mips64r6";
   }
Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -2277,7 +2277,7 @@
 
   if (TargetTriple.getVendor() == llvm::Triple::ImaginationTechnologies &&
   TargetTriple.getOS() == llvm::Triple::Linux &&
-  TargetTriple.getEnvironment() == llvm::Triple::GNU) {
+  TargetTriple.isGNUEnvironment()) {
 // Select mips-img-linux-gnu toolchain.
 for (auto Candidate : {&ImgMultilibsV1, &ImgMultilibsV2}) {
   if (Candidate->select(Flags, Result.SelectedMultilib)) {
Index: lib/Basic/Targets.cpp
===
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -7054,10 +7054,22 @@
 BigEndian = getTriple().getArch() == llvm::Triple::mips ||
 getTriple().getArch() == llvm::Triple::mips64;
 
-setABI((getTriple().getArch() == llvm::Triple::mips ||
-getTriple().getArch() == llvm::Triple::mipsel)
-   ? "o32"
-   : "n64");
+if (getTriple().getEnvironment() == llvm::Triple::ABI32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABI32 ||
+getTriple().getEnvironment() == llvm::Triple::AndroidABI32)
+  setABI("o32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABIN32 ||
+getTriple().getEnvironment() == llvm::Triple::GNUABIN32)
+  setABI("n32");
+else if (getTriple().getEnvironment() == llvm::Triple::ABI64 ||
+ getTriple().getEnvironment() == llvm::Triple::GNUABI64 ||
+  

[PATCH] D21071: [mips] Account for -mabi when determining whether IAS is the default or not.

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added a subscriber: cfe-commits.
dsanders added a dependency: D21070: Pass the ABI in the triple when 
appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'.
Herald added subscribers: dschuff, jfb.

This stops cases such as '-target mips-linux-gnu -mabi=n32' from using the
IAS by default.

Depends on D21070.

http://reviews.llvm.org/D21071

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/MSVCToolChain.cpp
  lib/Driver/MinGWToolChain.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp

Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4236,7 +4236,7 @@
   // Decide whether to use verbose asm. Verbose assembly is the default on
   // toolchains which have the integrated assembler on by default.
   bool IsIntegratedAssemblerDefault =
-  getToolChain().IsIntegratedAssemblerDefault();
+  getToolChain().IsIntegratedAssemblerDefault(Args);
   if (Args.hasFlag(options::OPT_fverbose_asm, options::OPT_fno_verbose_asm,
IsIntegratedAssemblerDefault) ||
   Args.hasArg(options::OPT_dA))
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -207,7 +207,8 @@
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
   bool isPICDefaultForced() const override;
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
 
 protected:
   Tool *getTool(Action::ActionClass AC) const override;
@@ -314,7 +315,8 @@
 // expected to use /usr/include/Block.h.
 return true;
   }
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 // Default integrated assembler to on for Apple's MachO targets.
 return true;
   }
@@ -633,7 +635,10 @@
   Solaris(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
 
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 
   void AddClangCXXStdlibIncludeArgs(
   const llvm::opt::ArgList &DriverArgs,
@@ -651,7 +656,8 @@
   MinGW(const Driver &D, const llvm::Triple &Triple,
 const llvm::opt::ArgList &Args);
 
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
   bool IsUnwindTablesDefault() const override;
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
@@ -896,7 +902,10 @@
   LanaiToolChain(const Driver &D, const llvm::Triple &Triple,
  const llvm::opt::ArgList &Args)
   : Generic_ELF(D, Triple, Args) {}
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY HexagonToolChain : public Linux {
@@ -919,7 +928,8 @@
   CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
 
   StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 return true;
   }
 
@@ -944,7 +954,10 @@
   AMDGPUToolChain(const Driver &D, const llvm::Triple &Triple,
 const llvm::opt::ArgList &Args);
   unsigned GetDefaultDwarfVersion() const override { return 2; }
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY NaClToolChain : public Generic_ELF {
@@ -964,7 +977,8 @@
   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
 
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 return getTriple().getArch() == llvm::Triple::mipsel;
   }
 
@@ -1007,7 +1021,8 @@
   TranslateArgs(const llvm::opt::DerivedArgList &Args,
 const char *BoundArch) const override;
 
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
   bool IsUnwindTablesDefault() const override;
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
@@ -1054,7 +1069,10 @@
   CrossWindowsToolChain(const Driver &D, const llvm::Triple &T,
 const llvm::opt

Re: [PATCH] D21071: [mips] Account for -mabi when determining whether IAS is the default or not.

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders abandoned this revision.
dsanders added a comment.

Part of this patch is missing. I'll repost it soon.


http://reviews.llvm.org/D21071



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


[PATCH] D21072: [mips] Account for -mabi when determining whether IAS is the default or not.

2016-06-07 Thread Daniel Sanders via cfe-commits
dsanders created this revision.
dsanders added subscribers: jfb, dschuff, cfe-commits.
dsanders added a dependency: D21070: Pass the ABI in the triple when 
appropriate (currently for MIPS) for 'clang -cc1' and 'clang -cc1as'.
Herald added subscribers: sdardis, srhines, danalbert, tberghammer.

This stops cases such as '-target mips-linux-gnu -mabi=n32' from using the
IAS by default.

Depends on D21070.

http://reviews.llvm.org/D21072

Files:
  include/clang/Driver/ToolChain.h
  lib/Driver/MSVCToolChain.cpp
  lib/Driver/MinGWToolChain.cpp
  lib/Driver/ToolChain.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  test/Driver/mips-integrated-as.s

Index: test/Driver/mips-integrated-as.s
===
--- test/Driver/mips-integrated-as.s
+++ test/Driver/mips-integrated-as.s
@@ -1,3 +1,5 @@
+// RUN: %clang -target mips-linux-gnu -### -c %s 2>&1 | \
+// RUN:   FileCheck -check-prefix=ABI-O32 %s
 // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \
 // RUN:   FileCheck -check-prefix=ABI-O32 %s
 // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabi=32 2>&1 | \
@@ -293,3 +295,13 @@
 // IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+single-float"
 // IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx"
 // IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg"
+
+// RUN: %clang -target mips-linux-gnu -### -c %s -mips64 -mabi=n32 2>&1 | \
+// RUN:   FileCheck -check-prefix=GAS %s
+// RUN: %clang -target mips64-linux-gnu -### -c %s -mabi=n32 2>&1 | \
+// RUN:   FileCheck -check-prefix=GAS %s
+// RUN: %clang -target mips-linux-gnu -### -c %s -mips64 -mabi=64 2>&1 | \
+// RUN:   FileCheck -check-prefix=GAS %s
+// RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 | \
+// RUN:   FileCheck -check-prefix=GAS %s
+// GAS-NOT: -cc1as
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4236,7 +4236,7 @@
   // Decide whether to use verbose asm. Verbose assembly is the default on
   // toolchains which have the integrated assembler on by default.
   bool IsIntegratedAssemblerDefault =
-  getToolChain().IsIntegratedAssemblerDefault();
+  getToolChain().IsIntegratedAssemblerDefault(Args);
   if (Args.hasFlag(options::OPT_fverbose_asm, options::OPT_fno_verbose_asm,
IsIntegratedAssemblerDefault) ||
   Args.hasArg(options::OPT_dA))
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -207,7 +207,8 @@
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
   bool isPICDefaultForced() const override;
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
 
 protected:
   Tool *getTool(Action::ActionClass AC) const override;
@@ -314,7 +315,8 @@
 // expected to use /usr/include/Block.h.
 return true;
   }
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 // Default integrated assembler to on for Apple's MachO targets.
 return true;
   }
@@ -633,7 +635,10 @@
   Solaris(const Driver &D, const llvm::Triple &Triple,
   const llvm::opt::ArgList &Args);
 
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 
   void AddClangCXXStdlibIncludeArgs(
   const llvm::opt::ArgList &DriverArgs,
@@ -651,7 +656,8 @@
   MinGW(const Driver &D, const llvm::Triple &Triple,
 const llvm::opt::ArgList &Args);
 
-  bool IsIntegratedAssemblerDefault() const override;
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override;
   bool IsUnwindTablesDefault() const override;
   bool isPICDefault() const override;
   bool isPIEDefault() const override;
@@ -896,7 +902,10 @@
   LanaiToolChain(const Driver &D, const llvm::Triple &Triple,
  const llvm::opt::ArgList &Args)
   : Generic_ELF(D, Triple, Args) {}
-  bool IsIntegratedAssemblerDefault() const override { return true; }
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
+return true;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY HexagonToolChain : public Linux {
@@ -919,7 +928,8 @@
   CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override;
 
   StringRef GetGCCLibAndIncVersion() const { return GCCLibAndIncVersion.Text; }
-  bool IsIntegratedAssemblerDefault() const override {
+  bool
+  IsIntegratedAssemblerDefault(const llvm::opt::ArgList &Args) const override {
 return true;
   }
 
@@ -944,7 +954,10 @@
   AMDGPUToolChain(const Driver &D, const llvm::Triple &Tripl

Re: [PATCH] D21023: [mips] Defer validity check for CPU/ABI pairs and improve error message for invalid cases.

2016-06-07 Thread Simon Atanasyan via cfe-commits
atanasyan accepted this revision.
atanasyan added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D21023



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


r272012 - [clang][AVX512][Intrinsics] Adding intrinsics reduce_[round]_{ss|sd} to clang

2016-06-07 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Tue Jun  7 09:00:20 2016
New Revision: 272012

URL: http://llvm.org/viewvc/llvm-project?rev=272012&view=rev
Log:
[clang][AVX512][Intrinsics] Adding intrinsics reduce_[round]_{ss|sd} to clang

Differential Revision: http://reviews.llvm.org/D21014


Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512dqintrin.h
cfe/trunk/test/CodeGen/avx512dq-builtins.c

Modified: cfe/trunk/include/clang/Basic/BuiltinsX86.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsX86.def?rev=272012&r1=272011&r2=272012&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Jun  7 09:00:20 2016
@@ -1531,6 +1531,8 @@ TARGET_BUILTIN(__builtin_ia32_reducepd12
 TARGET_BUILTIN(__builtin_ia32_reducepd256_mask, "V4dV4dIiV4dUc", "", 
"avx512vl,avx512dq")
 TARGET_BUILTIN(__builtin_ia32_reduceps128_mask, "V4fV4fIiV4fUc", "", 
"avx512vl,avx512dq")
 TARGET_BUILTIN(__builtin_ia32_reduceps256_mask, "V8fV8fIiV8fUc", "", 
"avx512vl,avx512dq")
+TARGET_BUILTIN(__builtin_ia32_reducesd_mask, "V2dV2dV2dV2dUcIiIi", "", 
"avx512vl,avx512dq")
+TARGET_BUILTIN(__builtin_ia32_reducess_mask, "V4fV4fV4fV4fUcIiIi", "", 
"avx512vl,avx512dq")
 TARGET_BUILTIN(__builtin_ia32_pmaddubsw128_mask, "V8sV16cV16cV8sUc", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmaddubsw256_mask, "V16sV32cV32cV16sUs", "", 
"avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmaddwd128_mask, "V4iV8sV8sV4iUc", "", 
"avx512vl,avx512bw")

Modified: cfe/trunk/lib/Headers/avx512dqintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512dqintrin.h?rev=272012&r1=272011&r2=272012&view=diff
==
--- cfe/trunk/lib/Headers/avx512dqintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512dqintrin.h Tue Jun  7 09:00:20 2016
@@ -851,6 +851,78 @@ _mm512_maskz_cvtepu64_ps (__mmask8 __U,
   (__v16sf)_mm512_setzero_ps(), \
   (__mmask16)(U), (int)(R)); })
 
+#define _mm_reduce_ss(A, B, C) __extension__ ({  \
+  (__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), 
(__v4sf)(__m128)(B), \
+  (__v4sf)_mm_setzero_ps(), \
+  (__mmask8)-1, \
+  (int)(C),_MM_FROUND_CUR_DIRECTION); 
})
+
+#define _mm_mask_reduce_ss(W, U, A, B, C) __extension__ ({   \
+  (__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128 )(A), (__v4sf)(__m128 
)(B), \
+  (__v4sf)(__m128 )(W), \
+  (__mmask8)(U), \
+  (int)(C),_MM_FROUND_CUR_DIRECTION); 
})
+
+#define _mm_maskz_reduce_ss(U, A, B, C) __extension__ ({   \
+  (__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), (__v4sf)(__m128 
)(B), \
+  (__v4sf)_mm_setzero_ps(), \
+  (__mmask8)(U), \
+  (int)(C),_MM_FROUND_CUR_DIRECTION); 
})
+   
+#define _mm_reduce_round_ss(A, B, C, R) __extension__ ({  \
+  (__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), (__v4sf)(__m128 
)(B), \
+  (__v4sf)_mm_setzero_ps(), \
+  (__mmask8)-1, \
+  (int)(C),(int)(R)); })
+
+#define _mm_mask_reduce_round_ss(W, U, A, B, C, R) __extension__ ({   \
+  (__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128 )(A), (__v4sf)(__m128 
)(B), \
+  (__v4sf)(__m128 )(W), \
+  (__mmask8)(U), \
+  (int)(C),(int)(R)); })
+
+#define _mm_maskz_reduce_round_ss(U, A, B, C, R) __extension__ ({   \
+  (__m128)__builtin_ia32_reducess_mask((__v4sf)(__m128)(A), (__v4sf)(__m128 
)(B), \
+  (__v4sf)_mm_setzero_ps(), \
+  (__mmask8)(U), \
+  (int)(C),(int)(R)); })
+
+#define _mm_reduce_sd(A, B, C) __extension__ ({  \
+  (__m128d)__builtin_ia32_reducesd_mask((__v2df)(__m128)(A), 
(__v2df)(__m128)(B), \
+  (__v2df)_mm_setzero_pd(), \
+  (__mmask8)-1, \
+  (int)(C),_MM_FROUND_CUR_DIRECTION); 
})
+
+#define _mm_mask_reduce_sd(W, U, A, B, C) __extension__ ({   \
+  (__m128d)__builtin_ia32_reducesd_mask((__v2df)(__m128 )(A), 
(__v2df)(__m128)(B), \
+  (__v2df)(__m128 )(W), \
+  

Re: [PATCH] D21014: [Clang][AVX512][Intrinsics] Adding intrinsics reduce_[round]_{ss|sd} to clang

2016-06-07 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL272012: [clang][AVX512][Intrinsics] Adding intrinsics 
reduce_[round]_{ss|sd} to clang (authored by mzuckerm).

Changed prior to commit:
  http://reviews.llvm.org/D21014?vs=59697&id=59882#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D21014

Files:
  cfe/trunk/include/clang/Basic/BuiltinsX86.def
  cfe/trunk/lib/Headers/avx512dqintrin.h
  cfe/trunk/test/CodeGen/avx512dq-builtins.c

Index: cfe/trunk/include/clang/Basic/BuiltinsX86.def
===
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def
@@ -1531,6 +1531,8 @@
 TARGET_BUILTIN(__builtin_ia32_reducepd256_mask, "V4dV4dIiV4dUc", "", "avx512vl,avx512dq")
 TARGET_BUILTIN(__builtin_ia32_reduceps128_mask, "V4fV4fIiV4fUc", "", "avx512vl,avx512dq")
 TARGET_BUILTIN(__builtin_ia32_reduceps256_mask, "V8fV8fIiV8fUc", "", "avx512vl,avx512dq")
+TARGET_BUILTIN(__builtin_ia32_reducesd_mask, "V2dV2dV2dV2dUcIiIi", "", "avx512vl,avx512dq")
+TARGET_BUILTIN(__builtin_ia32_reducess_mask, "V4fV4fV4fV4fUcIiIi", "", "avx512vl,avx512dq")
 TARGET_BUILTIN(__builtin_ia32_pmaddubsw128_mask, "V8sV16cV16cV8sUc", "", "avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmaddubsw256_mask, "V16sV32cV32cV16sUs", "", "avx512vl,avx512bw")
 TARGET_BUILTIN(__builtin_ia32_pmaddwd128_mask, "V4iV8sV8sV4iUc", "", "avx512vl,avx512bw")
Index: cfe/trunk/test/CodeGen/avx512dq-builtins.c
===
--- cfe/trunk/test/CodeGen/avx512dq-builtins.c
+++ cfe/trunk/test/CodeGen/avx512dq-builtins.c
@@ -743,6 +743,78 @@
   return _mm512_maskz_reduce_round_ps(__U, __A, 4, 8); 
 }
 
+__m128 test_mm_reduce_ss(__m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_reduce_ss
+  // CHECK: @llvm.x86.avx512.mask.reduce.ss
+  return _mm_reduce_ss(__A, __B, 4);
+}
+
+__m128 test_mm_mask_reduce_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_mask_reduce_ss
+  // CHECK: @llvm.x86.avx512.mask.reduce.ss
+  return _mm_mask_reduce_ss(__W, __U, __A, __B, 4);
+}
+
+__m128 test_mm_maskz_reduce_ss(__mmask8 __U, __m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_maskz_reduce_ss
+  // CHECK: @llvm.x86.avx512.mask.reduce.ss
+  return _mm_maskz_reduce_ss(__U, __A, __B, 4);
+}
+
+__m128 test_mm_reduce_round_ss(__m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_reduce_round_ss
+  // CHECK: @llvm.x86.avx512.mask.reduce.ss
+  return _mm_reduce_round_ss(__A, __B, 4, 8);
+}
+
+__m128 test_mm_mask_reduce_round_ss(__m128 __W, __mmask8 __U, __m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_mask_reduce_round_ss
+  // CHECK: @llvm.x86.avx512.mask.reduce.ss
+  return _mm_mask_reduce_round_ss(__W, __U, __A, __B, 4, 8);
+}
+
+__m128 test_mm_maskz_reduce_round_ss(__mmask8 __U, __m128 __A, __m128 __B) {
+  // CHECK-LABEL: @test_mm_maskz_reduce_round_ss
+  // CHECK: @llvm.x86.avx512.mask.reduce.ss
+  return _mm_maskz_reduce_round_ss(__U, __A, __B, 4, 8);
+}
+
+__m128d test_mm_reduce_sd(__m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_reduce_sd
+  // CHECK: @llvm.x86.avx512.mask.reduce.sd
+  return _mm_reduce_sd(__A, __B, 4);
+}
+
+__m128d test_mm_mask_reduce_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_mask_reduce_sd
+  // CHECK: @llvm.x86.avx512.mask.reduce.sd
+  return _mm_mask_reduce_sd(__W, __U, __A, __B, 4);
+}
+
+__m128d test_mm_maskz_reduce_sd(__mmask8 __U, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_maskz_reduce_sd
+  // CHECK: @llvm.x86.avx512.mask.reduce.sd
+  return _mm_maskz_reduce_sd(__U, __A, __B, 4);
+}
+
+__m128d test_mm_reduce_round_sd(__m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_reduce_round_sd
+  // CHECK: @llvm.x86.avx512.mask.reduce.sd
+  return _mm_reduce_round_sd(__A, __B, 4, 8);
+}
+
+__m128d test_mm_mask_reduce_round_sd(__m128d __W, __mmask8 __U, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_mask_reduce_round_sd
+  // CHECK: @llvm.x86.avx512.mask.reduce.sd
+  return _mm_mask_reduce_round_sd(__W, __U, __A, __B, 4, 8);
+}
+
+__m128d test_mm_maskz_reduce_round_sd(__mmask8 __U, __m128d __A, __m128d __B) {
+  // CHECK-LABEL: @test_mm_maskz_reduce_round_sd
+  // CHECK: @llvm.x86.avx512.mask.reduce.sd
+  return _mm_maskz_reduce_round_sd(__U, __A, __B, 4, 8);
+}
+
 __mmask16 test_mm512_movepi32_mask(__m512i __A) {
   // CHECK-LABEL: @test_mm512_movepi32_mask
   // CHECK: @llvm.x86.avx512.cvtd2mask.512
Index: cfe/trunk/lib/Headers/avx512dqintrin.h
===
--- cfe/trunk/lib/Headers/avx512dqintrin.h
+++ cfe/trunk/lib/Headers/avx512dqintrin.h
@@ -851,6 +851,78 @@
   (__v16sf)_mm512_setzero_ps(), \
   (__mmask16)(U), (int)(R)); })
 
+#define _mm_reduce_ss(A, B, C) __extension__ ({  \
+  (__m128)__builtin_ia32_r

Re: [PATCH] D20687: [ASTMatchers] Make isNoThrow and hasDynamicExceptionSpec polymorphic for use with both functionDecl and functionProtoType

2016-06-07 Thread Aaron Ballman via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM, thank you for working on this!


http://reviews.llvm.org/D20687



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


Re: [PATCH] D20687: [ASTMatchers] Make isNoThrow and hasDynamicExceptionSpec polymorphic for use with both functionDecl and functionProtoType

2016-06-07 Thread don hinton via cfe-commits
hintonda added a comment.

Thanks Aaron.  If you could commit for me, I'd appreciate it.  Thanks again...


http://reviews.llvm.org/D20687



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


Re: [PATCH] D15994: Allow for unfinished #if blocks in preambles.

2016-06-07 Thread Erik Verbruggen via cfe-commits
erikjv abandoned this revision.
erikjv added a comment.

This will give errors about unbalanced #if/#endif for header guards.


http://reviews.llvm.org/D15994



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


[PATCH] D21074: Correct invalid end location in diagnostics for some identifiers.

2016-06-07 Thread Erik Verbruggen via cfe-commits
erikjv created this revision.
erikjv added reviewers: bkramer, klimek.
erikjv added a subscriber: cfe-commits.

Declaration names in DeclSpec had only their start set to a valid
location, so when the type specifier was missing, only the carret would
be shown at the first character of the name of a member declaration. Now
the whole identifier is underlined, which is useful for IDEs using
libclang.

Also, when the lookup for an identifier-expression failed, the end
location for that identifier was invalid.

Fixes PR25374.


http://reviews.llvm.org/D21074

Files:
  lib/Lex/Lexer.cpp
  test/Lexer/preamble.c
  test/Lexer/preamble2.c

Index: test/Lexer/preamble2.c
===
--- /dev/null
+++ test/Lexer/preamble2.c
@@ -0,0 +1,19 @@
+// Preamble detection test: header with an include guard.
+#ifndef HEADER_H
+#define HEADER_H
+#include "foo"
+int bar;
+#endif
+
+// This test checks for detection of the preamble of a file, which
+// includes all of the starting comments and #includes.
+
+// RUN: %clang_cc1 -print-preamble %s > %t
+// RUN: echo END. >> %t
+// RUN: FileCheck < %t %s
+
+// CHECK: // Preamble detection test: header with an include guard.
+// CHECK-NEXT: #ifndef HEADER_H
+// CHECK-NEXT: #define HEADER_H
+// CHECK-NEXT: #include "foo"
+// CHECK-NEXT: END.
Index: test/Lexer/preamble.c
===
--- test/Lexer/preamble.c
+++ test/Lexer/preamble.c
@@ -9,15 +9,12 @@
 #pragma unknown
 #endif
 #ifdef WIBBLE
-#include "honk"
-#else
-int foo();
+#include "foo"
+int bar;
 #endif
 
 // This test checks for detection of the preamble of a file, which
-// includes all of the starting comments and #includes. Note that any
-// changes to the preamble part of this file must be mirrored in
-// Inputs/preamble.txt, since we diff against it.
+// includes all of the starting comments and #includes.
 
 // RUN: %clang_cc1 -print-preamble %s > %t
 // RUN: echo END. >> %t
@@ -33,4 +30,6 @@
 // CHECK-NEXT: #endif
 // CHECK-NEXT: #pragma unknown
 // CHECK-NEXT: #endif
+// CHECK-NEXT: #ifdef WIBBLE
+// CHECK-NEXT: #include "foo"
 // CHECK-NEXT: END.
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -552,7 +552,7 @@
   bool InPreprocessorDirective = false;
   Token TheTok;
   Token IfStartTok;
-  unsigned IfCount = 0;
+  int IfCount = 0;
   SourceLocation ActiveCommentLoc;
 
   unsigned MaxLineOffset = 0;
@@ -656,8 +656,10 @@
 
 case PDK_EndIf:
   // Mismatched #endif. The preamble ends here.
-  if (IfCount == 0)
+  if (IfCount == 0) {
+--IfCount;
 break;
+  }
 
   --IfCount;
   continue;
@@ -682,7 +684,8 @@
   } while (true);
   
   SourceLocation End;
-  if (IfCount)
+  if (IfCount < 0) // This allows for open #ifs, so a header with an include
+   // guard will have a preamble generated for it.
 End = IfStartTok.getLocation();
   else if (ActiveCommentLoc.isValid())
 End = ActiveCommentLoc; // don't truncate a decl comment.


Index: test/Lexer/preamble2.c
===
--- /dev/null
+++ test/Lexer/preamble2.c
@@ -0,0 +1,19 @@
+// Preamble detection test: header with an include guard.
+#ifndef HEADER_H
+#define HEADER_H
+#include "foo"
+int bar;
+#endif
+
+// This test checks for detection of the preamble of a file, which
+// includes all of the starting comments and #includes.
+
+// RUN: %clang_cc1 -print-preamble %s > %t
+// RUN: echo END. >> %t
+// RUN: FileCheck < %t %s
+
+// CHECK: // Preamble detection test: header with an include guard.
+// CHECK-NEXT: #ifndef HEADER_H
+// CHECK-NEXT: #define HEADER_H
+// CHECK-NEXT: #include "foo"
+// CHECK-NEXT: END.
Index: test/Lexer/preamble.c
===
--- test/Lexer/preamble.c
+++ test/Lexer/preamble.c
@@ -9,15 +9,12 @@
 #pragma unknown
 #endif
 #ifdef WIBBLE
-#include "honk"
-#else
-int foo();
+#include "foo"
+int bar;
 #endif
 
 // This test checks for detection of the preamble of a file, which
-// includes all of the starting comments and #includes. Note that any
-// changes to the preamble part of this file must be mirrored in
-// Inputs/preamble.txt, since we diff against it.
+// includes all of the starting comments and #includes.
 
 // RUN: %clang_cc1 -print-preamble %s > %t
 // RUN: echo END. >> %t
@@ -33,4 +30,6 @@
 // CHECK-NEXT: #endif
 // CHECK-NEXT: #pragma unknown
 // CHECK-NEXT: #endif
+// CHECK-NEXT: #ifdef WIBBLE
+// CHECK-NEXT: #include "foo"
 // CHECK-NEXT: END.
Index: lib/Lex/Lexer.cpp
===
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -552,7 +552,7 @@
   bool InPreprocessorDirective = false;
   Token TheTok;
   Token IfStartTok;
-  unsigned IfCount = 0;
+  int IfCount = 0;
  

Re: [PATCH] D21074: Correct invalid end location in diagnostics for some identifiers.

2016-06-07 Thread Erik Verbruggen via cfe-commits
erikjv abandoned this revision.
erikjv added a comment.

Wrong patch


http://reviews.llvm.org/D21074



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


[PATCH] D21075: Correct invalid end location in diagnostics for some identifiers.

2016-06-07 Thread Erik Verbruggen via cfe-commits
erikjv created this revision.
erikjv added reviewers: bkramer, klimek.
erikjv added a subscriber: cfe-commits.

Declaration names in DeclSpec had only their start set to a valid
location, so when the type specifier was missing, only the carret would
be shown at the first character of the name of a member declaration. Now
the whole identifier is underlined, which is useful for IDEs using
libclang.

Also, when the lookup for an identifier-expression failed, the end
location for that identifier was invalid.

Fixes PR25374.


http://reviews.llvm.org/D21075

Files:
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaType.cpp

Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -1335,8 +1335,11 @@
   // specifiers in each declaration, and in the specifier-qualifier list in
   // each struct declaration and type name."
   if (S.getLangOpts().CPlusPlus) {
+auto R = DS.getSourceRange();
+if (R.getEnd().isInvalid())
+  R.setEnd(R.getBegin());
 S.Diag(DeclLoc, diag::err_missing_type_specifier)
-  << DS.getSourceRange();
+  << R;
 
 // When this occurs in C++ code, often something is very broken with 
the
 // value being declared, poison it as invalid so we don't get chains of
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -2057,7 +2057,9 @@
   }
 
   // Give up, we can't recover.
-  Diag(R.getNameLoc(), diagnostic) << Name;
+  auto Builder = Diag(R.getNameLoc(), diagnostic) << Name;
+  if (Name.isIdentifier())
+Builder << SourceRange(R.getNameLoc());
   return true;
 }
 


Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -1335,8 +1335,11 @@
   // specifiers in each declaration, and in the specifier-qualifier list in
   // each struct declaration and type name."
   if (S.getLangOpts().CPlusPlus) {
+auto R = DS.getSourceRange();
+if (R.getEnd().isInvalid())
+  R.setEnd(R.getBegin());
 S.Diag(DeclLoc, diag::err_missing_type_specifier)
-  << DS.getSourceRange();
+  << R;
 
 // When this occurs in C++ code, often something is very broken with the
 // value being declared, poison it as invalid so we don't get chains of
Index: lib/Sema/SemaExpr.cpp
===
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -2057,7 +2057,9 @@
   }
 
   // Give up, we can't recover.
-  Diag(R.getNameLoc(), diagnostic) << Name;
+  auto Builder = Diag(R.getNameLoc(), diagnostic) << Name;
+  if (Name.isIdentifier())
+Builder << SourceRange(R.getNameLoc());
   return true;
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20867: [PCH] Fix timestamp check on windows hosts.

2016-06-07 Thread pierre gousseau via cfe-commits
pgousseau updated this revision to Diff 59887.
pgousseau added a comment.

Following Bruno's comment:

- Remove call to sleep using touch -m -a -t


http://reviews.llvm.org/D20867

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Frontend/FrontendOptions.h
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/FrontendActions.cpp
  lib/Serialization/ASTReader.cpp
  test/PCH/Inputs/pragma-once2-pch.h
  test/PCH/Inputs/pragma-once2.h
  test/PCH/include-timestamp.cpp

Index: test/PCH/include-timestamp.cpp
===
--- /dev/null
+++ test/PCH/include-timestamp.cpp
@@ -0,0 +1,27 @@
+// Test that the timestamp is not included in the produced pch file with
+// -fno-pch-timestamp.
+
+// Check timestamp is included by default.
+// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/Inputs/pragma-once2-pch.h
+// RUN: touch -m -a -t 201008011501 %S/Inputs/pragma-once2.h
+// RUN: not %clang_cc1 -include-pch %t %s 2>&1 | FileCheck -check-prefix=CHECK-TIMESTAMP %s
+
+// Check bitcode output as well.
+// RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-ON %s
+
+// Check timestamp inclusion is disabled by -fno-pch-timestamp.
+// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %S/Inputs/pragma-once2-pch.h -fno-pch-timestamp
+// RUN: touch -m -a -t 201008011502 %S/Inputs/pragma-once2.h
+// RUN: %clang_cc1 -include-pch %t %s 2>&1
+
+// Check bitcode output as well.
+// RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-OFF %s
+
+#include "Inputs/pragma-once2.h"
+
+void g() { f(); }
+
+// CHECK-BITCODE-TIMESTAMP-ON: getSize() ||
-#if defined(LLVM_ON_WIN32)
-   false
-#else
-   // In our regression testing, the Windows file system seems to
-   // have inconsistent modification times that sometimes
-   // erroneously trigger this error-handling path.
-   //
-   // FIXME: This probably also breaks HeaderFileInfo lookups on Windows.
(StoredTime && StoredTime != File->getModificationTime() &&
 !DisableValidation)
-#endif
)) {
 if (Complain) {
   // Build a list of the PCH imports that got us here (in reverse).
Index: lib/Frontend/FrontendActions.cpp
===
--- lib/Frontend/FrontendActions.cpp
+++ lib/Frontend/FrontendActions.cpp
@@ -92,7 +92,10 @@
   std::vector> Consumers;
   Consumers.push_back(llvm::make_unique(
 CI.getPreprocessor(), OutputFile, nullptr, Sysroot,
-Buffer, CI.getFrontendOpts().ModuleFileExtensions));
+Buffer, CI.getFrontendOpts().ModuleFileExtensions,
+/*AllowASTWithErrors*/false,
+/*IncludeTimestamps*/
+  +CI.getFrontendOpts().IncludeTimestamps));
   Consumers.push_back(CI.getPCHContainerWriter().CreatePCHContainerGenerator(
   CI, InFile, OutputFile, OS, Buffer));
 
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1144,6 +1144,7 @@
   Opts.ModuleFiles = Args.getAllArgValues(OPT_fmodule_file);
   Opts.ModulesEmbedFiles = Args.getAllArgValues(OPT_fmodules_embed_file_EQ);
   Opts.ModulesEmbedAllFiles = Args.hasArg(OPT_fmodules_embed_all_files);
+  Opts.IncludeTimestamps = !Args.hasArg(OPT_fno_pch_timestamp);
 
   Opts.CodeCompleteOpts.IncludeMacros
 = Args.hasArg(OPT_code_completion_macros);
Index: include/clang/Frontend/FrontendOptions.h
===
--- include/clang/Frontend/FrontendOptions.h
+++ include/clang/Frontend/FrontendOptions.h
@@ -153,6 +153,8 @@
///< implicit module build.
   unsigned ModulesEmbedAllFiles : 1;   ///< Whether we should embed all used
///< files into the PCM file.
+  unsigned IncludeTimestamps : 1;  ///< Whether timestamps should be
+   ///< written to the produced PCH file.
 
   CodeCompleteOptions CodeCompleteOpts;
 
@@ -277,8 +279,8 @@
 SkipFunctionBodies(false), UseGlobalModuleIndex(true),
 GenerateGlobalModuleIndex(true), ASTDumpDecls(false), ASTDumpLookups(false),
 BuildingImplicitModule(false), ModulesEmbedAllFiles(false),
-ARCMTAction(ARCMT_None), ObjCMTAction(ObjCMT_None),
-ProgramAction(frontend::ParseSyntaxOnly)
+IncludeTimestamps(true), ARCMTAction(ARCMT_None),
+ObjCMTAction(ObjCMT_None), ProgramAction(frontend::ParseSyntaxOnly)
   {}
 
   /// getInputKindForExtension - Return the appropriate input kind for a file
Index: include/clang/Driver/CC1Options.td
===
--- include/clang/Driver/CC1Options.td
+++ include/clang/Driver/CC1Options.td
@@ -507,6 +507,8 @@
   HelpT

Re: [PATCH] D20867: [PCH] Fix timestamp check on windows hosts.

2016-06-07 Thread pierre gousseau via cfe-commits
pgousseau added a comment.

> > On Linux, if the timestamp of a header file, included in the pch, is 
> > modified, then including the pch without regenerating it causes a fatal 
> > error, which is reasonable.

> 

> >  On Windows the check is ifdefed out, allowing the compilation to continue 
> > in a broken state.

> 

> >  The root of the broken state is that, if timestamps dont match, the 
> > preprocessor will reparse a header without discarding the pch data.

> 

> >  This leads to "#pragma once" header to be included twice.

> 

> >  The reason behind the ifdefing of the check lacks documentation, and was 
> > done 6 years ago.

> 




> It's documented in the comment you deleted:

> 

>   // In our regression testing, the Windows file system seems to

>   // have inconsistent modification times that sometimes

>   // erroneously trigger this error-handling path.

>

> 

> We should confirm whether this is in fact still the case. Maybe this is 
> caused by building on a networked file system, where a locally-changed file 
> might have a different mtime locally and remotely (the local mtime may be 
> precise where the remote one has been rounded to a multiple of 2 seconds by 
> an underlying FAT filesystem)? If it's something like that, we could perhaps 
> work around this by rounding the mtime to a multiple of 2 seconds ourselves.


I am not sure how to reproduce this build scenario, would you be able to 
provide some more stepped details?
I have tried emitting and including a PCH on a networked FAT32 drive, but no 
false warnings observed so far.

Are you asking for the 2 seconds tolerance to be part of this patch?
Or, as it seems the main problem here is the lack of a reproducible, are you ok 
with the idea of committing this patch first, to see if the inconsistent time 
stamps is still an issue?


http://reviews.llvm.org/D20867



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


Re: [PATCH] D20948: [OpenCL] Fix access qualifiers handling for typedefs

2016-06-07 Thread Andrew Savonichev via cfe-commits
asavonic added inline comments.


Comment at: test/SemaOpenCL/images-typedef.cl:40
@@ +39,3 @@
+  myWrite(img); // expected-error {{passing 'img1d_ro_default' (aka 
'__read_only image1d_t') to parameter of incompatible type '__write_only 
image1d_t'}}
+}
+

No, but write_only qualifer was just silently ignored and img had a read_only 
type.

I changed the diagnostic, it should be better now:

  typedef write_only image1d_t img1d_wo; // note: previously declared 
'write_only' here
  kernel void k7(read_only img1d_wo img){} // error: multiple access qualifiers


Comment at: test/SemaOpenCL/images-typedef.cl:43
@@ +42,3 @@
+kernel void k6(img1d_ro img) {
+  myRead(img);
+}

In this case we should rename merged test to just 'access-qualifier.cl', since 
images-typedef.cl contains positive test cases too. Is it ok?


http://reviews.llvm.org/D20948



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


Re: [PATCH] D20867: [PCH] Fix timestamp check on windows hosts.

2016-06-07 Thread Pierre Gousseau via cfe-commits
It seems Phabricator did not picked up Richard's message so I have manually
copied and replied to it via Phabricator's web interface.

Cheers,

Pierre

On 6 June 2016 at 21:53, Richard Smith  wrote:

> On Wed, Jun 1, 2016 at 8:33 AM, pierre gousseau via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> pgousseau created this revision.
>> pgousseau added reviewers: rsmith, thakis.
>> pgousseau added subscribers: cfe-commits, wristow, probinson, gbedwell,
>> bruno, cameron314.
>>
>> On Linux, if the timestamp of a header file, included in the pch, is
>> modified, then including the pch without regenerating it causes a fatal
>> error, which is reasonable.
>> On Windows the check is ifdefed out, allowing the compilation to continue
>> in a broken state.
>> The root of the broken state is that, if timestamps dont match, the
>> preprocessor will reparse a header without discarding the pch data.
>> This leads to "#pragma once" header to be included twice.
>> The reason behind the ifdefing of the check lacks documentation, and was
>> done 6 years ago.
>>
>
> It's documented in the comment you deleted:
>
>// In our regression testing, the Windows file system seems to
>// have inconsistent modification times that sometimes
>// erroneously trigger this error-handling path.
>
> We should confirm whether this is in fact still the case. Maybe this is
> caused by building on a networked file system, where a locally-changed file
> might have a different mtime locally and remotely (the local mtime may be
> precise where the remote one has been rounded to a multiple of 2 seconds by
> an underlying FAT filesystem)? If it's something like that, we could
> perhaps work around this by rounding the mtime to a multiple of 2 seconds
> ourselves.
>
>
>> This change tentatively removes the ifdefing and adds a cc1 option to
>> disable the inclusion of timestamps in pch files, giving some flexibility
>> to build systems such as distributed builds.
>>
>> This change is a follow up to the discussion started in
>> http://reviews.llvm.org/D20243
>>
>> http://reviews.llvm.org/D20867
>>
>> Files:
>>   include/clang/Driver/CC1Options.td
>>   include/clang/Frontend/FrontendOptions.h
>>   lib/Frontend/CompilerInvocation.cpp
>>   lib/Frontend/FrontendActions.cpp
>>   lib/Serialization/ASTReader.cpp
>>   test/PCH/Inputs/include-timestamp-pch.h
>>   test/PCH/Inputs/include-timestamp.h
>>   test/PCH/include-timestamp.cpp
>>
>>
>> ___
>> cfe-commits mailing list
>> cfe-commits@lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant

2016-06-07 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

@mclow.lists, @ericwf: Ping.

@bcraig: I guess you wouldn't be able to let this through on your own? (in case 
if there isn't much interest in this functionality from others). Eric might be 
away though (didn't see many emails from him), so I'll hold off for now.

/ Asiri


http://reviews.llvm.org/D20328



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


Re: [PATCH] D21050: [clang-tidy] correct clang-tidy-diff.py help message

2016-06-07 Thread Igor Sugak via cfe-commits
sugak added a comment.

Thank you for the review! I need someone to commit this for me :)


http://reviews.llvm.org/D21050



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


[libcxx] r272018 - Avoid Shadowing warnings in the associative containers tests. Thanks to STL for the patch.

2016-06-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jun  7 10:49:39 2016
New Revision: 272018

URL: http://llvm.org/viewvc/llvm-project?rev=272018&view=rev
Log:
Avoid Shadowing warnings in the associative containers tests. Thanks to STL for 
the patch.

Modified:

libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp

libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp

libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp

libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp?rev=272018&r1=272017&r2=272018&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/map/map.special/non_member_swap.pass.cpp
 Tue Jun  7 10:49:39 2016
@@ -98,6 +98,7 @@ int main()
 assert(m1 == m2_save);
 assert(m2 == m1_save);
 }
+}
 {
 typedef test_allocator A;
 typedef test_compare > C;
@@ -166,7 +167,6 @@ int main()
 assert(m2.key_comp() == C(1));
 assert(m2.get_allocator() == A(1));
 }
-}
 #if __cplusplus >= 201103L
 {
 typedef std::map, min_allocator> M;
@@ -242,6 +242,7 @@ int main()
 assert(m1 == m2_save);
 assert(m2 == m1_save);
 }
+}
 {
 typedef min_allocator A;
 typedef test_compare > C;
@@ -276,6 +277,5 @@ int main()
 assert(m2.key_comp() == C(1));
 assert(m2.get_allocator() == A());
 }
-}
 #endif
 }

Modified: 
libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp?rev=272018&r1=272017&r2=272018&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/multimap/multimap.special/non_member_swap.pass.cpp
 Tue Jun  7 10:49:39 2016
@@ -98,6 +98,7 @@ int main()
 assert(m1 == m2_save);
 assert(m2 == m1_save);
 }
+}
 {
 typedef test_allocator A;
 typedef test_compare > C;
@@ -166,7 +167,6 @@ int main()
 assert(m2.key_comp() == C(1));
 assert(m2.get_allocator() == A(1));
 }
-}
 #if __cplusplus >= 201103L
 {
 typedef std::multimap, 
min_allocator>> M;
@@ -242,6 +242,7 @@ int main()
 assert(m1 == m2_save);
 assert(m2 == m1_save);
 }
+}
 {
 typedef min_allocator A;
 typedef test_compare > C;
@@ -276,6 +277,5 @@ int main()
 assert(m2.key_comp() == C(1));
 assert(m2.get_allocator() == A());
 }
-}
 #endif
 }

Modified: 
libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp?rev=272018&r1=272017&r2=272018&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/multiset/multiset.special/non_member_swap.pass.cpp
 Tue Jun  7 10:49:39 2016
@@ -21,6 +21,7 @@
 int main()
 {
 typedef int V;
+{
 typedef std::multiset M;
 {
 M m1;
@@ -94,6 +95,7 @@ int main()
 assert(m1 == m2_save);
 assert(m2 == m1_save);
 }
+}
 {
 typedef test_allocator A;
 typedef test_compare > C;

Modified: 
libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp?rev=272018&r1=272017&r2=272018&view=diff
==
--- 
libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/associative/set/set.special/non_member_swap.pass.cpp
 Tue Jun  7 10:49:39 2016
@@ -21,6 +21,7 @@
 int main()
 {
 typedef int V;
+{
 typedef std::set M;
 {
 M m1;
@@ -94,6 +95,7 @@ int main()
 assert(m1 == m2_save);
 assert(m2 == m1_save);
 }
+}
 {
 typedef test_allocator A;
 typedef test_compare > C;


__

Re: [PATCH] D20921: [libcxx] [test] Slightly rearrange scopes in order to avoid shadowing M typedefs.

2016-06-07 Thread Marshall Clow via cfe-commits
mclow.lists accepted this revision.
mclow.lists added a comment.
This revision is now accepted and ready to land.

Landed as revision 272018


http://reviews.llvm.org/D20921



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


Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant

2016-06-07 Thread Marshall Clow via cfe-commits
mclow.lists added a comment.

Some nits while reading this. More to come.

Also, I don't see how this can be retargeted "at runtime"; are you implying 
that someone can choose at program launch time what threading system to use?

How could that work given (say) a constexpr constructor for a mutex type?



Comment at: src/algorithm.cpp:99
@@ -90,1 +98,3 @@
 
+#ifndef _LIBCPP_HAS_NO_THREADS
+# undef __LOCK_LOCK

Why the undef here?


Comment at: src/mutex.cpp:277
@@ -261,1 +276,3 @@
 
+#ifndef _LIBCPP_HAS_NO_THREADS
+# undef __LOCK_INIT

Again; why undef at the end of a source file (not an include)?

For that matter, there's no need to use reserved identifiers here - `__LOCKXXX`


http://reviews.llvm.org/D20328



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


[PATCH] D21081: MPI-Checker patch for Clang Static Analyzer

2016-06-07 Thread Devin Coughlin via cfe-commits
dcoughlin created this revision.
dcoughlin added reviewers: zaks.anna, dcoughlin, Alexander_Droste.
dcoughlin added a subscriber: cfe-commits.

(Cloning the revision for the ASan issue since the old one is closed and can't 
be re-opened)

This patch adds a static analysis checker to verify the correct usage of the 
MPI API in C and C++.

3 path-sensitive checks are included: 
- Double nonblocking: Double request usage by nonblocking calls without 
intermediate wait
- Missing wait: Nonblocking call without matching wait.
- Unmatched wait: Waiting for a request that was never used by a nonblocking 
call

Examples of how to use the checker can be found on: GitHub 
https://github.com/0ax1/MPI-Checker

http://reviews.llvm.org/D21081

Files:
  include/clang/StaticAnalyzer/Checkers/Checkers.td
  include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  lib/StaticAnalyzer/Checkers/CMakeLists.txt
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.h
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.cpp
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h
  lib/StaticAnalyzer/Checkers/MPI-Checker/MPITypes.h
  lib/StaticAnalyzer/Core/MemRegion.cpp
  test/Analysis/MPIMock.h
  test/Analysis/MemRegion.cpp
  test/Analysis/mpichecker.cpp
  test/Analysis/mpicheckernotes.cpp

Index: test/Analysis/mpicheckernotes.cpp
===
--- /dev/null
+++ test/Analysis/mpicheckernotes.cpp
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=optin.mpi.MPI-Checker -analyzer-output=text -verify %s
+
+// MPI-Checker test file to test note diagnostics.
+
+#include "MPIMock.h"
+
+void doubleNonblocking() {
+  double buf = 0;
+  MPI_Request sendReq;
+  MPI_Isend(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-note{{Request is previously used by nonblocking call here.}}
+  MPI_Irecv(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-warning{{Double nonblocking on request 'sendReq'.}} expected-note{{Double nonblocking on request 'sendReq'.}}
+  MPI_Wait(&sendReq, MPI_STATUS_IGNORE);
+}
+
+void missingWait() {
+  double buf = 0;
+  MPI_Request sendReq;
+  MPI_Ireduce(MPI_IN_PLACE, &buf, 1, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD, &sendReq); // expected-note{{Request is previously used by nonblocking call here.}}
+} // expected-warning{{Request 'sendReq' has no matching wait.}} expected-note{{Request 'sendReq' has no matching wait.}}
+
+// If more than 2 nonblocking calls are using a request in a sequence, they all
+// point to the first call as the 'previous' call. This is because the
+// BugReporterVisitor only checks for differences in state or existence of an
+// entity.
+void tripleNonblocking() {
+  double buf = 0;
+  MPI_Request sendReq;
+  MPI_Isend(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-note 2{{Request is previously used by nonblocking call here.}}
+  MPI_Irecv(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-warning{{Double nonblocking on request 'sendReq'.}} expected-note{{Double nonblocking on request 'sendReq'.}}
+
+  MPI_Isend(&buf, 1, MPI_DOUBLE, 0, 0, MPI_COMM_WORLD, &sendReq); // expected-warning{{Double nonblocking on request 'sendReq'.}} expected-note{{Double nonblocking on request 'sendReq'.}}
+
+  MPI_Wait(&sendReq, MPI_STATUS_IGNORE);
+}
Index: test/Analysis/mpichecker.cpp
===
--- /dev/null
+++ test/Analysis/mpichecker.cpp
@@ -0,0 +1,342 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=optin.mpi.MPI-Checker -verify %s
+
+#include "MPIMock.h"
+
+void matchedWait1() {
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  if (rank >= 0) {
+MPI_Request sendReq1, recvReq1;
+MPI_Isend(&buf, 1, MPI_DOUBLE, rank + 1, 0, MPI_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 0, MPI_COMM_WORLD, &recvReq1);
+
+MPI_Wait(&sendReq1, MPI_STATUS_IGNORE);
+MPI_Wait(&recvReq1, MPI_STATUS_IGNORE);
+  }
+} // no error
+
+void matchedWait2() {
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  if (rank >= 0) {
+MPI_Request sendReq1, recvReq1;
+MPI_Isend(&buf, 1, MPI_DOUBLE, rank + 1, 0, MPI_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 0, MPI_COMM_WORLD, &recvReq1);
+MPI_Wait(&sendReq1, MPI_STATUS_IGNORE);
+MPI_Wait(&recvReq1, MPI_STATUS_IGNORE);
+  }
+} // no error
+
+void matchedWait3() {
+  int rank = 0;
+  double buf = 0;
+  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+  if (rank >= 0) {
+MPI_Request sendReq1, recvReq1;
+MPI_Isend(&buf, 1, MPI_DOUBLE, rank + 1, 0, MPI_COMM_WORLD, &sendReq1);
+MPI_Irecv(&buf, 1, MPI_DOUBLE, rank - 1, 0, MPI_COMM_WORLD, &recvReq1);
+
+if (rank > 1000) {
+  M

Re: [PATCH] D20948: [OpenCL] Fix access qualifiers handling for typedefs

2016-06-07 Thread Andrew Savonichev via cfe-commits
asavonic updated this revision to Diff 59890.
asavonic added a comment.

- Cleanup images-typedef.cl
- Fix typo in SemaType.cpp
- Change diagnostic: error when access qualifier applied to a typedef


http://reviews.llvm.org/D20948

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/AttributeList.h
  lib/Sema/SemaType.cpp
  test/CodeGenOpenCL/kernel-arg-info.cl
  test/SemaOpenCL/images-typedef.cl

Index: test/SemaOpenCL/images-typedef.cl
===
--- /dev/null
+++ test/SemaOpenCL/images-typedef.cl
@@ -0,0 +1,53 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+
+typedef image1d_t img1d_ro_default; // expected-note {{previously declared 'read_only' here}}
+
+typedef write_only image1d_t img1d_wo; // expected-note {{previously declared 'write_only' here}}
+typedef read_only image1d_t img1d_ro;
+
+#if __OPENCL_C_VERSION__ >= 200
+  typedef read_write image1d_t img1d_rw;
+#endif
+
+typedef int Int;
+typedef read_only int IntRO; // expected-error {{access qualifier can only be used for pipe and image type}}
+
+
+void myWrite(write_only image1d_t); // expected-note {{passing argument to parameter here}} expected-note {{passing argument to parameter here}}
+void myRead(read_only image1d_t); // expected-note {{passing argument to parameter here}}
+
+kernel void k1(img1d_wo img) {
+  myRead(img); // expected-error {{passing 'img1d_wo' (aka '__write_only image1d_t') to parameter of incompatible type '__read_only image1d_t'}}
+}
+
+kernel void k2(img1d_ro img) {
+  myWrite(img); // expected-error {{passing 'img1d_ro' (aka '__read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}}
+}
+
+kernel void k3(img1d_wo img) {
+  myWrite(img);
+}
+
+#if __OPENCL_C_VERSION__ >= 200
+  kernel void k4(img1d_rw img) {
+myWrite(img);
+myRead(img);
+  }
+#endif
+
+kernel void k5(img1d_ro_default img) {
+  myWrite(img); // expected-error {{passing 'img1d_ro_default' (aka '__read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}}
+}
+
+kernel void k6(img1d_ro img) {
+  myRead(img);
+}
+
+kernel void k7(read_only img1d_wo img) { // expected-error {{multiple access qualifiers}}
+}
+
+kernel void k8(write_only img1d_ro_default img) { // expected-error {{multiple access qualifiers}}
+}
+
+kernel void k9(read_only Int img) { // expected-error {{access qualifier can only be used for pipe and image type}}
+}
Index: test/CodeGenOpenCL/kernel-arg-info.cl
===
--- test/CodeGenOpenCL/kernel-arg-info.cl
+++ test/CodeGenOpenCL/kernel-arg-info.cl
@@ -46,7 +46,7 @@
 // NO-ARGINFO-NOT: !{!"kernel_arg_name", !"X", !"Y"}
 
 typedef image1d_t myImage;
-kernel void foo5(read_only myImage img1, write_only image1d_t img2) {
+kernel void foo5(myImage img1, write_only image1d_t img2) {
 }
 // CHECK:  !{!"kernel_arg_access_qual", !"read_only", !"write_only"}
 // CHECK:  !{!"kernel_arg_type", !"myImage", !"image1d_t"}
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -6472,12 +6472,31 @@
 /// Handle OpenCL Access Qualifier Attribute.
 static void HandleOpenCLAccessAttr(QualType &CurType, const AttributeList &Attr,
Sema &S) {
-  // OpenCL v2.0 s6.6 - Access qualifier can used only for image and pipe type.
+  // OpenCL v2.0 s6.6 - Access qualifier can be used only for image and pipe type.
   if (!(CurType->isImageType() || CurType->isPipeType())) {
 S.Diag(Attr.getLoc(), diag::err_opencl_invalid_access_qualifier);
 Attr.setInvalid();
 return;
   }
+
+  if (const TypedefType* TypedefTy = CurType->getAs()) {
+QualType PointeeTy = TypedefTy->desugar();
+S.Diag(Attr.getLoc(), diag::err_opencl_multiple_access_qualifiers);
+
+std::string PrevAccessQual;
+switch (cast(PointeeTy.getTypePtr())->getKind()) {
+  #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
+	case BuiltinType::Id:	   \
+	  PrevAccessQual = #Access;   \
+	  break;
+  #include "clang/Basic/OpenCLImageTypes.def"
+default:
+  assert(0 && "unable to find corresponding image type");
+}
+
+S.Diag(TypedefTy->getDecl()->getLocStart(),
+	   diag::note_opencl_typedef_access_qualifier) << PrevAccessQual;
+  }
 }
 
 static void processTypeAttrs(TypeProcessingState &state, QualType &type,
Index: include/clang/Sema/AttributeList.h
===
--- include/clang/Sema/AttributeList.h
+++ include/clang/Sema/AttributeList.h
@@ -881,6 +881,7 @@
   ExpectedMethod,
   ExpectedFieldOrGlobalVar,
   ExpectedStruct,
+  ExpectedParameterOrTypedef,
   ExpectedVariableOrTypedef,
   ExpectedTLSVar,
   ExpectedVariableOrField,
Index: include/clang/Basic/DiagnosticSemaKinds.td
==

Re: [PATCH] D20948: [OpenCL] Fix access qualifiers handling for typedefs

2016-06-07 Thread Andrew Savonichev via cfe-commits
asavonic updated this revision to Diff 59893.
asavonic marked 3 inline comments as done.
asavonic added a comment.

- Fix images-typedef.cl for OpenCL 2.0


http://reviews.llvm.org/D20948

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/AttributeList.h
  lib/Sema/SemaType.cpp
  test/CodeGenOpenCL/kernel-arg-info.cl
  test/SemaOpenCL/images-typedef.cl

Index: test/SemaOpenCL/images-typedef.cl
===
--- /dev/null
+++ test/SemaOpenCL/images-typedef.cl
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -verify -pedantic -fsyntax-only %s
+// RUN: %clang_cc1 -verify -pedantic -fsyntax-only -cl-std=CL2.0 %s
+
+typedef image1d_t img1d_ro_default; // expected-note {{previously declared 'read_only' here}}
+
+typedef write_only image1d_t img1d_wo; // expected-note {{previously declared 'write_only' here}}
+typedef read_only image1d_t img1d_ro;
+
+#if __OPENCL_C_VERSION__ >= 200
+  typedef read_write image1d_t img1d_rw;
+#endif
+
+typedef int Int;
+typedef read_only int IntRO; // expected-error {{access qualifier can only be used for pipe and image type}}
+
+
+void myWrite(write_only image1d_t); // expected-note {{passing argument to parameter here}} expected-note {{passing argument to parameter here}}
+void myRead(read_only image1d_t); // expected-note {{passing argument to parameter here}}
+
+#if __OPENCL_C_VERSION__ >= 200
+  void myReadWrite(read_write image1d_t);
+#endif
+
+
+kernel void k1(img1d_wo img) {
+  myRead(img); // expected-error {{passing 'img1d_wo' (aka '__write_only image1d_t') to parameter of incompatible type '__read_only image1d_t'}}
+}
+
+kernel void k2(img1d_ro img) {
+  myWrite(img); // expected-error {{passing 'img1d_ro' (aka '__read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}}
+}
+
+kernel void k3(img1d_wo img) {
+  myWrite(img);
+}
+
+#if __OPENCL_C_VERSION__ >= 200
+  kernel void k4(img1d_rw img) {
+myReadWrite(img);
+  }
+#endif
+
+kernel void k5(img1d_ro_default img) {
+  myWrite(img); // expected-error {{passing 'img1d_ro_default' (aka '__read_only image1d_t') to parameter of incompatible type '__write_only image1d_t'}}
+}
+
+kernel void k6(img1d_ro img) {
+  myRead(img);
+}
+
+kernel void k7(read_only img1d_wo img) { // expected-error {{multiple access qualifiers}}
+}
+
+kernel void k8(write_only img1d_ro_default img) { // expected-error {{multiple access qualifiers}}
+}
+
+kernel void k9(read_only Int img) { // expected-error {{access qualifier can only be used for pipe and image type}}
+}
Index: test/CodeGenOpenCL/kernel-arg-info.cl
===
--- test/CodeGenOpenCL/kernel-arg-info.cl
+++ test/CodeGenOpenCL/kernel-arg-info.cl
@@ -46,7 +46,7 @@
 // NO-ARGINFO-NOT: !{!"kernel_arg_name", !"X", !"Y"}
 
 typedef image1d_t myImage;
-kernel void foo5(read_only myImage img1, write_only image1d_t img2) {
+kernel void foo5(myImage img1, write_only image1d_t img2) {
 }
 // CHECK:  !{!"kernel_arg_access_qual", !"read_only", !"write_only"}
 // CHECK:  !{!"kernel_arg_type", !"myImage", !"image1d_t"}
Index: lib/Sema/SemaType.cpp
===
--- lib/Sema/SemaType.cpp
+++ lib/Sema/SemaType.cpp
@@ -6472,12 +6472,31 @@
 /// Handle OpenCL Access Qualifier Attribute.
 static void HandleOpenCLAccessAttr(QualType &CurType, const AttributeList &Attr,
Sema &S) {
-  // OpenCL v2.0 s6.6 - Access qualifier can used only for image and pipe type.
+  // OpenCL v2.0 s6.6 - Access qualifier can be used only for image and pipe type.
   if (!(CurType->isImageType() || CurType->isPipeType())) {
 S.Diag(Attr.getLoc(), diag::err_opencl_invalid_access_qualifier);
 Attr.setInvalid();
 return;
   }
+
+  if (const TypedefType* TypedefTy = CurType->getAs()) {
+QualType PointeeTy = TypedefTy->desugar();
+S.Diag(Attr.getLoc(), diag::err_opencl_multiple_access_qualifiers);
+
+std::string PrevAccessQual;
+switch (cast(PointeeTy.getTypePtr())->getKind()) {
+  #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
+	case BuiltinType::Id:	   \
+	  PrevAccessQual = #Access;   \
+	  break;
+  #include "clang/Basic/OpenCLImageTypes.def"
+default:
+  assert(0 && "unable to find corresponding image type");
+}
+
+S.Diag(TypedefTy->getDecl()->getLocStart(),
+	   diag::note_opencl_typedef_access_qualifier) << PrevAccessQual;
+  }
 }
 
 static void processTypeAttrs(TypeProcessingState &state, QualType &type,
Index: include/clang/Sema/AttributeList.h
===
--- include/clang/Sema/AttributeList.h
+++ include/clang/Sema/AttributeList.h
@@ -881,6 +881,7 @@
   ExpectedMethod,
   ExpectedFieldOrGlobalVar,
   ExpectedStruct,
+  ExpectedParameterOrTypedef,
   ExpectedVariableOrTypedef,
   ExpectedTLSVar,
   ExpectedVariableOrField,
Index: i

Re: [PATCH] D21081: MPI-Checker patch for Clang Static Analyzer

2016-06-07 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

Alexander,

When I committed your patch, the AddressSanitizer bots found a memory 
corruption issue so I reverted it. This will need to be fixed before we can 
commit the patch. Since Phabricator automatically closed 
http://reviews.llvm.org/D12761, I've created a new revision. The attached diff 
is a very a slightly modified version of your original patch modified so that 
it compiles with gcc, which is more strict about certain template 
specializations and brace initializations.


http://reviews.llvm.org/D21081



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


Re: 3.8 Merge Request: r259776

2016-06-07 Thread Tom Stellard via cfe-commits
Hi Richard,

Is this OK for the 3.8 branch?

reviews.llvm.org/rL259776

-Tom

On Mon, May 30, 2016 at 11:35:04AM +, Hahnfeld, Jonas wrote:
> Assuming I got it right...
> 
> > -Original Message-
> > From: Alexey Bataev [mailto:a.bat...@hotmail.com]
> > Sent: Monday, May 30, 2016 1:31 PM
> > To: Hahnfeld, Jonas
> > Cc: cfe-commits@lists.llvm.org; Tom Stellard
> > Subject: Re: 3.8 Merge Request: r259776
> > 
> > I can try to rebase it to 3.8.1 but Tom wants an approve from Richard.
> > Ping him!
> > 
> > Best regards,
> > Alexey Bataev
> > =
> > Software Engineer
> > Intel Compiler Team
> > 
> > 
> > 
> > 30.05.2016 14:19, Hahnfeld, Jonas пишет:
> > > Hi,
> > >
> > > last possible ping as changes are required to be merged by tomorrow...
> > >
> > > Cheers,
> > > Jonas
> > >
> > >> -Original Message-
> > >> From: llvm-commits [mailto:llvm-commits-boun...@lists.llvm.org] On
> > >> Behalf Of Hahnfeld, Jonas via llvm-commits
> > >> Sent: Monday, May 23, 2016 8:13 AM
> > >> To: Tom Stellard
> > >> Cc: Bataev, Alexey (a.bat...@hotmail.com);
> > >> llvm-comm...@lists.llvm.org
> > >> Subject: RE: 3.8 Merge Request: r259776
> > >>
> > >> Ping. I would really much like to see this (and possibly other OpenMP
> > > bugs)
> > >> fixed for 3.8.1.
> > >>
> > >> Thanks,
> > >> Jonas
> > >>
> > >>> -Original Message-
> > >>> From: Tom Stellard [mailto:t...@stellard.net]
> > >>> Sent: Thursday, May 19, 2016 7:37 PM
> > >>> To: Hahnfeld, Jonas
> > >>> Cc: llvm-comm...@lists.llvm.org; Bataev, Alexey
> > >>> (a.bat...@hotmail.com)
> > >>> Subject: Re: 3.8 Merge Request: r259776
> > >>>
> > >>> On Thu, May 19, 2016 at 11:25:43AM +, Hahnfeld, Jonas wrote:
> >  This bug also exists in 3.8.0. Alexey already agreed to merge this
> >  back
> > >> in
> >  March:
> >  http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-
> > >>> 20160314/152975.html
> >  Alexey, are there other OpenMP commits needed for 3.8.1?
> > 
> > >>> Hi,
> > >>>
> > >>> I would also like Richard to take a look at this one to.
> > >>>
> > >>> Richard, does this look OK to merge:
> > >>>
> > >>> reviews.llvm.org/rL259776
> > >>>
> > >>> -Tom
> > >>>
> >  Cheers,
> >  Jonas
> > 
> 


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


Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant

2016-06-07 Thread Asiri Rathnayake via cfe-commits
rmaprath added a subscriber: STL_MSFT.
rmaprath added a comment.

In http://reviews.llvm.org/D20328#451178, @mclow.lists wrote:

> Also, I don't see how this can be retargeted "at runtime"; are you implying 
> that someone can choose at program launch time what threading system to use?


Yup, users can link their objects with an implementation of the dynamic 
threading API and it should all be fine.

> How could that work given (say) a constexpr constructor for a mutex type?

>  [ I read the previous discussion, but still don't see how to make it work]


Yeah, that is a real pain point. I have provided a sample implementation of the 
API in `test/support/external_threads.cpp` (last file in this patch) where I've 
adopted a initialize-on-first-use policy to workaround this particular problem. 
I've put a bunch of comments there to explain the details.

The `constexpr` mutex constructor is apparently also a pain point on windows 
[1], I'm sure @STL_MSFT knows more about it.

Thanks!

/ Asiri

[1] 
https://blogs.msdn.microsoft.com/vcblog/2015/06/02/constexpr-complete-for-vs-2015-rtm-c11-compiler-c17-stl/


http://reviews.llvm.org/D20328



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


Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant

2016-06-07 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D20328#451197, @rmaprath wrote:

> In http://reviews.llvm.org/D20328#451178, @mclow.lists wrote:
>
> > Also, I don't see how this can be retargeted "at runtime"; are you implying 
> > that someone can choose at program launch time what threading system to use?
>
>
> Yup, users can link their objects with an implementation of the dynamic 
> threading API and it should all be fine.


Apologies, not at program launch time but link time.


http://reviews.llvm.org/D20328



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


Re: 3.8 Merge Request: r259776

2016-06-07 Thread Richard Smith via cfe-commits
It's larger than I'd like for a merge onto the branch, but yes, it looks OK.

On 7 Jun 2016 9:20 a.m., "Tom Stellard via cfe-commits" <
cfe-commits@lists.llvm.org> wrote:

> Hi Richard,
>
> Is this OK for the 3.8 branch?
>
> reviews.llvm.org/rL259776
>
> -Tom
>
> On Mon, May 30, 2016 at 11:35:04AM +, Hahnfeld, Jonas wrote:
> > Assuming I got it right...
> >
> > > -Original Message-
> > > From: Alexey Bataev [mailto:a.bat...@hotmail.com]
> > > Sent: Monday, May 30, 2016 1:31 PM
> > > To: Hahnfeld, Jonas
> > > Cc: cfe-commits@lists.llvm.org; Tom Stellard
> > > Subject: Re: 3.8 Merge Request: r259776
> > >
> > > I can try to rebase it to 3.8.1 but Tom wants an approve from Richard.
> > > Ping him!
> > >
> > > Best regards,
> > > Alexey Bataev
> > > =
> > > Software Engineer
> > > Intel Compiler Team
> > >
> > >
> > >
> > > 30.05.2016 14:19, Hahnfeld, Jonas пишет:
> > > > Hi,
> > > >
> > > > last possible ping as changes are required to be merged by
> tomorrow...
> > > >
> > > > Cheers,
> > > > Jonas
> > > >
> > > >> -Original Message-
> > > >> From: llvm-commits [mailto:llvm-commits-boun...@lists.llvm.org] On
> > > >> Behalf Of Hahnfeld, Jonas via llvm-commits
> > > >> Sent: Monday, May 23, 2016 8:13 AM
> > > >> To: Tom Stellard
> > > >> Cc: Bataev, Alexey (a.bat...@hotmail.com);
> > > >> llvm-comm...@lists.llvm.org
> > > >> Subject: RE: 3.8 Merge Request: r259776
> > > >>
> > > >> Ping. I would really much like to see this (and possibly other
> OpenMP
> > > > bugs)
> > > >> fixed for 3.8.1.
> > > >>
> > > >> Thanks,
> > > >> Jonas
> > > >>
> > > >>> -Original Message-
> > > >>> From: Tom Stellard [mailto:t...@stellard.net]
> > > >>> Sent: Thursday, May 19, 2016 7:37 PM
> > > >>> To: Hahnfeld, Jonas
> > > >>> Cc: llvm-comm...@lists.llvm.org; Bataev, Alexey
> > > >>> (a.bat...@hotmail.com)
> > > >>> Subject: Re: 3.8 Merge Request: r259776
> > > >>>
> > > >>> On Thu, May 19, 2016 at 11:25:43AM +, Hahnfeld, Jonas wrote:
> > >  This bug also exists in 3.8.0. Alexey already agreed to merge this
> > >  back
> > > >> in
> > >  March:
> > >  http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-
> > > >>> 20160314/152975.html
> > >  Alexey, are there other OpenMP commits needed for 3.8.1?
> > > 
> > > >>> Hi,
> > > >>>
> > > >>> I would also like Richard to take a look at this one to.
> > > >>>
> > > >>> Richard, does this look OK to merge:
> > > >>>
> > > >>> reviews.llvm.org/rL259776
> > > >>>
> > > >>> -Tom
> > > >>>
> > >  Cheers,
> > >  Jonas
> > >
> >
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: [PATCH] D20328: [libcxx] Externally threaded libc++ variant

2016-06-07 Thread Stephan T. Lavavej via cfe-commits
[Asiri Rathnayake]
> The `constexpr` mutex constructor is apparently also a
> pain point on windows [1], I'm sure @STL_MSFT knows more about it.

That's because of MSVC-specific issues, where we need to dynamically switch 
between WinAPI and ConcRT implementations depending on whether the end user's 
machine is Win7+/Vista/XP. If we could assume Win7+, we wouldn't need this 
squirrelly machinery.

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


[PATCH] D21082: Do not assume that -fsanitize=address is valid option in clang tests

2016-06-07 Thread Christof Douma via cfe-commits
christof created this revision.
christof added reviewers: vitalybuka, chapuni.
christof added a subscriber: cfe-commits.
christof set the repository for this revision to rL LLVM.

The asan tests should only run on builds that have LLVM_USE_SANITIZER set. The 
feature 'asan' reflects this and is required for test/CodeGen/lifetime-asan.c

Repository:
  rL LLVM

http://reviews.llvm.org/D21082

Files:
  test/CodeGen/lifetime-asan.c

Index: test/CodeGen/lifetime-asan.c
===
--- test/CodeGen/lifetime-asan.c
+++ test/CodeGen/lifetime-asan.c
@@ -2,6 +2,7 @@
 // RUN: %clang -S -emit-llvm -o - -O0 \
 // RUN: -fsanitize=address -fsanitize-address-use-after-scope %s | \
 // RUN: FileCheck %s -check-prefix=CHECK-ASAN-USE-AFTER-SCOPE
+// REQUIRES: asan
 // UNSUPPORTED: mingw32
 
 extern int bar(char *A, int n);


Index: test/CodeGen/lifetime-asan.c
===
--- test/CodeGen/lifetime-asan.c
+++ test/CodeGen/lifetime-asan.c
@@ -2,6 +2,7 @@
 // RUN: %clang -S -emit-llvm -o - -O0 \
 // RUN: -fsanitize=address -fsanitize-address-use-after-scope %s | \
 // RUN: FileCheck %s -check-prefix=CHECK-ASAN-USE-AFTER-SCOPE
+// REQUIRES: asan
 // UNSUPPORTED: mingw32
 
 extern int bar(char *A, int n);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D21081: MPI-Checker patch for Clang Static Analyzer

2016-06-07 Thread Devin Coughlin via cfe-commits
dcoughlin added a comment.

Here is the ASan report. It looks to me like the issue is that MPIChecker is 
holding on a reference to a clang::ento::BugReporter after the lifetime of the 
BugReporter has ended. The BugReporter lives in ExprEngine and the analyzer 
creates a new ExprEngine for each top-level declaration that is analyzed but 
uses the same Checker instances across declarations. This means it is not safe 
to stash a reference to the BugReporter in an instance of MPIBugReporter in an 
instance of MPIChecker.




18751==ERROR: AddressSanitizer: stack-use-after-return on address 
0x7f0c695ebc70 at pc 0x0867b44c bp 0x7ffe3b01d6f0 sp 0x7ffe3b01d6e8
-

READ of size 8 at 0x7f0c695ebc70 thread T0

  #0 0x867b44b in getSourceManager 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:448:46
  #1 0x867b44b in 
clang::ento::BugReporter::emitReport(std::__1::unique_ptr >) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/BugReporter.cpp:3240
  #2 0x8636355 in 
clang::ento::mpi::MPIBugReporter::reportUnmatchedWait(clang::ento::CallEvent 
const&, clang::ento::MemRegion const*, clang::ento::ExplodedNode const*) const 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp:82:3
  #3 0x843e1ee in 
clang::ento::mpi::MPIChecker::checkUnmatchedWaits(clang::ento::CallEvent 
const&, clang::ento::CheckerContext&) const 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.cpp:88:7
  #4 0x8447dc8 in checkPreCall 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIChecker.h:36:5
  #5 0x8447dc8 in void 
clang::ento::check::PreCall::_checkCall(void*, 
clang::ento::CallEvent const&, clang::ento::CheckerContext&) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/include/clang/StaticAnalyzer/Core/Checker.h:168
  #6 0x86db2f2 in operator() 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h:59:12
  #7 0x86db2f2 in runChecker 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp:269
  #8 0x86db2f2 in expandGraphWithCheckers<(anonymous 
namespace)::CheckCallContext> 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp:123
  #9 0x86db2f2 in clang::ento::CheckerManager::runCheckersForCallEvent(bool, 
clang::ento::ExplodedNodeSet&, clang::ento::ExplodedNodeSet const&, 
clang::ento::CallEvent const&, clang::ento::ExprEngine&, bool) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/CheckerManager.cpp:285
  #10 0x8782a84 in runCheckersForPreCall 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/include/clang/StaticAnalyzer/Core/CheckerManager.h:252:5
  #11 0x8782a84 in 
clang::ento::ExprEngine::evalCall(clang::ento::ExplodedNodeSet&, 
clang::ento::ExplodedNode*, clang::ento::CallEvent const&) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:509
  #12 0x878205b in clang::ento::ExprEngine::VisitCallExpr(clang::CallExpr 
const*, clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp:487:5
  #13 0x872a0d8 in clang::ento::ExprEngine::Visit(clang::Stmt const*, 
clang::ento::ExplodedNode*, clang::ento::ExplodedNodeSet&) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:1104:7
  #14 0x87210bf in clang::ento::ExprEngine::ProcessStmt(clang::CFGStmt, 
clang::ento::ExplodedNode*) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:448:5
  #15 0x87207ae in 
clang::ento::ExprEngine::processCFGElement(clang::CFGElement, 
clang::ento::ExplodedNode*, unsigned int, clang::ento::NodeBuilderContext*) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp:297:7
  #16 0x86fc7a6 in clang::ento::CoreEngine::HandlePostStmt(clang::CFGBlock 
const*, unsigned int, clang::ento::ExplodedNode*) 
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/StaticAnalyzer/Core/CoreEngine.cpp:515:5
  #17 0x86fafed in 
clang::ento::CoreEngine::dispatchWorkItem(clang::ento::ExplodedNode*, 
clang::ProgramPoint, clang::ento::

Re: [PATCH] D20328: [libcxx] Externally threaded libc++ variant

2016-06-07 Thread Asiri Rathnayake via cfe-commits
rmaprath added a comment.

In http://reviews.llvm.org/D20328#451210, @STL_MSFT wrote:

> [Asiri Rathnayake]
>
> > The `constexpr` mutex constructor is apparently also a
>
> >  pain point on windows [1], I'm sure @STL_MSFT knows more about it.
>
>
> That's because of MSVC-specific issues, where we need to dynamically switch 
> between WinAPI and ConcRT implementations depending on whether the end user's 
> machine is Win7+/Vista/XP. If we could assume Win7+, we wouldn't need this 
> squirrelly machinery.
>
> STL


Thanks. I was thinking may be it's because you also need to call some dynamic 
initialization routine from within the `std::mutex` constructor (like, to 
initialize a kernel provided mutex). Good to know that this isn't the case.

Cheers,

/ Asiri


http://reviews.llvm.org/D20328



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


Re: [PATCH] D20867: [PCH] Fix timestamp check on windows hosts.

2016-06-07 Thread Richard Smith via cfe-commits
On 7 Jun 2016 7:52 a.m., "pierre gousseau" 
wrote:
>
> pgousseau added a comment.
>
> > > On Linux, if the timestamp of a header file, included in the pch, is
modified, then including the pch without regenerating it causes a fatal
error, which is reasonable.
>
> >
>
> > >  On Windows the check is ifdefed out, allowing the compilation to
continue in a broken state.
>
> >
>
> > >  The root of the broken state is that, if timestamps dont match, the
preprocessor will reparse a header without discarding the pch data.
>
> >
>
> > >  This leads to "#pragma once" header to be included twice.
>
> >
>
> > >  The reason behind the ifdefing of the check lacks documentation, and
was done 6 years ago.
>
> >
>
>
>
>
> > It's documented in the comment you deleted:
>
> >
>
> >   // In our regression testing, the Windows file system seems to
>
> >   // have inconsistent modification times that sometimes
>
> >   // erroneously trigger this error-handling path.
>
> >
>
> >
>
> > We should confirm whether this is in fact still the case. Maybe this is
caused by building on a networked file system, where a locally-changed file
might have a different mtime locally and remotely (the local mtime may be
precise where the remote one has been rounded to a multiple of 2 seconds by
an underlying FAT filesystem)? If it's something like that, we could
perhaps work around this by rounding the mtime to a multiple of 2 seconds
ourselves.
>
>
> I am not sure how to reproduce this build scenario, would you be able to
provide some more stepped details?
> I have tried emitting and including a PCH on a networked FAT32 drive, but
no false warnings observed so far.
>
> Are you asking for the 2 seconds tolerance to be part of this patch?
> Or, as it seems the main problem here is the lack of a reproducible, are
you ok with the idea of committing this patch first, to see if the
inconsistent time stamps is still an issue?

Yes, let's commit a patch to remove the #if first, and see if anything
actually breaks (and if so, what). There's no need to add an option for
this we have no uses for it.

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


Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Samuel Benzaquen via cfe-commits
sbenza added a comment.

In http://reviews.llvm.org/D21036#450935, @aaron.ballman wrote:

> In http://reviews.llvm.org/D21036#450106, @sbenza wrote:
>
> > I think this would be more interesting with macros.
> >  Eg triggering in code like this:
> >
> >   #define FOO(type, op) const type& X = op()
> >   FOO(int*, bar);
>
>
> Sorry, I originally missed this comment.
>
> That might be a reasonable addition to this check, but strikes me as a future 
> enhancement. Are you looking for the patch to cover this case initially, or 
> is it fine for a follow-up?


Yes, a follow up is ok. I was just making sure this is considered.


http://reviews.llvm.org/D21036



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


Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Samuel Benzaquen via cfe-commits
sbenza added inline comments.


Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:22
@@ +21,3 @@
+  Finder->addMatcher(
+  valueDecl(allOf(hasType(isConstQualified()),
+  hasType(typedefType(hasDeclaration(

allOf() is unnecessary


Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:26
@@ +25,3 @@
+  isConstQualified(),
+  ignoringParens(functionType(
+  .bind("typedef"))

Should we ignore pointer to members?
If not, we should add a test for those.


http://reviews.llvm.org/D21036



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


Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:22
@@ +21,3 @@
+  Finder->addMatcher(
+  valueDecl(allOf(hasType(isConstQualified()),
+  hasType(typedefType(hasDeclaration(

sbenza wrote:
> allOf() is unnecessary
Good catch, that was a holdover from when I was using clang-query.


Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:26
@@ +25,3 @@
+  isConstQualified(),
+  ignoringParens(functionType(
+  .bind("typedef"))

sbenza wrote:
> Should we ignore pointer to members?
> If not, we should add a test for those.
Pointer to members are not pointer types (they're a MemberPointerType which 
derives from Type, not PointerType), so they are ignored already. I think 
that's reasonable because we'd want the pointer to member function types to 
behave the same as function types. I'll add an explicit test case.


http://reviews.llvm.org/D21036



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


Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Aaron Ballman via cfe-commits
aaron.ballman updated this revision to Diff 59906.
aaron.ballman marked 2 inline comments as done.
aaron.ballman added a comment.

Corrected more review feedback.


http://reviews.llvm.org/D21036

Files:
  clang-tidy/misc/CMakeLists.txt
  clang-tidy/misc/MiscTidyModule.cpp
  clang-tidy/misc/MisplacedConstCheck.cpp
  clang-tidy/misc/MisplacedConstCheck.h
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/misc-misplaced-const.rst
  test/clang-tidy/misc-misplaced-const.c
  test/clang-tidy/misc-misplaced-const.cpp

Index: test/clang-tidy/misc-misplaced-const.cpp
===
--- test/clang-tidy/misc-misplaced-const.cpp
+++ test/clang-tidy/misc-misplaced-const.cpp
@@ -0,0 +1,37 @@
+// RUN: %check_clang_tidy %s misc-misplaced-const %t
+
+typedef int plain_i;
+typedef int *ip;
+typedef const int *cip;
+
+void func() {
+  if (const int *i = 0)
+;
+  if (const plain_i *i = 0)
+;
+  if (const cip i = 0)
+;
+
+  // CHECK-MESSAGES: :[[@LINE+1]]:16: warning: 'i' declared with a const-qualified typedef type; results in the type being 'int *const' instead of 'const int *'
+  if (const ip i = 0)
+;
+}
+
+template 
+struct S {
+  const Ty *i;
+  const Ty &i2;
+};
+
+template struct S;
+template struct S; // ok
+template struct S;
+template struct S; // ok
+
+struct T {
+  typedef void (T::*PMF)();
+
+  void f() {
+const PMF val = &T::f; // ok
+  }
+};
Index: test/clang-tidy/misc-misplaced-const.c
===
--- test/clang-tidy/misc-misplaced-const.c
+++ test/clang-tidy/misc-misplaced-const.c
@@ -0,0 +1,45 @@
+// RUN: %check_clang_tidy %s misc-misplaced-const %t
+
+typedef int plain_i;
+typedef int *ip;
+typedef const int *cip;
+
+typedef void (*func_ptr)(void);
+
+void func(void) {
+  // ok
+  const int *i0 = 0;
+  const plain_i *i1 = 0;
+  const cip i2 = 0; // const applies to both pointer and pointee.
+
+  // Not ok
+  const ip i3 = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i3' declared with a const-qualified typedef type; results in the type being 'int *const' instead of 'const int *'
+
+  ip const i4 = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i4' declared with a const-qualified
+
+  const volatile ip i5 = 0;
+  // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 'i5' declared with a const-qualified typedef type; results in the type being 'int *const volatile' instead of 'const int *volatile'
+}
+
+void func2(const plain_i *i1,
+   const cip i2,
+   const ip i3,
+   // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 'i3' declared with a const-qualified
+   const int *i4) {
+}
+
+struct S {
+  const int *i0;
+  const plain_i *i1;
+  const cip i2;
+  const ip i3;
+  // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: 'i3' declared with a const-qualified
+};
+
+// Function pointers should not be diagnosed because a function
+// pointer type can never be const.
+void func3(const func_ptr fp) {
+  const func_ptr fp2 = fp;
+}
Index: docs/clang-tidy/checks/misc-misplaced-const.rst
===
--- docs/clang-tidy/checks/misc-misplaced-const.rst
+++ docs/clang-tidy/checks/misc-misplaced-const.rst
@@ -0,0 +1,21 @@
+.. title:: clang-tidy - misc-misplaced-const
+
+misc-misplaced-const
+
+
+This check diagnoses when a const qualifier is applied to a typedef to a pointer
+type rather than to the pointee, because such constructs are often misleading to
+developers because the const applies to the pointer rather than the pointee.
+
+For instance, in the following code, the resulting type is `int *` const rather
+than `const int *`:
+
+.. code:: c++
+
+  typedef int *int_ptr;
+  void f(const int_ptr ptr);
+
+The check does not diagnose when the underlying typedef type is a pointer to a
+const type or a function pointer type. This is because the const qualifier is
+less likely to be mistaken because it would be redundant (or disallowed) on the
+underlying pointee type.
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -4,7 +4,6 @@
 =
 
 .. toctree::
-
boost-use-to-string
cert-dcl03-c (redirects to misc-static-assert) 
cert-dcl50-cpp
@@ -63,6 +62,7 @@
misc-inefficient-algorithm
misc-macro-parentheses
misc-macro-repeated-side-effects
+   misc-misplaced-const
misc-misplaced-widening-cast
misc-move-const-arg
misc-move-constructor-init
Index: clang-tidy/misc/MisplacedConstCheck.h
===
--- clang-tidy/misc/MisplacedConstCheck.h
+++ clang-tidy/misc/MisplacedConstCheck.h
@@ -0,0 +1,36 @@
+//===--- MisplacedConstCheck.h - clang-tidy--*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dis

Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Samuel Benzaquen via cfe-commits
sbenza accepted this revision.
This revision is now accepted and ready to land.


Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:22
@@ +21,3 @@
+  Finder->addMatcher(
+  valueDecl(allOf(hasType(isConstQualified()),
+  hasType(typedefType(hasDeclaration(

aaron.ballman wrote:
> sbenza wrote:
> > allOf() is unnecessary
> Good catch, that was a holdover from when I was using clang-query.
You shouldn't need it for clang-query either.


http://reviews.llvm.org/D21036



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


Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Aaron Ballman via cfe-commits
aaron.ballman added inline comments.


Comment at: clang-tidy/misc/MisplacedConstCheck.cpp:23
@@ +22,3 @@
+  valueDecl(hasType(isConstQualified()),
+hasType(typedefType(hasDeclaration(
+typedefDecl(hasType(pointerType(unless(pointee(

Oddly enough, I did. What's more, there's a bug with hasType that I didn't have 
time to track down. It seems `hasType(allOf(...))` always fails but 
`allOf(hasType(...), hasType(...))` works. :-(


http://reviews.llvm.org/D21036



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


[clang-tools-extra] r272025 - Add the misc-misplaced-const check to clang-tidy, which diagnoses when a const-qualifier is applied to a typedef of pointer type rather than to the pointee type.

2016-06-07 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Jun  7 12:22:47 2016
New Revision: 272025

URL: http://llvm.org/viewvc/llvm-project?rev=272025&view=rev
Log:
Add the misc-misplaced-const check to clang-tidy, which diagnoses when a 
const-qualifier is applied to a typedef of pointer type rather than to the 
pointee type.

Added:
clang-tools-extra/trunk/clang-tidy/misc/MisplacedConstCheck.cpp
clang-tools-extra/trunk/clang-tidy/misc/MisplacedConstCheck.h
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst
clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-const.c
clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-const.cpp
Modified:
clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt
clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp
clang-tools-extra/trunk/docs/clang-tidy/checks/list.rst

Modified: clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt?rev=272025&r1=272024&r2=272025&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/CMakeLists.txt Tue Jun  7 12:22:47 
2016
@@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS support)
 add_clang_library(clangTidyMiscModule
   ArgumentCommentCheck.cpp
   AssertSideEffectCheck.cpp
+  MisplacedConstCheck.cpp
   UnconventionalAssignOperatorCheck.cpp
   BoolPointerImplicitConversionCheck.cpp
   DanglingHandleCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp?rev=272025&r1=272024&r2=272025&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/misc/MiscTidyModule.cpp Tue Jun  7 
12:22:47 2016
@@ -12,6 +12,7 @@
 #include "../ClangTidyModuleRegistry.h"
 #include "ArgumentCommentCheck.h"
 #include "AssertSideEffectCheck.h"
+#include "MisplacedConstCheck.h"
 #include "UnconventionalAssignOperatorCheck.h"
 #include "BoolPointerImplicitConversionCheck.h"
 #include "DanglingHandleCheck.h"
@@ -61,6 +62,8 @@ public:
 
CheckFactories.registerCheck("misc-argument-comment");
 CheckFactories.registerCheck(
 "misc-assert-side-effect");
+CheckFactories.registerCheck(
+"misc-misplaced-const");
 CheckFactories.registerCheck(
 "misc-unconventional-assign-operator");
 CheckFactories.registerCheck(

Added: clang-tools-extra/trunk/clang-tidy/misc/MisplacedConstCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/misc/MisplacedConstCheck.cpp?rev=272025&view=auto
==
--- clang-tools-extra/trunk/clang-tidy/misc/MisplacedConstCheck.cpp (added)
+++ clang-tools-extra/trunk/clang-tidy/misc/MisplacedConstCheck.cpp Tue Jun  7 
12:22:47 2016
@@ -0,0 +1,63 @@
+//===--- MisplacedConstCheck.cpp - 
clang-tidy--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "MisplacedConstCheck.h"
+#include "clang/AST/ASTContext.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang {
+namespace tidy {
+namespace misc {
+
+void MisplacedConstCheck::registerMatchers(MatchFinder *Finder) {
+  Finder->addMatcher(
+  valueDecl(hasType(isConstQualified()),
+hasType(typedefType(hasDeclaration(
+typedefDecl(hasType(pointerType(unless(pointee(
+anyOf(isConstQualified(),
+  ignoringParens(functionType(
+.bind("typedef")
+  .bind("decl"),
+  this);
+}
+
+static QualType guessAlternateQualification(ASTContext &Context, QualType QT) {
+  // We're given a QualType from a typedef where the qualifiers apply to the
+  // pointer instead of the pointee. Strip the const qualifier from the pointer
+  // type and add it to the pointee instead.
+  if (!QT->isPointerType())
+return QT;
+
+  Qualifiers Quals = QT.getLocalQualifiers();
+  Quals.removeConst();
+
+  QualType NewQT = Context.getPointerType(
+  QualType(QT->getPointeeType().getTypePtr(), Qualifiers::Const));
+  return NewQT.withCVRQualifiers(Quals.getCVRQualifiers());
+}
+
+void MisplacedConstCheck::check(const MatchFinder::MatchResult &Result) {
+  const auto *Var = Result.Nodes.getNodeAs("decl");
+  const auto *Typedef = Result.Nodes.getNodeAs("typedef");
+  ASTContext &Ctx = *Result.Con

Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Committed in r272025.


http://reviews.llvm.org/D21036



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


[clang-tools-extra] r272026 - Adding a release note for the misc-misplaced-const check added in r272025.

2016-06-07 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Jun  7 12:29:49 2016
New Revision: 272026

URL: http://llvm.org/viewvc/llvm-project?rev=272026&view=rev
Log:
Adding a release note for the misc-misplaced-const check added in r272025.

Modified:
clang-tools-extra/trunk/docs/ReleaseNotes.rst

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=272026&r1=272025&r2=272026&view=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Tue Jun  7 12:29:49 2016
@@ -123,6 +123,12 @@ identified.  The improvements since the
 
   Checks if an unused forward declaration is in a wrong namespace.
 
+- New `misc-misplaced-const
+  `_ 
check
+  
+  Checks if a const-qualifier is applied to a typedef to pointer type instead 
of
+  the underlying pointee type.
+
 - New `misc-misplaced-widening-cast
   
`_
 check
 


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


[clang-tools-extra] r272027 - Fixing a build bot issue with duplicate explicit instantiations.

2016-06-07 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Jun  7 12:32:07 2016
New Revision: 272027

URL: http://llvm.org/viewvc/llvm-project?rev=272027&view=rev
Log:
Fixing a build bot issue with duplicate explicit instantiations.

Modified:
clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-const.cpp

Modified: clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-const.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-const.cpp?rev=272027&r1=272026&r2=272027&view=diff
==
--- clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-const.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-const.cpp Tue Jun  7 
12:32:07 2016
@@ -26,7 +26,14 @@ struct S {
 template struct S;
 template struct S; // ok
 template struct S;
-template struct S; // ok
+
+template 
+struct U {
+  const Ty *i;
+  const Ty &i2;
+};
+
+template struct U; // ok
 
 struct T {
   typedef void (T::*PMF)();


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


r272028 - Make isNoThrow and hasDynamicExceptionSpec polymorphic so they can be used with both functionDecl and functionPrototype matchers.

2016-06-07 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Jun  7 12:34:45 2016
New Revision: 272028

URL: http://llvm.org/viewvc/llvm-project?rev=272028&view=rev
Log:
Make isNoThrow and hasDynamicExceptionSpec polymorphic so they can be used with 
both functionDecl and functionPrototype matchers.

Patch by Don Hinton.

Modified:
cfe/trunk/docs/LibASTMatchersReference.html
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
cfe/trunk/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

Modified: cfe/trunk/docs/LibASTMatchersReference.html
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=272028&r1=272027&r2=272028&view=diff
==
--- cfe/trunk/docs/LibASTMatchersReference.html (original)
+++ cfe/trunk/docs/LibASTMatchersReference.html Tue Jun  7 12:34:45 2016
@@ -2414,8 +2414,9 @@ Given:
   void j() throw();
   void k() throw(int);
   void l() throw(...);
-functionDecl(hasDynamicExceptionSpec())
-  matches the declarations of j, k, and l, but not f, g, h, or i.
+functionDecl(hasDynamicExceptionSpec()) and
+  functionProtoType(hasDynamicExceptionSpec())
+  match the declarations of j, k, and l, but not f, g, h, or i.
 
 
 
@@ -2540,8 +2541,8 @@ Given:
   void h() throw();
   void i() throw(int);
   void j() noexcept(false);
-functionDecl(isNoThrow())
-  matches the declarations of g, and h, but not f, i or j.
+functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
+  match the declarations of g, and h, but not f, i or j.
 
 
 
@@ -2597,6 +2598,37 @@ functionProtoType(parameterCountIs(3))
 
 
 
+MatcherFunctionProtoType>hasDynamicExceptionSpec
+Matches 
functions that have a dynamic exception specification.
+
+Given:
+  void f();
+  void g() noexcept;
+  void h() noexcept(true);
+  void i() noexcept(false);
+  void j() throw();
+  void k() throw(int);
+  void l() throw(...);
+functionDecl(hasDynamicExceptionSpec()) and
+  functionProtoType(hasDynamicExceptionSpec())
+  match the declarations of j, k, and l, but not f, g, h, or i.
+
+
+
+MatcherFunctionProtoType>isNoThrow
+Matches functions that 
have a non-throwing exception specification.
+
+Given:
+  void f();
+  void g() noexcept;
+  void h() throw();
+  void i() throw(int);
+  void j() noexcept(false);
+functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
+  match the declarations of g, and h, but not f, i or j.
+
+
+
 MatcherFunctionProtoType>parameterCountIsunsigned N
 Matches 
FunctionDecls and FunctionProtoTypes that have a
 specific parameter count.

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=272028&r1=272027&r2=272028&view=diff
==
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Jun  7 12:34:45 2016
@@ -3265,10 +3265,13 @@ AST_MATCHER(FunctionDecl, isDefaulted) {
 ///   void k() throw(int);
 ///   void l() throw(...);
 /// \endcode
-/// functionDecl(hasDynamicExceptionSpec())
-///   matches the declarations of j, k, and l, but not f, g, h, or i.
-AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) {
-  if (const auto *FnTy = Node.getType()->getAs())
+/// functionDecl(hasDynamicExceptionSpec()) and
+///   functionProtoType(hasDynamicExceptionSpec())
+///   match the declarations of j, k, and l, but not f, g, h, or i.
+AST_POLYMORPHIC_MATCHER(hasDynamicExceptionSpec,
+AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
+FunctionProtoType)) {
+  if (const FunctionProtoType *FnTy = internal::getFunctionProtoType(Node))
 return FnTy->hasDynamicExceptionSpec();
   return false;
 }
@@ -3283,10 +3286,12 @@ AST_MATCHER(FunctionDecl, hasDynamicExce
 ///   void i() throw(int);
 ///   void j() noexcept(false);
 /// \endcode
-/// functionDecl(isNoThrow())
-///   matches the declarations of g, and h, but not f, i or j.
-AST_MATCHER(FunctionDecl, isNoThrow) {
-  const auto *FnTy = Node.getType()->getAs();
+/// functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
+///   match the declarations of g, and h, but not f, i or j.
+AST_POLYMORPHIC_MATCHER(isNoThrow,
+AST_POLYMORPHIC_SUPPORTED_TYPES(FunctionDecl,
+FunctionProtoType)) {
+  const FunctionProtoType *FnTy = internal::getFunctionProtoType(Node);
 
   // If the function does not have a prototype, then it is assumed to be a
   // throwing function (as it would if the function did not have any exception
@@ -3298,7 +3303,

Re: [PATCH] D20687: [ASTMatchers] Make isNoThrow and hasDynamicExceptionSpec polymorphic for use with both functionDecl and functionProtoType

2016-06-07 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Committed in r272028.


http://reviews.llvm.org/D20687



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


[libcxx] r272029 - Added notes about the issues for Oulu

2016-06-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jun  7 12:54:38 2016
New Revision: 272029

URL: http://llvm.org/viewvc/llvm-project?rev=272029&view=rev
Log:
Added notes about the issues for Oulu

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=272029&r1=272028&r2=272029&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Tue Jun  7 12:54:38 2016
@@ -97,23 +97,23 @@
 Comments about the issues
 
 2181 - 
-2309 - 
-2310 - 
-2328 - 
+2309 - I don't think there's anything to do here.
+2310 - I think we need a test that checks array::data() == 
addressof(front()). Other than that, we're good.
+2328 - :1467 - fix is straightforward.  Need to think about 
tests.
 2393 - 
-2426 - 
-2436 - 
-2441 - 
-2451 - 
-2509 - 
-2516 - 
-2542 - 
-2549 - 
-2550 - 
-2551 - 
-2555 - 
+2426 - I believe this is just a wording clarification, but need to study 
it some more.
+2436 - Adds Requirements on compare/hasher. We can static_assert this, and 
test it.
+2441 - Looks straightforward.
+2451 - Significant work.
+2509 - Significant work.
+2516 - We don't have an observer_ptr implementation yet.
+2542 - This is probably mostly writing additional tests.
+2549 - Tuple EXPLICIT - Eric?
+2550 - Wording clarification; no code change needed.
+2551 - Wording cleanup; no code change needed.
+2555 - Wording clarification; no code change needed.
 2573 - 
-2596 - 
+2596 - Easy.
 2667 - 
 2669 - 
 2670 - 
@@ -121,17 +121,17 @@
 2673 - 
 2674 - 
 2683 - 
-2684 - 
-2685 - 
-2688 - 
-2689 - 
-2698 - 
+2684 - We already have one; just need to add a test for it (in 
test/std/containers/container.adaptors/priority.queue/types.pass.cpp)
+2685 - Wording clarification; no code change needed. We don't handle 
throwing move ctors here anyway.
+2688 - I believe that we already do this.
+2689 - We don't have a parallel implementation yet (though I'm working on 
it).
+2698 - Wording clarification; no code change needed.
 2706 - 
 2707 - 
-2710 - 
+2710 - Wording cleanup; no code change needed.
 
 
-Last Updated: 31-May-2016
+Last Updated: 7-Jun-2016
 
 
 


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


[clang-tools-extra] r272038 - [Clang-tidy] Documentation style consistency.

2016-06-07 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Tue Jun  7 13:29:15 2016
New Revision: 272038

URL: http://llvm.org/viewvc/llvm-project?rev=272038&view=rev
Log:
[Clang-tidy] Documentation style consistency.

Modified:
clang-tools-extra/trunk/docs/ReleaseNotes.rst
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=272038&r1=272037&r2=272038&view=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Tue Jun  7 13:29:15 2016
@@ -126,8 +126,8 @@ identified.  The improvements since the
 - New `misc-misplaced-const
   `_ 
check
   
-  Checks if a const-qualifier is applied to a typedef to pointer type instead 
of
-  the underlying pointee type.
+  Checks if a ``const`` qualifier is applied to a ``typedef`` to pointer type
+  instead of the underlying pointee type.
 
 - New `misc-misplaced-widening-cast
   
`_
 check

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst?rev=272038&r1=272037&r2=272038&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst 
(original)
+++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst Tue 
Jun  7 13:29:15 2016
@@ -3,19 +3,20 @@
 misc-misplaced-const
 
 
-This check diagnoses when a const qualifier is applied to a typedef to a 
pointer
-type rather than to the pointee, because such constructs are often misleading 
to
-developers because the const applies to the pointer rather than the pointee.
+This check diagnoses when a ``const`` qualifier is applied to a ``typedef`` to 
a
+pointer type rather than to the pointee, because such constructs are often
+misleading to developers because the ``const`` applies to the pointer rather
+than the pointee.
 
-For instance, in the following code, the resulting type is `int *` const rather
-than `const int *`:
+For instance, in the following code, the resulting type is ``int *`` ``const``
+rather than ``const int *``:
 
 .. code:: c++
 
   typedef int *int_ptr;
   void f(const int_ptr ptr);
 
-The check does not diagnose when the underlying typedef type is a pointer to a
-const type or a function pointer type. This is because the const qualifier is
-less likely to be mistaken because it would be redundant (or disallowed) on the
-underlying pointee type.
+The check does not diagnose when the underlying ``typedef`` type is a pointer 
to
+a ``const`` type or a function pointer type. This is because the ``const``
+qualifier is less likely to be mistaken because it would be redundant (or
+disallowed) on the underlying pointee type.


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


Re: [clang-tools-extra] r272038 - [Clang-tidy] Documentation style consistency.

2016-06-07 Thread Aaron Ballman via cfe-commits
On Tue, Jun 7, 2016 at 2:29 PM, Eugene Zelenko via cfe-commits
 wrote:
> Author: eugenezelenko
> Date: Tue Jun  7 13:29:15 2016
> New Revision: 272038
>
> URL: http://llvm.org/viewvc/llvm-project?rev=272038&view=rev
> Log:
> [Clang-tidy] Documentation style consistency.

Thank you for fixing those up!

~Aaron

>
> Modified:
> clang-tools-extra/trunk/docs/ReleaseNotes.rst
> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst
>
> Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=272038&r1=272037&r2=272038&view=diff
> ==
> --- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
> +++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Tue Jun  7 13:29:15 2016
> @@ -126,8 +126,8 @@ identified.  The improvements since the
>  - New `misc-misplaced-const
>
> `_ 
> check
>
> -  Checks if a const-qualifier is applied to a typedef to pointer type 
> instead of
> -  the underlying pointee type.
> +  Checks if a ``const`` qualifier is applied to a ``typedef`` to pointer type
> +  instead of the underlying pointee type.
>
>  - New `misc-misplaced-widening-cast
>
> `_
>  check
>
> Modified: 
> clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst
> URL: 
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst?rev=272038&r1=272037&r2=272038&view=diff
> ==
> --- clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst 
> (original)
> +++ clang-tools-extra/trunk/docs/clang-tidy/checks/misc-misplaced-const.rst 
> Tue Jun  7 13:29:15 2016
> @@ -3,19 +3,20 @@
>  misc-misplaced-const
>  
>
> -This check diagnoses when a const qualifier is applied to a typedef to a 
> pointer
> -type rather than to the pointee, because such constructs are often 
> misleading to
> -developers because the const applies to the pointer rather than the pointee.
> +This check diagnoses when a ``const`` qualifier is applied to a ``typedef`` 
> to a
> +pointer type rather than to the pointee, because such constructs are often
> +misleading to developers because the ``const`` applies to the pointer rather
> +than the pointee.
>
> -For instance, in the following code, the resulting type is `int *` const 
> rather
> -than `const int *`:
> +For instance, in the following code, the resulting type is ``int *`` 
> ``const``
> +rather than ``const int *``:
>
>  .. code:: c++
>
>typedef int *int_ptr;
>void f(const int_ptr ptr);
>
> -The check does not diagnose when the underlying typedef type is a pointer to 
> a
> -const type or a function pointer type. This is because the const qualifier is
> -less likely to be mistaken because it would be redundant (or disallowed) on 
> the
> -underlying pointee type.
> +The check does not diagnose when the underlying ``typedef`` type is a 
> pointer to
> +a ``const`` type or a function pointer type. This is because the ``const``
> +qualifier is less likely to be mistaken because it would be redundant (or
> +disallowed) on the underlying pointee type.
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r272042 - [Clang-tidy] Alphabetical checks order in release notes.

2016-06-07 Thread Eugene Zelenko via cfe-commits
Author: eugenezelenko
Date: Tue Jun  7 13:38:42 2016
New Revision: 272042

URL: http://llvm.org/viewvc/llvm-project?rev=272042&view=rev
Log:
[Clang-tidy] Alphabetical checks order in release notes.

Highlight return statement in misc-unconventional-assign-operator documentation.

Modified:
clang-tools-extra/trunk/docs/ReleaseNotes.rst

clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unconventional-assign-operator.rst

Modified: clang-tools-extra/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/ReleaseNotes.rst?rev=272042&r1=272041&r2=272042&view=diff
==
--- clang-tools-extra/trunk/docs/ReleaseNotes.rst (original)
+++ clang-tools-extra/trunk/docs/ReleaseNotes.rst Tue Jun  7 13:38:42 2016
@@ -182,6 +182,13 @@ identified.  The improvements since the
 
   Find suspicious usage of runtime string comparison functions.
 
+- New `misc-unconventional-assign-operator
+  
`_
+  check replacing the *misc-assign-operator-signature* check.
+
+  Does not only checks for correct signature but also for correct ``return``
+  statements (returning ``*this``)
+
 - New `misc-unused-using-decls
   
`_ 
check
 
@@ -258,13 +265,6 @@ identified.  The improvements since the
 
   Finds static function and variable definitions in anonymous namespace.
 
-- New `misc-unconventional-assign-operator
-  
`_
-  check replacing the *misc-assign-operator-signature* check.
-
-  Does not only checks for correct signature but also for correct ``return``
-  statements (returning ``*this``)
-
 Fixed bugs:
 
 - Crash when running on compile database with relative source files paths.

Modified: 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unconventional-assign-operator.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unconventional-assign-operator.rst?rev=272042&r1=272041&r2=272042&view=diff
==
--- 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unconventional-assign-operator.rst
 (original)
+++ 
clang-tools-extra/trunk/docs/clang-tidy/checks/misc-unconventional-assign-operator.rst
 Tue Jun  7 13:38:42 2016
@@ -5,7 +5,7 @@ misc-unconventional-assign-operator
 
 
 Finds declarations of assign operators with the wrong return and/or argument
-types and definitions with good return type but wrong return statements.
+types and definitions with good return type but wrong ``return`` statements.
 
   * The return type must be ``Class&``.
   * Works with move-assign and assign by value.


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


Re: [PATCH] D21020: [clang-tidy] readability-identifier-naming - Support for Macros

2016-06-07 Thread Eugene Zelenko via cfe-commits
Eugene.Zelenko added inline comments.


Comment at: docs/ReleaseNotes.rst:262
@@ -261,1 +261,3 @@
 
+- Updated `readability-identifier-naming-check
+  
`_

Please put this not in alphabetical order. I just fixed misleading order of 
misc-unconventional-assign-operator.


http://reviews.llvm.org/D21020



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


Re: [PATCH] D21082: Do not assume that -fsanitize=address is valid option in clang tests

2016-06-07 Thread Kuba Brecka via cfe-commits
kubabrecka added a subscriber: kubabrecka.
kubabrecka added a comment.

This doesn’t make sense to me, Clang is able to produce ASanified code even 
when the compiler itself isn’t ASanified (that’s what LLVM_USE_SANITIZER does). 
 Where exactly is this test failing?


Repository:
  rL LLVM

http://reviews.llvm.org/D21082



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


Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Haojian Wu via cfe-commits
hokein added a comment.

@aaron.ballman, you forgot to add the check in docs/ReleaseNotes.rst.


http://reviews.llvm.org/D21036



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


Re: [PATCH] D20922: [libcxx] [test] Rename global "x" to "testcases" in complex.number/cases.h and make it const for safety.

2016-06-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT closed this revision.
STL_MSFT added a comment.

Marshall checked this in, so I'm closing this.


http://reviews.llvm.org/D20922



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


Re: [PATCH] D20921: [libcxx] [test] Slightly rearrange scopes in order to avoid shadowing M typedefs.

2016-06-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT closed this revision.
STL_MSFT added a comment.

Marshall checked this one in too, closing.


http://reviews.llvm.org/D20921



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


Re: [PATCH] D21036: Misplaced const-qualification with typedef types

2016-06-07 Thread Aaron Ballman via cfe-commits
On Tue, Jun 7, 2016 at 3:06 PM, Haojian Wu  wrote:
> hokein added a comment.
>
> @aaron.ballman, you forgot to add the check in docs/ReleaseNotes.rst.

Added in a separate commit (r272026).

~Aaron

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


[PATCH] D21092: [libcxx] [test] Fix vector tests that were using ints copy-pasted from vector tests.

2016-06-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

Fix vector tests that were using ints copy-pasted from vector tests.

I copied the bool a[] 0/1 pattern from another vector test.

Fixes MSVC warning C4305 "'argument': truncation from 'int' to 'const bool'".

http://reviews.llvm.org/D21092

Files:
  test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
  test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
  test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
  test/std/containers/sequences/vector.bool/copy.pass.cpp
  test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp

Index: test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
===
--- test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
+++ test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
@@ -32,30 +32,30 @@
 int main()
 {
 {
-int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
-int* an = a + sizeof(a)/sizeof(a[0]);
+bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+bool* an = a + sizeof(a)/sizeof(a[0]);
 test(std::vector(a, an), std::allocator());
 }
 {
-std::vector > l(3, 2, test_allocator(5));
+std::vector > l(3, true, test_allocator(5));
 std::vector > l2(l, test_allocator(3));
 assert(l2 == l);
 assert(l2.get_allocator() == test_allocator(3));
 }
 {
-std::vector > l(3, 2, other_allocator(5));
+std::vector > l(3, true, other_allocator(5));
 std::vector > l2(l, other_allocator(3));
 assert(l2 == l);
 assert(l2.get_allocator() == other_allocator(3));
 }
 #if TEST_STD_VER >= 11
 {
-int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 1, 0};
-int* an = a + sizeof(a)/sizeof(a[0]);
+bool a[] = {0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0};
+bool* an = a + sizeof(a)/sizeof(a[0]);
 test(std::vector>(a, an), min_allocator());
 }
 {
-std::vector > l(3, 2, min_allocator());
+std::vector > l(3, true, min_allocator());
 std::vector > l2(l, min_allocator());
 assert(l2 == l);
 assert(l2.get_allocator() == min_allocator());
Index: test/std/containers/sequences/vector.bool/copy.pass.cpp
===
--- test/std/containers/sequences/vector.bool/copy.pass.cpp
+++ test/std/containers/sequences/vector.bool/copy.pass.cpp
@@ -38,14 +38,14 @@
 test(std::vector(a, an));
 }
 {
-std::vector > v(3, 2, test_allocator(5));
+std::vector > v(3, true, test_allocator(5));
 std::vector > v2 = v;
 assert(v2 == v);
 assert(v2.get_allocator() == v.get_allocator());
 }
 #if TEST_STD_VER >= 11
 {
-std::vector > v(3, 2, other_allocator(5));
+std::vector > v(3, true, other_allocator(5));
 std::vector > v2 = v;
 assert(v2 == v);
 assert(v2.get_allocator() == other_allocator(-2));
@@ -56,7 +56,7 @@
 test(std::vector>(a, an));
 }
 {
-std::vector > v(3, 2, min_allocator());
+std::vector > v(3, true, min_allocator());
 std::vector > v2 = v;
 assert(v2 == v);
 assert(v2.get_allocator() == v.get_allocator());
Index: test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
===
--- test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
+++ test/std/containers/sequences/vector.bool/construct_size_value_alloc.pass.cpp
@@ -33,8 +33,8 @@
 
 int main()
 {
-test >(50, 3, std::allocator());
+test >(50, true, std::allocator());
 #if TEST_STD_VER >= 11
-test> >(50, 3, min_allocator());
+test> >(50, true, min_allocator());
 #endif
 }
Index: test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
===
--- test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
+++ test/std/containers/sequences/vector.bool/construct_size_value.pass.cpp
@@ -31,8 +31,8 @@
 
 int main()
 {
-test >(50, 3);
+test >(50, true);
 #if TEST_STD_VER >= 11
-test> >(50, 3);
+test> >(50, true);
 #endif
 }
Index: test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
===
--- test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
+++ test/std/containers/sequences/vector.bool/assign_copy.pass.cpp
@@ -19,22 +19,22 @@
 int main()
 {
 {
-std::vector > l(3, 2, test_allocator(5));
+std::vector > l(3, true, test_allocator(5));
 std::vector > l2(l, test_allocator(3));
 l2 = l;
 asser

[PATCH] D21093: [libcxx] [test] In unord.hash/floating.pass.cpp, add a static_cast to fix a truncation warning.

2016-06-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

In unord.hash/floating.pass.cpp, add a static_cast to fix a truncation warning.

Fixes MSVC warning C4305 "'argument': truncation from 'double' to 'const 
std::hash::_Kty'".

http://reviews.llvm.org/D21093

Files:
  test/std/utilities/function.objects/unord.hash/floating.pass.cpp

Index: test/std/utilities/function.objects/unord.hash/floating.pass.cpp
===
--- test/std/utilities/function.objects/unord.hash/floating.pass.cpp
+++ test/std/utilities/function.objects/unord.hash/floating.pass.cpp
@@ -35,7 +35,7 @@
 
 std::size_t t0 = h(0.);
 std::size_t tn0 = h(-0.);
-std::size_t tp1 = h(0.1);
+std::size_t tp1 = h(static_cast(0.1));
 std::size_t t1 = h(1);
 std::size_t tn1 = h(-1);
 std::size_t pinf = h(INFINITY);


Index: test/std/utilities/function.objects/unord.hash/floating.pass.cpp
===
--- test/std/utilities/function.objects/unord.hash/floating.pass.cpp
+++ test/std/utilities/function.objects/unord.hash/floating.pass.cpp
@@ -35,7 +35,7 @@
 
 std::size_t t0 = h(0.);
 std::size_t tn0 = h(-0.);
-std::size_t tp1 = h(0.1);
+std::size_t tp1 = h(static_cast(0.1));
 std::size_t t1 = h(1);
 std::size_t tn1 = h(-1);
 std::size_t pinf = h(INFINITY);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21094: [libcxx] [test] In test/support/test_allocator.h, fix construct() to avoid moving immovable types.

2016-06-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

In test/support/test_allocator.h, fix construct() to avoid moving immovable 
types.

This improves the allocator's conformance, and fixes compiler errors with 
MSVC's STL. The scenario is when the allocator is asked to construct an object 
of type X that's immovable (deleted copy/move ctors), but implicitly 
constructible from an argument type A. When perfectly forwarded, X can be 
(explicitly) constructed from A, and everything is fine. That's 
std::allocator's behavior, and the Standard's default when a user allocator's 
construct() doesn't exist. The previous implementation of construct() here 
mishandled this scenario. Passing A to this construct() would implicitly 
construct an X temporary, bound to (non-templated) T&&. Then construct() would 
attempt to move-construct X from that X temporary, but X is immovable, boom.

http://reviews.llvm.org/D21094

Files:
  test/support/test_allocator.h

Index: test/support/test_allocator.h
===
--- test/support/test_allocator.h
+++ test/support/test_allocator.h
@@ -80,11 +80,12 @@
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);}
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 void construct(pointer p, const T& val)
 {::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void construct(pointer p, T&& val)
-{::new(p) T(std::move(val));}
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template  void construct(pointer p, U&& val)
+{::new(p) T(std::forward(val));}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 void destroy(pointer p) {p->~T();}
 
@@ -140,11 +141,12 @@
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); }
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 void construct(pointer p, const T& val)
 {::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void construct(pointer p, T&& val)
-{::new(p) T(std::move(val));}
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template  void construct(pointer p, U&& val)
+{::new(p) T(std::forward(val));}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 void destroy(pointer p) {p->~T();}
 


Index: test/support/test_allocator.h
===
--- test/support/test_allocator.h
+++ test/support/test_allocator.h
@@ -80,11 +80,12 @@
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);}
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 void construct(pointer p, const T& val)
 {::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void construct(pointer p, T&& val)
-{::new(p) T(std::move(val));}
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template  void construct(pointer p, U&& val)
+{::new(p) T(std::forward(val));}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 void destroy(pointer p) {p->~T();}
 
@@ -140,11 +141,12 @@
 {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); }
 size_type max_size() const throw()
 {return UINT_MAX / sizeof(T);}
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
 void construct(pointer p, const T& val)
 {::new(p) T(val);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-void construct(pointer p, T&& val)
-{::new(p) T(std::move(val));}
+#else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template  void construct(pointer p, U&& val)
+{::new(p) T(std::forward(val));}
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
 void destroy(pointer p) {p->~T();}
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21095: [libcxx] [test] Fix another MSVC warning C4101 "unreferenced local variable".

2016-06-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

Fix another MSVC warning C4101 "unreferenced local variable".

http://reviews.llvm.org/D21095

Files:
  
test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp

Index: 
test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
===
--- 
test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
+++ 
test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
@@ -83,7 +83,7 @@
 assert(!t0.joinable());
 try {
 t0.detach();
-} catch (std::system_error const& ec) {
+} catch (std::system_error const&) {
 }
 }
 #endif


Index: test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
===
--- test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
+++ test/std/thread/thread.threads/thread.thread.class/thread.thread.member/detach.pass.cpp
@@ -83,7 +83,7 @@
 assert(!t0.joinable());
 try {
 t0.detach();
-} catch (std::system_error const& ec) {
+} catch (std::system_error const&) {
 }
 }
 #endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D21096: [libcxx] [test] Fix MSVC warning C4125 "decimal digit terminates octal escape sequence".

2016-06-07 Thread Stephan T. Lavavej via cfe-commits
STL_MSFT created this revision.
STL_MSFT added reviewers: mclow.lists, EricWF.
STL_MSFT added a subscriber: cfe-commits.

Fix MSVC warning C4125 "decimal digit terminates octal escape sequence".

MSVC somewhat justifiably warns when it sees an octal escape immediately 
followed by a decimal digit, even if the octal escape used the maximum of 3 
octal digits.  Avoiding this warning while preserving the test's semantics (as 
viewed by the library) is easy - simply separate the string literal after the 
octal escape is finished.

http://reviews.llvm.org/D21096

Files:
  test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
  test/std/re/re.submatch/re.submatch.op/compare.pass.cpp

Index: test/std/re/re.submatch/re.submatch.op/compare.pass.cpp
===
--- test/std/re/re.submatch/re.submatch.op/compare.pass.cpp
+++ test/std/re/re.submatch/re.submatch.op/compare.pass.cpp
@@ -283,6 +283,6 @@
 test(std::string("1234"), std::string("123"));
 test(std::wstring(L"123"), std::wstring(L"123"));
 test(std::wstring(L"1234"), std::wstring(L"123"));
-test(std::string("123\00056", 6), std::string("123\00056", 6), false);
-test(std::wstring(L"123\00056", 6), std::wstring(L"123\00056", 6), false);
+test(std::string("123\000" "56", 6), std::string("123\000" "56", 6), 
false);
+test(std::wstring(L"123\000" L"56", 6), std::wstring(L"123\000" L"56", 6), 
false);
 }
Index: test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
===
--- test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
+++ test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
@@ -25,5 +25,5 @@
 assert(std::regex_match("\4", std::regex("\\4", awk)));
 assert(std::regex_match("\41", std::regex("\\41", awk)));
 assert(std::regex_match("\141", std::regex("\\141", awk)));
-assert(std::regex_match("\1411", std::regex("\\1411", awk)));
+assert(std::regex_match("\141" "1", std::regex("\\1411", awk)));
 }


Index: test/std/re/re.submatch/re.submatch.op/compare.pass.cpp
===
--- test/std/re/re.submatch/re.submatch.op/compare.pass.cpp
+++ test/std/re/re.submatch/re.submatch.op/compare.pass.cpp
@@ -283,6 +283,6 @@
 test(std::string("1234"), std::string("123"));
 test(std::wstring(L"123"), std::wstring(L"123"));
 test(std::wstring(L"1234"), std::wstring(L"123"));
-test(std::string("123\00056", 6), std::string("123\00056", 6), false);
-test(std::wstring(L"123\00056", 6), std::wstring(L"123\00056", 6), false);
+test(std::string("123\000" "56", 6), std::string("123\000" "56", 6), false);
+test(std::wstring(L"123\000" L"56", 6), std::wstring(L"123\000" L"56", 6), false);
 }
Index: test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
===
--- test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
+++ test/std/re/re.regex/re.regex.construct/awk_oct.pass.cpp
@@ -25,5 +25,5 @@
 assert(std::regex_match("\4", std::regex("\\4", awk)));
 assert(std::regex_match("\41", std::regex("\\41", awk)));
 assert(std::regex_match("\141", std::regex("\\141", awk)));
-assert(std::regex_match("\1411", std::regex("\\1411", awk)));
+assert(std::regex_match("\141" "1", std::regex("\\1411", awk)));
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: 3.8 Merge Request: r259776

2016-06-07 Thread Tom Stellard via cfe-commits
Hi Alexy,

Can you merge this?

Thanks,
Tom

On Tue, Jun 07, 2016 at 09:40:44AM -0700, Richard Smith wrote:
> It's larger than I'd like for a merge onto the branch, but yes, it looks OK.
> 
> On 7 Jun 2016 9:20 a.m., "Tom Stellard via cfe-commits" <
> cfe-commits@lists.llvm.org> wrote:
> 
> > Hi Richard,
> >
> > Is this OK for the 3.8 branch?
> >
> > reviews.llvm.org/rL259776
> >
> > -Tom
> >
> > On Mon, May 30, 2016 at 11:35:04AM +, Hahnfeld, Jonas wrote:
> > > Assuming I got it right...
> > >
> > > > -Original Message-
> > > > From: Alexey Bataev [mailto:a.bat...@hotmail.com]
> > > > Sent: Monday, May 30, 2016 1:31 PM
> > > > To: Hahnfeld, Jonas
> > > > Cc: cfe-commits@lists.llvm.org; Tom Stellard
> > > > Subject: Re: 3.8 Merge Request: r259776
> > > >
> > > > I can try to rebase it to 3.8.1 but Tom wants an approve from Richard.
> > > > Ping him!
> > > >
> > > > Best regards,
> > > > Alexey Bataev
> > > > =
> > > > Software Engineer
> > > > Intel Compiler Team
> > > >
> > > >
> > > >
> > > > 30.05.2016 14:19, Hahnfeld, Jonas пишет:
> > > > > Hi,
> > > > >
> > > > > last possible ping as changes are required to be merged by
> > tomorrow...
> > > > >
> > > > > Cheers,
> > > > > Jonas
> > > > >
> > > > >> -Original Message-
> > > > >> From: llvm-commits [mailto:llvm-commits-boun...@lists.llvm.org] On
> > > > >> Behalf Of Hahnfeld, Jonas via llvm-commits
> > > > >> Sent: Monday, May 23, 2016 8:13 AM
> > > > >> To: Tom Stellard
> > > > >> Cc: Bataev, Alexey (a.bat...@hotmail.com);
> > > > >> llvm-comm...@lists.llvm.org
> > > > >> Subject: RE: 3.8 Merge Request: r259776
> > > > >>
> > > > >> Ping. I would really much like to see this (and possibly other
> > OpenMP
> > > > > bugs)
> > > > >> fixed for 3.8.1.
> > > > >>
> > > > >> Thanks,
> > > > >> Jonas
> > > > >>
> > > > >>> -Original Message-
> > > > >>> From: Tom Stellard [mailto:t...@stellard.net]
> > > > >>> Sent: Thursday, May 19, 2016 7:37 PM
> > > > >>> To: Hahnfeld, Jonas
> > > > >>> Cc: llvm-comm...@lists.llvm.org; Bataev, Alexey
> > > > >>> (a.bat...@hotmail.com)
> > > > >>> Subject: Re: 3.8 Merge Request: r259776
> > > > >>>
> > > > >>> On Thu, May 19, 2016 at 11:25:43AM +, Hahnfeld, Jonas wrote:
> > > >  This bug also exists in 3.8.0. Alexey already agreed to merge this
> > > >  back
> > > > >> in
> > > >  March:
> > > >  http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-
> > > > >>> 20160314/152975.html
> > > >  Alexey, are there other OpenMP commits needed for 3.8.1?
> > > > 
> > > > >>> Hi,
> > > > >>>
> > > > >>> I would also like Richard to take a look at this one to.
> > > > >>>
> > > > >>> Richard, does this look OK to merge:
> > > > >>>
> > > > >>> reviews.llvm.org/rL259776
> > > > >>>
> > > > >>> -Tom
> > > > >>>
> > > >  Cheers,
> > > >  Jonas
> > > >
> > >
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r272050 - Added notes for a bunch of the issues

2016-06-07 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Jun  7 15:05:57 2016
New Revision: 272050

URL: http://llvm.org/viewvc/llvm-project?rev=272050&view=rev
Log:
Added notes for a bunch of the issues

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=272050&r1=272049&r2=272050&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Tue Jun  7 15:05:57 2016
@@ -4,7 +4,7 @@
 
 
   
-  libc++ Jacksonville Status
+  libc++ Upcoming Meeting Status
   
   
 
@@ -60,7 +60,7 @@
Issue #Issue 
NameMeetingStatus
 
http://wg21.link/LWG2181";>2181Exceptions 
from seed sequence operationsOulu
-   http://wg21.link/LWG2309";>2309mutex::lock() should not throw 
device_or_resource_busyOulu
+   http://wg21.link/LWG2309";>2309mutex::lock() should not throw 
device_or_resource_busyOuluComplete
http://wg21.link/LWG2310";>2310Public 
exposition only member in std::arrayOulu
http://wg21.link/LWG2328";>2328Rvalue 
stream extraction should use perfect forwardingOulu
http://wg21.link/LWG2393";>2393std::function's Callable 
definition is brokenOulu
@@ -72,9 +72,9 @@
http://wg21.link/LWG2516";>2516[fund.ts.v2] Public 
"exposition only" members in observer_ptrOulu
http://wg21.link/LWG2542";>2542Missing 
const requirements for associative containersOulu
http://wg21.link/LWG2549";>2549Tuple 
EXPLICIT constructor templates that take tuple parameters end up taking 
references to temporaries and will create dangling 
referencesOulu
-   http://wg21.link/LWG2550";>2550Wording of 
unordered container's clear() method complexityOulu
-   http://wg21.link/LWG2551";>2551[fund.ts.v2] "Exception 
safety" cleanup in library fundamentals requiredOulu
-   http://wg21.link/LWG2555";>2555[fund.ts.v2] No handling for 
over-aligned types in optionalOulu
+   http://wg21.link/LWG2550";>2550Wording of 
unordered container's clear() method 
complexityOuluComplete
+   http://wg21.link/LWG2551";>2551[fund.ts.v2] "Exception 
safety" cleanup in library fundamentals 
requiredOuluComplete
+   http://wg21.link/LWG2555";>2555[fund.ts.v2] No handling for 
over-aligned types in optionalOuluComplete
http://wg21.link/LWG2573";>2573[fund.ts.v2] 
std::hash> does not work for 
arraysOulu
http://wg21.link/LWG2596";>2596vector::data() should use 
addressofOulu
http://wg21.link/LWG2667";>2667path::root_directory() 
description is confusingOulu
@@ -84,14 +84,14 @@
http://wg21.link/LWG2673";>2673status() 
effects cannot be implemented as specifiedOulu
http://wg21.link/LWG2674";>2674Bidirectional iterator 
requirement on path::iterator is very expensiveOulu
http://wg21.link/LWG2683";>2683filesystem::copy() says "no 
effects"Oulu
-   http://wg21.link/LWG2684";>2684priority_queue lacking 
comparator typedefOulu
-   http://wg21.link/LWG2685";>2685shared_ptr 
deleters must not not throw on move constructionOulu
+   http://wg21.link/LWG2684";>2684priority_queue lacking 
comparator typedefOuluPatch Ready
+   http://wg21.link/LWG2685";>2685shared_ptr 
deleters must not not throw on move 
constructionOuluComplete
http://wg21.link/LWG2688";>2688clamp 
misses preconditions and has extraneous condition on 
resultOulu
http://wg21.link/LWG2689";>2689Parallel 
versions of std::copy and std::move shouldn't be in 
orderOulu
-   http://wg21.link/LWG2698";>2698Effect of 
assign() on iterators/pointers/referencesOulu
+   http://wg21.link/LWG2698";>2698Effect of 
assign() on 
iterators/pointers/referencesOuluComplete
http://wg21.link/LWG2706";>2706Error 
reporting for recursive_directory_iterator::pop() is 
under-specifiedOulu
http://wg21.link/LWG2707";>2707path 
construction and assignment should have "string_type&&" 
overloadsOulu
-   http://wg21.link/LWG2710";>2710"Effects: 
Equivalent to ..." doesn't count "Synchronization:" as determined 
semanticsOulu
+   http://wg21.link/LWG2710";>2710"Effects: 
Equivalent to ..." doesn't count "Synchronization:" as determined 
semanticsOuluComplete
   
 
 Comments about the issues
@@ -121,7 +121,7 @@
 2673 - 
 2674 - 
 2683 - 
-2684 - We already have one; just need to add a test for it (in 
test/std/containers/container.adaptors/priority.queue/types.pass.cpp)
+2684 - We already have one; just need to add a test for it.
 2685 - Wording clarification; no code change needed. We don't handle 
throwing move ctors here anyway.
 2688 - I believe that we already do this.
 2689 - We don't have a parallel implementation yet (though I'm working on 
it).


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


[PATCH] D21099: [Sema] Teach -Wcast-align to look at the aligned attribute of the declared variables

2016-06-07 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a subscriber: cfe-commits.

Sema::CheckCastAlign currently ignores the aligned attribute attached to the 
declared variables, which causes clang to issue spurious warnings. This patch 
fixes the bug.

http://reviews.llvm.org/D21099

Files:
  lib/Sema/SemaChecking.cpp
  test/Sema/warn-cast-align.c

Index: test/Sema/warn-cast-align.c
===
--- test/Sema/warn-cast-align.c
+++ test/Sema/warn-cast-align.c
@@ -39,3 +39,23 @@
 void test3(char *P) {
   struct B *b = (struct B*) P;
 }
+
+// Do not issue a warning. The aligned attribute changes the alignment of the
+// variables and fields.
+char __attribute__((aligned(4))) a[16];
+
+struct S0 {
+  char a[16];
+};
+
+struct S {
+  char __attribute__((aligned(4))) a[16];
+  struct S0 __attribute__((aligned(4))) s0;
+};
+
+void test4() {
+  struct S s;
+  int *i = (int *)s.a;
+  i = (int *)&s.s0;
+  i = (int *)a;
+}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -9304,6 +9304,23 @@
   if (SrcPointee->isIncompleteType()) return;
 
   CharUnits SrcAlign = Context.getTypeAlignInChars(SrcPointee);
+  Expr *SE = nullptr;
+
+  if (auto *CE = dyn_cast(Op)) {
+if (CE->getCastKind() == CK_ArrayToPointerDecay)
+  SE = CE->getSubExpr();
+  } else if (auto *UO = dyn_cast(Op)) {
+if (UO->getOpcode() == UO_AddrOf)
+  SE = UO->getSubExpr();
+  }
+
+  if (SE) {
+if (const DeclRefExpr *DRE = dyn_cast(SE))
+  SrcAlign = Context.getDeclAlign(DRE->getDecl());
+else if (const MemberExpr *ME = dyn_cast(SE))
+  SrcAlign = Context.getDeclAlign(ME->getMemberDecl());
+  }
+
   if (SrcAlign >= DestAlign) return;
 
   Diag(TRange.getBegin(), diag::warn_cast_align)


Index: test/Sema/warn-cast-align.c
===
--- test/Sema/warn-cast-align.c
+++ test/Sema/warn-cast-align.c
@@ -39,3 +39,23 @@
 void test3(char *P) {
   struct B *b = (struct B*) P;
 }
+
+// Do not issue a warning. The aligned attribute changes the alignment of the
+// variables and fields.
+char __attribute__((aligned(4))) a[16];
+
+struct S0 {
+  char a[16];
+};
+
+struct S {
+  char __attribute__((aligned(4))) a[16];
+  struct S0 __attribute__((aligned(4))) s0;
+};
+
+void test4() {
+  struct S s;
+  int *i = (int *)s.a;
+  i = (int *)&s.s0;
+  i = (int *)a;
+}
Index: lib/Sema/SemaChecking.cpp
===
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -9304,6 +9304,23 @@
   if (SrcPointee->isIncompleteType()) return;
 
   CharUnits SrcAlign = Context.getTypeAlignInChars(SrcPointee);
+  Expr *SE = nullptr;
+
+  if (auto *CE = dyn_cast(Op)) {
+if (CE->getCastKind() == CK_ArrayToPointerDecay)
+  SE = CE->getSubExpr();
+  } else if (auto *UO = dyn_cast(Op)) {
+if (UO->getOpcode() == UO_AddrOf)
+  SE = UO->getSubExpr();
+  }
+
+  if (SE) {
+if (const DeclRefExpr *DRE = dyn_cast(SE))
+  SrcAlign = Context.getDeclAlign(DRE->getDecl());
+else if (const MemberExpr *ME = dyn_cast(SE))
+  SrcAlign = Context.getDeclAlign(ME->getMemberDecl());
+  }
+
   if (SrcAlign >= DestAlign) return;
 
   Diag(TRange.getBegin(), diag::warn_cast_align)
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


RE: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

2016-06-07 Thread Liu, Yaxun (Sam) via cfe-commits
Hi Jeroen,

Thanks for your consideration.

I am OK with removing those extensions which do not affect language or builtin 
functions. After removing them, they will be unknown to Clang. If a user tries 
to enable them, a warning will be emitted saying the extension is unknown. 

Anastasia, are you OK with that? Thanks.

Sam

-Original Message-
From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk] 
Sent: Monday, June 6, 2016 5:16 PM
To: Liu, Yaxun (Sam) 
Cc: Anastasia Stulova ; Clang Commits 
; nd 
Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target info.

Hi Sam,

Thanks baring with me, and thanks a lot for your explanation! I indeed now 
believe that this is correct; I got somewhat confused by all the macro magic 
that is going on, and had missed that the enabled extensions are actually 
stored in a class instance separate from the one with available options.

I still think it would be good if the extensions that only affect the host-side 
are removed, in particular cl_khr_icd and cl_khr_terminate_context. We have a 
runtime that indirectly includes both Clang’s OpenCLExtensions.def and the 
Khronos extension header, and we run into problems when we include the 
extension header before OpenCLExtensions.def, because the extension header 
defines macros named cl_khr_icd and cl_khr_terminate_context. I admit this is a 
somewhat special use-case though.

Thanks again,

 Jeroen

> On 02 Jun 2016, at 21:53, Liu, Yaxun (Sam)  wrote:
> 
> Sorry for the delay.
> 
> In ParsePragma.cpp:
> 
> void Parser::HandlePragmaOpenCLExtension() {  
> assert(Tok.is(tok::annot_pragma_opencl_extension));
>  OpenCLExtData data =
>  OpenCLExtData::getFromOpaqueValue(Tok.getAnnotationValue());
>  unsigned state = data.getInt();
>  IdentifierInfo *ename = data.getPointer();  SourceLocation NameLoc = 
> Tok.getLocation();  ConsumeToken(); // The annotation token.
> 
>  OpenCLOptions &f = Actions.getOpenCLOptions();  auto CLVer = 
> getLangOpts().OpenCLVersion;  auto &Supp = 
> getTargetInfo().getSupportedOpenCLOpts();
>  // OpenCL 1.1 9.1: "The all variant sets the behavior for all 
> extensions,  // overriding all previously issued extension directives, 
> but only if the  // behavior is set to disable."
>  if (state == 0 && ename->isStr("all")) { #define OPENCLEXT(nm) \
>if (Supp.is_##nm##_supported_extension(CLVer)) \
>  f.nm = 0;
> #include "clang/Basic/OpenCLExtensions.def"
>  }
> #define OPENCLEXT(nm) else if (ename->isStr(#nm)) \
>   if (Supp.is_##nm##_supported_extension(CLVer)) \
> f.nm = state; \
>   else if (Supp.is_##nm##_supported_core(CLVer)) \
> PP.Diag(NameLoc, diag::warn_pragma_extension_is_core) << ename; \
>   else \
> PP.Diag(NameLoc, diag::warn_pragma_unsupported_extension) << 
> ename; #include "clang/Basic/OpenCLExtensions.def"
>  else {
>PP.Diag(NameLoc, diag::warn_pragma_unknown_extension) << ename;
>return;
>  }
> }
> 
> Whether an extension is supported is represented by 
> getTargetInfo().getSupportedOpenCLOpts(), which does not change with pragma.
> 
> Whether an extension is enabled is reprented by Actions.getOpenCLOptions(), 
> which changes with pragma.
> 
> test/SemaOpenCL/extensions.cl contains examples of unsupported extensions.
> 
> Sam
> 
> -Original Message-
> From: Jeroen Ketema [mailto:j.ket...@imperial.ac.uk]
> Sent: Tuesday, May 31, 2016 6:07 PM
> To: Liu, Yaxun (Sam) 
> Cc: Anastasia Stulova ; Clang Commits 
> ; nd 
> Subject: Re: r269670 - [OpenCL] Add supported OpenCL extensions to target 
> info.
> 
> Hi Sam,
> 
>> This commit does not change the initial state of the extensions. An 
>> extension is supported is not the same as enabled. At the beginning all 
>> extensions are disabled.
> 
> I do not see this reflected in the code at all. Could you please:
> 
> a. Point me to the location where this distinction is made.
> 
> b. Convince me that I cannot enable an extension for a target if that target 
> does not support the extension?
> 
> Jeroen
> 

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


  1   2   >