r261618 - [ms-inline-asm] Fixing bug in single asm statement support

2016-02-23 Thread Marina Yatsina via cfe-commits
Author: myatsina
Date: Tue Feb 23 02:53:45 2016
New Revision: 261618

URL: http://llvm.org/viewvc/llvm-project?rev=261618&view=rev
Log:
[ms-inline-asm] Fixing bug in single asm statement support

Fixing a crash caused by trying to merge a single-line asm statement with an 
asm block that follows it, e.g:
asm int 4
asm {
  int 5
}

Now, only adjacent single-line asm statements that are not surrounded by braces 
will be merged into one asm call.

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


Modified:
cfe/trunk/lib/Parse/ParseStmtAsm.cpp
cfe/trunk/test/CodeGen/ms-inline-asm.c
cfe/trunk/test/Parser/ms-inline-asm.c

Modified: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmtAsm.cpp?rev=261618&r1=261617&r2=261618&view=diff
==
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp Tue Feb 23 02:53:45 2016
@@ -423,6 +423,10 @@ StmtResult Parser::ParseMicrosoftAsmStat
 // We're no longer in a comment.
 InAsmComment = false;
 if (isAsm) {
+  // If this is a new __asm {} block we want to process it seperately
+  // from the single-line __asm statements
+  if (PP.LookAhead(0).is(tok::l_brace))
+break;
   LineNo = SrcMgr.getLineNumber(ExpLoc.first, ExpLoc.second);
   SkippedStartOfLine = Tok.isAtStartOfLine();
 }

Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=261618&r1=261617&r2=261618&view=diff
==
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Tue Feb 23 02:53:45 2016
@@ -63,10 +63,19 @@ void t7() {
 int t8() {
   __asm int 4 ; } comments for single-line asm
   __asm {}
-  __asm int 4
+  __asm { int 5}
+  __asm int 6
+  __asm int 7
+  __asm { 
+int 8
+  }
   return 10;
 // CHECK: t8
-// CHECK: call i32 asm sideeffect inteldialect "int $$4\0A\09int $$4", 
"={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "int $$4", 
"={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "", 
"={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "int $$5", 
"={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "int $$6\0A\09int $$7", 
"={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "int $$8", 
"={eax},~{dirflag},~{fpsr},~{flags}"()
 // CHECK: ret i32 10
 }
 

Modified: cfe/trunk/test/Parser/ms-inline-asm.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/ms-inline-asm.c?rev=261618&r1=261617&r2=261618&view=diff
==
--- cfe/trunk/test/Parser/ms-inline-asm.c (original)
+++ cfe/trunk/test/Parser/ms-inline-asm.c Tue Feb 23 02:53:45 2016
@@ -55,4 +55,4 @@ void t12() {
 }
 int t_fail() { // expected-note {{to match this}}
   __asm 
-  __asm { // expected-error 2 {{expected}} expected-note {{to match this}}
+  __asm { // expected-error 3 {{expected}} expected-note {{to match this}}


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


[clang-tools-extra] r261622 - [clang-tidy] Updated docs on testing clang-tidy checks.

2016-02-23 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Feb 23 03:30:20 2016
New Revision: 261622

URL: http://llvm.org/viewvc/llvm-project?rev=261622&view=rev
Log:
[clang-tidy] Updated docs on testing clang-tidy checks.

Modified:
clang-tools-extra/trunk/docs/clang-tidy/index.rst

Modified: clang-tools-extra/trunk/docs/clang-tidy/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/docs/clang-tidy/index.rst?rev=261622&r1=261621&r2=261622&view=diff
==
--- clang-tools-extra/trunk/docs/clang-tidy/index.rst (original)
+++ clang-tools-extra/trunk/docs/clang-tidy/index.rst Tue Feb 23 03:30:20 2016
@@ -546,11 +546,12 @@ It's advised to make the checks as speci
 to incorrect parts of the input. Use ``[[@LINE+X]]``/``[[@LINE-X]]``
 substitutions and distinct function and variable names in the test code.
 
-Here's an example of a test using the ``check_clang_tidy.py`` script:
+Here's an example of a test using the ``check_clang_tidy.py`` script (the full
+source code is at `test/clang-tidy/google-readability-casting.cpp`_):
 
 .. code-block:: bash
 
-  // RUN: %python %S/check_clang_tidy.py %s google-readability-casting %t
+  // RUN: %check_clang_tidy %s google-readability-casting %t
 
   void f(int a) {
 int b = (int)a;
@@ -558,8 +559,25 @@ Here's an example of a test using the ``
 // CHECK-FIXES: int b = a;
   }
 
+There are many dark corners in the C++ language, and it may be difficult to 
make
+your check work perfectly in all cases, especially if it issues fixit hints. 
The
+most frequent pitfalls are macros and templates:
+
+1. code written in a macro body/template definition may have a different 
meaning
+   depending on the macro expansion/template instantiation;
+2. multiple macro expansions/template instantiations may result in the same 
code
+   being inspected by the check multiple times (possibly, with different
+   meanings, see 1), and the same warning (or a slightly different one) may be
+   issued by the check multipe times; clang-tidy will deduplicate _identical_
+   warnings, but if the warnings are slightly different, all of them will be
+   shown to the user (and used for applying fixes, if any);
+3. making replacements to a macro body/template definition may be fine for some
+   macro expansions/template instantiations, but easily break some other
+   expansions/instantiations.
+
 .. _lit: http://llvm.org/docs/CommandGuide/lit.html
 .. _FileCheck: http://llvm.org/docs/CommandGuide/FileCheck.html
+.. _test/clang-tidy/google-readability-casting.cpp: 
http://reviews.llvm.org/diffusion/L/browse/clang-tools-extra/trunk/test/clang-tidy/google-readability-casting.cpp
 
 
 Running clang-tidy on LLVM


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


Re: [PATCH] D17484: [clang-tidy] introduce modernize-deprecated-headers check

2016-02-23 Thread Kirill Bobyrev via cfe-commits
omtcyf0 updated this revision to Diff 48797.
omtcyf0 marked 4 inline comments as done.
omtcyf0 added a comment.

Resolved issues @alexfh pointed to.


http://reviews.llvm.org/D17484

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/DeprecatedHeadersCheck.cpp
  clang-tidy/modernize/DeprecatedHeadersCheck.h
  clang-tidy/modernize/ModernizeTidyModule.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-deprecated-headers.rst
  test/clang-tidy/modernize-deprecated-headers-cxx03.cpp
  test/clang-tidy/modernize-deprecated-headers-cxx11.cpp

Index: test/clang-tidy/modernize-deprecated-headers-cxx11.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-deprecated-headers-cxx11.cpp
@@ -0,0 +1,163 @@
+// RUN: %check_clang_tidy %s modernize-deprecated-headers %t -- -- -std=c++11 -isystem %S/Inputs/Headers
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'ccomplex' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider using 'cfenv' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'iso646.h'; consider using 'ciso646' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdalign.h'; consider using 'cstdalign' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdbool.h'; consider using 'cstdbool' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'tgmath.h'; consider using 'ctgmath' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'uchar.h'; consider using 'cuchar' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead
+
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #in

Re: [PATCH] D17484: [clang-tidy] introduce modernize-deprecated-headers check

2016-02-23 Thread Kirill Bobyrev via cfe-commits
omtcyf0 updated this revision to Diff 48799.
omtcyf0 added a comment.

changed the warning comment to be more precise; fixed line with > 80 symbols


http://reviews.llvm.org/D17484

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/DeprecatedHeadersCheck.cpp
  clang-tidy/modernize/DeprecatedHeadersCheck.h
  clang-tidy/modernize/ModernizeTidyModule.cpp
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-deprecated-headers.rst
  test/clang-tidy/modernize-deprecated-headers-cxx03.cpp
  test/clang-tidy/modernize-deprecated-headers-cxx11.cpp

Index: test/clang-tidy/modernize-deprecated-headers-cxx11.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-deprecated-headers-cxx11.cpp
@@ -0,0 +1,163 @@
+// RUN: %check_clang_tidy %s modernize-deprecated-headers %t -- -- -std=c++11 -isystem %S/Inputs/Headers
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider including 'cassert' instead [modernize-deprecated-headers]
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider including 'ccomplex' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider including 'cctype' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider including 'cerrno' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider including 'cfenv' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider including 'cfloat' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider including 'cinttypes' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'iso646.h'; consider including 'ciso646' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider including 'climits' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider including 'clocale' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider including 'cmath' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider including 'csetjmp' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider including 'csignal' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdalign.h'; consider including 'cstdalign' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider including 'cstdarg' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdbool.h'; consider including 'cstdbool' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider including 'cstddef' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider including 'cstdint' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider including 'cstdio' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider including 'cstdlib' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider including 'cstring' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'tgmath.h'; consider including 'ctgmath' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider including 'ctime' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'uchar.h'; consider including 'cuchar' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider including 'cwchar' instead
+// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider including 'cwctype' instead
+
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include 
+// CHECK-FIXES: #include

r261625 - Print options, if requested.

2016-02-23 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Feb 23 04:29:02 2016
New Revision: 261625

URL: http://llvm.org/viewvc/llvm-project?rev=261625&view=rev
Log:
Print options, if requested.

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

Modified: cfe/trunk/lib/Tooling/CommonOptionsParser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CommonOptionsParser.cpp?rev=261625&r1=261624&r2=261625&view=diff
==
--- cfe/trunk/lib/Tooling/CommonOptionsParser.cpp (original)
+++ cfe/trunk/lib/Tooling/CommonOptionsParser.cpp Tue Feb 23 04:29:02 2016
@@ -118,6 +118,8 @@ CommonOptionsParser::CommonOptionsParser
 
   Compilations.reset(FixedCompilationDatabase::loadFromCommandLine(argc, 
argv));
   cl::ParseCommandLineOptions(argc, argv, Overview);
+  cl::PrintOptionValues();
+
   SourcePathList = SourcePaths;
   if ((OccurrencesFlag == cl::ZeroOrMore || OccurrencesFlag == cl::Optional) &&
   SourcePathList.empty())


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


r261626 - Fix a -Wunused-variable diagnostic.

2016-02-23 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Feb 23 04:29:04 2016
New Revision: 261626

URL: http://llvm.org/viewvc/llvm-project?rev=261626&view=rev
Log:
Fix a -Wunused-variable diagnostic.

Modified:
cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp

Modified: cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp?rev=261626&r1=261625&r2=261626&view=diff
==
--- cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp Tue Feb 23 04:29:04 2016
@@ -307,8 +307,10 @@ HasNameMatcher::HasNameMatcher(std::vect
   N.begin(), N.end(),
   [](StringRef Name) { return Name.find("::") == Name.npos; })),
   Names(std::move(N)) {
+#ifndef NDEBUG
   for (StringRef Name : Names)
 assert(!Name.empty());
+#endif
 }
 
 namespace {


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


Re: [PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

A few small comments!



Comment at: include/clang/Basic/AttrDocs.td:1572
@@ +1571,3 @@
+The __read_only, __write_only, __read_write, read_only, write_only and
+read_write names are reserved for use as access qualifiers and shall not be
+used otherwise.

what about __read_write?


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7713
@@ +7712,3 @@
+def err_opencl_invalid_read_write : Error<
+  "access qualifier read_write can not be used for %0 %select{|earlier than 
OpenCL2.0 version}1">;
+def err_opencl_multiple_access_qualifiers : Error<

could you write __read_write/read_write please!


Comment at: test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl:24
@@ -23,3 +23,3 @@
   work_group_commit_read_pipe(p, tmp);// expected-error{{invalid argument 
type to function work_group_commit_read_pipe (expecting 'reserve_id_t')}}
-  sub_group_commit_write_pipe(p, tmp);// expected-error{{nvalid pipe 
access modifier (expecting write_only)}}
 }

This test doesn't seem to work correctly because it didn't detect that we were 
checking for the wrong error message!

I am thinking it might be the issue of adding "-ferror-limit 100" to the RUN 
line as it might have stopped to diagnose after certain number of errors given. 
Could you please double check this?


http://reviews.llvm.org/D16040



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


Re: [PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/invalid-pipe-builtin-cl2.0.cl:24
@@ -23,3 +23,3 @@
   work_group_commit_read_pipe(p, tmp);// expected-error{{invalid argument 
type to function work_group_commit_read_pipe (expecting 'reserve_id_t')}}
-  sub_group_commit_write_pipe(p, tmp);// expected-error{{nvalid pipe 
access modifier (expecting write_only)}}
 }

Anastasia wrote:
> This test doesn't seem to work correctly because it didn't detect that we 
> were checking for the wrong error message!
> 
> I am thinking it might be the issue of adding "-ferror-limit 100" to the RUN 
> line as it might have stopped to diagnose after certain number of errors 
> given. Could you please double check this?
I just checked it and I guess it's passing because it's doing substring check, 
so no need to add anything to the RUN line. Your change is fine here!


http://reviews.llvm.org/D16040



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


r261632 - [analyzer] Improve pointer arithmetic checker.

2016-02-23 Thread Gabor Horvath via cfe-commits
Author: xazax
Date: Tue Feb 23 06:34:39 2016
New Revision: 261632

URL: http://llvm.org/viewvc/llvm-project?rev=261632&view=rev
Log:
[analyzer] Improve pointer arithmetic checker.

This patch is intended to improve pointer arithmetic checker.
From now on it only warns when the pointer arithmetic is likely to cause an
error. For example when the pointer points to a single object, or an array of
derived types.

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

Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
cfe/trunk/test/Analysis/PR24184.cpp
cfe/trunk/test/Analysis/fields.c
cfe/trunk/test/Analysis/ptr-arith.c
cfe/trunk/test/Analysis/ptr-arith.cpp
cfe/trunk/test/Analysis/rdar-6442306-1.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp?rev=261632&r1=261631&r2=261632&view=diff
==
--- cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp Tue Feb 23 
06:34:39 2016
@@ -13,55 +13,329 @@
 
//===--===//
 
 #include "ClangSACheckers.h"
+#include "clang/AST/DeclCXX.h"
+#include "clang/AST/ExprCXX.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/Checker.h"
 #include "clang/StaticAnalyzer/Core/CheckerManager.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
+#include "llvm/ADT/SmallVector.h"
 
 using namespace clang;
 using namespace ento;
 
 namespace {
+enum class AllocKind {
+  SingleObject,
+  Array,
+  Unknown,
+  Reinterpreted // Single object interpreted as an array.
+};
+} // end namespace
+
+namespace llvm {
+template <> struct FoldingSetTrait {
+  static inline void Profile(AllocKind X, FoldingSetNodeID &ID) {
+ID.AddInteger(static_cast(X));
+  }
+};
+} // end namespace llvm
+
+namespace {
 class PointerArithChecker
-  : public Checker< check::PreStmt > {
-  mutable std::unique_ptr BT;
+: public Checker<
+  check::PreStmt, check::PreStmt,
+  check::PreStmt, check::PreStmt,
+  check::PostStmt, check::PostStmt,
+  check::PostStmt, check::DeadSymbols> {
+  AllocKind getKindOfNewOp(const CXXNewExpr *NE, const FunctionDecl *FD) const;
+  const MemRegion *getArrayRegion(const MemRegion *Region, bool &Polymorphic,
+  AllocKind &AKind, CheckerContext &C) const;
+  const MemRegion *getPointedRegion(const MemRegion *Region,
+CheckerContext &C) const;
+  void reportPointerArithMisuse(const Expr *E, CheckerContext &C,
+bool PointedNeeded = false) const;
+  void initAllocIdentifiers(ASTContext &C) const;
+
+  mutable std::unique_ptr BT_pointerArith;
+  mutable std::unique_ptr BT_polyArray;
+  mutable llvm::SmallSet AllocFunctions;
 
 public:
-  void checkPreStmt(const BinaryOperator *B, CheckerContext &C) const;
+  void checkPreStmt(const UnaryOperator *UOp, CheckerContext &C) const;
+  void checkPreStmt(const BinaryOperator *BOp, CheckerContext &C) const;
+  void checkPreStmt(const ArraySubscriptExpr *SubExpr, CheckerContext &C) 
const;
+  void checkPreStmt(const CastExpr *CE, CheckerContext &C) const;
+  void checkPostStmt(const CastExpr *CE, CheckerContext &C) const;
+  void checkPostStmt(const CXXNewExpr *NE, CheckerContext &C) const;
+  void checkPostStmt(const CallExpr *CE, CheckerContext &C) const;
+  void checkDeadSymbols(SymbolReaper &SR, CheckerContext &C) const;
 };
+} // end namespace
+
+REGISTER_MAP_WITH_PROGRAMSTATE(RegionState, const MemRegion *, AllocKind)
+
+void PointerArithChecker::checkDeadSymbols(SymbolReaper &SR,
+   CheckerContext &C) const {
+  // TODO: intentional leak. Some information is garbage collected too early,
+  // see http://reviews.llvm.org/D14203 for further information.
+  /*ProgramStateRef State = C.getState();
+  RegionStateTy RegionStates = State->get();
+  for (RegionStateTy::iterator I = RegionStates.begin(), E = 
RegionStates.end();
+   I != E; ++I) {
+if (!SR.isLiveRegion(I->first))
+  State = State->remove(I->first);
+  }
+  C.addTransition(State);*/
 }
 
-void PointerArithChecker::checkPreStmt(const BinaryOperator *B,
-   CheckerContext &C) const {
-  if (B->getOpcode() != BO_Sub && B->getOpcode() != BO_Add)
-return;
+AllocKind PointerArithChecker::getKindOfNewOp(const CXXNewExpr *NE,
+  const FunctionDecl *FD) const {
+  // This checker try not to assume anything about placement and overloaded
+  // new to avoid false positives.
+  if (isa(FD))
+return AllocKind::Unknown;
+  if (FD->getNumParams() != 1 || FD->isVariadic())
+  

Re: [PATCH] D14203: [analyzer] Improve pointer arithmetic checker.

2016-02-23 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL261632: [analyzer] Improve pointer arithmetic checker. 
(authored by xazax).

Changed prior to commit:
  http://reviews.llvm.org/D14203?vs=41022&id=48806#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D14203

Files:
  cfe/trunk/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp
  cfe/trunk/test/Analysis/PR24184.cpp
  cfe/trunk/test/Analysis/fields.c
  cfe/trunk/test/Analysis/ptr-arith.c
  cfe/trunk/test/Analysis/ptr-arith.cpp
  cfe/trunk/test/Analysis/rdar-6442306-1.m

Index: cfe/trunk/test/Analysis/ptr-arith.cpp
===
--- cfe/trunk/test/Analysis/ptr-arith.cpp
+++ cfe/trunk/test/Analysis/ptr-arith.cpp
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify %s
-// expected-no-diagnostics
+// RUN: %clang_cc1 -Wno-unused-value -std=c++14 -analyze -analyzer-checker=core,debug.ExprInspection,alpha.core.PointerArithm -verify %s
 struct X {
   int *p;
   int zero;
@@ -20,3 +19,82 @@
   return 5/littleX.zero; // no-warning
 }
 
+
+class Base {};
+class Derived : public Base {};
+
+void checkPolymorphicUse() {
+  Derived d[10];
+
+  Base *p = d;
+  ++p; // expected-warning{{Pointer arithmetic on a pointer to base class is dangerous}}
+}
+
+void checkBitCasts() {
+  long l;
+  char *p = (char*)&l;
+  p = p+2;
+}
+
+void checkBasicarithmetic(int i) {
+  int t[10];
+  int *p = t;
+  ++p;
+  int a = 5;
+  p = &a;
+  ++p; // expected-warning{{Pointer arithmetic on non-array variables relies on memory layout, which is dangerous}}
+  p = p + 2; // expected-warning{{}}
+  p = 2 + p; // expected-warning{{}}
+  p += 2; // expected-warning{{}}
+  a += p[2]; // expected-warning{{}}
+  p = i*0 + p;
+  p = p + i*0;
+  p += i*0;
+}
+
+void checkArithOnSymbolic(int*p) {
+  ++p;
+  p = p + 2;
+  p = 2 + p;
+  p += 2;
+  (void)p[2];
+}
+
+struct S {
+  int t[10];
+};
+
+void arrayInStruct() {
+  S s;
+  int * p = s.t;
+  ++p;
+  S *sp = new S;
+  p = sp->t;
+  ++p;
+  delete sp;
+}
+
+void checkNew() {
+  int *p = new int;
+  p[1] = 1; // expected-warning{{}}
+}
+
+void InitState(int* state) {
+state[1] = 1; // expected-warning{{}}
+}
+
+int* getArray(int size) {
+if (size == 0)
+  return new int;
+return new int[5];
+}
+
+void checkConditionalArray() {
+int* maybeArray = getArray(0);
+InitState(maybeArray);
+}
+
+void checkMultiDimansionalArray() {
+  int a[5][5];
+   *(*(a+1)+2) = 2;
+}
Index: cfe/trunk/test/Analysis/PR24184.cpp
===
--- cfe/trunk/test/Analysis/PR24184.cpp
+++ cfe/trunk/test/Analysis/PR24184.cpp
@@ -12,7 +12,7 @@
 typedef int *vcreate_t(int *, DATA_TYPE, int, int);
 void fn1(unsigned, unsigned) {
   char b = 0;
-  for (; 1; a++, &b + a * 0) // expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}}
+  for (; 1; a++, &b + a * 0)
 ;
 }
 
@@ -55,7 +55,7 @@
 void fn2_1(uint32_t *p1, unsigned char *p2, uint32_t p3) {
   unsigned i = 0;
   for (0; i < p3; i++)
-fn1_1(p1 + i, p2 + i * 0);// expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}}
+fn1_1(p1 + i, p2 + i * 0);
 }
 
 struct A_1 {
Index: cfe/trunk/test/Analysis/ptr-arith.c
===
--- cfe/trunk/test/Analysis/ptr-arith.c
+++ cfe/trunk/test/Analysis/ptr-arith.c
@@ -52,7 +52,7 @@
 void f5() {
   int x, y;
   int *p;
-  p = &x + 1;  // expected-warning{{Pointer arithmetic done on non-array variables means reliance on memory layout, which is dangerous}}
+  p = &x + 1;  // expected-warning{{Pointer arithmetic on non-array variables relies on memory layout, which is dangerous}}
 
   int a[10];
   p = a + 1; // no-warning
@@ -75,7 +75,7 @@
   clang_analyzer_eval(&a != 0); // expected-warning{{TRUE}}
   clang_analyzer_eval(&a >= 0); // expected-warning{{TRUE}}
   clang_analyzer_eval(&a > 0); // expected-warning{{TRUE}}
-  clang_analyzer_eval((&a - 0) != 0); // expected-warning{{TRUE}} expected-warning{{Pointer arithmetic done on non-array variables}}
+  clang_analyzer_eval((&a - 0) != 0); // expected-warning{{TRUE}}
 
   // LHS is NULL, RHS is non-symbolic
   // The same code is used for labels and non-symbolic values.
Index: cfe/trunk/test/Analysis/rdar-6442306-1.m
===
--- cfe/trunk/test/Analysis/rdar-6442306-1.m
+++ cfe/trunk/test/Analysis/rdar-6442306-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core %s -analyzer-store=region -verify
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-disable-checker=alpha.core.PointerArithm %s -analyzer-store=region -verify
 // expected-no-diagnostics
 
 typedef int bar_return_t;
Index: cfe/trunk/test/Analysis/fields.c
===

Re: [PATCH] D16298: Improve test coverage of -Wdouble-promotion

2016-02-23 Thread Robert Lougher via cfe-commits
rob.lougher added a comment.

Ping.  Just test changes - OK to commit?


http://reviews.llvm.org/D16298



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


[clang-format-vs] Add Format on Save function. Add Format Document function.

2016-02-23 Thread Péter Budai via cfe-commits
Hi,

This patch adds Format on Save  and Format Document functions to 
clang-format-vs Visual Studio extension.

The automatic format option can be turned on and off completely or for specific 
file extensions via the Options dialog.
Patch is attached, tested on Visual Studio 2013 and 2015.

Peter Budai


-clang-format-vs-formatonsave.patch
Description: -clang-format-vs-formatonsave.patch
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r261634 - Supporting all entities declared in lexical scope in LLVM debug info.

2016-02-23 Thread Amjad Aboud via cfe-commits
Author: aaboud
Date: Tue Feb 23 07:37:18 2016
New Revision: 261634

URL: http://llvm.org/viewvc/llvm-project?rev=261634&view=rev
Log:
Supporting all entities declared in lexical scope in LLVM debug info.

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

Added:
cfe/trunk/test/CodeGenCXX/debug-info-lb.cpp
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-anon-union-vars.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=261634&r1=261633&r2=261634&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 07:37:18 2016
@@ -831,15 +831,18 @@ llvm::DIType *CGDebugInfo::CreateType(co
 
 llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
   llvm::DIFile *Unit) {
+  TypedefNameDecl *TD = Ty->getDecl();
   // We don't set size information, but do specify where the typedef was
   // declared.
-  SourceLocation Loc = Ty->getDecl()->getLocation();
+  SourceLocation Loc = TD->getLocation();
+
+  llvm::DIScope *TDContext = getDeclarationLexicalScope(*TD, QualType(Ty, 0));
 
   // Typedefs are derived from some other type.
   return DBuilder.createTypedef(
   getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit),
   Ty->getDecl()->getName(), getOrCreateFile(Loc), getLineNumber(Loc),
-  getDeclContextDescriptor(Ty->getDecl()));
+  TDContext);
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
@@ -1472,6 +1475,23 @@ llvm::DIType *CGDebugInfo::getOrCreateSt
   return T;
 }
 
+void CGDebugInfo::recordDeclarationLexicalScope(const Decl &D) {
+  assert(LexicalBlockMap.find(&D) == LexicalBlockMap.end() &&
+ "D is already mapped to lexical block scope");
+  if (!LexicalBlockStack.empty())
+LexicalBlockMap[&D] = LexicalBlockStack.back();
+}
+
+llvm::DIScope *CGDebugInfo::getDeclarationLexicalScope(const Decl &D,
+   QualType Ty) {
+  auto I = LexicalBlockMap.find(&D);
+  if (I != LexicalBlockMap.end()) {
+RetainedTypes.push_back(Ty.getAsOpaquePtr());
+return I->second;
+  }
+  return getDeclContextDescriptor(cast(&D));
+}
+
 void CGDebugInfo::completeType(const EnumDecl *ED) {
   if (DebugKind <= codegenoptions::DebugLineTablesOnly)
 return;
@@ -2068,7 +2088,8 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
 // Cache the enum type so it is available when building the declcontext
 // and replace the declcontect with the real thing.
 TypeCache[Ty].reset(RetTy);
-TmpContext->replaceAllUsesWith(getDeclContextDescriptor(ED));
+TmpContext->replaceAllUsesWith(
+getDeclarationLexicalScope(*ED, QualType(Ty, 0)));
 
 ReplaceMap.emplace_back(
 std::piecewise_construct, std::make_tuple(Ty),
@@ -2103,7 +2124,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDef
 
   llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
   unsigned Line = getLineNumber(ED->getLocation());
-  llvm::DIScope *EnumContext = getDeclContextDescriptor(ED);
+  llvm::DIScope *EnumContext = getDeclarationLexicalScope(*ED, QualType(Ty, 
0));
   llvm::DIType *ClassTy =
   ED->isFixed() ? getOrCreateType(ED->getIntegerType(), DefUnit) : nullptr;
   return DBuilder.createEnumerationType(EnumContext, ED->getName(), DefUnit,
@@ -2364,7 +2385,7 @@ llvm::DICompositeType *CGDebugInfo::Crea
   unsigned Line = getLineNumber(RD->getLocation());
   StringRef RDName = getClassName(RD);
 
-  llvm::DIScope *RDContext = getDeclContextDescriptor(RD);
+  llvm::DIScope *RDContext = getDeclarationLexicalScope(*RD, QualType(Ty, 0));
 
   // If we ended up creating the type during the context chain construction,
   // just return that.
@@ -2511,8 +2532,15 @@ void CGDebugInfo::collectVarDeclProps(co
   if (DC->isRecord())
 DC = CGM.getContext().getTranslationUnitDecl();
 
- llvm::DIScope *Mod = getParentModuleOrNull(VD);
- VDContext = getContextDescriptor(cast(DC), Mod ? Mod : TheCU);
+  if (VD->isStaticLocal()) {
+// Get context for static locals (that are technically globals) the same 
way
+// we do for "local" locals -- by using current lexical block.
+assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack 
empty!");
+VDContext = LexicalBlockStack.back();
+  } else {
+llvm::DIScope *Mod = getParentModuleOrNull(VD);
+VDContext = getContextDescriptor(cast(DC), Mod ? Mod : TheCU);
+  }
 }
 
 llvm::DISubprogram *

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=261634&r1=261633&r2=261634&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk

Re: [PATCH] D15977: [Clang] Supporting all entities declared in lexical scope in LLVM debug info

2016-02-23 Thread Amjad Aboud via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL261634: Supporting all entities declared in lexical scope in 
LLVM debug info. (authored by aaboud).

Changed prior to commit:
  http://reviews.llvm.org/D15977?vs=47988&id=48808#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15977

Files:
  cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
  cfe/trunk/lib/CodeGen/CGDebugInfo.h
  cfe/trunk/lib/CodeGen/CGDecl.cpp
  cfe/trunk/test/CodeGenCXX/debug-info-anon-union-vars.cpp
  cfe/trunk/test/CodeGenCXX/debug-info-lb.cpp

Index: cfe/trunk/lib/CodeGen/CGDebugInfo.h
===
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h
@@ -116,6 +116,11 @@
 
   /// Keep track of our current nested lexical block.
   std::vector> LexicalBlockStack;
+
+  /// Map of AST declaration to its lexical block scope.
+  llvm::DenseMap>
+  LexicalBlockMap;
+
   llvm::DenseMap RegionMap;
   /// Keep track of LexicalBlockStack counter at the beginning of a
   /// function. This is used to pop unbalanced regions at the end of a
@@ -378,6 +383,12 @@
   /// Emit an Objective-C interface type standalone debug info.
   llvm::DIType *getOrCreateInterfaceType(QualType Ty, SourceLocation Loc);
 
+  /// Map AST declaration to its lexical block scope if available.
+  void recordDeclarationLexicalScope(const Decl &D);
+
+  /// Get lexical scope of AST declaration.
+  llvm::DIScope *getDeclarationLexicalScope(const Decl &D, QualType Ty);
+
   /// Emit standalone debug info for a type.
   llvm::DIType *getOrCreateStandaloneType(QualType Ty, SourceLocation Loc);
 
Index: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
===
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
@@ -831,15 +831,18 @@
 
 llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
   llvm::DIFile *Unit) {
+  TypedefNameDecl *TD = Ty->getDecl();
   // We don't set size information, but do specify where the typedef was
   // declared.
-  SourceLocation Loc = Ty->getDecl()->getLocation();
+  SourceLocation Loc = TD->getLocation();
+
+  llvm::DIScope *TDContext = getDeclarationLexicalScope(*TD, QualType(Ty, 0));
 
   // Typedefs are derived from some other type.
   return DBuilder.createTypedef(
   getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit),
   Ty->getDecl()->getName(), getOrCreateFile(Loc), getLineNumber(Loc),
-  getDeclContextDescriptor(Ty->getDecl()));
+  TDContext);
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
@@ -1472,6 +1475,23 @@
   return T;
 }
 
+void CGDebugInfo::recordDeclarationLexicalScope(const Decl &D) {
+  assert(LexicalBlockMap.find(&D) == LexicalBlockMap.end() &&
+ "D is already mapped to lexical block scope");
+  if (!LexicalBlockStack.empty())
+LexicalBlockMap[&D] = LexicalBlockStack.back();
+}
+
+llvm::DIScope *CGDebugInfo::getDeclarationLexicalScope(const Decl &D,
+   QualType Ty) {
+  auto I = LexicalBlockMap.find(&D);
+  if (I != LexicalBlockMap.end()) {
+RetainedTypes.push_back(Ty.getAsOpaquePtr());
+return I->second;
+  }
+  return getDeclContextDescriptor(cast(&D));
+}
+
 void CGDebugInfo::completeType(const EnumDecl *ED) {
   if (DebugKind <= codegenoptions::DebugLineTablesOnly)
 return;
@@ -2068,7 +2088,8 @@
 // Cache the enum type so it is available when building the declcontext
 // and replace the declcontect with the real thing.
 TypeCache[Ty].reset(RetTy);
-TmpContext->replaceAllUsesWith(getDeclContextDescriptor(ED));
+TmpContext->replaceAllUsesWith(
+getDeclarationLexicalScope(*ED, QualType(Ty, 0)));
 
 ReplaceMap.emplace_back(
 std::piecewise_construct, std::make_tuple(Ty),
@@ -2103,7 +2124,7 @@
 
   llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
   unsigned Line = getLineNumber(ED->getLocation());
-  llvm::DIScope *EnumContext = getDeclContextDescriptor(ED);
+  llvm::DIScope *EnumContext = getDeclarationLexicalScope(*ED, QualType(Ty, 0));
   llvm::DIType *ClassTy =
   ED->isFixed() ? getOrCreateType(ED->getIntegerType(), DefUnit) : nullptr;
   return DBuilder.createEnumerationType(EnumContext, ED->getName(), DefUnit,
@@ -2364,7 +2385,7 @@
   unsigned Line = getLineNumber(RD->getLocation());
   StringRef RDName = getClassName(RD);
 
-  llvm::DIScope *RDContext = getDeclContextDescriptor(RD);
+  llvm::DIScope *RDContext = getDeclarationLexicalScope(*RD, QualType(Ty, 0));
 
   // If we ended up creating the type during the context chain construction,
   // just return that.
@@ -2511,8 +2532,15 @@
   if (DC->isRecord())
 DC = CGM.getContext().getTranslationUnitDecl();
 
- llvm::DIScope *Mod = getParentModuleOrNull(VD);
- VDContext = getContextDescriptor(cast(DC), Mod ? Mod : TheCU);
+  if (VD->isStaticLocal()) {
+

r261635 - [CLANG] [AVX512] [BUILTIN] Adding pro{lv|r}{d|q}{128|256|512} builtin to clang

2016-02-23 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Tue Feb 23 07:41:13 2016
New Revision: 261635

URL: http://llvm.org/viewvc/llvm-project?rev=261635&view=rev
Log:
[CLANG] [AVX512] [BUILTIN] Adding pro{lv|r}{d|q}{128|256|512} builtin to clang


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

Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-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=261635&r1=261634&r2=261635&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Feb 23 07:41:13 2016
@@ -1614,6 +1614,18 @@ TARGET_BUILTIN(__builtin_ia32_prold128_m
 TARGET_BUILTIN(__builtin_ia32_prold256_mask, "V8iV8iIiV8iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_prolq128_mask, 
"V2LLiV2LLiIiV2LLiUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_prolq256_mask, 
"V4LLiV4LLiIiV4LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prolvd512_mask, 
"V16iV16iV16iV16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_prolvq512_mask, 
"V8LLiV8LLiV8LLiV8LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_prord512_mask, "V16iV16iiV16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_prorq512_mask, "V8LLiV8LLiiV8LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_prolvd128_mask, "V4iV4iV4iV4iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prolvd256_mask, "V8iV8iV8iV8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prolvq128_mask, 
"V2LLiV2LLiV2LLiV2LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prolvq256_mask, 
"V4LLiV4LLiV4LLiV4LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prord128_mask, "V4iV4iIiV4iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prord256_mask, "V8iV8iIiV8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prorq128_mask, 
"V2LLiV2LLiIiV2LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prorq256_mask, 
"V4LLiV4LLiIiV4LLiUc","","avx512vl")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=261635&r1=261634&r2=261635&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Tue Feb 23 07:41:13 2016
@@ -3363,6 +3363,103 @@ _mm512_maskz_cvtepu16_epi64 (__mmask8 __
   (__v8di)\
   _mm512_setzero_si512 (),\
   (__mmask8) (U)); })
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_rolv_epi32 (__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prolvd512_mask ((__v16si) __A,
+  (__v16si) __B,
+  (__v16si)
+  _mm512_setzero_si512 (),
+  (__mmask16) -1);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_rolv_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prolvd512_mask ((__v16si) __A,
+  (__v16si) __B,
+  (__v16si) __W,
+  (__mmask16) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_rolv_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prolvd512_mask ((__v16si) __A,
+  (__v16si) __B,
+  (__v16si)
+  _mm512_setzero_si512 (),
+  (__mmask16) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_rolv_epi64 (__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prolvq512_mask ((__v8di) __A,
+  (__v8di) __B,
+  (__v8di)
+  _mm512_setzero_si512 (),
+  (__mmask8) -1);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_rolv_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prolvq512_mask ((__v8di) __A,
+  (__v8di) __B,
+  (__v8di) __W,
+  (__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_rolv_epi64 (__mmask8 __U, __m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prolvq512_mask ((__v8di) __A,
+  (__v8di) __B,
+  (__v8di)
+  _mm512_setzero_si512 (),
+  (__mmask8) __U);
+}
+
+#define _mm512_ror_epi32( __A, __B) __extension__ ({ \
+__builtin_ia32_prord512_mask ((__v16si)( __A),( __B),\
+ (__v16si)\
+ _mm512_setzero_si512 (),\
+ (__mmask16) -1);\
+}
+
+#define _mm512_mask_ror_epi32( __W, __U, __A, __B) __extension__ ({ \
+__builtin_ia32_prord512_mask ((__v16si)( __A),( __B),\
+  

Re: [PATCH] D17484: [clang-tidy] introduce modernize-deprecated-headers check

2016-02-23 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 with one nit.

Let me know if you need me to commit the patch for you.



Comment at: clang-tidy/modernize/DeprecatedHeadersCheck.cpp:99
@@ +98,3 @@
+std::string Replacement =
+(llvm::Twine("<") + llvm::Twine(CStyledHeaderToCxx[FileName]) +
+ llvm::Twine(">"))

No need to convert all of them to llvm::Twine. The first one is enough to make 
the compiler choose the right overloaded operators:

  (llvm::Twine("<") + CStyledHeaderToCxx[FileName] + ">").str();


http://reviews.llvm.org/D17484



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


Re: [PATCH] D17244: [clang-tidy] readability-ternary-operator new check

2016-02-23 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/readability/BracesAroundStatementsCheck.cpp:16
@@ -15,2 +15,3 @@
 using namespace clang::ast_matchers;
+using namespace clang::tidy::lexer_utils;
 

This file only needs one function from this namespace, so it's better to 
qualify the function name instead.


Comment at: clang-tidy/readability/TernaryOperatorCheck.cpp:31
@@ +30,3 @@
+for (auto Kind : TokenKinds) {
+  if (Kind == TokKind) {
+return true;

No need for braces around single-line `if`/`for`/... bodies. Here and elsewhere.


Comment at: clang-tidy/readability/TernaryOperatorCheck.cpp:36
@@ +35,3 @@
+// Fast-forward current token.
+// it = Lexer::getLocForEndOfToken(it, 0, SM, Context->getLangOpts());
+  }

Leftover from debugging?


Comment at: clang-tidy/readability/TernaryOperatorCheck.cpp:47
@@ +46,3 @@
+  while (lexer_utils::getTokenKind(Result, SM, Context) != TokKind) {
+Result = Result.getLocWithOffset(1);
+  }

You could skip whole tokens here instead of one character at a time.


Comment at: clang-tidy/readability/TernaryOperatorCheck.cpp:125
@@ +124,3 @@
+  std::vector Hints;
+  if (dyn_cast(ThenNode) &&
+  !hasTokensInside({tok::comment, tok::hash}, IfNode->getSourceRange(), 
*SM,

When you don't need the casted pointer, use `isa` instead of `dyn_cast`.


Comment at: clang-tidy/readability/TernaryOperatorCheck.h:52
@@ +51,3 @@
+  bool matchIf(const IfStmt *IfNode);
+  std::vector getHints(const IfStmt *IfNode, const Expr *ThenNode,
+  const Expr *ElseNode);

The function name is too vague. It basically says what type the function 
returns without saying what exactly it is.


Comment at: docs/clang-tidy/checks/readability-ternary-operator.rst:10
@@ +9,3 @@
+And it gets transformed into::
+  (condition ? expression0 : expression1);
+

I don't think this particular replacement makes the code any better. A ternary 
operator in the void context seems rather unnatural.

What does make sense, is pulling some common part from both branches of the 
`if`, when there is a common part, e.g.:

  if (c) a = x; else a = y; // => a = c ? x : y;
  if (c) return x; else return y; // => return c ? x : y;
  if (c) f(x); else f(y); // => f(c ? x : y);
  if (c) {
SourceRange Range(Foo.getLocStart(), Bar.getLocEnd());
diag << FixItHint::CreateReplacement(Range, "qqq");
  } else {
SourceRange Range(Foo.getLocStart(), Bar.getLocEnd());
diag << FixItHint::CreateReplacement(Range, "eee");
  }
  // => 
  // SourceRange Range(Foo.getLocStart(), Bar.getLocEnd());
  // diag << FixItHint::CreateReplacement(Range, c ? "qqq" : "eee");

etc.


http://reviews.llvm.org/D17244



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


r261638 - [CLANG] [AVX512] [BUILTIN] Adding pro{lv|r}{d|q}{128|256|512} builtin to clang

2016-02-23 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Tue Feb 23 08:23:53 2016
New Revision: 261638

URL: http://llvm.org/viewvc/llvm-project?rev=261638&view=rev
Log:
[CLANG] [AVX512] [BUILTIN] Adding pro{lv|r}{d|q}{128|256|512} builtin to clang

Adding closer to the end of macro }->}) 

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

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=261638&r1=261637&r2=261638&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Tue Feb 23 08:23:53 2016
@@ -3426,40 +3426,40 @@ __builtin_ia32_prord512_mask ((__v16si)(
  (__v16si)\
  _mm512_setzero_si512 (),\
  (__mmask16) -1);\
-}
+})
 
 #define _mm512_mask_ror_epi32( __W, __U, __A, __B) __extension__ ({ \
 __builtin_ia32_prord512_mask ((__v16si)( __A),( __B),\
  (__v16si)( __W),\
  (__mmask16)( __U));\
-}
+})
 
 #define _mm512_maskz_ror_epi32( __U, __A, __B) __extension__ ({ \
 __builtin_ia32_prord512_mask ((__v16si)( __A),( __B),\
  (__v16si)\
  _mm512_setzero_si512 (),\
  (__mmask16)( __U));\
-}
+})
 
 #define _mm512_ror_epi64( __A, __B) __extension__ ({ \
 __builtin_ia32_prorq512_mask ((__v8di)( __A),( __B),\
  (__v8di)\
  _mm512_setzero_si512 (),\
  (__mmask8) -1);\
-}
+})
 
 #define _mm512_mask_ror_epi64( __W, __U, __A, __B) __extension__ ({ \
 __builtin_ia32_prorq512_mask ((__v8di)( __A),( __B),\
  (__v8di)( __W),\
  (__mmask8)( __U));\
-}
+})
 
 #define _mm512_maskz_ror_epi64( __U, __A, __B) __extension__ ({ \
 __builtin_ia32_prorq512_mask ((__v8di)( __A),( __B),\
  (__v8di)\
  _mm512_setzero_si512 (),\
  (__mmask8)( __U));\
-}
+})
 
 
 #undef __DEFAULT_FN_ATTRS

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=261638&r1=261637&r2=261638&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Tue Feb 23 08:23:53 2016
@@ -5140,80 +5140,80 @@ __builtin_ia32_prord128_mask ((__v4si)(
  (__v4si)\
  _mm_setzero_si128 (),\
  (__mmask8) -1);\
-}
+})
 
 #define _mm_mask_ror_epi32( __W, __U, __A ,__B) __extension__ ({ \
 __builtin_ia32_prord128_mask ((__v4si) __A, __B,\
  (__v4si)( __W),\
  (__mmask8)( __U));\
-}
+})
 
 #define _mm_maskz_ror_epi32( __U, __A, __B) __extension__ ({ \
 __builtin_ia32_prord128_mask ((__v4si)( __A),( __B),\
  (__v4si)\
  _mm_setzero_si128 (),\
  (__mmask8)( __U));\
-}
+})
 
 #define _mm256_ror_epi32( __A, __B) __extension__ ({ \
 __builtin_ia32_prord256_mask ((__v8si)( __A),( __B),\
  (__v8si)\
  _mm256_setzero_si256 (),\
  (__mmask8) -1);\
-}
+})
 
 #define _mm256_mask_ror_epi32( __W, __U, __A ,__B) __extension__ ({ \
 __builtin_ia32_prord256_mask ((__v8si) __A, __B,\
  (__v8si)( __W),\
  (__mmask8)( __U));\
-}
+})
 
 #define _mm256_maskz_ror_epi32( __U, __A, __B) __extension__ ({ \
 __builtin_ia32_prord256_mask ((__v8si)( __A),( __B),\
  (__v8si)\
  _mm256_setzero_si256 (),\
  (__mmask8)( __U));\
-}
+})
 
 #define _mm_ror_epi64( __A, __B) __extension__ ({ \
 __builtin_ia32_prorq128_mask ((__v2di)( __A),( __B),\
  (__v2di)\
  _mm_setzero_di (),\
  (__mmask8) -1);\
-}
+})
 
 #define _mm_mask_ror_epi64( __W, __U, __A ,__B) __extension__ ({ \
 __builtin_ia32_prorq128_mask ((__v2di) __A, __B,\
  (__v2di)( __W),\
  (__mmask8)( __U));\
-}
+})
 
 #define _mm_maskz_ror_epi64( __U, __A, __B) __extension__ ({ \
 __builtin_ia32_prorq128_mask ((__v2di)( __A),( __B),\
  (__v2di)\
  _mm_setzero_di (),\
  (__mmask8)( __U));\
-}
+})
 
 #define _mm256_ror_epi64( __A, __B) __extension__ ({ \
 __builtin_ia32_prorq256_mask ((__v4di)( __A),( __B),\
  (__v4di)\
  _mm256_setzero_si256 (),\
  (__mmask8) -1);\
-}
+})
 
 #define _mm256_mask_ror_epi64( __W, __U, __A ,__B) __extension__ ({ \
 __builtin_ia32_prorq256_mask ((__v4di) __A, __B,\
  (__v4di)( __W),\
  (__mmask8)( __U));\
-}
+})
 
 #define _mm256_maskz_ror_epi64( __U, __A, __B) __extension__ ({ \
 __builtin_ia32_prorq256_mask ((__v4di)( __A),( __B),\
  (__v4di)\
  _mm256_setzero_si256 (),\
  (__mmask8)( __U));\
-}
+})
 
 
 #undef __DEFAULT_FN_ATTRS


___
cfe-commits

Re: [PATCH] D17407: [Sema] PR25755 Fix crash when initializing out-of-order struct references

2016-02-23 Thread don hinton via cfe-commits
hintonda updated this revision to Diff 48815.
hintonda added a comment.

Moved new test into existing test file.


http://reviews.llvm.org/D17407

Files:
  lib/Sema/SemaInit.cpp
  test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp
  test/SemaCXX/cxx0x-initializer-aggregates.cpp
  test/SemaCXX/cxx0x-initializer-constructor.cpp
  test/SemaCXX/dcl_init_aggr.cpp
  test/SemaCXX/libstdcxx_explicit_init_list_hack.cpp
  test/SemaCXX/new-delete-cxx0x.cpp

Index: test/SemaCXX/new-delete-cxx0x.cpp
===
--- test/SemaCXX/new-delete-cxx0x.cpp
+++ test/SemaCXX/new-delete-cxx0x.cpp
@@ -15,8 +15,10 @@
   ~S();
 };
 
-struct T { // expected-note 2 {{not viable}}
-  T(int); // expected-note {{not viable}}
+struct T { // expected-note 2 {{not viable}} \
+   // expected-note {{candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided}} \
+   // expected-note {{candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 0 were provided}}
+  T(int); // expected-note {{not viable}} expected-note {{candidate constructor not viable: requires 1 argument, but 0 were provided}}
 };
 
 void fn() {
@@ -29,5 +31,6 @@
   //
   // Note that this happens even if the array bound is constant and the
   // initializer initializes every array element.
-  (void) new T[2] {1, 2}; // expected-error {{no matching constructor}} expected-note {{in implicit initialization of array element 2}}
+  (void) new T[2] {1, 2}; // expected-error {{no matching constructor}} expected-note 2{{in implicit initialization of array element}} \
+  // expected-error {{no matching constructor for initialization of 'T'}}
 }
Index: test/SemaCXX/libstdcxx_explicit_init_list_hack.cpp
===
--- test/SemaCXX/libstdcxx_explicit_init_list_hack.cpp
+++ test/SemaCXX/libstdcxx_explicit_init_list_hack.cpp
@@ -9,16 +9,17 @@
 template 
 class vector {
 public:
-  explicit vector() {} // expected-warning 2 {{should not be explicit}}
+  explicit vector() {} // expected-warning 2 {{should not be explicit}} \
+   // expected-warning 3{{invalid constructor form class in system header, should not be explicit}}
 };
 }
 }
 #else
 
 #define BE_THE_HEADER
 #include __FILE__
 
-struct { int a, b; std::__debug::vector c; } e[] = { {1, 1} }; // expected-note{{used in initialization here}}
+struct { int a, b; std::__debug::vector c; } e[] = { {1, 1} }; // expected-note 3{{used in initialization here}}
 // expected-warning@+1 {{expression with side effects has no effect in an unevaluated context}}
-decltype(new std::__debug::vector[1]{}) x; // expected-note{{used in initialization here}}
+decltype(new std::__debug::vector[1]{}) x; // expected-note 2{{used in initialization here}}
 #endif
Index: test/SemaCXX/dcl_init_aggr.cpp
===
--- test/SemaCXX/dcl_init_aggr.cpp
+++ test/SemaCXX/dcl_init_aggr.cpp
@@ -40,21 +40,24 @@
 struct TooFew { int a; char* b; int c; }; 
 TooFew too_few = { 1, "asdf" }; // expected-warning{{conversion from string literal to 'char *' is deprecated}}
 
-struct NoDefaultConstructor { // expected-note 3 {{candidate constructor (the implicit copy constructor)}} \
+struct NoDefaultConstructor { // expected-note 6 {{candidate constructor (the implicit copy constructor)}} \
   // expected-note{{declared here}}
-  NoDefaultConstructor(int); // expected-note 3 {{candidate constructor}}
+  NoDefaultConstructor(int); // expected-note 6 {{candidate constructor}}
 };
-struct TooFewError { // expected-error{{implicit default constructor for}}
+struct TooFewError { // expected-error{{implicit default constructor for}} \
+ // expected-note {{candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 0 were provided}}
   int a;
-  NoDefaultConstructor nodef; // expected-note{{member is declared here}} expected-note 2{{in implicit initialization of field 'nodef'}}
+  NoDefaultConstructor nodef; // expected-note{{member is declared here}} expected-note 4{{in implicit initialization of field 'nodef'}}
 };
 TooFewError too_few_okay = { 1, 1 };
-TooFewError too_few_error = { 1 }; // expected-error{{no matching constructor}}
+TooFewError too_few_error = { 1 }; // expected-error 2{{no matching constructor}}
 
-TooFewError too_few_okay2[2] = { 1, 1 }; // expected-note{{implicit default constructor for 'TooFewError' first required here}}
-TooFewError too_few_error2[2] = { 1 }; // expected-error{{no matching constructor}}
+TooFewError too_few_okay2[2] = { 1, 1 }; // expected-note{{implicit default constructor for 'TooFewError' first required here}} \
+ // expected-error {{no matching constructor}} \
+ // expected-note {{in 

Re: [PATCH] D16044: getVariableName() for MemRegion

2016-02-23 Thread Gábor Horváth via cfe-commits
xazax.hun added a comment.

What is the status if this? Do you need some help with any of the 
modifications? I'd love to see this patch in the repository soon.


http://reviews.llvm.org/D16044



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


[libclc] r261639 - math: Add ilogb ported from amd-builtins

2016-02-23 Thread Aaron Watry via cfe-commits
Author: awatry
Date: Tue Feb 23 08:43:09 2016
New Revision: 261639

URL: http://llvm.org/viewvc/llvm-project?rev=261639&view=rev
Log:
math: Add ilogb ported from amd-builtins

The scalar float/double function bodies are a direct copy/paste
with usage of the CLC wrappers to vectorize them.

This commit also adds in the FP_ILOGB0 and FP_ILOGBNAN macros which are
equal to the results of ilogb(0.0f) and ilogb(float nan) respectively.

v2: Add FP_ILOGB0 and FP_ILOGBNAN definitions

Signed-off-by: Aaron Watry 
Reviewed-by: Jan Vesely 
v1 Reviewed-by: Tom Stellard 

Added:
libclc/trunk/generic/include/clc/math/ilogb.h
libclc/trunk/generic/include/clc/math/ilogb.inc
libclc/trunk/generic/lib/math/ilogb.cl
Modified:
libclc/trunk/generic/include/clc/clc.h
libclc/trunk/generic/include/clc/float/definitions.h
libclc/trunk/generic/lib/SOURCES

Modified: libclc/trunk/generic/include/clc/clc.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clc.h?rev=261639&r1=261638&r2=261639&view=diff
==
--- libclc/trunk/generic/include/clc/clc.h (original)
+++ libclc/trunk/generic/include/clc/clc.h Tue Feb 23 08:43:09 2016
@@ -62,6 +62,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

Modified: libclc/trunk/generic/include/clc/float/definitions.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/float/definitions.h?rev=261639&r1=261638&r2=261639&view=diff
==
--- libclc/trunk/generic/include/clc/float/definitions.h (original)
+++ libclc/trunk/generic/include/clc/float/definitions.h Tue Feb 23 08:43:09 
2016
@@ -14,6 +14,9 @@
 #define FLT_MIN 0x1.0p-126f
 #define FLT_EPSILON 0x1.0p-23f
 
+#define FP_ILOGB0 (-2147483647 - 1)
+#define FP_ILOGBNAN (-2147483647 - 1)
+
 #define M_E_F   0x1.5bf0a8p+1f
 #define M_LOG2E_F   0x1.715476p+0f
 #define M_LOG10E_F  0x1.bcb7b2p-2f

Added: libclc/trunk/generic/include/clc/math/ilogb.h
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/ilogb.h?rev=261639&view=auto
==
--- libclc/trunk/generic/include/clc/math/ilogb.h (added)
+++ libclc/trunk/generic/include/clc/math/ilogb.h Tue Feb 23 08:43:09 2016
@@ -0,0 +1,5 @@
+#define __CLC_BODY 
+
+#include 
+
+#undef __CLC_BODY

Added: libclc/trunk/generic/include/clc/math/ilogb.inc
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/math/ilogb.inc?rev=261639&view=auto
==
--- libclc/trunk/generic/include/clc/math/ilogb.inc (added)
+++ libclc/trunk/generic/include/clc/math/ilogb.inc Tue Feb 23 08:43:09 2016
@@ -0,0 +1 @@
+_CLC_OVERLOAD _CLC_DECL __CLC_INTN ilogb(__CLC_GENTYPE x);

Modified: libclc/trunk/generic/lib/SOURCES
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/SOURCES?rev=261639&r1=261638&r2=261639&view=diff
==
--- libclc/trunk/generic/lib/SOURCES (original)
+++ libclc/trunk/generic/lib/SOURCES Tue Feb 23 08:43:09 2016
@@ -90,6 +90,7 @@ math/frexp.cl
 math/half_rsqrt.cl
 math/half_sqrt.cl
 math/hypot.cl
+math/ilogb.cl
 math/clc_ldexp.cl
 math/ldexp.cl
 math/log.cl

Added: libclc/trunk/generic/lib/math/ilogb.cl
URL: 
http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/lib/math/ilogb.cl?rev=261639&view=auto
==
--- libclc/trunk/generic/lib/math/ilogb.cl (added)
+++ libclc/trunk/generic/lib/math/ilogb.cl Tue Feb 23 08:43:09 2016
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015 Advanced Micro Devices, Inc.
+ * Copyright (c) 2016 Aaron Watry
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTW

Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct

2016-02-23 Thread H.J. Lu via cfe-commits
On Mon, Feb 22, 2016 at 4:50 AM, Michael Matz  wrote:
> Hi,
>
> On Sat, 20 Feb 2016, Richard Smith wrote:
>
>> > An empty type is a type where it and all of its subobjects
>> > (recursively) are of class, structure, union, or array type.
>> >
>> > doesn't cover "trivially-copyable".
>>
>> That's correct. Whether a type is trivially copyable is unrelated to
>> whether it is empty.
>
> I would still feel more comfortable to include the restriction to
> trivially copyable types, not in the part of definition of empty type, of
> course, but as part of the restrictions of when a type can be passed in no
> registers.  Basically to clarify the intent in the psABI if there's any
> doubt.  I.e. like so:
>
> ---
> An empty type is a type where it and all of its subobjects (recursively)
> are of class, structure, union, or array type.  No memory slot nor
> register should be used to pass or return an object of empty type that's
> trivially copyable.
> ---
>
> (With possibly a self-sufficient definition of trivially copyable, that's
> language agnostic)
>

Do you have an example in which an empty type defined above isn't
"trivially copyable"?

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


Re: [PATCH] D17436: [OpenCL] Add Sema checks for OpenCL 2.0 block

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM!


http://reviews.llvm.org/D17436



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


Re: [PATCH] D17437: [OpenCL] Add Sema checks for types

2016-02-23 Thread Yaxun Liu via cfe-commits
yaxunl accepted this revision.
yaxunl added a comment.
This revision is now accepted and ready to land.

LGTM. Thanks!



Comment at: lib/Sema/SemaType.cpp:2180
@@ -2179,1 +2179,3 @@
+  // OpenCL v2.0 s6.16.13.1 - Arrays of pipe type are not supported.
+  //  OpenCL v2.0 s6.9.b - Arrays of image/sampler type are not supported.
   if (getLangOpts().OpenCL) {

remove extra space


http://reviews.llvm.org/D17437



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


Re: [PATCH] D16040: [OpenCL] Refine OpenCLImageAccessAttr to OpenCLAccessAttr

2016-02-23 Thread Aaron Ballman via cfe-commits
aaron.ballman added a comment.

Mostly minor comments, but I like this approach!



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7713
@@ +7712,3 @@
+def err_opencl_invalid_read_write : Error<
+  "access qualifier read_write can not be used for %0 %select{|earlier than 
OpenCL2.0 version}1">;
+def err_opencl_multiple_access_qualifiers : Error<

Anastasia wrote:
> could you write __read_write/read_write please!
Better yet, use the spelling the user wrote, since you have access to that 
information already.


Comment at: lib/Sema/SemaType.cpp:6228
@@ -6227,1 +6227,3 @@
 
+/// Handle OpenCL Access Qualifier Attribute
+static void HandleOpenCLAccessAttr(QualType &CurType, const AttributeList 
&Attr,

Missing a period at the end of the sentence.


Comment at: lib/Sema/SemaType.cpp:6231
@@ +6230,3 @@
+   Sema &S) {
+  // OpenCL v2.0 s6.6 - Access qualifier can used only for image and pipe type
+  if (!(CurType->isImageType() || CurType->isPipeType())) {

Missing a period at the end of the sentence.


http://reviews.llvm.org/D16040



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


Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct

2016-02-23 Thread Michael Matz via cfe-commits
Hi,

On Tue, 23 Feb 2016, H.J. Lu wrote:

> > ---
> > An empty type is a type where it and all of its subobjects (recursively)
> > are of class, structure, union, or array type.  No memory slot nor
> > register should be used to pass or return an object of empty type that's
> > trivially copyable.
> > ---
> >
> > (With possibly a self-sufficient definition of trivially copyable, that's
> > language agnostic)
> >
> 
> Do you have an example in which an empty type defined above isn't
> "trivially copyable"?

The ones we've always talked about: empty C++ types with non-trivial copy 
ctors or dtors.  Yes, I'm aware of the fact that the Itanium C++ ABI 
doesn't invoke the underlying psABI for these types (or better, it 
specifies them to be passed by reference).  But first, there are other 
languages that have such constructs, but don't necessarily have an 
written-down ABI (OO fortran anyone? Ada?).  Second, there may be other 
C++ ABIs that don't contain such language (which would be an ommission, 
but well, happens).  And third even for our C++ needs (based on the 
Itanium ABI) I feel it's simply more clear and self-sufficient to be 
explicit about this restriction.

It's not that we have any sort of upper bound on the number of words we're 
allowed to use in the psABI, and I also don't think anything is gained by 
being as terse as possible.  Succinct, sure, but not as arcane as we can 
make it while still being correct.

So, question back: can you imaging any cases where the "restriction" to 
trivially copyable would _not_ do the thing we want?


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


Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct

2016-02-23 Thread H.J. Lu via cfe-commits
On Tue, Feb 23, 2016 at 7:30 AM, Michael Matz  wrote:
> Hi,
>
> On Tue, 23 Feb 2016, H.J. Lu wrote:
>
>> > ---
>> > An empty type is a type where it and all of its subobjects (recursively)
>> > are of class, structure, union, or array type.  No memory slot nor
>> > register should be used to pass or return an object of empty type that's
>> > trivially copyable.
>> > ---
>> >
>> > (With possibly a self-sufficient definition of trivially copyable, that's
>> > language agnostic)
>> >
>>
>> Do you have an example in which an empty type defined above isn't
>> "trivially copyable"?
>
> The ones we've always talked about: empty C++ types with non-trivial copy
> ctors or dtors.  Yes, I'm aware of the fact that the Itanium C++ ABI
> doesn't invoke the underlying psABI for these types (or better, it
> specifies them to be passed by reference).  But first, there are other
> languages that have such constructs, but don't necessarily have an
> written-down ABI (OO fortran anyone? Ada?).  Second, there may be other
> C++ ABIs that don't contain such language (which would be an ommission,
> but well, happens).  And third even for our C++ needs (based on the
> Itanium ABI) I feel it's simply more clear and self-sufficient to be
> explicit about this restriction.
>
> It's not that we have any sort of upper bound on the number of words we're
> allowed to use in the psABI, and I also don't think anything is gained by
> being as terse as possible.  Succinct, sure, but not as arcane as we can
> make it while still being correct.
>
> So, question back: can you imaging any cases where the "restriction" to
> trivially copyable would _not_ do the thing we want?

I thought

---
An empty type is a type where it and all of its subobjects (recursively)
are of class, structure, union, or array type.
---

excluded

struct empty
{
empty () = default;
};

Adding "trivially copyable" extends, not limiting, the scope of
empty type.

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


r261641 - [CLANG] [AVX512] [BUILTIN] Adding prorv{d|q}{128|256|512} builtin to clang

2016-02-23 Thread Michael Zuckerman via cfe-commits
Author: mzuckerm
Date: Tue Feb 23 09:59:47 2016
New Revision: 261641

URL: http://llvm.org/viewvc/llvm-project?rev=261641&view=rev
Log:
[CLANG] [AVX512] [BUILTIN] Adding prorv{d|q}{128|256|512} builtin to clang 

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


Modified:
cfe/trunk/include/clang/Basic/BuiltinsX86.def
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/avx512vlintrin.h
cfe/trunk/test/CodeGen/avx512f-builtins.c
cfe/trunk/test/CodeGen/avx512vl-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=261641&r1=261640&r2=261641&view=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsX86.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsX86.def Tue Feb 23 09:59:47 2016
@@ -1626,6 +1626,12 @@ TARGET_BUILTIN(__builtin_ia32_prord128_m
 TARGET_BUILTIN(__builtin_ia32_prord256_mask, "V8iV8iIiV8iUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_prorq128_mask, 
"V2LLiV2LLiIiV2LLiUc","","avx512vl")
 TARGET_BUILTIN(__builtin_ia32_prorq256_mask, 
"V4LLiV4LLiIiV4LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prorvd512_mask, 
"V16iV16iV16iV16iUs","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_prorvq512_mask, 
"V8LLiV8LLiV8LLiV8LLiUc","","avx512f")
+TARGET_BUILTIN(__builtin_ia32_prorvd128_mask, "V4iV4iV4iV4iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prorvd256_mask, "V8iV8iV8iV8iUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prorvq128_mask, 
"V2LLiV2LLiV2LLiV2LLiUc","","avx512vl")
+TARGET_BUILTIN(__builtin_ia32_prorvq256_mask, 
"V4LLiV4LLiV4LLiV4LLiUc","","avx512vl")
 
 #undef BUILTIN
 #undef TARGET_BUILTIN

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=261641&r1=261640&r2=261641&view=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Tue Feb 23 09:59:47 2016
@@ -3289,6 +3289,65 @@ _mm512_maskz_cvtepu16_epi64 (__mmask8 __
 (__mmask8) __U);
 }
 
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_rorv_epi32 (__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prorvd512_mask ((__v16si) __A,
+  (__v16si) __B,
+  (__v16si)
+  _mm512_setzero_si512 (),
+  (__mmask16) -1);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_rorv_epi32 (__m512i __W, __mmask16 __U, __m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prorvd512_mask ((__v16si) __A,
+  (__v16si) __B,
+  (__v16si) __W,
+  (__mmask16) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_rorv_epi32 (__mmask16 __U, __m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prorvd512_mask ((__v16si) __A,
+  (__v16si) __B,
+  (__v16si)
+  _mm512_setzero_si512 (),
+  (__mmask16) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_rorv_epi64 (__m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prorvq512_mask ((__v8di) __A,
+  (__v8di) __B,
+  (__v8di)
+  _mm512_setzero_si512 (),
+  (__mmask8) -1);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_mask_rorv_epi64 (__m512i __W, __mmask8 __U, __m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prorvq512_mask ((__v8di) __A,
+  (__v8di) __B,
+  (__v8di) __W,
+  (__mmask8) __U);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS
+_mm512_maskz_rorv_epi64 (__mmask8 __U, __m512i __A, __m512i __B)
+{
+  return (__m512i) __builtin_ia32_prorvq512_mask ((__v8di) __A,
+  (__v8di) __B,
+  (__v8di)
+  _mm512_setzero_si512 (),
+  (__mmask8) __U);
+}
+
+
 
 #define _mm512_cmp_epi32_mask(a, b, p) __extension__ ({ \
   (__mmask16)__builtin_ia32_cmpd512_mask((__v16si)(__m512i)(a), \

Modified: cfe/trunk/lib/Headers/avx512vlintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512vlintrin.h?rev=261641&r1=261640&r2=261641&view=diff
==
--- cfe/trunk/lib/Headers/avx512vlintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512vlintrin.h Tue Feb 23 09:59:47 2016
@@ -5216,6 +5216,127 @@ __builtin_ia32_prorq256_mask ((__v4di)(
 })
 
 
+static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_rorv_epi32 (__m128i __A, __m128i __B)
+{
+  return (__m128i) __builtin_ia32_prorvd128_mask ((__v4si) __A,
+  (__v4si) __B,
+  (__v4si)
+  _mm_setzero_si128 (),
+  (__mmask8) -1);
+}
+
+static __inline__ __m128i __DEFAULT_FN_ATTRS
+_mm_mask_rorv_epi32 (__m128i __W, __mmask8 __U, __m128i __A,
+ __m

Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct

2016-02-23 Thread Michael Matz via cfe-commits
Hi,

On Tue, 23 Feb 2016, H.J. Lu wrote:

> I thought
> 
> ---
> An empty type is a type where it and all of its subobjects (recursively)
> are of class, structure, union, or array type.
> ---
> 
> excluded
> 
> struct empty
> {
> empty () = default;
> };


Why would that be excluded?  There are no subobjects, hence all of them 
are of class, structure, union or array type, hence this is an empty type. 
(And that's good, it indeed looks quite empty to me).  Even if you would 
add a non-trivial copy ctor, making this thing not trivially copyable 
anymore, it would still be empty.  Hence, given your proposed language in 
the psABI, without reference to any other ABI (in particular not to the 
Itanium C++ ABI), you would then need to pass it without registers.  That 
can't be done, and that's exactly why I find that wording incomplete.  It 
needs implicit references to other languages ABIs to work.

> Adding "trivially copyable" extends, not limiting, the scope of
> empty type.

Huh?  Adding (as in ANDing, not ORing) anything to a positive condition 
necessarily restricts it.  But also note, that my wording does _not_ add 
the restriction to the definition of "empty type", but rather only to when 
they can be passed/returned by nothing.


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


r261642 - Allow running dump_format_style.py from any directory.

2016-02-23 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Feb 23 10:11:43 2016
New Revision: 261642

URL: http://llvm.org/viewvc/llvm-project?rev=261642&view=rev
Log:
Allow running dump_format_style.py from any directory.

Modified:
cfe/trunk/docs/tools/dump_format_style.py

Modified: cfe/trunk/docs/tools/dump_format_style.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/dump_format_style.py?rev=261642&r1=261641&r2=261642&view=diff
==
--- cfe/trunk/docs/tools/dump_format_style.py (original)
+++ cfe/trunk/docs/tools/dump_format_style.py Tue Feb 23 10:11:43 2016
@@ -4,11 +4,13 @@
 # Run from the directory in which this file is located to update the docs.
 
 import collections
+import os
 import re
 import urllib2
 
-FORMAT_STYLE_FILE = '../../include/clang/Format/Format.h'
-DOC_FILE = '../ClangFormatStyleOptions.rst'
+CLANG_DIR = os.path.join(os.path.dirname(__file__), '../..')
+FORMAT_STYLE_FILE = os.path.join(CLANG_DIR, 'include/clang/Format/Format.h')
+DOC_FILE = os.path.join(CLANG_DIR, 'docs/ClangFormatStyleOptions.rst')
 
 
 def substitute(text, tag, contents):


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


r261643 - Update clang-format options docs.

2016-02-23 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Feb 23 10:11:51 2016
New Revision: 261643

URL: http://llvm.org/viewvc/llvm-project?rev=261643&view=rev
Log:
Update clang-format options docs.

Modified:
cfe/trunk/docs/ClangFormatStyleOptions.rst

Modified: cfe/trunk/docs/ClangFormatStyleOptions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormatStyleOptions.rst?rev=261643&r1=261642&r2=261643&view=diff
==
--- cfe/trunk/docs/ClangFormatStyleOptions.rst (original)
+++ cfe/trunk/docs/ClangFormatStyleOptions.rst Tue Feb 23 10:11:51 2016
@@ -154,7 +154,7 @@ the configuration (without a prefix: ``A
   If ``true``, horizontally aligns arguments after an open bracket.
 
   This applies to round brackets (parentheses), angle brackets and square
-  brackets. This will result in formattings like
+  brackets.
 
   Possible values:
 
@@ -214,6 +214,14 @@ the configuration (without a prefix: ``A
   If ``true``, horizontally align operands of binary and ternary
   expressions.
 
+  Specifically, this aligns operands of a single expression that needs to be
+  split over multiple lines, e.g.:
+
+  .. code-block:: c++
+
+int aaa = bbb +
+  ccc;
+
 **AlignTrailingComments** (``bool``)
   If ``true``, aligns trailing comments.
 
@@ -377,6 +385,9 @@ the configuration (without a prefix: ``A
   Always break constructor initializers before commas and align
   the commas with the colon.
 
+**BreakStringLiterals** (``bool``)
+  Allow breaking string literals when formatting.
+
 **ColumnLimit** (``unsigned``)
   The column limit.
 
@@ -462,10 +473,12 @@ the configuration (without a prefix: ``A
   according to increasing category number and then alphabetically within
   each category.
 
-  If none of the regular expressions match, UINT_MAX is assigned as
-  category. The main header for a source file automatically gets category 0,
-  so that it is kept at the beginning of the #includes
-  (http://llvm.org/docs/CodingStandards.html#include-style).
+  If none of the regular expressions match, INT_MAX is assigned as
+  category. The main header for a source file automatically gets category 0.
+  so that it is generally kept at the beginning of the #includes
+  (http://llvm.org/docs/CodingStandards.html#include-style). However, you
+  can also assign negative priorities if you have certain headers that
+  always need to be first.
 
   To configure this in the .clang-format file, use:
 
@@ -511,6 +524,8 @@ the configuration (without a prefix: ``A
   * ``LK_Proto`` (in configuration: ``Proto``)
 Should be used for Protocol Buffers
 (https://developers.google.com/protocol-buffers/).
+  * ``LK_TableGen`` (in configuration: ``TableGen``)
+Should be used for TableGen code.
 
 
 **MacroBlockBegin** (``std::string``)
@@ -578,6 +593,12 @@ the configuration (without a prefix: ``A
 Align pointer in the middle.
 
 
+**ReflowComments** (``bool``)
+  If true, clang-format will attempt to re-flow comments.
+
+**SortIncludes** (``bool``)
+  If true, clang-format will sort #includes.
+
 **SpaceAfterCStyleCast** (``bool``)
   If ``true``, a space may be inserted after C style casts.
 


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


r261644 - Support language selection for \code blocks.

2016-02-23 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Feb 23 10:11:55 2016
New Revision: 261644

URL: http://llvm.org/viewvc/llvm-project?rev=261644&view=rev
Log:
Support language selection for \code blocks.

Modified:
cfe/trunk/docs/tools/dump_format_style.py

Modified: cfe/trunk/docs/tools/dump_format_style.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/dump_format_style.py?rev=261644&r1=261643&r2=261644&view=diff
==
--- cfe/trunk/docs/tools/dump_format_style.py (original)
+++ cfe/trunk/docs/tools/dump_format_style.py Tue Feb 23 10:11:55 2016
@@ -79,7 +79,7 @@ class Enum:
 class EnumValue:
   def __init__(self, name, comment):
 self.name = name
-self.comment = comment.strip()
+self.comment = comment
 
   def __str__(self):
 return '* ``%s`` (in configuration: ``%s``)\n%s' % (
@@ -88,8 +88,12 @@ class EnumValue:
 doxygen2rst(indent(self.comment, 2)))
 
 def clean_comment_line(line):
-  if line == '/// \\code':
-return '\n.. code-block:: c++\n\n'
+  match = re.match(r'^/// \\code(\{.(\w+)\})?$', line)
+  if match:
+lang = match.groups()[1]
+if not lang:
+  lang = 'c++'
+return '\n.. code-block:: %s\n\n' % lang
   if line == '/// \\endcode':
 return ''
   return line[4:] + '\n'


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


r261645 - Clean up clang-format options documentation. NFC

2016-02-23 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Feb 23 10:12:00 2016
New Revision: 261645

URL: http://llvm.org/viewvc/llvm-project?rev=261645&view=rev
Log:
Clean up clang-format options documentation. NFC

Use uniform style for inline code blocks, specify language for YAML code blocks,
various formatting fixes etc.

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

Modified: cfe/trunk/docs/ClangFormatStyleOptions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormatStyleOptions.rst?rev=261645&r1=261644&r2=261645&view=diff
==
--- cfe/trunk/docs/ClangFormatStyleOptions.rst (original)
+++ cfe/trunk/docs/ClangFormatStyleOptions.rst Tue Feb 23 10:12:00 2016
@@ -148,7 +148,7 @@ the configuration (without a prefix: ``A
 .. START_FORMAT_STYLE_OPTIONS
 
 **AccessModifierOffset** (``int``)
-  The extra indent or outdent of access modifiers, e.g. ``public:``.
+  The extra indent or outdent of access modifiers, e.g. ``public``:.
 
 **AlignAfterOpenBracket** (``BracketAlignmentStyle``)
   If ``true``, horizontally aligns arguments after an open bracket.
@@ -165,6 +165,7 @@ the configuration (without a prefix: ``A
 
   someLongFunction(argument1,
argument2);
+
   * ``BAS_DontAlign`` (in configuration: ``DontAlign``)
 Don't align, instead use ``ContinuationIndentWidth``, e.g.:
 
@@ -172,6 +173,7 @@ the configuration (without a prefix: ``A
 
   someLongFunction(argument1,
   argument2);
+
   * ``BAS_AlwaysBreak`` (in configuration: ``AlwaysBreak``)
 Always break after an open bracket, if the parameters don't fit
 on a single line, e.g.:
@@ -182,6 +184,7 @@ the configuration (without a prefix: ``A
   argument1, argument2);
 
 
+
 **AlignConsecutiveAssignments** (``bool``)
   If ``true``, aligns consecutive assignments.
 
@@ -238,28 +241,31 @@ the configuration (without a prefix: ``A
   If ``true``, short case labels will be contracted to a single line.
 
 **AllowShortFunctionsOnASingleLine** (``ShortFunctionStyle``)
-  Dependent on the value, ``int f() { return 0; }`` can be put
-  on a single line.
+  Dependent on the value, ``int f() { return 0; }`` can be put on a
+  single line.
 
   Possible values:
 
   * ``SFS_None`` (in configuration: ``None``)
 Never merge functions into a single line.
+
   * ``SFS_Empty`` (in configuration: ``Empty``)
 Only merge empty functions.
+
   * ``SFS_Inline`` (in configuration: ``Inline``)
 Only merge functions defined inside a class. Implies "empty".
+
   * ``SFS_All`` (in configuration: ``All``)
 Merge all functions fitting on a single line.
 
 
+
 **AllowShortIfStatementsOnASingleLine** (``bool``)
-  If ``true``, ``if (a) return;`` can be put on a single
-  line.
+  If ``true``, ``if (a) return;`` can be put on a single line.
 
 **AllowShortLoopsOnASingleLine** (``bool``)
-  If ``true``, ``while (true) continue;`` can be put on a
-  single line.
+  If ``true``, ``while (true) continue;`` can be put on a single
+  line.
 
 **AlwaysBreakAfterDefinitionReturnType** 
(``DefinitionReturnTypeBreakingStyle``)
   The function definition return type breaking style to use.  This
@@ -270,12 +276,15 @@ the configuration (without a prefix: ``A
   * ``DRTBS_None`` (in configuration: ``None``)
 Break after return type automatically.
 ``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
+
   * ``DRTBS_All`` (in configuration: ``All``)
 Always break after the return type.
+
   * ``DRTBS_TopLevel`` (in configuration: ``TopLevel``)
 Always break after the return types of top-level functions.
 
 
+
 **AlwaysBreakAfterReturnType** (``ReturnTypeBreakingStyle``)
   The function declaration return type breaking style to use.
 
@@ -284,16 +293,21 @@ the configuration (without a prefix: ``A
   * ``RTBS_None`` (in configuration: ``None``)
 Break after return type automatically.
 ``PenaltyReturnTypeOnItsOwnLine`` is taken into account.
+
   * ``RTBS_All`` (in configuration: ``All``)
 Always break after the return type.
+
   * ``RTBS_TopLevel`` (in configuration: ``TopLevel``)
 Always break after the return types of top-level functions.
+
   * ``RTBS_AllDefinitions`` (in configuration: ``AllDefinitions``)
 Always break after the return type of function definitions.
+
   * ``RTBS_TopLevelDefinitions`` (in configuration: ``TopLevelDefinitions``)
 Always break after the return type of top-level definitions.
 
 
+
 **AlwaysBreakBeforeMultilineStrings** (``bool``)
   If ``true``, always break before multiline string literals.
 
@@ -303,8 +317,8 @@ the configuration (without a prefix: ``A
   ``ContinuationIndentWidth`` spaces from the start of the line.
 
 **AlwaysBreakTemplateDeclarations** (``bool``)
-  If ``true``, always break after the ``template<...>`` of a
-  template declaration.
+  If ``true``, always break after the ``template<...>`` of a template
+  declaration.
 
 **

r261646 - Fix a typo. NFC

2016-02-23 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Tue Feb 23 10:12:08 2016
New Revision: 261646

URL: http://llvm.org/viewvc/llvm-project?rev=261646&view=rev
Log:
Fix a typo. NFC

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

Modified: cfe/trunk/docs/ClangFormatStyleOptions.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangFormatStyleOptions.rst?rev=261646&r1=261645&r2=261646&view=diff
==
--- cfe/trunk/docs/ClangFormatStyleOptions.rst (original)
+++ cfe/trunk/docs/ClangFormatStyleOptions.rst Tue Feb 23 10:12:08 2016
@@ -148,7 +148,7 @@ the configuration (without a prefix: ``A
 .. START_FORMAT_STYLE_OPTIONS
 
 **AccessModifierOffset** (``int``)
-  The extra indent or outdent of access modifiers, e.g. ``public``:.
+  The extra indent or outdent of access modifiers, e.g. ``public:``.
 
 **AlignAfterOpenBracket** (``BracketAlignmentStyle``)
   If ``true``, horizontally aligns arguments after an open bracket.

Modified: cfe/trunk/include/clang/Format/Format.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Format/Format.h?rev=261646&r1=261645&r2=261646&view=diff
==
--- cfe/trunk/include/clang/Format/Format.h (original)
+++ cfe/trunk/include/clang/Format/Format.h Tue Feb 23 10:12:08 2016
@@ -40,7 +40,7 @@ std::error_code make_error_code(ParseErr
 /// \brief The ``FormatStyle`` is used to configure the formatting to follow
 /// specific guidelines.
 struct FormatStyle {
-  /// \brief The extra indent or outdent of access modifiers, e.g. ``public``:.
+  /// \brief The extra indent or outdent of access modifiers, e.g. ``public:``.
   int AccessModifierOffset;
 
   /// \brief Different styles for aligning after open brackets.


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


[libcxx] r261647 - More updates; patch for 2583 ready

2016-02-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb 23 10:20:24 2016
New Revision: 261647

URL: http://llvm.org/viewvc/llvm-project?rev=261647&view=rev
Log:
More updates; patch for 2583 ready

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=261647&r1=261646&r2=261647&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Tue Feb 23 10:20:24 2016
@@ -83,7 +83,7 @@
http://cplusplus.github.io/LWG/lwg-defects.html#2579";>2579Inconsistency
 wrt Allocators in basic_string assignment vs. 
basic_string::assignJacksonvillePatch 
Ready
http://cplusplus.github.io/LWG/lwg-defects.html#2581";>2581Specialization
 of  variable templates should be 
prohibitedJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2582";>2582§[res.on.functions]/2's
 prohibition against incomplete types shouldn't apply to type 
traitsJacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2583";>2583There
 is no way to supply an allocator for basic_string(str, 
pos)Jacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2583";>2583There
 is no way to supply an allocator for basic_string(str, 
pos)JacksonvillePatch Ready
http://cplusplus.github.io/LWG/lwg-defects.html#2585";>2585forward_list::resize(size_type,
 const value_type&) effects 
incorrectJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2586";>2586Wrong
 value category used in 
scoped_allocator_adaptor::construct()Jacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2590";>2590Aggregate
 initialization for std::arrayJacksonville
@@ -114,16 +114,16 @@
 2575 - I don't think we ever implemented this; so 'removing' it is 
trivial
 2576 - This one is simple, but testing it will be hard. I tried making a 
sublass of istringstream, but it got sliced.
 2577 - This one is simple
-2579 - Done.
+2579 - Done
 2581 - 
 2582 - 
-2583 - This looks easy.
+2583 - Done
 2585 - This looks easy.
 2586 - 
 2590 - 
 
 
-Last Updated: 16-Feb-2015
+Last Updated: 23-Feb-2015
 
 
 


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


Re: RFC: Update Intel386, x86-64 and IA MCU psABIs for passing/returning empty struct

2016-02-23 Thread H.J. Lu via cfe-commits
On Tue, Feb 23, 2016 at 8:15 AM, Michael Matz  wrote:
> Hi,
>
> On Tue, 23 Feb 2016, H.J. Lu wrote:
>
>> I thought
>>
>> ---
>> An empty type is a type where it and all of its subobjects (recursively)
>> are of class, structure, union, or array type.
>> ---
>>
>> excluded
>>
>> struct empty
>> {
>> empty () = default;
>> };
>
>
> Why would that be excluded?  There are no subobjects, hence all of them
> are of class, structure, union or array type, hence this is an empty type.
> (And that's good, it indeed looks quite empty to me).  Even if you would
> add a non-trivial copy ctor, making this thing not trivially copyable
> anymore, it would still be empty.  Hence, given your proposed language in
> the psABI, without reference to any other ABI (in particular not to the
> Itanium C++ ABI), you would then need to pass it without registers.  That
> can't be done, and that's exactly why I find that wording incomplete.  It
> needs implicit references to other languages ABIs to work.
>

It is clear to me now.  Let's go with

---
An empty type is a type where it and all of its subobjects (recursively)
are of class, structure, union, or array type.  No memory slot nor
register should be used to pass or return an object of empty type that's
trivially copyable.
---

Any comments?


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


[libcxx] r261648 - Add additional tests to ensure that we DTRT with short lists. This is LWG#2590, but there are no code changes, just additional tests

2016-02-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb 23 10:25:20 2016
New Revision: 261648

URL: http://llvm.org/viewvc/llvm-project?rev=261648&view=rev
Log:
Add additional tests to ensure that we DTRT with short lists. This is LWG#2590, 
but there are no code changes, just additional tests

Modified:

libcxx/trunk/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp

Modified: 
libcxx/trunk/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp?rev=261648&r1=261647&r2=261648&view=diff
==
--- 
libcxx/trunk/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
 Tue Feb 23 10:25:20 2016
@@ -35,4 +35,18 @@ int main()
 C c = {};
 assert(c.size() == 0);
 }
+
+{
+typedef double T;
+typedef std::array C;
+C c = {1};
+assert(c.size() == 3.0);
+assert(c[0] == 1);
+}
+{
+typedef int T;
+typedef std::array C;
+C c = {};
+assert(c.size() == 1);
+}
 }


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


Re: [PATCH] D17438: [OpenCL] Add Sema checks for atomics and implicit declaration

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

I agree there seems to be nothing specifically on this topic in OpenCL spec. 
However, I wouldn't modify Clang and rely on its default behavior:

1. In C99 gives a warning
2. For some targets set up in a special way (i.e. SPIR) gives an error



Comment at: lib/Sema/SemaInit.cpp:6156
@@ +6155,3 @@
+   TyQualifiers.getAddressSpace() == LangAS::opencl_global;
+if (!HasGlobalAS && Entity.getKind() == InitializedEntity::EK_Variable &&
+Args.size() > 0) {

Actually I don't see any statement in spec that forbids initialization of 
atomic variables inside the functions. It just says that ATOMIC_VAR_INIT can 
only be used with global variables, but you are not checking that here.


http://reviews.llvm.org/D17438



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


Re: [PATCH] D16876: [OpenCL] Refine pipe builtin support

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

Could you please address number 1 from my previous comment?

Otherwise, I think we should try to proceed quickly here, it will be too hard 
to merge back in after long delay and also it would be nice to have as many 
corrections as possible ASAP.

Could we move Richard to subscribers for now, as he can give his feedback later 
too.

@Pekka, do you have any more comments?


http://reviews.llvm.org/D16876



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


Re: [PATCH] D17437: [OpenCL] Add Sema checks for types

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.


Comment at: test/SemaOpenCL/sampler_t.cl:13
@@ -12,2 +12,3 @@
   foo(5); // expected-error {{sampler_t variable required - got 'int'}}
+  sampler_t sa[] = {argsmp,const_smp}; // expected-error {{array of 
'sampler_t' type is invalid in OpenCL}}
 }

put whitespace after ,


http://reviews.llvm.org/D17437



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


Re: r261626 - Fix a -Wunused-variable diagnostic.

2016-02-23 Thread David Blaikie via cfe-commits
On Tue, Feb 23, 2016 at 2:29 AM, Alexander Kornienko via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: alexfh
> Date: Tue Feb 23 04:29:04 2016
> New Revision: 261626
>
> URL: http://llvm.org/viewvc/llvm-project?rev=261626&view=rev
> Log:
> Fix a -Wunused-variable diagnostic.
>
> Modified:
> cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
>
> Modified: cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp?rev=261626&r1=261625&r2=261626&view=diff
>
> ==
> --- cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp (original)
> +++ cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp Tue Feb 23 04:29:04
> 2016
> @@ -307,8 +307,10 @@ HasNameMatcher::HasNameMatcher(std::vect
>N.begin(), N.end(),
>[](StringRef Name) { return Name.find("::") == Name.npos; })),
>Names(std::move(N)) {
> +#ifndef NDEBUG
>for (StringRef Name : Names)
>  assert(!Name.empty());
>

Alternatively, you could fold the loop into the assert:

assert(llvm::all_of(Names, [](StringRef Name) { return !Name.empty(); }));

(not sure if we have rangified llvm::all_of, but we have some of the other
_of in llvm rangified versions and it would be easy to add this one too)


> +#endif
>  }
>
>  namespace {
>
>
> ___
> 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] D16876: [OpenCL] Refine pipe builtin support

2016-02-23 Thread Pekka Jääskeläinen via cfe-commits
pekka.jaaskelainen accepted this revision.
pekka.jaaskelainen added a comment.
This revision is now accepted and ready to land.

In http://reviews.llvm.org/D16876#359781, @Anastasia wrote:

> @Pekka, do you have any more comments?


Nope. Looking forward to finally implementing proper pipe support to pocl.

With the future Clang OpenCL patches I appreciate if you keep adding me to the 
cc list of the reviews, but it might be pointless to wait for my LGTM as I'm 
still quite a Clang noob, thus that "LGTM" might not have the "weight" it 
should have :) In other words, I keep monitoring the patches and will yell if I 
see something that sticks to my eye, but no point in blocking the progress due 
to possibly slow acks from my side.


http://reviews.llvm.org/D16876



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


Re: [PATCH] D16876: [OpenCL] Refine pipe builtin support

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia added a comment.

In http://reviews.llvm.org/D16876#359786, @pekka.jaaskelainen wrote:

> In http://reviews.llvm.org/D16876#359781, @Anastasia wrote:
>
> > @Pekka, do you have any more comments?
>
>
> Nope. Looking forward to finally implementing proper pipe support to pocl.
>
> With the future Clang OpenCL patches I appreciate if you keep adding me to 
> the cc list of the reviews, but it might be pointless to wait for my LGTM as 
> I'm still quite a Clang noob, thus that "LGTM" might not have the "weight" it 
> should have :) In other words, I keep monitoring the patches and will yell if 
> I see something that sticks to my eye, but no point in blocking the progress 
> due to possibly slow acks from my side.


Sure, no problem! Thanks!


http://reviews.llvm.org/D16876



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


[libcxx] r261653 - Add tests for LWG#2560. No code changes, just tests

2016-02-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb 23 11:01:52 2016
New Revision: 261653

URL: http://llvm.org/viewvc/llvm-project?rev=261653&view=rev
Log:
Add tests for LWG#2560. No code changes, just tests

Modified:

libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp?rev=261653&r1=261652&r2=261653&view=diff
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
 Tue Feb 23 11:01:52 2016
@@ -99,4 +99,13 @@ int main()
 test_is_not_constructible ();
 test_is_not_constructible ();
 test_is_not_constructible ();
+
+//  LWG 2560
+test_is_not_constructible ();
+#if TEST_STD_VERS > 11
+test_is_not_constructible ();
+test_is_not_constructible ();
+test_is_not_constructible ();
+test_is_not_constructible ();
+#endif
 }


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


r261654 - Revert "[VFS] Add support for handling path traversals"

2016-02-23 Thread Bruno Cardoso Lopes via cfe-commits
Author: bruno
Date: Tue Feb 23 11:06:50 2016
New Revision: 261654

URL: http://llvm.org/viewvc/llvm-project?rev=261654&view=rev
Log:
Revert "[VFS] Add support for handling path traversals"

This reverts commit r261551 due to failing tests in windows bots:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10054

Failing Tests (4):
Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.CaseInsensitive
Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.DirectoryIteration
Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MappedFiles
Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.UseExternalName

Removed:
cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m
cfe/trunk/test/Modules/crash-vfs-path-traversal.m
Modified:
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp

Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=261654&r1=261653&r2=261654&view=diff
==
--- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)
+++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Tue Feb 23 11:06:50 2016
@@ -111,20 +111,6 @@ bool FileSystem::exists(const Twine &Pat
   return Status && Status->exists();
 }
 
-#ifndef NDEBUG
-static bool isTraversalComponent(StringRef Component) {
-  return Component.equals("..") || Component.equals(".");
-}
-
-static bool pathHasTraversal(StringRef Path) {
-  using namespace llvm::sys;
-  for (StringRef Comp : llvm::make_range(path::begin(Path), path::end(Path)))
-if (isTraversalComponent(Comp))
-  return true;
-  return false;
-}
-#endif
-
 
//===---===/
 // RealFileSystem implementation
 
//===---===/
@@ -821,9 +807,6 @@ public:
 ///
 /// and inherit their attributes from the external contents.
 ///
-/// Virtual file paths and external files are expected to be canonicalized
-/// without "..", "." and "./" in their paths.
-///
 /// In both cases, the 'name' field may contain multiple path components (e.g.
 /// /path/to/file). However, any directory that contains more than one child
 /// must be uniquely represented by a directory entry.
@@ -1021,13 +1004,7 @@ class RedirectingFileSystemParser {
   if (Key == "name") {
 if (!parseScalarString(I->getValue(), Value, Buffer))
   return nullptr;
-
-SmallString<256> Path(Value);
-// Guarantee that old YAML files containing paths with ".." and "." are
-// properly canonicalized before read into the VFS.
-Path = sys::path::remove_leading_dotslash(Path);
-sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
-Name = Path.str();
+Name = Value;
   } else if (Key == "type") {
 if (!parseScalarString(I->getValue(), Value, Buffer))
   return nullptr;
@@ -1071,12 +1048,7 @@ class RedirectingFileSystemParser {
 HasContents = true;
 if (!parseScalarString(I->getValue(), Value, Buffer))
   return nullptr;
-SmallString<256> Path(Value);
-// Guarantee that old YAML files containing paths with ".." and "." are
-// properly canonicalized before read into the VFS.
-Path = sys::path::remove_leading_dotslash(Path);
-sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
-ExternalContentsPath = Path.str();
+ExternalContentsPath = Value;
   } else if (Key == "use-external-name") {
 bool Val;
 if (!parseScalarBool(I->getValue(), Val))
@@ -1266,12 +1238,6 @@ ErrorOr RedirectingFileSystem::
   if (std::error_code EC = makeAbsolute(Path))
 return EC;
 
-  // Canonicalize path by removing ".", "..", "./", etc components. This is
-  // a VFS request, do bot bother about symlinks in the path components
-  // but canonicalize in order to perform the correct entry search.
-  Path = sys::path::remove_leading_dotslash(Path);
-  sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
-
   if (Path.empty())
 return make_error_code(llvm::errc::invalid_argument);
 
@@ -1288,10 +1254,10 @@ ErrorOr RedirectingFileSystem::
 ErrorOr
 RedirectingFileSystem::lookupPath(sys::path::const_iterator Start,
   sys::path::const_iterator End, Entry *From) {
-  assert(!isTraversalComponent(*Start) &&
- !isTraversalComponent(From->getName()) &&
- "Paths should not contain traversal components");
+  if (Start->equals("."))
+++Start;
 
+  // FIXME: handle ..
   if (CaseSensitive ? !Start->equals(From->getName())
 : !Start->equals_lower(From->getName()))
 // failure to match
@@ -1410,6 +1376,16 @@ UniqueID vfs::getNextVirtualUniqueID() {
   return UniqueID(std::numeric_limits::max(), ID);
 }
 
+#ifndef NDEBUG
+static bool pathHasTraversal(

Re: r261552 - [VFS] Add 'overlay-relative' field to YAML files

2016-02-23 Thread Bruno Cardoso Lopes via cfe-commits
Looks like r261551's fault. Reverted in r261654.

On Mon, Feb 22, 2016 at 11:12 PM, Bruno Cardoso Lopes
 wrote:
> Reverted r261552 & r261556 in r261613. Waiting for next win bot
> results to see if it's necessary to revert r261551 as well.
>
> On Mon, Feb 22, 2016 at 7:16 PM, Bruno Cardoso Lopes
>  wrote:
>> Yes, but because of a related but different issue. The same as here:
>> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10026
>>
>> I've been trying to figure it out but it's been hard without a Unix
>> system available. I'll keep investigating and revert later tonight in
>> case I can't guess it.
>>
>> On Mon, Feb 22, 2016 at 7:08 PM, Sean Silva  wrote:
>>> The bot is still red:
>>> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast
>>>
>>> On Mon, Feb 22, 2016 at 6:48 PM, Bruno Cardoso Lopes
>>>  wrote:

 Hi Sean,

 This is hopefully fixed in r261556.

 On Mon, Feb 22, 2016 at 5:45 PM, Sean Silva  wrote:
 > This or r261551 seem to be causing a build failure:
 >
 > http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/527
 >
 > -- Sean SIlva
 >
 > On Mon, Feb 22, 2016 at 10:41 AM, Bruno Cardoso Lopes via cfe-commits
 >  wrote:
 >>
 >> Author: bruno
 >> Date: Mon Feb 22 12:41:09 2016
 >> New Revision: 261552
 >>
 >> URL: http://llvm.org/viewvc/llvm-project?rev=261552&view=rev
 >> Log:
 >> [VFS] Add 'overlay-relative' field to YAML files
 >>
 >> The VFS overlay mapping between virtual paths and real paths is done
 >> through
 >> the 'external-contents' entries in YAML files, which contains hardcoded
 >> paths
 >> to the real files.
 >>
 >> When a module compilation crashes, headers are dumped into
 >> .cache/vfs
 >> directory and are mapped via the .cache/vfs/vfs.yaml. The script
 >> generated for reproduction uses -ivfsoverlay pointing to file to gather
 >> the
 >> mapping between virtual paths and files inside .cache/vfs.
 >> Currently, we
 >> are only capable of reproducing such crashes in the same machine as
 >> they
 >> happen, because of the hardcoded paths in 'external-contents'.
 >>
 >> To be able to reproduce a crash in another machine, this patch
 >> introduces
 >> a new
 >> option in the VFS yaml file called 'overlay-relative'. When it's equal
 >> to
 >> 'true' it means that the provided path to the YAML file through the
 >> -ivfsoverlay option should also be used to prefix the final path for
 >> every
 >> 'external-contents'.
 >>
 >> Example, given the invocation snippet "... -ivfsoverlay
 >> .cache/vfs/vfs.yaml" and the following entry in the yaml file:
 >>
 >> "overlay-relative": "true",
 >> "roots": [
 >> ...
 >>   "type": "directory",
 >>   "name": "/usr/include",
 >>   "contents": [
 >> {
 >>   "type": "file",
 >>   "name": "stdio.h",
 >>   "external-contents": "/usr/include/stdio.h"
 >> },
 >> ...
 >>
 >> Here, a file manager request for virtual "/usr/include/stdio.h", that
 >> will
 >> map
 >> into real path
 >> "//.cache/vfs/usr/include/stdio.h.
 >>
 >> This is a useful feature for debugging module crashes in machines other
 >> than
 >> the one where the error happened.
 >>
 >> Differential Revision: http://reviews.llvm.org/D17457
 >>
 >> rdar://problem/24499339
 >>
 >> Added:
 >> cfe/trunk/test/Modules/crash-vfs-relative-overlay.m
 >>   - copied, changed from r261551,
 >> cfe/trunk/test/Modules/crash-vfs-path-traversal.m
 >> Modified:
 >> cfe/trunk/include/clang/Basic/VirtualFileSystem.h
 >> cfe/trunk/lib/Basic/VirtualFileSystem.cpp
 >> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
 >> cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp
 >> cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m
 >> cfe/trunk/test/Modules/crash-vfs-path-traversal.m
 >>
 >> Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
 >> URL:
 >>
 >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=261552&r1=261551&r2=261552&view=diff
 >>
 >>
 >> ==
 >> --- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
 >> +++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Mon Feb 22
 >> 12:41:09
 >> 2016
 >> @@ -310,6 +310,7 @@ llvm::sys::fs::UniqueID getNextVirtualUn
 >>  IntrusiveRefCntPtr
 >>  getVFSFromYAML(std::unique_ptr Buffer,
 >> llvm::SourceMgr::DiagHandlerTy DiagHandler,
 >> +   StringRef YAMLFilePath,
 >> void *DiagContext = nullptr,
 >> IntrusiveR

[libcxx] r261655 - More updates

2016-02-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb 23 11:07:15 2016
New Revision: 261655

URL: http://llvm.org/viewvc/llvm-project?rev=261655&view=rev
Log:
More updates

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=261655&r1=261654&r2=261655&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Tue Feb 23 11:07:15 2016
@@ -58,8 +58,8 @@
   Library Working group Issues Status
   
http://cplusplus.github.io/LWG/lwg-defects.html#2192";>2192Validity
 and return type of std::abs(0u) is 
unclearJacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2253";>2253[arrays.ts]
 dynarray should state which container requirements aren't 
metJacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2255";>2255[arrays.ts]
 dynarray constructor ambiguityJacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2253";>2253[arrays.ts]
 dynarray should state which container requirements aren't 
metJacksonvilleNothing to do
+   http://cplusplus.github.io/LWG/lwg-defects.html#2255";>2255[arrays.ts]
 dynarray constructor ambiguityJacksonvilleNothing 
to do
http://cplusplus.github.io/LWG/lwg-defects.html#2276";>2276Missing
 requirement on 
std::promise::set_exceptionJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2450";>2450(greater|less|greater_equal|less_equal)
 do not yield a total order for pointersJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2520";>2520N4089
 broke initializing unique_ptr from a 
nullptrJacksonville
@@ -71,10 +71,10 @@
http://cplusplus.github.io/LWG/lwg-defects.html#2557";>2557Logical
 operator traits are broken in the zero-argument 
caseJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2558";>2558[fund.ts.v2]
 Logical operator traits are broken in the zero-argument 
caseJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2559";>2559Error
 in LWG 2234's resolutionJacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2560";>2560is_constructible
 underspecified when applied to a function 
typeJacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2560";>2560is_constructible
 underspecified when applied to a function 
typeJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2565";>2565std::function's
 move constructor should guarantee nothrow for reference_wrappers and 
function pointersJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2566";>2566Requirements
 on the first template parameter of container 
adaptorsJacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2571";>2571§[map.modifiers]/2
 imposes nonsensical requirement on insert(InputIterator, 
InputIterator)Jacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2571";>2571§[map.modifiers]/2
 imposes nonsensical requirement on insert(InputIterator, 
InputIterator)JacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2572";>2572The
 remarks for shared_ptr::operator* should apply to cv-qualified 
void as wellJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2574";>2574[fund.ts.v2]
 std::experimental::function::operator=(F&&) should be 
constrainedJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2575";>2575[fund.ts.v2]
 experimental::function::assign should be 
removedJacksonville
@@ -84,9 +84,9 @@
http://cplusplus.github.io/LWG/lwg-defects.html#2581";>2581Specialization
 of  variable templates should be 
prohibitedJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2582";>2582§[res.on.functions]/2's
 prohibition against incomplete types shouldn't apply to type 
traitsJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2583";>2583There
 is no way to supply an allocator for basic_string(str, 
pos)JacksonvillePatch Ready
-   http://cplusplus.github.io/LWG/lwg-defects.html#2585";>2585forward_list::resize(size_type,
 const value_type&) effects 
incorrectJacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2585";>2585forward_list::resize(size_type,
 const value_type&) effects 
incorrectJacksonvilleDisputed
http://cplusplus.github.io/LWG/lwg-defects.html#2586";>2586Wrong
 value category used in 
scoped_allocator_adaptor::construct()Jacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2590";>2590Aggregate
 initialization for std::arrayJacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2590";>2590Aggregate
 initialization for 
std::arrayJacksonvilleComplete
   
 
 Comments about the issues
@@ -105,11 +105,11 @@
 2557 - Cleaning up wording; no code change required.
 2558

Re: r261626 - Fix a -Wunused-variable diagnostic.

2016-02-23 Thread Alexander Kornienko via cfe-commits
On Tue, Feb 23, 2016 at 5:51 PM, David Blaikie  wrote:

>
>
> On Tue, Feb 23, 2016 at 2:29 AM, Alexander Kornienko via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: alexfh
>> Date: Tue Feb 23 04:29:04 2016
>> New Revision: 261626
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=261626&view=rev
>> Log:
>> Fix a -Wunused-variable diagnostic.
>>
>> Modified:
>> cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
>>
>> Modified: cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp?rev=261626&r1=261625&r2=261626&view=diff
>>
>> ==
>> --- cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp (original)
>> +++ cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp Tue Feb 23 04:29:04
>> 2016
>> @@ -307,8 +307,10 @@ HasNameMatcher::HasNameMatcher(std::vect
>>N.begin(), N.end(),
>>[](StringRef Name) { return Name.find("::") == Name.npos; })),
>>Names(std::move(N)) {
>> +#ifndef NDEBUG
>>for (StringRef Name : Names)
>>  assert(!Name.empty());
>>
>
> Alternatively, you could fold the loop into the assert:
>
> assert(llvm::all_of(Names, [](StringRef Name) { return !Name.empty(); }));
>
> (not sure if we have rangified llvm::all_of, but we have some of the other
> _of in llvm rangified versions and it would be easy to add this one too)
>

Good to know we have rangified algorithms. However, I'll leave improvement
of the code to the original author.


>
>
>> +#endif
>>  }
>>
>>  namespace {
>>
>>
>> ___
>> 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


r261657 - Remove an unnecessary workaround introduced in r259975. (NFC)

2016-02-23 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Tue Feb 23 11:13:47 2016
New Revision: 261657

URL: http://llvm.org/viewvc/llvm-project?rev=261657&view=rev
Log:
Remove an unnecessary workaround introduced in r259975. (NFC)

Now that LLVM r259973 allows replacing a temporary type with another
temporary we can rely on the original implementation.

It is possible for enums to be created as part of
their own declcontext. In this case a FwdDecl will be created
twice. This doesn't cause a problem because both FwdDecls are
entered into the ReplaceMap: finalize() will replace the first
FwdDecl with the second and then replace the second with
complete type.

Thanks to echristo for pointing this out.

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

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=261657&r1=261656&r2=261657&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 11:13:47 2016
@@ -2071,25 +2071,22 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
   // If this is just a forward declaration, construct an appropriately
   // marked node and just return it.
   if (isImportedFromModule || !ED->getDefinition()) {
+// Note that it is possible for enums to be created as part of
+// their own declcontext. In this case a FwdDecl will be created
+// twice. This doesn't cause a problem because both FwdDecls are
+// entered into the ReplaceMap: finalize() will replace the first
+// FwdDecl with the second and then replace the second with
+// complete type.
+llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
 llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
-
-// It is possible for enums to be created as part of their own
-// declcontext. We need to cache a placeholder to avoid the type being
-// created twice before hitting the cache.
 llvm::TempDIScope TmpContext(DBuilder.createReplaceableCompositeType(
 llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0));
 
 unsigned Line = getLineNumber(ED->getLocation());
 StringRef EDName = ED->getName();
 llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
-llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext.get(), 
DefUnit,
-Line, 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
-
-// Cache the enum type so it is available when building the declcontext
-// and replace the declcontect with the real thing.
-TypeCache[Ty].reset(RetTy);
-TmpContext->replaceAllUsesWith(
-getDeclarationLexicalScope(*ED, QualType(Ty, 0)));
+llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, Line,
+0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
 
 ReplaceMap.emplace_back(
 std::piecewise_construct, std::make_tuple(Ty),


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


Re: r259975 - Fix a crash when emitting dbeug info for forward-declared scoped enums.

2016-02-23 Thread Adrian Prantl via cfe-commits
--> r261657.

Author: adrian 
Date:   Tue Feb 23 17:13:47 2016 +

Remove an unnecessary workaround introduced in r259975. (NFC)

Now that LLVM r259973 allows replacing a temporary type with another
temporary we can rely on the original implementation.

It is possible for enums to be created as part of
their own declcontext. In this case a FwdDecl will be created
twice. This doesn't cause a problem because both FwdDecls are
entered into the ReplaceMap: finalize() will replace the first
FwdDecl with the second and then replace the second with
complete type.

Thanks to echristo for pointing this out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261657 

-- adrian

> On Feb 22, 2016, at 5:26 PM, Eric Christopher  wrote:
> 
> Hi Adrian,
> 
> On Sat, Feb 20, 2016 at 1:18 PM Adrian Prantl  wrote:
> This had me puzzled for a second, but then I figured out what happened :-)
> The “crash” I quoted in the commit message really was an assertion failure, 
> to be precise, the very assertion I relaxed in LLVM r259973 in order to be 
> able to defer the building of the DeclContext implemented by this commit. 
> Even with the assertion removed, I still believe that implementing it this 
> way preferable, as it avoids creating the enum a second time.
> 
> > On Feb 19, 2016, at 7:05 PM, Eric Christopher  wrote:
> >
> > Hi Adrian,
> >
> > I'm taking a look at this and can't duplicate using the testcase you gave 
> > without your patch(es) applied. It's also causing asserts in other code as 
> > you can have the forward decl left around and the CU isn't a valid context.
> 
> Do you happen to have an example handy? I don’t quite understand the problem 
> from the description — shouldn’t the temporary fwddecl be RAUWed 
> unconditionally after the DeclContext is created?
> 
> 
> I'd think so. It appears to get through to code generation unreplaced though 
> and...
>  
> If you’re blocked on this we can definitely revert the change in CGDebugInfo 
> (but not the testcase), I just would like to understand what’s going on.
> 
> 
> I am a bit. I don't have a reduction at the moment small enough to debug 
> what's wrong with this and the current patch doesn't appear necessary so I'm 
> unable to debug the original problem at this point to try to help more.
> 
> -eric
>  
> -- adrian
> 
> > Can you take a look/revert until you've got a different testcase? There's 
> > not enough information in the commit to construct one up for you.
> >
> > Thanks!
> >
> > -eric
> >
> > On Fri, Feb 5, 2016 at 6:03 PM Adrian Prantl via cfe-commits 
> >  wrote:
> > Author: adrian
> > Date: Fri Feb  5 19:59:09 2016
> > New Revision: 259975
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=259975&view=rev
> > Log:
> > Fix a crash when emitting dbeug info for forward-declared scoped enums.
> > It is possible for enums to be created as part of their own
> > declcontext. We need to cache a placeholder to avoid the type being
> > created twice before hitting the cache.
> >
> > 
> >
> > Added:
> > cfe/trunk/test/CodeGenCXX/debug-info-scoped-class.cpp
> > Modified:
> > cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> >
> > Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> > URL: 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=259975&r1=259974&r2=259975&view=diff
> > ==
> > --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> > +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Feb  5 19:59:09 2016
> > @@ -2051,13 +2051,25 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
> >// If this is just a forward declaration, construct an appropriately
> >// marked node and just return it.
> >if (isImportedFromModule || !ED->getDefinition()) {
> > -llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
> >  llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
> > +
> > +// It is possible for enums to be created as part of their own
> > +// declcontext. We need to cache a placeholder to avoid the type being
> > +// created twice before hitting the cache.
> > +llvm::DIScope *EDContext = DBuilder.createReplaceableCompositeType(
> > +  llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0);
> > +
> >  unsigned Line = getLineNumber(ED->getLocation());
> >  StringRef EDName = ED->getName();
> >  llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
> >  llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, 
> > Line,
> >  0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
> > +
> > +// Cache the enum type so it is available when building the declcontext
> > +// and replace the declcontect with the real thing.
> > +TypeCache[Ty].reset(RetTy);
> > +EDContext->replaceAllUsesWith(getDeclContextDescriptor(ED));
> > +
> >  ReplaceMap.emplace_back(
> >  std::piecewise_constr

Re: [PATCH] D17092: [X86] Add -mseparate-stack-seg

2016-02-23 Thread Michael LeMay via cfe-commits
mlemay-intel added a comment.

Thank you for your feedback!



Comment at: lib/CodeGen/TargetInfo.cpp:1569
@@ +1568,3 @@
+CGF.getTarget().getTargetOpts().Features;
+  if (std::find(TargetFeatures.begin(), TargetFeatures.end(),
+"+separate-stack-seg") != TargetFeatures.end()) {

delena wrote:
> Hi,
> I'm not clang reviewer at all and you can ignore my comment.
> 
> Searching string looks strange for me. I suppose that this string should be 
> defined in another form. Something like
> options::OPT_separate_stack_seg.
> 
I haven't quite found an example of how an option like this should be handled.  
String comparisons of this form are performed in clang/lib/Basic/Targets.cpp, 
but there they are used to initialize variables.  Furthermore, all of those 
tests are for CPU features, whereas this one is for a particular segment 
configuration.


Comment at: lib/CodeGen/TargetInfo.cpp:1577
@@ +1576,3 @@
+  CGF.Builder.CreatePtrToInt(Addr.getPointer(), CGF.IntPtrTy);
+llvm::Value *PtrInStackSeg = CGF.Builder.CreateIntToPtr(PtrAsInt,
+   
DirectTy->getPointerTo(258));

delena wrote:
> You should not use 258 as a constant. It should be defined somewhere as 
> address space enum.
I agree with this principle.  However, the address space numbers for FS and GS 
are listed in the Clang documentation [1] and are used as literals in LLVM 
code.  Thus, I think this patch is consistent with existing usage of address 
space numbers.

[1] 
http://clang.llvm.org/docs/LanguageExtensions.html#memory-references-off-the-gs-segment


Comment at: lib/CodeGen/TargetInfo.cpp:1578
@@ +1577,3 @@
+llvm::Value *PtrInStackSeg = CGF.Builder.CreateIntToPtr(PtrAsInt,
+   
DirectTy->getPointerTo(258));
+return Address(PtrInStackSeg, Addr.getAlignment());

delena wrote:
> This line alignment does not match LLVM style.
I'll fix it.


Comment at: lib/CodeGen/TargetInfo.cpp:1580
@@ +1579,3 @@
+return Address(PtrInStackSeg, Addr.getAlignment());
+  }
+

delena wrote:
> Again, not sure that I'm right. You are trying to create addressspacecast. Is 
> it the right way to create ptrtoint + inttoptr?
I first attempted to create an address space cast, but LLVM disallows that.  I 
think it is necessary to perform the conversion through an int, but I am not 
entirely sure of that.


http://reviews.llvm.org/D17092



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


Re: [PATCH] D17345: [OpenCL] Improve diagnostics of address spaces for variables inside function

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia removed a reviewer: pekka.jaaskelainen.
Anastasia added a subscriber: pekka.jaaskelainen.
Anastasia updated this revision to Diff 48826.
Anastasia added a comment.

I am adding a small clean up here for duplicate code!

@Sam, could you please re-check again. Thanks!


http://reviews.llvm.org/D17345

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  test/Parser/opencl-storage-class.cl
  test/SemaOpenCL/storageclass-cl20.cl
  test/SemaOpenCL/storageclass.cl

Index: test/SemaOpenCL/storageclass.cl
===
--- test/SemaOpenCL/storageclass.cl
+++ test/SemaOpenCL/storageclass.cl
@@ -14,6 +14,7 @@
   local int L2;
 
   auto int L3 = 7; // expected-error{{OpenCL does not support the 'auto' storage class specifier}}
+  global int L4;   // expected-error{{function scope variable cannot be declared in global address space}}
 }
 
 static void kernel bar() { // expected-error{{kernel functions cannot be declared static}}
@@ -26,4 +27,6 @@
 constant int L1 = 0; // expected-error{{non-kernel function variable cannot be declared in constant address space}}
 local int L2;// expected-error{{non-kernel function variable cannot be declared in local address space}}
   }
+  global int L3; // expected-error{{function scope variable cannot be declared in global address space}}
+  extern constant float L4;
 }
Index: test/SemaOpenCL/storageclass-cl20.cl
===
--- test/SemaOpenCL/storageclass-cl20.cl
+++ test/SemaOpenCL/storageclass-cl20.cl
@@ -1,15 +1,19 @@
-// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -DCL20 -cl-std=CL2.0
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0
 
 static constant int G1 = 0;
 int G2 = 0;
 global int G3 = 0;
-local int G4 = 0;// expected-error{{program scope variable must reside in global or constant address space}}
+local int G4 = 0;  // expected-error{{program scope variable must reside in global or constant address space}}
 
 void kernel foo() {
   static int S1 = 5;
   static global int S2 = 5;
-  static private int S3 = 5;// expected-error{{program scope variable must reside in global or constant address space}}
+  static private int S3 = 5;   // expected-error{{program scope variable must reside in global or constant address space}}
 
   constant int L1 = 0;
   local int L2;
+  global int L3; // expected-error{{function scope variable cannot be declared in global address space}}
+
+  extern global int G5;
+  extern int G6; // expected-error{{program scope variable must reside in global or constant address space}}
 }
Index: test/Parser/opencl-storage-class.cl
===
--- test/Parser/opencl-storage-class.cl
+++ test/Parser/opencl-storage-class.cl
@@ -10,6 +10,6 @@
 #pragma OPENCL EXTENSION cl_clang_storage_class_specifiers : enable
   static int e; // expected-error {{program scope variable must reside in constant address space}}
   register int f;
-  extern int g;
+  extern int g; // expected-error {{program scope variable must reside in constant address space}}
   auto int h;
 }
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -6594,7 +6594,8 @@
 // OpenCL v2.0 s6.5.1 - Variables defined at program scope and static
 // variables inside a function can also be declared in the global
 // address space.
-if (NewVD->isFileVarDecl()) {
+if (NewVD->isFileVarDecl() || NewVD->isStaticLocal() ||
+NewVD->hasExternalStorage()) {
   if (!T->isSamplerT() &&
   !(T.getAddressSpace() == LangAS::opencl_constant ||
 (T.getAddressSpace() == LangAS::opencl_global &&
@@ -6609,19 +6610,9 @@
 return;
   }
 } else {
-  // OpenCL v2.0 s6.5.1 - Variables defined at program scope and static
-  // variables inside a function can also be declared in the global
-  // address space.
-  if (NewVD->isStaticLocal() &&
-  !(T.getAddressSpace() == LangAS::opencl_constant ||
-(T.getAddressSpace() == LangAS::opencl_global &&
- getLangOpts().OpenCLVersion == 200))) {
-if (getLangOpts().OpenCLVersion == 200)
-  Diag(NewVD->getLocation(), diag::err_opencl_global_invalid_addr_space)
-  << "global or constant";
-else
-  Diag(NewVD->getLocation(), diag::err_opencl_global_invalid_addr_space)
-  << "constant";
+  if (T.getAddressSpace() == LangAS::opencl_global) {
+Diag(NewVD->getLocation(), diag::err_opencl_function_variable)
+<< 1 /*is any function*/ << "global";
 NewVD->setInvalidDecl();
 return;
   }
@@ -6632,11 +6623,11 @@
 FunctionDecl *FD = getCurFunctionDecl();
 if (FD && !FD->hasAttr()) {
   if (T.getAddressSpace() == LangAS::op

Re: [PATCH] D17345: [OpenCL] Improve diagnostics of address spaces for variables inside function

2016-02-23 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments.


Comment at: test/SemaOpenCL/storageclass-cl20.cl:11
@@ -10,3 +10,3 @@
   static global int S2 = 5;
-  static private int S3 = 5;// expected-error{{program scope variable must 
reside in global or constant address space}}
+  static private int S3 = 5;   // expected-error{{program scope variable must 
reside in global or constant address space}}
 

this error msg is confusing. better say 'function scope variable with static 
storage must ...'


http://reviews.llvm.org/D17345



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


[PATCH] D17547: [OpenMP] Add support for multidimensional array sections in map clause SEMA.

2016-02-23 Thread Samuel Antao via cfe-commits
sfantao created this revision.
sfantao added reviewers: ABataev, hfinkel, carlo.bertolli, arpith-jacob, kkwli0.
sfantao added subscribers: caomhin, fraggamuffin, cfe-commits.

In some cases it can be proved statically that multidimensional array section 
refer to contiguous storage and can therefore be allowed in a map clause. This 
patch adds support for those cases in SEMA.

http://reviews.llvm.org/D17547

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/target_map_messages.cpp

Index: test/OpenMP/target_map_messages.cpp
===
--- test/OpenMP/target_map_messages.cpp
+++ test/OpenMP/target_map_messages.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
+// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 200 %s
 template 
 struct SA {
   static int ss;
@@ -82,13 +82,82 @@
 void SAclient(int arg) {
   SA s;
   s.func(arg); // expected-note {{in instantiation of member function}}
-
+  double marr[10][10][10];
+  double marr2[5][10][1];
+  double mvla[5][arg][10];
+  double ***mptr;
   SB *p;
 
   SD u;
   SC r(p),t(p);
   #pragma omp target map(r)
   {}
+  #pragma omp target map(marr[2][0:2][0:2]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr[:][0:2][0:2]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr[2][3][0:2])
+  {}
+  #pragma omp target map(marr[:][:][:])
+  {}
+  #pragma omp target map(marr[:2][:][:])
+  {}
+  #pragma omp target map(marr[:2][:1][:]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr[:2][1:][:]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr[:2][:][:1]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr[:2][:][1:]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr[:1][:2][:])
+  {}
+  #pragma omp target map(marr[:1][0][:])
+  {}
+  #pragma omp target map(marr[:arg][:2][:]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr[:1][3:1][:2])
+  {}
+  #pragma omp target map(marr[:1][3:arg][:2]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr[:1][3:2][:2]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr[:2][:10][:])
+  {}
+  #pragma omp target map(marr[:2][:][:5+5])
+  {}
+  #pragma omp target map(marr[:2][2+2-4:][0:5+5])
+  {}
+
+  #pragma omp target map(marr[:1][:2][0]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(marr2[:1][:2][0])
+  {}
+
+  #pragma omp target map(mvla[:1][:][0]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(mvla[:2][:arg][:]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(mvla[1][2:arg][:])
+  {}
+  #pragma omp target map(mvla[:1][:][:])
+  {}
+
+  #pragma omp target map(mptr[:2][2+2-4:1][0:5+5]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(mptr[:1][:2-1][2:4-3])
+  {}
+  #pragma omp target map(mptr[:1][:arg][2:4-3]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(mptr[:1][:2-1][0:2])
+  {}
+  #pragma omp target map(mptr[:1][:2][0:2]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+  #pragma omp target map(mptr[:1][:][0:2]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}}
+  {}
+  #pragma omp target map(mptr[:2][:1][0:2]) // expected-error {{employed array section is or can be incompatible with contiguous storage requirements}}
+  {}
+
   #pragma omp target map(r.ArrS[0].B)
   {}
   #pragma omp target map(r.ArrS[0].Arr[1:23])
Index: lib/Sema/SemaOpenMP.cpp
===
--- lib/Sema/SemaOpenMP.cpp
+++ lib/Sema/SemaOpenMP.cpp
@@ -8978,6 +8978,91 @@
   return true;
 }
 
+/// \brief Return true if it can be proven that the provided array expression
+///

[libcxx] r261661 - These new tests fail on the green-dragon bots, which use an old Apple compiler.

2016-02-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb 23 12:09:38 2016
New Revision: 261661

URL: http://llvm.org/viewvc/llvm-project?rev=261661&view=rev
Log:
These new tests fail on the green-dragon bots, which use an old Apple compiler.
Since they're scheduled to be updated soon, we'll just comment out this test for
the moment, and re-commit when the bots are updated.


Modified:

libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp

Modified: 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp?rev=261661&r1=261660&r2=261661&view=diff
==
--- 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
 (original)
+++ 
libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
 Tue Feb 23 12:09:38 2016
@@ -8,6 +8,8 @@
 
//===--===//
 
 // type_traits
+// XFAIL: apple-clang-6.0
+// The Apple-6 compiler gets is_constructible wrong.
 
 // template 
 //   struct is_constructible;
@@ -100,12 +102,12 @@ int main()
 test_is_not_constructible ();
 test_is_not_constructible ();
 
-//  LWG 2560
-test_is_not_constructible ();
-#if TEST_STD_VERS > 11
-test_is_not_constructible ();
-test_is_not_constructible ();
-test_is_not_constructible ();
-test_is_not_constructible ();
-#endif
+//  LWG 2560  -- postpone this test until bots updated
+// test_is_not_constructible ();
+// #if TEST_STD_VERS > 11
+// test_is_not_constructible ();
+// test_is_not_constructible ();
+// test_is_not_constructible ();
+// test_is_not_constructible ();
+// #endif
 }


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


Re: [PATCH] D16749: [OpenMP] Map clause codegeneration.

2016-02-23 Thread Samuel Antao via cfe-commits
sfantao added inline comments.


Comment at: lib/CodeGen/CGOpenMPRuntime.cpp:3901-3932
@@ +3900,34 @@
+// Reference types are ignored for mapping purposes.
+if (auto *RefTy = ExprTy->getAs())
+  ExprTy = RefTy->getPointeeType().getCanonicalType();
+
+// Given that an array section is considered a built-in type, we need to
+// do the calculation based on the length of the section instead of relying
+// on CGF.getTypeSize(E->getType()).
+if (const auto *OAE = dyn_cast(E)) {
+  auto BaseTy =
+  OAE->getBase()->IgnoreParenImpCasts()->getType().getCanonicalType();
+  // Reference types are ignored for mapping purposes.
+  if (auto *RefTy = BaseTy->getAs())
+BaseTy = RefTy->getPointeeType().getCanonicalType();
+
+  // If there is no length associated with the expression, that means we
+  // are using the whole length of the base.
+  if (!OAE->getLength())
+return CGF.getTypeSize(BaseTy);
+
+  llvm::Value *ElemSize;
+  if (auto *PTy = BaseTy->getAs()) {
+ElemSize = CGF.getTypeSize(PTy->getPointeeType().getCanonicalType());
+  } else {
+auto *ATy = cast(BaseTy.getTypePtr());
+assert(ATy && "Expecting array type if not a pointer type.");
+ElemSize = CGF.getTypeSize(ATy->getElementType().getCanonicalType());
+  }
+
+  auto *LengthVal = CGF.EmitScalarExpr(OAE->getLength());
+  LengthVal =
+  CGF.Builder.CreateIntCast(LengthVal, CGF.SizeTy, /*isSigned=*/false);
+  return CGF.Builder.CreateNUWMul(LengthVal, ElemSize);
+}
+return CGF.getTypeSize(ExprTy);

ABataev wrote:
> sfantao wrote:
> > ABataev wrote:
> > > 'marr[:][:][:2]' produces contiguous storage, no? Is this allowed? And if 
> > > it is allowed, how it will be handled? Besides, if 'marr' is a pointer, 
> > > even 'marr[:2][:3][:4]' may result in contiguous space.
> > > 'marr[:][:][:2]' produces contiguous storage, no? Is this allowed? And if 
> > > it is allowed, how it will be handled?
> > That is not contiguous so it is not allowed. `marr[:2][:][:]` is contiguous 
> > storage but can be expressed as `marr[:2]` only. Do you think I should 
> > create a patch to allow the latter case in Sema? Should it be part of this 
> > patch?
> > 
> > > Besides, if 'marr' is a pointer, even 'marr[:2][:3][:4]' may result in 
> > > contiguous space.
> > This is illegal. This requires multiple memory allocations that are not 
> > contiguous on the host.
> > That is not contiguous so it is not allowed. marr[:2][:][:] is contiguous 
> > storage but can be expressed as marr[:2] only. Do you think I should create 
> > a patch to allow the latter case in Sema? Should it be part of this patch?
> Yes, I think this must be supported. Also we should support 
> marr[:2][0:size2][0:size3] forms, if they produce contiguous space. No, it 
> should be a separate patch.
> 
> 
> 
> 
Done, posted a new patch for the SEMA support and updated this one with 
regression tests for multidimensional array sections and few changes in map 
elements scanning to handle array sections correctly.


http://reviews.llvm.org/D16749



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


Re: [PATCH] D17345: [OpenCL] Improve diagnostics of address spaces for variables inside function

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/storageclass-cl20.cl:19
@@ -15,1 +18,2 @@
+  extern int G6; // expected-error{{program scope variable must reside in 
global or constant address space}}
 }

Khronos bug: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=15598


http://reviews.llvm.org/D17345



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


Re: [PATCH] D17367: [OpenMP] Code generation for target data directive

2016-02-23 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 48831.
sfantao updated the summary for this revision.
sfantao added a comment.

Rebase.


http://reviews.llvm.org/D17367

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  test/OpenMP/target_data_codegen.cpp

Index: test/OpenMP/target_data_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_data_codegen.cpp
@@ -0,0 +1,248 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+///==///
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -omptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -omptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -omptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -omptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -omptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -omptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+// CK1: [[ST:%.+]] = type { i32, double* }
+template 
+struct ST {
+  T a;
+  double *b;
+};
+
+ST gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i32] [i32 2]
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i32] [i32 1]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i32] [i32 5]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i32] [i32 1, i32 97]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+  int la;
+  float lb[arg];
+
+  // Region 00
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+  // CK1-DAG: [[DEV]] = load i32, i32* %{{[^,]+}},
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[BP0]]
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[P0]]
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+
+  // CK1-DAG: call void @__tgt_target_data_end(i32 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+  // CK1-DAG: [[DEV]] = load i32, i32* %{{[^,]+}},
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P]]
+  #pragma omp target data if(1+3-5) device(arg) map(from: gc)
+  {++arg;}
+
+  // Region 01
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target data map(la) if(1+3-4)
+  {++arg;}
+
+  // Region 02
+  // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+  // CK1: [[IFTHEN]]
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
+  // CK1-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
+  // CK1-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
+  // CK1-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
+  // CK1: br label %[[IFEND:[^,]+]]
+
+  // CK1: [[IFELSE]]
+  // CK1: br label %[[IFEND]]
+  // CK1: [[IFEND]]
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+
+  // CK1: [[IFTHEN]]
+  // CK1-DAG: call void @__tgt

Re: [PATCH] D17436: [OpenCL] Add Sema checks for OpenCL 2.0 block

2016-02-23 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/invalid-block.cl:17
@@ +16,3 @@
+void f2(BlkInt *BlockPtr) {
+  BlkInt B = ^int(int I) {return 1;};
+  BlkInt *P = &B; // expected-error {{invalid argument type 'BlkInt' (aka 'int 
(^)(int)') to unary expression}}

Khronos bug: https://cvs.khronos.org/bugzilla/show_bug.cgi?id=15599


http://reviews.llvm.org/D17436



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


Re: [PATCH] D17368: [OpenMP] Code generation for target enter data directive

2016-02-23 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 48834.
sfantao added a comment.

Rebase.


http://reviews.llvm.org/D17368

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  test/OpenMP/target_enter_data_codegen.cpp

Index: test/OpenMP/target_enter_data_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_enter_data_codegen.cpp
@@ -0,0 +1,221 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+///==///
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -omptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -omptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -omptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -omptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -omptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -omptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+// CK1: [[ST:%.+]] = type { i32, double* }
+template 
+struct ST {
+  T a;
+  double *b;
+};
+
+ST gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i32] zeroinitializer
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i32] [i32 1]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i32] [i32 5]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i32] [i32 1, i32 97]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+  int la;
+  float lb[arg];
+
+  // Region 00
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+  // CK1-DAG: [[DEV]] = load i32, i32* %{{[^,]+}},
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[BP0]]
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[P0]]
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  // CK1-NOT: __tgt_target_data_end
+  #pragma omp target enter data if(1+3-5) device(arg) map(alloc: gc)
+  {++arg;}
+
+  // Region 01
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target enter data map(to: la) if(1+3-4)
+  {++arg;}
+
+  // Region 02
+  // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+  // CK1: [[IFTHEN]]
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
+  // CK1-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
+  // CK1-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
+  // CK1-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
+  // CK1: br label %[[IFEND:[^,]+]]
+
+  // CK1: [[IFELSE]]
+  // CK1: br label %[[IFEND]]
+  // CK1: [[IFEND]]
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  // CK1-NOT: __tgt_target_data_end
+  #pragma omp target enter data map(to: arg) if(arg) device(4)
+  {++arg;}
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  {++arg;}
+
+  // Region 03
+  // CK1-DAG: call void @__tgt_target_data_begin(i32 -1, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[

Re: [PATCH] SemaCXX: Support templates in availability attributes

2016-02-23 Thread Manman Ren via cfe-commits
This patch looks good to me. But I am not sure if Aaron has any comment.

> On Feb 22, 2016, at 6:19 PM, Duncan P. N. Exon Smith  
> wrote:
> 
>> 
>> On 2016-Feb-22, at 17:24, Manman Ren  wrote:
>> 
>> 
>> 
>>> On Feb 8, 2016, at 8:17 PM, Duncan P. N. Exon Smith  
>>> wrote:
>>> 
>>> This patch adds support for templates in availability attributes.
>>> - If the context for an availability diagnostic is a
>>>  `FunctionTemplateDecl`, look through it to the `FunctionDecl`.
>> 
>>> AvailabilityResult Decl::getAvailability(std::string *Message) const {
>>> +  if (auto *FTD = dyn_cast(this))
>>> +return FTD->getTemplatedDecl()->getAvailability(Message);
>>> +
>>>  AvailabilityResult Result = AR_Available;
>> 
>> This looks generally correct to me.
>> The UnavailableAttr is attached to the FunctionDecl, not the 
>> FunctionTemplateDecl, so looking through sounds right.
>> 
>>> - Add `__has_feature(attribute_availability_in_templates)`.

@Aaron, any comment on this?
This patch adds extra support for Availability attribute (similar to 
attribute_availability_with_strict in r261548).
Not sure if has_attribute can be used for this purpose.

Manman

>>> 
>>> Is there anything else I should be testing to be sure availability
>>> works correctly in templates?
>> 
>> Maybe
>> test()
>> calling unavailable function from an unavailable template function
>> calling an unavailable template function
>> 
>> I think these all work with the current compiler. But I am not sure if we 
>> have existing test coverage.
> 
> Thanks for the ideas; let me know if you have any others.
> 
> Can you have a look at the new patch?
> 
>> Cheers,
>> Manman
>> 
>>> I'm working on a patch to add
>>> availability markup to the libc++ headers, and this is the only
>>> problem I've hit so far.  Anyone have thoughts on other things I
>>> should test?
> 
> <0001-SemaCXX-Support-templates-in-availability-attributes.patch>

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


Re: [PATCH] D17507: The controlling expression for _Generic is unevaluated

2016-02-23 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

LGTM for trunk and 3.8.


http://reviews.llvm.org/D17507



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


r261669 - Amends r252104 to evaluate the controlling expression in an unevaluated context. This eliminates false-positive diagnostics about null pointer dereferences (etc) in the controlling expressio

2016-02-23 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Feb 23 12:55:15 2016
New Revision: 261669

URL: http://llvm.org/viewvc/llvm-project?rev=261669&view=rev
Log:
Amends r252104 to evaluate the controlling expression in an unevaluated 
context. This eliminates false-positive diagnostics about null pointer 
dereferences (etc) in the controlling expression.

Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/Sema/generic-selection.c

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=261669&r1=261668&r2=261669&view=diff
==
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Feb 23 12:55:15 2016
@@ -1373,10 +1373,13 @@ Sema::CreateGenericSelectionExpr(SourceL
 
   // Decay and strip qualifiers for the controlling expression type, and handle
   // placeholder type replacement. See committee discussion from WG14 DR423.
-  ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
-  if (R.isInvalid())
-return ExprError();
-  ControllingExpr = R.get();
+  {
+EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
+ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
+if (R.isInvalid())
+  return ExprError();
+ControllingExpr = R.get();
+  }
 
   // The controlling expression is an unevaluated operand, so side effects are
   // likely unintended.

Modified: cfe/trunk/test/Sema/generic-selection.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/generic-selection.c?rev=261669&r1=261668&r2=261669&view=diff
==
--- cfe/trunk/test/Sema/generic-selection.c (original)
+++ cfe/trunk/test/Sema/generic-selection.c Tue Feb 23 12:55:15 2016
@@ -31,4 +31,8 @@ void foo(int n) {
 
   const int i = 12;
   int a9[_Generic(i, int: 1, default: 2) == 1 ? 1 : -1];
+
+  // This is expected to not trigger any diagnostics because the controlling
+  // expression is not evaluated.
+  (void)_Generic(*(int *)0, int: 1);
 }


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


Re: [PATCH] D17369: [OpenMP] Code generation for target exit data directive

2016-02-23 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 48835.
sfantao added a comment.

Rebase.


http://reviews.llvm.org/D17369

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  test/OpenMP/target_exit_data_codegen.cpp

Index: test/OpenMP/target_exit_data_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/target_exit_data_codegen.cpp
@@ -0,0 +1,221 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+///==///
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -omptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -omptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -omptargets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -omptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -omptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -omptargets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s  --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+// CK1: [[ST:%.+]] = type { i32, double* }
+template 
+struct ST {
+  T a;
+  double *b;
+};
+
+ST gb;
+double gc[100];
+
+// CK1: [[SIZE00:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 800]
+// CK1: [[MTYPE00:@.+]] = {{.+}}constant [1 x i32] [i32 2]
+
+// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4]
+// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i32] [i32 8]
+
+// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i32] [i32 6]
+
+// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24]
+// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i32] [i32 8, i32 104]
+
+// CK1-LABEL: _Z3fooi
+void foo(int arg) {
+  int la;
+  float lb[arg];
+
+  // Region 00
+  // CK1-NOT: __tgt_target_data_begin
+  // CK1-DAG: call void @__tgt_target_data_end(i32 [[DEV:%[^,]+]], i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}})
+  // CK1-DAG: [[DEV]] = load i32, i32* %{{[^,]+}},
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[BP0]]
+  // CK1-DAG: store i8* bitcast ([100 x double]* @gc to i8*), i8** [[P0]]
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target exit data if(1+3-5) device(arg) map(from: gc)
+  {++arg;}
+
+  // Region 01
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target exit data map(release: la) if(1+3-4)
+  {++arg;}
+
+  // Region 02
+  // CK1-NOT: __tgt_target_data_begin
+  // CK1: br i1 %{{[^,]+}}, label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]]
+  // CK1: [[IFTHEN]]
+  // CK1-DAG: call void @__tgt_target_data_end(i32 4, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE02]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE02]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK1-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0
+  // CK1-DAG: store i8* [[CBPVAL0:%[^,]+]], i8** [[BP0]]
+  // CK1-DAG: store i8* [[CPVAL0:%[^,]+]], i8** [[P0]]
+  // CK1-DAG: [[CBPVAL0]] = bitcast i32* [[VAR0:%.+]] to i8*
+  // CK1-DAG: [[CPVAL0]] = bitcast i32* [[VAR0]] to i8*
+  // CK1: br label %[[IFEND:[^,]+]]
+
+  // CK1: [[IFELSE]]
+  // CK1: br label %[[IFEND]]
+  // CK1: [[IFEND]]
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  #pragma omp target exit data map(release: arg) if(arg) device(4)
+  {++arg;}
+
+  // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1
+  {++arg;}
+
+  // Region 03
+  // CK1-NOT: __tgt_target_data_begin
+  // CK1-DAG: call void @__tgt_target_data_end(i32 -1, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], i[[sz]]* [[GEPS:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE03]]{{.+}})
+  // CK1-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK1-DAG: [[GEPP]]

Re: [PATCH] D17507: The controlling expression for _Generic is unevaluated

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

Thanks! I've commit in r261669.


http://reviews.llvm.org/D17507



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


Re: r261669 - Amends r252104 to evaluate the controlling expression in an unevaluated context. This eliminates false-positive diagnostics about null pointer dereferences (etc) in the controlling expre

2016-02-23 Thread Aaron Ballman via cfe-commits
Hans, this should be safe to merge into 3.8 (as Richard had mentioned
in the review thread). Can you do the merge magic on my behalf?

Thanks!

~Aaron

On Tue, Feb 23, 2016 at 1:55 PM, Aaron Ballman via cfe-commits
 wrote:
> Author: aaronballman
> Date: Tue Feb 23 12:55:15 2016
> New Revision: 261669
>
> URL: http://llvm.org/viewvc/llvm-project?rev=261669&view=rev
> Log:
> Amends r252104 to evaluate the controlling expression in an unevaluated 
> context. This eliminates false-positive diagnostics about null pointer 
> dereferences (etc) in the controlling expression.
>
> Modified:
> cfe/trunk/lib/Sema/SemaExpr.cpp
> cfe/trunk/test/Sema/generic-selection.c
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=261669&r1=261668&r2=261669&view=diff
> ==
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Feb 23 12:55:15 2016
> @@ -1373,10 +1373,13 @@ Sema::CreateGenericSelectionExpr(SourceL
>
>// Decay and strip qualifiers for the controlling expression type, and 
> handle
>// placeholder type replacement. See committee discussion from WG14 DR423.
> -  ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
> -  if (R.isInvalid())
> -return ExprError();
> -  ControllingExpr = R.get();
> +  {
> +EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
> +ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
> +if (R.isInvalid())
> +  return ExprError();
> +ControllingExpr = R.get();
> +  }
>
>// The controlling expression is an unevaluated operand, so side effects 
> are
>// likely unintended.
>
> Modified: cfe/trunk/test/Sema/generic-selection.c
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/generic-selection.c?rev=261669&r1=261668&r2=261669&view=diff
> ==
> --- cfe/trunk/test/Sema/generic-selection.c (original)
> +++ cfe/trunk/test/Sema/generic-selection.c Tue Feb 23 12:55:15 2016
> @@ -31,4 +31,8 @@ void foo(int n) {
>
>const int i = 12;
>int a9[_Generic(i, int: 1, default: 2) == 1 ? 1 : -1];
> +
> +  // This is expected to not trigger any diagnostics because the controlling
> +  // expression is not evaluated.
> +  (void)_Generic(*(int *)0, int: 1);
>  }
>
>
> ___
> 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: r261669 - Amends r252104 to evaluate the controlling expression in an unevaluated context. This eliminates false-positive diagnostics about null pointer dereferences (etc) in the controlling expre

2016-02-23 Thread Hans Wennborg via cfe-commits
Hi Aaron,

I'll let it sit in the tree for a bit, and will then merge it later today.

Many thanks,
Hans

On Tue, Feb 23, 2016 at 11:01 AM, Aaron Ballman  wrote:
> Hans, this should be safe to merge into 3.8 (as Richard had mentioned
> in the review thread). Can you do the merge magic on my behalf?
>
> Thanks!
>
> ~Aaron
>
> On Tue, Feb 23, 2016 at 1:55 PM, Aaron Ballman via cfe-commits
>  wrote:
>> Author: aaronballman
>> Date: Tue Feb 23 12:55:15 2016
>> New Revision: 261669
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=261669&view=rev
>> Log:
>> Amends r252104 to evaluate the controlling expression in an unevaluated 
>> context. This eliminates false-positive diagnostics about null pointer 
>> dereferences (etc) in the controlling expression.
>>
>> Modified:
>> cfe/trunk/lib/Sema/SemaExpr.cpp
>> cfe/trunk/test/Sema/generic-selection.c
>>
>> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=261669&r1=261668&r2=261669&view=diff
>> ==
>> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Feb 23 12:55:15 2016
>> @@ -1373,10 +1373,13 @@ Sema::CreateGenericSelectionExpr(SourceL
>>
>>// Decay and strip qualifiers for the controlling expression type, and 
>> handle
>>// placeholder type replacement. See committee discussion from WG14 DR423.
>> -  ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
>> -  if (R.isInvalid())
>> -return ExprError();
>> -  ControllingExpr = R.get();
>> +  {
>> +EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
>> +ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
>> +if (R.isInvalid())
>> +  return ExprError();
>> +ControllingExpr = R.get();
>> +  }
>>
>>// The controlling expression is an unevaluated operand, so side effects 
>> are
>>// likely unintended.
>>
>> Modified: cfe/trunk/test/Sema/generic-selection.c
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/generic-selection.c?rev=261669&r1=261668&r2=261669&view=diff
>> ==
>> --- cfe/trunk/test/Sema/generic-selection.c (original)
>> +++ cfe/trunk/test/Sema/generic-selection.c Tue Feb 23 12:55:15 2016
>> @@ -31,4 +31,8 @@ void foo(int n) {
>>
>>const int i = 12;
>>int a9[_Generic(i, int: 1, default: 2) == 1 ? 1 : -1];
>> +
>> +  // This is expected to not trigger any diagnostics because the controlling
>> +  // expression is not evaluated.
>> +  (void)_Generic(*(int *)0, int: 1);
>>  }
>>
>>
>> ___
>> 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: r259975 - Fix a crash when emitting dbeug info for forward-declared scoped enums.

2016-02-23 Thread Eric Christopher via cfe-commits
Thanks Adrian!

On Tue, Feb 23, 2016 at 9:19 AM Adrian Prantl  wrote:

> --> r261657.
>
> Author: adrian 
> Date:   Tue Feb 23 17:13:47 2016 +
>
> Remove an unnecessary workaround introduced in r259975. (NFC)
>
> Now that LLVM r259973 allows replacing a temporary type with another
> temporary we can rely on the original implementation.
>
> It is possible for enums to be created as part of
> their own declcontext. In this case a FwdDecl will be created
> twice. This doesn't cause a problem because both FwdDecls are
> entered into the ReplaceMap: finalize() will replace the first
> FwdDecl with the second and then replace the second with
> complete type.
>
> Thanks to echristo for pointing this out.
>
> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@261657
>
> -- adrian
>
> > On Feb 22, 2016, at 5:26 PM, Eric Christopher 
> wrote:
> >
> > Hi Adrian,
> >
> > On Sat, Feb 20, 2016 at 1:18 PM Adrian Prantl  wrote:
> > This had me puzzled for a second, but then I figured out what happened
> :-)
> > The “crash” I quoted in the commit message really was an assertion
> failure, to be precise, the very assertion I relaxed in LLVM r259973 in
> order to be able to defer the building of the DeclContext implemented by
> this commit. Even with the assertion removed, I still believe that
> implementing it this way preferable, as it avoids creating the enum a
> second time.
> >
> > > On Feb 19, 2016, at 7:05 PM, Eric Christopher 
> wrote:
> > >
> > > Hi Adrian,
> > >
> > > I'm taking a look at this and can't duplicate using the testcase you
> gave without your patch(es) applied. It's also causing asserts in other
> code as you can have the forward decl left around and the CU isn't a valid
> context.
> >
> > Do you happen to have an example handy? I don’t quite understand the
> problem from the description — shouldn’t the temporary fwddecl be RAUWed
> unconditionally after the DeclContext is created?
> >
> >
> > I'd think so. It appears to get through to code generation unreplaced
> though and...
> >
> > If you’re blocked on this we can definitely revert the change in
> CGDebugInfo (but not the testcase), I just would like to understand what’s
> going on.
> >
> >
> > I am a bit. I don't have a reduction at the moment small enough to debug
> what's wrong with this and the current patch doesn't appear necessary so
> I'm unable to debug the original problem at this point to try to help more.
> >
> > -eric
> >
> > -- adrian
> >
> > > Can you take a look/revert until you've got a different testcase?
> There's not enough information in the commit to construct one up for you.
> > >
> > > Thanks!
> > >
> > > -eric
> > >
> > > On Fri, Feb 5, 2016 at 6:03 PM Adrian Prantl via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> > > Author: adrian
> > > Date: Fri Feb  5 19:59:09 2016
> > > New Revision: 259975
> > >
> > > URL: http://llvm.org/viewvc/llvm-project?rev=259975&view=rev
> > > Log:
> > > Fix a crash when emitting dbeug info for forward-declared scoped enums.
> > > It is possible for enums to be created as part of their own
> > > declcontext. We need to cache a placeholder to avoid the type being
> > > created twice before hitting the cache.
> > >
> > > 
> > >
> > > Added:
> > > cfe/trunk/test/CodeGenCXX/debug-info-scoped-class.cpp
> > > Modified:
> > > cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> > >
> > > Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> > > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=259975&r1=259974&r2=259975&view=diff
> > >
> ==
> > > --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> > > +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Feb  5 19:59:09 2016
> > > @@ -2051,13 +2051,25 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
> > >// If this is just a forward declaration, construct an appropriately
> > >// marked node and just return it.
> > >if (isImportedFromModule || !ED->getDefinition()) {
> > > -llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
> > >  llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
> > > +
> > > +// It is possible for enums to be created as part of their own
> > > +// declcontext. We need to cache a placeholder to avoid the type
> being
> > > +// created twice before hitting the cache.
> > > +llvm::DIScope *EDContext =
> DBuilder.createReplaceableCompositeType(
> > > +  llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0);
> > > +
> > >  unsigned Line = getLineNumber(ED->getLocation());
> > >  StringRef EDName = ED->getName();
> > >  llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
> > >  llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext,
> DefUnit, Line,
> > >  0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
> > > +
> > > +// Cache the enum type so it is available when building the
>

Re: r261669 - Amends r252104 to evaluate the controlling expression in an unevaluated context. This eliminates false-positive diagnostics about null pointer dereferences (etc) in the controlling expre

2016-02-23 Thread Aaron Ballman via cfe-commits
On Tue, Feb 23, 2016 at 2:03 PM, Hans Wennborg  wrote:
> Hi Aaron,
>
> I'll let it sit in the tree for a bit, and will then merge it later today.

Sounds great, thank you!

~Aaron

>
> Many thanks,
> Hans
>
> On Tue, Feb 23, 2016 at 11:01 AM, Aaron Ballman  
> wrote:
>> Hans, this should be safe to merge into 3.8 (as Richard had mentioned
>> in the review thread). Can you do the merge magic on my behalf?
>>
>> Thanks!
>>
>> ~Aaron
>>
>> On Tue, Feb 23, 2016 at 1:55 PM, Aaron Ballman via cfe-commits
>>  wrote:
>>> Author: aaronballman
>>> Date: Tue Feb 23 12:55:15 2016
>>> New Revision: 261669
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=261669&view=rev
>>> Log:
>>> Amends r252104 to evaluate the controlling expression in an unevaluated 
>>> context. This eliminates false-positive diagnostics about null pointer 
>>> dereferences (etc) in the controlling expression.
>>>
>>> Modified:
>>> cfe/trunk/lib/Sema/SemaExpr.cpp
>>> cfe/trunk/test/Sema/generic-selection.c
>>>
>>> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=261669&r1=261668&r2=261669&view=diff
>>> ==
>>> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
>>> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Feb 23 12:55:15 2016
>>> @@ -1373,10 +1373,13 @@ Sema::CreateGenericSelectionExpr(SourceL
>>>
>>>// Decay and strip qualifiers for the controlling expression type, and 
>>> handle
>>>// placeholder type replacement. See committee discussion from WG14 
>>> DR423.
>>> -  ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
>>> -  if (R.isInvalid())
>>> -return ExprError();
>>> -  ControllingExpr = R.get();
>>> +  {
>>> +EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
>>> +ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
>>> +if (R.isInvalid())
>>> +  return ExprError();
>>> +ControllingExpr = R.get();
>>> +  }
>>>
>>>// The controlling expression is an unevaluated operand, so side effects 
>>> are
>>>// likely unintended.
>>>
>>> Modified: cfe/trunk/test/Sema/generic-selection.c
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/generic-selection.c?rev=261669&r1=261668&r2=261669&view=diff
>>> ==
>>> --- cfe/trunk/test/Sema/generic-selection.c (original)
>>> +++ cfe/trunk/test/Sema/generic-selection.c Tue Feb 23 12:55:15 2016
>>> @@ -31,4 +31,8 @@ void foo(int n) {
>>>
>>>const int i = 12;
>>>int a9[_Generic(i, int: 1, default: 2) == 1 ? 1 : -1];
>>> +
>>> +  // This is expected to not trigger any diagnostics because the 
>>> controlling
>>> +  // expression is not evaluated.
>>> +  (void)_Generic(*(int *)0, int: 1);
>>>  }
>>>
>>>
>>> ___
>>> 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] D17019: [OpenMP] Code generation for teams - kernel launching

2016-02-23 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 48839.
sfantao added a comment.

Rebase.


http://reviews.llvm.org/D17019

Files:
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  test/OpenMP/teams_codegen.cpp

Index: test/OpenMP/teams_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/teams_codegen.cpp
@@ -0,0 +1,211 @@
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+// Test host codegen.
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+// RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -triple i386-unknown-unknown -omptargets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
+#ifdef CK1
+
+int Gbla;
+long long Gblb;
+
+// CK1-LABEL: teams_argument_global_local
+int teams_argument_global_local(int a){
+  int comp = 1;
+
+  int la = 23;
+  float lc = 25.0;
+
+  // CK1: call i32 @__tgt_target_teams(i32 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0)
+  // CK1: call void @{{.+}}(i{{64|32}} %{{.+}})
+  #pragma omp target
+  #pragma omp teams
+  {
+++comp;
+  }
+
+  // CK1-DAG: call i32 @__tgt_target_teams(i32 -1, i8* @{{[^,]+}}, i32 2, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 [[NT:%[^,]+]], i32 0)
+  // CK1-DAG: [[NT]] = load i32, i32* [[NTA:%[^,]+]],
+  // CK1-64-DAG: [[NTA]] = bitcast i64* [[NTB:%[^,]+]] to i32*
+  // CK1-64-DAG: store i64 [[NTC:%[^,]+]], i64* [[NTB]],
+  // CK1-64-DAG: [[NTC]] = load i64, i64* [[NTD:%[^,]+]],
+  // CK1-64-DAG: [[NTE:%[^,]+]] = bitcast i64* [[NTD]] to i32*
+  // CK1-64-DAG: store i32 [[NTF:%[^,]+]], i32* [[NTE]],
+  // CK1-64-DAG: [[NTF]] = load i32, i32* {{%[^,]+}},
+
+
+  // CK1: call void @{{.+}}(i{{64|32}} %{{.+}})
+  #pragma omp target
+  #pragma omp teams num_teams(la)
+  {
+++comp;
+  }
+
+  // CK1-DAG: call i32 @__tgt_target_teams(i32 -1, i8* @{{[^,]+}}, i32 2, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 [[NT:%[^,]+]])
+  // CK1-DAG: [[NT]] = load i32, i32* [[NTA:%[^,]+]],
+  // CK1-64-DAG: [[NTA]] = bitcast i64* [[NTB:%[^,]+]] to i32*
+  // CK1-64-DAG: store i64 [[NTC:%[^,]+]], i64* [[NTB]],
+  // CK1-64-DAG: [[NTC]] = load i64, i64* [[NTD:%[^,]+]],
+  // CK1-64-DAG: [[NTE:%[^,]+]] = bitcast i64* [[NTD]] to i32*
+  // CK1-64-DAG: store i32 [[NTF:%[^,]+]], i32* [[NTE]],
+  // CK1-64-DAG: [[NTF]] = load i32, i32* {{%[^,]+}},
+  // CK1: call void @{{.+}}(i{{64|32}} %{{.+}})
+  #pragma omp target
+  #pragma omp teams thread_limit(la)
+  {
+++comp;
+  }
+
+  // CK1-DAG: call i32 @__tgt_target_teams(i32 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 [[NT:%[^,]+]], i32 [[TL:%[^,]+]])
+
+  // CK1-DAG: [[NT]] = add nsw i32 [[NTA:%[^,]+]], [[NTB:%[^,]+]]
+  // CK1-64-DAG: [[NTB]] = load i32, i32* %c{{.+}},
+  // CK1-64-DAG: [[NTA]] = load i32, i32* %c{{.+}},
+
+  // CK1-DAG: [[TL]] = trunc i64 [[TLA:%[^,]+]] to i32
+  // CK1-DAG: [[TLA]] = add nsw i64 [[TLB:%[^,]+]], [[TLC:%[^,]+]]
+  // CK1-DAG: [[TLC]] = fptosi float [[TLD:%[^,]+]] to i64
+  // CK1-DAG: [[TLD]] = load float, float* %{{.+}},
+  // CK1-DAG: [[TLB]] = load i64, i64* %{{.+}},
+
+  // CK1: call void @{{.+}}(i{{.+}} {{.+}}, i{{.+}} {{.+}}, i{{.+}} {{.+}}, i{{.+}} {{.+}}, i{{.+}} {{.+}})
+  #pragma omp target
+  #pragma omp teams num_teams(Gbla+a) thread_limit(Gblb+(long long)lc)
+  {
+++comp;
+  }
+
+  return comp;
+}
+
+#endif // CK1
+
+// Test host codegen.
+// RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
+// RUN: %clang_cc1 -DCK2 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -omptargets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
+// RUN: %clang_cc1 -DCK2 -fopenmp

r261670 - Revert r261634 "Supporting all entities declared in lexical scope in LLVM debug info." and r261657

2016-02-23 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Feb 23 13:10:16 2016
New Revision: 261670

URL: http://llvm.org/viewvc/llvm-project?rev=261670&view=rev
Log:
Revert r261634 "Supporting all entities declared in lexical scope in LLVM debug 
info." and r261657

r261634 and r261633 seems to have caused PR26715. r261657 depends on the former 
two.

Removed:
cfe/trunk/test/CodeGenCXX/debug-info-lb.cpp
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/lib/CodeGen/CGDecl.cpp
cfe/trunk/test/CodeGenCXX/debug-info-anon-union-vars.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=261670&r1=261669&r2=261670&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 13:10:16 2016
@@ -831,18 +831,15 @@ llvm::DIType *CGDebugInfo::CreateType(co
 
 llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
   llvm::DIFile *Unit) {
-  TypedefNameDecl *TD = Ty->getDecl();
   // We don't set size information, but do specify where the typedef was
   // declared.
-  SourceLocation Loc = TD->getLocation();
-
-  llvm::DIScope *TDContext = getDeclarationLexicalScope(*TD, QualType(Ty, 0));
+  SourceLocation Loc = Ty->getDecl()->getLocation();
 
   // Typedefs are derived from some other type.
   return DBuilder.createTypedef(
   getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit),
   Ty->getDecl()->getName(), getOrCreateFile(Loc), getLineNumber(Loc),
-  TDContext);
+  getDeclContextDescriptor(Ty->getDecl()));
 }
 
 llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
@@ -1475,23 +1472,6 @@ llvm::DIType *CGDebugInfo::getOrCreateSt
   return T;
 }
 
-void CGDebugInfo::recordDeclarationLexicalScope(const Decl &D) {
-  assert(LexicalBlockMap.find(&D) == LexicalBlockMap.end() &&
- "D is already mapped to lexical block scope");
-  if (!LexicalBlockStack.empty())
-LexicalBlockMap[&D] = LexicalBlockStack.back();
-}
-
-llvm::DIScope *CGDebugInfo::getDeclarationLexicalScope(const Decl &D,
-   QualType Ty) {
-  auto I = LexicalBlockMap.find(&D);
-  if (I != LexicalBlockMap.end()) {
-RetainedTypes.push_back(Ty.getAsOpaquePtr());
-return I->second;
-  }
-  return getDeclContextDescriptor(cast(&D));
-}
-
 void CGDebugInfo::completeType(const EnumDecl *ED) {
   if (DebugKind <= codegenoptions::DebugLineTablesOnly)
 return;
@@ -2071,22 +2051,24 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
   // If this is just a forward declaration, construct an appropriately
   // marked node and just return it.
   if (isImportedFromModule || !ED->getDefinition()) {
-// Note that it is possible for enums to be created as part of
-// their own declcontext. In this case a FwdDecl will be created
-// twice. This doesn't cause a problem because both FwdDecls are
-// entered into the ReplaceMap: finalize() will replace the first
-// FwdDecl with the second and then replace the second with
-// complete type.
-llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
 llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
+
+// It is possible for enums to be created as part of their own
+// declcontext. We need to cache a placeholder to avoid the type being
+// created twice before hitting the cache.
 llvm::TempDIScope TmpContext(DBuilder.createReplaceableCompositeType(
 llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0));
 
 unsigned Line = getLineNumber(ED->getLocation());
 StringRef EDName = ED->getName();
 llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
-llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, Line,
-0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
+llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext.get(), 
DefUnit,
+Line, 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
+
+// Cache the enum type so it is available when building the declcontext
+// and replace the declcontect with the real thing.
+TypeCache[Ty].reset(RetTy);
+TmpContext->replaceAllUsesWith(getDeclContextDescriptor(ED));
 
 ReplaceMap.emplace_back(
 std::piecewise_construct, std::make_tuple(Ty),
@@ -2121,7 +2103,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDef
 
   llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
   unsigned Line = getLineNumber(ED->getLocation());
-  llvm::DIScope *EnumContext = getDeclarationLexicalScope(*ED, QualType(Ty, 
0));
+  llvm::DIScope *EnumContext = getDeclContextDescriptor(ED);
   llvm::DIType *ClassTy =
   ED->isFixed() ? getOrCreateType(ED->getIntegerType(), DefUnit) : nullptr;
   return DBuilder.createEnumerationType(EnumContext, ED->getName(), DefUnit,
@@ -2382,7 

Re: r261657 - Remove an unnecessary workaround introduced in r259975. (NFC)

2016-02-23 Thread Hans Wennborg via cfe-commits
I'm sorry, but I had to revert this in order to revert r261634. r261657

On Tue, Feb 23, 2016 at 9:13 AM, Adrian Prantl via cfe-commits
 wrote:
> Author: adrian
> Date: Tue Feb 23 11:13:47 2016
> New Revision: 261657
>
> URL: http://llvm.org/viewvc/llvm-project?rev=261657&view=rev
> Log:
> Remove an unnecessary workaround introduced in r259975. (NFC)
>
> Now that LLVM r259973 allows replacing a temporary type with another
> temporary we can rely on the original implementation.
>
> It is possible for enums to be created as part of
> their own declcontext. In this case a FwdDecl will be created
> twice. This doesn't cause a problem because both FwdDecls are
> entered into the ReplaceMap: finalize() will replace the first
> FwdDecl with the second and then replace the second with
> complete type.
>
> Thanks to echristo for pointing this out.
>
> Modified:
> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=261657&r1=261656&r2=261657&view=diff
> ==
> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 11:13:47 2016
> @@ -2071,25 +2071,22 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
>// If this is just a forward declaration, construct an appropriately
>// marked node and just return it.
>if (isImportedFromModule || !ED->getDefinition()) {
> +// Note that it is possible for enums to be created as part of
> +// their own declcontext. In this case a FwdDecl will be created
> +// twice. This doesn't cause a problem because both FwdDecls are
> +// entered into the ReplaceMap: finalize() will replace the first
> +// FwdDecl with the second and then replace the second with
> +// complete type.
> +llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
>  llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
> -
> -// It is possible for enums to be created as part of their own
> -// declcontext. We need to cache a placeholder to avoid the type being
> -// created twice before hitting the cache.
>  llvm::TempDIScope TmpContext(DBuilder.createReplaceableCompositeType(
>  llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0));
>
>  unsigned Line = getLineNumber(ED->getLocation());
>  StringRef EDName = ED->getName();
>  llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
> -llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext.get(), 
> DefUnit,
> -Line, 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
> -
> -// Cache the enum type so it is available when building the declcontext
> -// and replace the declcontect with the real thing.
> -TypeCache[Ty].reset(RetTy);
> -TmpContext->replaceAllUsesWith(
> -getDeclarationLexicalScope(*ED, QualType(Ty, 0)));
> +llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, 
> Line,
> +0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
>
>  ReplaceMap.emplace_back(
>  std::piecewise_construct, std::make_tuple(Ty),
>
>
> ___
> 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] SemaCXX: Support templates in availability attributes

2016-02-23 Thread Aaron Ballman via cfe-commits
On Tue, Feb 23, 2016 at 1:52 PM, Manman Ren  wrote:
> This patch looks good to me. But I am not sure if Aaron has any comment.
>
> On Feb 22, 2016, at 6:19 PM, Duncan P. N. Exon Smith 
> wrote:
>
>
> On 2016-Feb-22, at 17:24, Manman Ren  wrote:
>
>
>
> On Feb 8, 2016, at 8:17 PM, Duncan P. N. Exon Smith 
> wrote:
>
> This patch adds support for templates in availability attributes.
> - If the context for an availability diagnostic is a
>  `FunctionTemplateDecl`, look through it to the `FunctionDecl`.
>
>
> AvailabilityResult Decl::getAvailability(std::string *Message) const {
> +  if (auto *FTD = dyn_cast(this))
> +return FTD->getTemplatedDecl()->getAvailability(Message);
> +
>  AvailabilityResult Result = AR_Available;
>
>
> This looks generally correct to me.
> The UnavailableAttr is attached to the FunctionDecl, not the
> FunctionTemplateDecl, so looking through sounds right.
>
> - Add `__has_feature(attribute_availability_in_templates)`.
>
>
> @Aaron, any comment on this?
> This patch adds extra support for Availability attribute (similar to
> attribute_availability_with_strict in r261548).
> Not sure if has_attribute can be used for this purpose.

Given that we're already using __has_feature for the rest of the
availability attribute stuff, I think it's better to keep it all
grouped together instead of checking for some features with
__has_feature and others with __has_attribute. If I understand
properly, this is taking code that would have previously been
ill-formed and making it well-formed, and that's why the feature
testing macro is required?

Thanks!

~Aaron

>
> Manman
>
>
> Is there anything else I should be testing to be sure availability
> works correctly in templates?
>
>
> Maybe
> test()
> calling unavailable function from an unavailable template function
> calling an unavailable template function
>
> I think these all work with the current compiler. But I am not sure if we
> have existing test coverage.
>
>
> Thanks for the ideas; let me know if you have any others.
>
> Can you have a look at the new patch?
>
> Cheers,
> Manman
>
> I'm working on a patch to add
> availability markup to the libc++ headers, and this is the only
> problem I've hit so far.  Anyone have thoughts on other things I
> should test?
>
>
> <0001-SemaCXX-Support-templates-in-availability-attributes.patch>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r261657 - Remove an unnecessary workaround introduced in r259975. (NFC)

2016-02-23 Thread Hans Wennborg via cfe-commits
On Tue, Feb 23, 2016 at 11:15 AM, Hans Wennborg  wrote:
> I'm sorry, but I had to revert this in order to revert r261634. r261657

Meant to say the revert is in r261670.

>
> On Tue, Feb 23, 2016 at 9:13 AM, Adrian Prantl via cfe-commits
>  wrote:
>> Author: adrian
>> Date: Tue Feb 23 11:13:47 2016
>> New Revision: 261657
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=261657&view=rev
>> Log:
>> Remove an unnecessary workaround introduced in r259975. (NFC)
>>
>> Now that LLVM r259973 allows replacing a temporary type with another
>> temporary we can rely on the original implementation.
>>
>> It is possible for enums to be created as part of
>> their own declcontext. In this case a FwdDecl will be created
>> twice. This doesn't cause a problem because both FwdDecls are
>> entered into the ReplaceMap: finalize() will replace the first
>> FwdDecl with the second and then replace the second with
>> complete type.
>>
>> Thanks to echristo for pointing this out.
>>
>> Modified:
>> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=261657&r1=261656&r2=261657&view=diff
>> ==
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 11:13:47 2016
>> @@ -2071,25 +2071,22 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
>>// If this is just a forward declaration, construct an appropriately
>>// marked node and just return it.
>>if (isImportedFromModule || !ED->getDefinition()) {
>> +// Note that it is possible for enums to be created as part of
>> +// their own declcontext. In this case a FwdDecl will be created
>> +// twice. This doesn't cause a problem because both FwdDecls are
>> +// entered into the ReplaceMap: finalize() will replace the first
>> +// FwdDecl with the second and then replace the second with
>> +// complete type.
>> +llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
>>  llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
>> -
>> -// It is possible for enums to be created as part of their own
>> -// declcontext. We need to cache a placeholder to avoid the type being
>> -// created twice before hitting the cache.
>>  llvm::TempDIScope TmpContext(DBuilder.createReplaceableCompositeType(
>>  llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0));
>>
>>  unsigned Line = getLineNumber(ED->getLocation());
>>  StringRef EDName = ED->getName();
>>  llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
>> -llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext.get(), 
>> DefUnit,
>> -Line, 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
>> -
>> -// Cache the enum type so it is available when building the declcontext
>> -// and replace the declcontect with the real thing.
>> -TypeCache[Ty].reset(RetTy);
>> -TmpContext->replaceAllUsesWith(
>> -getDeclarationLexicalScope(*ED, QualType(Ty, 0)));
>> +llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, 
>> Line,
>> +0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
>>
>>  ReplaceMap.emplace_back(
>>  std::piecewise_construct, std::make_tuple(Ty),
>>
>>
>> ___
>> 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: r261657 - Remove an unnecessary workaround introduced in r259975. (NFC)

2016-02-23 Thread Adrian Prantl via cfe-commits
I will carefully revert the revert of this commit on top of the current trunk. 
Thanks for the notice.

-- adrian

> On Feb 23, 2016, at 11:15 AM, Hans Wennborg  wrote:
> 
> I'm sorry, but I had to revert this in order to revert r261634. r261657
> 
> On Tue, Feb 23, 2016 at 9:13 AM, Adrian Prantl via cfe-commits
>  wrote:
>> Author: adrian
>> Date: Tue Feb 23 11:13:47 2016
>> New Revision: 261657
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=261657&view=rev
>> Log:
>> Remove an unnecessary workaround introduced in r259975. (NFC)
>> 
>> Now that LLVM r259973 allows replacing a temporary type with another
>> temporary we can rely on the original implementation.
>> 
>> It is possible for enums to be created as part of
>> their own declcontext. In this case a FwdDecl will be created
>> twice. This doesn't cause a problem because both FwdDecls are
>> entered into the ReplaceMap: finalize() will replace the first
>> FwdDecl with the second and then replace the second with
>> complete type.
>> 
>> Thanks to echristo for pointing this out.
>> 
>> Modified:
>>cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>> URL: 
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=261657&r1=261656&r2=261657&view=diff
>> ==
>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 11:13:47 2016
>> @@ -2071,25 +2071,22 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
>>   // If this is just a forward declaration, construct an appropriately
>>   // marked node and just return it.
>>   if (isImportedFromModule || !ED->getDefinition()) {
>> +// Note that it is possible for enums to be created as part of
>> +// their own declcontext. In this case a FwdDecl will be created
>> +// twice. This doesn't cause a problem because both FwdDecls are
>> +// entered into the ReplaceMap: finalize() will replace the first
>> +// FwdDecl with the second and then replace the second with
>> +// complete type.
>> +llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
>> llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
>> -
>> -// It is possible for enums to be created as part of their own
>> -// declcontext. We need to cache a placeholder to avoid the type being
>> -// created twice before hitting the cache.
>> llvm::TempDIScope TmpContext(DBuilder.createReplaceableCompositeType(
>> llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0));
>> 
>> unsigned Line = getLineNumber(ED->getLocation());
>> StringRef EDName = ED->getName();
>> llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
>> -llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext.get(), 
>> DefUnit,
>> -Line, 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
>> -
>> -// Cache the enum type so it is available when building the declcontext
>> -// and replace the declcontect with the real thing.
>> -TypeCache[Ty].reset(RetTy);
>> -TmpContext->replaceAllUsesWith(
>> -getDeclarationLexicalScope(*ED, QualType(Ty, 0)));
>> +llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, 
>> Line,
>> +0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
>> 
>> ReplaceMap.emplace_back(
>> std::piecewise_construct, std::make_tuple(Ty),
>> 
>> 
>> ___
>> 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


r261673 - Reapply r261657.

2016-02-23 Thread Adrian Prantl via cfe-commits
Author: adrian
Date: Tue Feb 23 13:30:08 2016
New Revision: 261673

URL: http://llvm.org/viewvc/llvm-project?rev=261673&view=rev
Log:
Reapply r261657.
Remove an unnecessary workaround introduced in r259975. (NFC)

Now that LLVM r259973 allows replacing a temporary type with another
temporary we can rely on the original implementation.

It is possible for enums to be created as part of
their own declcontext. In this case a FwdDecl will be created
twice. This doesn't cause a problem because both FwdDecls are
entered into the ReplaceMap: finalize() will replace the first
FwdDecl with the second and then replace the second with
complete type.

Thanks to echristo for pointing this out.


# Conflicts:
#   lib/CodeGen/CGDebugInfo.cpp

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

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=261673&r1=261672&r2=261673&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 13:30:08 2016
@@ -2051,24 +2051,22 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
   // If this is just a forward declaration, construct an appropriately
   // marked node and just return it.
   if (isImportedFromModule || !ED->getDefinition()) {
+// Note that it is possible for enums to be created as part of
+// their own declcontext. In this case a FwdDecl will be created
+// twice. This doesn't cause a problem because both FwdDecls are
+// entered into the ReplaceMap: finalize() will replace the first
+// FwdDecl with the second and then replace the second with
+// complete type.
+llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
 llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
-
-// It is possible for enums to be created as part of their own
-// declcontext. We need to cache a placeholder to avoid the type being
-// created twice before hitting the cache.
 llvm::TempDIScope TmpContext(DBuilder.createReplaceableCompositeType(
 llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0));
 
 unsigned Line = getLineNumber(ED->getLocation());
 StringRef EDName = ED->getName();
 llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
-llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext.get(), 
DefUnit,
-Line, 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
-
-// Cache the enum type so it is available when building the declcontext
-// and replace the declcontect with the real thing.
-TypeCache[Ty].reset(RetTy);
-TmpContext->replaceAllUsesWith(getDeclContextDescriptor(ED));
+llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, Line,
+0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
 
 ReplaceMap.emplace_back(
 std::piecewise_construct, std::make_tuple(Ty),


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


r261674 - Rename Action::begin() to Action::input_begin().

2016-02-23 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Feb 23 13:30:43 2016
New Revision: 261674

URL: http://llvm.org/viewvc/llvm-project?rev=261674&view=rev
Log:
Rename Action::begin() to Action::input_begin().

Also introduce inputs() that reutnrs an llvm::iterator_range.
Iterating over A->inputs() is much less mysterious than
iterating over *A.  No intended behavior change.

Modified:
cfe/trunk/include/clang/Driver/Action.h
cfe/trunk/lib/Driver/Compilation.cpp
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
cfe/trunk/lib/Tooling/CompilationDatabase.cpp

Modified: cfe/trunk/include/clang/Driver/Action.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=261674&r1=261673&r2=261674&view=diff
==
--- cfe/trunk/include/clang/Driver/Action.h (original)
+++ cfe/trunk/include/clang/Driver/Action.h Tue Feb 23 13:30:43 2016
@@ -41,8 +41,10 @@ namespace driver {
 class Action {
 public:
   typedef ActionList::size_type size_type;
-  typedef ActionList::iterator iterator;
-  typedef ActionList::const_iterator const_iterator;
+  typedef ActionList::iterator input_iterator;
+  typedef ActionList::const_iterator input_const_iterator;
+  typedef llvm::iterator_range input_range;
+  typedef llvm::iterator_range input_const_range;
 
   enum ActionClass {
 InputClass = 0,
@@ -98,10 +100,14 @@ public:
 
   size_type size() const { return Inputs.size(); }
 
-  iterator begin() { return Inputs.begin(); }
-  iterator end() { return Inputs.end(); }
-  const_iterator begin() const { return Inputs.begin(); }
-  const_iterator end() const { return Inputs.end(); }
+  input_iterator input_begin() { return Inputs.begin(); }
+  input_iterator input_end() { return Inputs.end(); }
+  input_range inputs() { return input_range(input_begin(), input_end()); }
+  input_const_iterator input_begin() const { return Inputs.begin(); }
+  input_const_iterator input_end() const { return Inputs.end(); }
+  input_const_range inputs() const {
+return input_const_range(input_begin(), input_end());
+  }
 };
 
 class InputAction : public Action {

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=261674&r1=261673&r2=261674&view=diff
==
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Tue Feb 23 13:30:43 2016
@@ -176,8 +176,8 @@ static bool ActionFailed(const Action *A
 if (A == &(CI->second->getSource()))
   return true;
 
-  for (Action::const_iterator AI = A->begin(), AE = A->end(); AI != AE; ++AI)
-if (ActionFailed(*AI, FailingCommands))
+  for (const Action *AI : A->inputs())
+if (ActionFailed(AI, FailingCommands))
   return true;
 
   return false;

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=261674&r1=261673&r2=261674&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Feb 23 13:30:43 2016
@@ -948,15 +948,15 @@ static unsigned PrintActions1(const Comp
 os << "\"" << IA->getInputArg().getValue() << "\"";
   } else if (BindArchAction *BIA = dyn_cast(A)) {
 os << '"' << BIA->getArchName() << '"' << ", {"
-   << PrintActions1(C, *BIA->begin(), Ids) << "}";
+   << PrintActions1(C, *BIA->input_begin(), Ids) << "}";
   } else if (CudaDeviceAction *CDA = dyn_cast(A)) {
 os << '"'
<< (CDA->getGpuArchName() ? CDA->getGpuArchName() : "(multiple archs)")
-   << '"' << ", {" << PrintActions1(C, *CDA->begin(), Ids) << "}";
+   << '"' << ", {" << PrintActions1(C, *CDA->input_begin(), Ids) << "}";
   } else {
 const ActionList *AL;
 if (CudaHostAction *CHA = dyn_cast(A)) {
-  os << "{" << PrintActions1(C, *CHA->begin(), Ids) << "}"
+  os << "{" << PrintActions1(C, *CHA->input_begin(), Ids) << "}"
  << ", gpu binaries ";
   AL = &CHA->getDeviceActions();
 } else
@@ -996,7 +996,7 @@ static bool ContainsCompileOrAssembleAct
   isa(A))
 return true;
 
-  for (const Action *Input : *A)
+  for (const Action *Input : A->inputs())
 if (ContainsCompileOrAssembleAction(Input))
   return true;
 
@@ -1747,8 +1747,8 @@ static const Tool *selectToolForJob(Comp
 // Compile job may be wrapped in CudaHostAction, extract it if
 // that's the case and update CollapsedCHA if we combine phases.
 CudaHostAction *CHA = dyn_cast(*BackendInputs->begin());
-JobAction *CompileJA =
-cast(CHA ? *CHA->begin() : *BackendInputs->begin());
+JobAction *CompileJA = cast(
+CHA ? *CHA->input_begin() : *BackendInputs->begin());
 assert(CompileJA && "Backend job is not preceeded by comp

Re: r261657 - Remove an unnecessary workaround introduced in r259975. (NFC)

2016-02-23 Thread Adrian Prantl via cfe-commits
Done in r261673.

-- adrian

> On Feb 23, 2016, at 11:23 AM, Adrian Prantl via cfe-commits 
>  wrote:
> 
> I will carefully revert the revert of this commit on top of the current 
> trunk. Thanks for the notice.
> 
> -- adrian
> 
>> On Feb 23, 2016, at 11:15 AM, Hans Wennborg  wrote:
>> 
>> I'm sorry, but I had to revert this in order to revert r261634. r261657
>> 
>> On Tue, Feb 23, 2016 at 9:13 AM, Adrian Prantl via cfe-commits
>>  wrote:
>>> Author: adrian
>>> Date: Tue Feb 23 11:13:47 2016
>>> New Revision: 261657
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=261657&view=rev
>>> Log:
>>> Remove an unnecessary workaround introduced in r259975. (NFC)
>>> 
>>> Now that LLVM r259973 allows replacing a temporary type with another
>>> temporary we can rely on the original implementation.
>>> 
>>> It is possible for enums to be created as part of
>>> their own declcontext. In this case a FwdDecl will be created
>>> twice. This doesn't cause a problem because both FwdDecls are
>>> entered into the ReplaceMap: finalize() will replace the first
>>> FwdDecl with the second and then replace the second with
>>> complete type.
>>> 
>>> Thanks to echristo for pointing this out.
>>> 
>>> Modified:
>>>   cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>> 
>>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>> URL: 
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=261657&r1=261656&r2=261657&view=diff
>>> ==
>>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb 23 11:13:47 2016
>>> @@ -2071,25 +2071,22 @@ llvm::DIType *CGDebugInfo::CreateEnumTyp
>>>  // If this is just a forward declaration, construct an appropriately
>>>  // marked node and just return it.
>>>  if (isImportedFromModule || !ED->getDefinition()) {
>>> +// Note that it is possible for enums to be created as part of
>>> +// their own declcontext. In this case a FwdDecl will be created
>>> +// twice. This doesn't cause a problem because both FwdDecls are
>>> +// entered into the ReplaceMap: finalize() will replace the first
>>> +// FwdDecl with the second and then replace the second with
>>> +// complete type.
>>> +llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
>>>llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
>>> -
>>> -// It is possible for enums to be created as part of their own
>>> -// declcontext. We need to cache a placeholder to avoid the type being
>>> -// created twice before hitting the cache.
>>>llvm::TempDIScope TmpContext(DBuilder.createReplaceableCompositeType(
>>>llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0));
>>> 
>>>unsigned Line = getLineNumber(ED->getLocation());
>>>StringRef EDName = ED->getName();
>>>llvm::DIType *RetTy = DBuilder.createReplaceableCompositeType(
>>> -llvm::dwarf::DW_TAG_enumeration_type, EDName, TmpContext.get(), 
>>> DefUnit,
>>> -Line, 0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
>>> -
>>> -// Cache the enum type so it is available when building the declcontext
>>> -// and replace the declcontect with the real thing.
>>> -TypeCache[Ty].reset(RetTy);
>>> -TmpContext->replaceAllUsesWith(
>>> -getDeclarationLexicalScope(*ED, QualType(Ty, 0)));
>>> +llvm::dwarf::DW_TAG_enumeration_type, EDName, EDContext, DefUnit, 
>>> Line,
>>> +0, Size, Align, llvm::DINode::FlagFwdDecl, FullName);
>>> 
>>>ReplaceMap.emplace_back(
>>>std::piecewise_construct, std::make_tuple(Ty),
>>> 
>>> 
>>> ___
>>> 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

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


Re: r261297 - Implement the likely resolution of core issue 253.

2016-02-23 Thread Richard Smith via cfe-commits
On Sat, Feb 20, 2016 at 6:53 AM, Nico Weber  wrote:
> On Fri, Feb 19, 2016 at 10:32 PM, Nico Weber  wrote:
>>
>> On Fri, Feb 19, 2016 at 10:02 PM, Nico Weber  wrote:
>>>
>>> On Fri, Feb 19, 2016 at 8:01 PM, Richard Smith 
>>> wrote:

 On Fri, Feb 19, 2016 at 4:41 PM, Nico Weber  wrote:
 > On Fri, Feb 19, 2016 at 4:29 PM, Richard Smith via cfe-commits
 >  wrote:
 >>
 >> On Thu, Feb 18, 2016 at 5:52 PM, Nico Weber via cfe-commits
 >>  wrote:
 >> > Author: nico
 >> > Date: Thu Feb 18 19:52:46 2016
 >> > New Revision: 261297
 >> >
 >> > URL: http://llvm.org/viewvc/llvm-project?rev=261297&view=rev
 >> > Log:
 >> > Implement the likely resolution of core issue 253.
 >> >
 >> > C++11 requires const objects to have a user-provided constructor,
 >> > even
 >> > for
 >> > classes without any fields. DR 253 relaxes this to say "If the
 >> > implicit
 >> > default
 >> > constructor initializes all subobjects, no initializer should be
 >> > required."
 >> >
 >> > clang is currently the only compiler that implements this C++11
 >> > rule,
 >> > and e.g.
 >> > libstdc++ relies on something like DR 253 to compile in newer
 >> > versions.
 >> > This
 >> > change  makes it possible to build code that says `const
 >> > vector v;'
 >> > again
 >> > when using libstdc++5.2 and _GLIBCXX_DEBUG
 >> > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60284).
 >> >
 >> > Fixes PR23381.
 >> >
 >> > http://reviews.llvm.org/D16552
 >> >
 >> > Modified:
 >> > cfe/trunk/include/clang/AST/DeclCXX.h
 >> > cfe/trunk/lib/AST/ASTImporter.cpp
 >> > cfe/trunk/lib/AST/DeclCXX.cpp
 >> > cfe/trunk/lib/Sema/SemaInit.cpp
 >> > cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
 >> > cfe/trunk/lib/Serialization/ASTWriter.cpp
 >> >
 >> > cfe/trunk/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp
 >> > cfe/trunk/test/CXX/dcl.decl/dcl.init/p6.cpp
 >> > cfe/trunk/test/CXX/drs/dr4xx.cpp
 >> > cfe/trunk/test/SemaCXX/attr-selectany.cpp
 >> > cfe/trunk/test/SemaCXX/constexpr-value-init.cpp
 >> > cfe/trunk/test/SemaCXX/cxx0x-cursory-default-delete.cpp
 >> > cfe/trunk/test/SemaCXX/illegal-member-initialization.cpp
 >> > cfe/trunk/www/cxx_dr_status.html
 >> >
 >> > Modified: cfe/trunk/include/clang/AST/DeclCXX.h
 >> > URL:
 >> >
 >> > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=261297&r1=261296&r2=261297&view=diff
 >> >
 >> >
 >> > ==
 >> > --- cfe/trunk/include/clang/AST/DeclCXX.h (original)
 >> > +++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Feb 18 19:52:46 2016
 >> > @@ -378,6 +378,10 @@ class CXXRecordDecl : public RecordDecl
 >> >  /// even if the class has a trivial default constructor.
 >> >  bool HasUninitializedReferenceMember : 1;
 >> >
 >> > +/// \brief True if any non-mutable field whose type doesn't
 >> > have a
 >> > user-
 >> > +/// provided default ctor also doesn't have an in-class
 >> > initializer.
 >> > +bool HasUninitializedFields : 1;
 >> > +
 >> >  /// \brief These flags are \c true if a defaulted
 >> > corresponding
 >> > special
 >> >  /// member can't be fully analyzed without performing overload
 >> > resolution.
 >> >  /// @{
 >> > @@ -1270,6 +1274,13 @@ public:
 >> >  return !(data().HasTrivialSpecialMembers & SMF_Destructor);
 >> >}
 >> >
 >> > +  /// \brief Determine whether declaring a const variable with
 >> > this
 >> > type is ok
 >> > +  /// per core issue 253.
 >> > +  bool allowConstDefaultInit() const {
 >> > +return !data().HasUninitializedFields ||
 >> > +   hasUserProvidedDefaultConstructor();
 >>
 >> hasUserProvidedDefaultConstructor() here is subtly incorrect. We
 >> shouldn't care whether there's a user-provided default constructor,
 >> we
 >> instead care whether the constructor that would have been chosen for
 >> initialization is defaulted (or equivalently, whether there *is* a
 >> defaulted default constructor, since if there is one, then either the
 >> initialization is ambiguous or it is chosen).
 >>
 >> This causes a regression for a testcase such as:
 >>
 >> struct X { template X(T...); int n; };
 >> const X x; // formerly OK, now bogus error
 >
 >
 > Hm, great point. For a single hop, this fixes it:
 >
 > Index: lib/Sema/SemaInit.cpp
 > ===
 > --- lib/Sema/SemaInit.cpp (revision 261298)
 > +++ lib/Sema/SemaInit.cpp (working copy)
 > @@ -3521,7 +3521,7 @@
 >// The 253 propo

Re: r261674 - Rename Action::begin() to Action::input_begin().

2016-02-23 Thread David Blaikie via cfe-commits
On Tue, Feb 23, 2016 at 11:30 AM, Nico Weber via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: nico
> Date: Tue Feb 23 13:30:43 2016
> New Revision: 261674
>
> URL: http://llvm.org/viewvc/llvm-project?rev=261674&view=rev
> Log:
> Rename Action::begin() to Action::input_begin().
>
> Also introduce inputs() that reutnrs an llvm::iterator_range.
> Iterating over A->inputs() is much less mysterious than
> iterating over *A.  No intended behavior change.
>

Seems like a strange change - is there ambiguity of what an Action is a
collection of? (does it expose other collections (perhaps its outputs?) -
or only its inputs? )

Lots of things in LLVM/Clang are containers (functions are containers of
basic blocks, basic blocks are containers of instructions, etc) so this
doesn't seem too strange to me... perhaps there's something different about
this situation/API?


>
> Modified:
> cfe/trunk/include/clang/Driver/Action.h
> cfe/trunk/lib/Driver/Compilation.cpp
> cfe/trunk/lib/Driver/Driver.cpp
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
> cfe/trunk/lib/Tooling/CompilationDatabase.cpp
>
> Modified: cfe/trunk/include/clang/Driver/Action.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=261674&r1=261673&r2=261674&view=diff
>
> ==
> --- cfe/trunk/include/clang/Driver/Action.h (original)
> +++ cfe/trunk/include/clang/Driver/Action.h Tue Feb 23 13:30:43 2016
> @@ -41,8 +41,10 @@ namespace driver {
>  class Action {
>  public:
>typedef ActionList::size_type size_type;
> -  typedef ActionList::iterator iterator;
> -  typedef ActionList::const_iterator const_iterator;
> +  typedef ActionList::iterator input_iterator;
> +  typedef ActionList::const_iterator input_const_iterator;
> +  typedef llvm::iterator_range input_range;
> +  typedef llvm::iterator_range input_const_range;
>
>enum ActionClass {
>  InputClass = 0,
> @@ -98,10 +100,14 @@ public:
>
>size_type size() const { return Inputs.size(); }
>
> -  iterator begin() { return Inputs.begin(); }
> -  iterator end() { return Inputs.end(); }
> -  const_iterator begin() const { return Inputs.begin(); }
> -  const_iterator end() const { return Inputs.end(); }
> +  input_iterator input_begin() { return Inputs.begin(); }
> +  input_iterator input_end() { return Inputs.end(); }
> +  input_range inputs() { return input_range(input_begin(), input_end()); }
> +  input_const_iterator input_begin() const { return Inputs.begin(); }
> +  input_const_iterator input_end() const { return Inputs.end(); }
> +  input_const_range inputs() const {
> +return input_const_range(input_begin(), input_end());
> +  }
>  };
>
>  class InputAction : public Action {
>
> Modified: cfe/trunk/lib/Driver/Compilation.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=261674&r1=261673&r2=261674&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/Compilation.cpp (original)
> +++ cfe/trunk/lib/Driver/Compilation.cpp Tue Feb 23 13:30:43 2016
> @@ -176,8 +176,8 @@ static bool ActionFailed(const Action *A
>  if (A == &(CI->second->getSource()))
>return true;
>
> -  for (Action::const_iterator AI = A->begin(), AE = A->end(); AI != AE;
> ++AI)
> -if (ActionFailed(*AI, FailingCommands))
> +  for (const Action *AI : A->inputs())
> +if (ActionFailed(AI, FailingCommands))
>return true;
>
>return false;
>
> Modified: cfe/trunk/lib/Driver/Driver.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=261674&r1=261673&r2=261674&view=diff
>
> ==
> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> +++ cfe/trunk/lib/Driver/Driver.cpp Tue Feb 23 13:30:43 2016
> @@ -948,15 +948,15 @@ static unsigned PrintActions1(const Comp
>  os << "\"" << IA->getInputArg().getValue() << "\"";
>} else if (BindArchAction *BIA = dyn_cast(A)) {
>  os << '"' << BIA->getArchName() << '"' << ", {"
> -   << PrintActions1(C, *BIA->begin(), Ids) << "}";
> +   << PrintActions1(C, *BIA->input_begin(), Ids) << "}";
>} else if (CudaDeviceAction *CDA = dyn_cast(A)) {
>  os << '"'
> << (CDA->getGpuArchName() ? CDA->getGpuArchName() : "(multiple
> archs)")
> -   << '"' << ", {" << PrintActions1(C, *CDA->begin(), Ids) << "}";
> +   << '"' << ", {" << PrintActions1(C, *CDA->input_begin(), Ids) <<
> "}";
>} else {
>  const ActionList *AL;
>  if (CudaHostAction *CHA = dyn_cast(A)) {
> -  os << "{" << PrintActions1(C, *CHA->begin(), Ids) << "}"
> +  os << "{" << PrintActions1(C, *CHA->input_begin(), Ids) << "}"
>   << ", gpu binaries ";
>AL = &CHA->getDeviceActions();
>  } else
> @@ -996,7 +996,7 @@ static bool ContainsCompi

[libcxx] r261677 - Fix a missing closing tag

2016-02-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb 23 13:48:44 2016
New Revision: 261677

URL: http://llvm.org/viewvc/llvm-project?rev=261677&view=rev
Log:
Fix a missing closing tag

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=261677&r1=261676&r2=261677&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Tue Feb 23 13:48:44 2016
@@ -105,7 +105,7 @@
 2557 - Cleaning up wording; no code change required.
 2558 - Cleaning up wording; no code change required.
 2559 - 
-2560 - We already do this; added tests in r261653. More: the new tests 
fail on green-dragon-09, so I reverted it. Will recommit after green-dragon 
bots are updated. Probably need to XFAIL for clang3-6 as well (arm bots)
+2560 - We already do this; added tests in r261653. More: the new tests 
fail on green-dragon-09, so I reverted it. Will recommit after green-dragon 
bots are updated. Probably need to XFAIL for clang3-6 as well (arm 
bots)
 2565 - 
 2566 - 
 2571 - Cleaning up wording; no code change required.


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


[libcxx] r261676 - More updates

2016-02-23 Thread Marshall Clow via cfe-commits
Author: marshall
Date: Tue Feb 23 13:48:09 2016
New Revision: 261676

URL: http://llvm.org/viewvc/llvm-project?rev=261676&view=rev
Log:
More updates

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=261676&r1=261675&r2=261676&view=diff
==
--- libcxx/trunk/www/upcoming_meeting.html (original)
+++ libcxx/trunk/www/upcoming_meeting.html Tue Feb 23 13:48:09 2016
@@ -64,18 +64,18 @@
http://cplusplus.github.io/LWG/lwg-defects.html#2450";>2450(greater|less|greater_equal|less_equal)
 do not yield a total order for pointersJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2520";>2520N4089
 broke initializing unique_ptr from a 
nullptrJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2522";>2522[fund.ts.v2]
 Contradiction in set_default_resource 
specificationJacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2523";>2523std::promise
 synopsis shows two set_value_at_thread_exit()'s for no apparent 
reasonJacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2523";>2523std::promise
 synopsis shows two set_value_at_thread_exit()'s for no apparent 
reasonJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2537";>2537Constructors
 for priority_queue taking allocators should call 
make_heapJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2539";>2539[fund.ts.v2]
 invocation_trait definition definition doesn't work for surrogate 
call functionsJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2545";>2545Simplify
 wording for bind without explicitly specified return 
typeJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2557";>2557Logical
 operator traits are broken in the zero-argument 
caseJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2558";>2558[fund.ts.v2]
 Logical operator traits are broken in the zero-argument 
caseJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2559";>2559Error
 in LWG 2234's resolutionJacksonville
-   http://cplusplus.github.io/LWG/lwg-defects.html#2560";>2560is_constructible
 underspecified when applied to a function 
typeJacksonvilleComplete
+   http://cplusplus.github.io/LWG/lwg-defects.html#2560";>2560is_constructible
 underspecified when applied to a function 
typeJacksonvilleBroken in 3.6; See r261653.
http://cplusplus.github.io/LWG/lwg-defects.html#2565";>2565std::function's
 move constructor should guarantee nothrow for reference_wrappers and 
function pointersJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2566";>2566Requirements
 on the first template parameter of container 
adaptorsJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2571";>2571§[map.modifiers]/2
 imposes nonsensical requirement on insert(InputIterator, 
InputIterator)JacksonvilleComplete
-   http://cplusplus.github.io/LWG/lwg-defects.html#2572";>2572The
 remarks for shared_ptr::operator* should apply to cv-qualified 
void as wellJacksonville
+   http://cplusplus.github.io/LWG/lwg-defects.html#2572";>2572The
 remarks for shared_ptr::operator* should apply to cv-qualified 
void as wellJacksonvilleComplete
http://cplusplus.github.io/LWG/lwg-defects.html#2574";>2574[fund.ts.v2]
 std::experimental::function::operator=(F&&) should be 
constrainedJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2575";>2575[fund.ts.v2]
 experimental::function::assign should be 
removedJacksonville
http://cplusplus.github.io/LWG/lwg-defects.html#2576";>2576istream_iterator
 and ostream_iterator should use 
std::addressofJacksonvillePatch done; needs 
tests
@@ -96,20 +96,20 @@
 2255 - Arrays.ts is moribund. No action needed.
 2276 - 
 2450 - 
-2520 - 
-2522 - 
-2523 - 
+2520 - We need to implement N4089 before doing this.
+2522 - I don't think we have a PMR implementation yet.
+2523 - Cleaning up wording; no code change required.
 2537 - 
 2539 - 
 2545 - 
 2557 - Cleaning up wording; no code change required.
 2558 - Cleaning up wording; no code change required.
 2559 - 
-2560 - We already do this; added tests in r261653.
+2560 - We already do this; added tests in r261653. More: the new tests 
fail on green-dragon-09, so I reverted it. Will recommit after green-dragon 
bots are updated. Probably need to XFAIL for clang3-6 as well (arm bots)
 2565 - 
 2566 - 
 2571 - Cleaning up wording; no code change required.
-2572 - I don't think that there's anything that needs to be done here.
+2572 - We already do this.
 2574 - 
 2575 - I don't think we ever implemented this; so 'removing' it is 
trivial
 2576 - This one is simple, but testing it will be hard. I tried making a 
sublass of istringstream, but it got sliced.



r261680 - [CMake] Add install-clang-format target by migrating to add_clang_tool

2016-02-23 Thread Chris Bieneman via cfe-commits
Author: cbieneman
Date: Tue Feb 23 14:33:15 2016
New Revision: 261680

URL: http://llvm.org/viewvc/llvm-project?rev=261680&view=rev
Log:
[CMake] Add install-clang-format target by migrating to add_clang_tool

This change migrates clang-format to add_clang_tool which makes a 
component-based install target. To support component-based installation the 
extra installed scripts all need to have the "clang-format" component too.

Modified:
cfe/trunk/tools/clang-format/CMakeLists.txt

Modified: cfe/trunk/tools/clang-format/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/CMakeLists.txt?rev=261680&r1=261679&r2=261680&view=diff
==
--- cfe/trunk/tools/clang-format/CMakeLists.txt (original)
+++ cfe/trunk/tools/clang-format/CMakeLists.txt Tue Feb 23 14:33:15 2016
@@ -1,6 +1,6 @@
 set(LLVM_LINK_COMPONENTS support)
 
-add_clang_executable(clang-format
+add_clang_tool(clang-format
   ClangFormat.cpp
   )
 
@@ -19,10 +19,21 @@ if( LLVM_USE_SANITIZE_COVERAGE )
   add_subdirectory(fuzzer)
 endif()
 
-install(TARGETS clang-format RUNTIME DESTINATION bin)
-install(PROGRAMS clang-format-bbedit.applescript DESTINATION share/clang)
-install(PROGRAMS clang-format-diff.py DESTINATION share/clang)
-install(PROGRAMS clang-format-sublime.py DESTINATION share/clang)
-install(PROGRAMS clang-format.el DESTINATION share/clang)
-install(PROGRAMS clang-format.py DESTINATION share/clang)
-install(PROGRAMS git-clang-format DESTINATION bin)
+install(PROGRAMS clang-format-bbedit.applescript
+  DESTINATION share/clang
+  COMPONENT clang-format)
+install(PROGRAMS clang-format-diff.py
+  DESTINATION share/clang
+  COMPONENT clang-format)
+install(PROGRAMS clang-format-sublime.py
+  DESTINATION share/clang
+  COMPONENT clang-format)
+install(PROGRAMS clang-format.el
+  DESTINATION share/clang
+  COMPONENT clang-format)
+install(PROGRAMS clang-format.py
+  DESTINATION share/clang
+  COMPONENT clang-format)
+install(PROGRAMS git-clang-format
+  DESTINATION bin
+  COMPONENT clang-format)


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


Re: r261674 - Rename Action::begin() to Action::input_begin().

2016-02-23 Thread Nico Weber via cfe-commits
On Tue, Feb 23, 2016 at 2:44 PM, David Blaikie via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
>
> On Tue, Feb 23, 2016 at 11:30 AM, Nico Weber via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: nico
>> Date: Tue Feb 23 13:30:43 2016
>> New Revision: 261674
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=261674&view=rev
>> Log:
>> Rename Action::begin() to Action::input_begin().
>>
>> Also introduce inputs() that reutnrs an llvm::iterator_range.
>> Iterating over A->inputs() is much less mysterious than
>> iterating over *A.  No intended behavior change.
>>
>
> Seems like a strange change - is there ambiguity of what an Action is a
> collection of?
>

Action isn't primarily a collection, but an action (a list of inputs, but
also a kind, an output type, etc) :-) I found this code pretty confusing,
hence I renamed it.

(I do have a local change currently that gives it a second iterable thing,
but this seemed like a good change independent of my local change.)


> (does it expose other collections (perhaps its outputs?) - or only its
> inputs? )
>
> Lots of things in LLVM/Clang are containers (functions are containers of
> basic blocks, basic blocks are containers of instructions, etc) so this
> doesn't seem too strange to me... perhaps there's something different about
> this situation/API?
>
>
>>
>> Modified:
>> cfe/trunk/include/clang/Driver/Action.h
>> cfe/trunk/lib/Driver/Compilation.cpp
>> cfe/trunk/lib/Driver/Driver.cpp
>> cfe/trunk/lib/Driver/Tools.cpp
>> cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
>> cfe/trunk/lib/Tooling/CompilationDatabase.cpp
>>
>> Modified: cfe/trunk/include/clang/Driver/Action.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=261674&r1=261673&r2=261674&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Driver/Action.h (original)
>> +++ cfe/trunk/include/clang/Driver/Action.h Tue Feb 23 13:30:43 2016
>> @@ -41,8 +41,10 @@ namespace driver {
>>  class Action {
>>  public:
>>typedef ActionList::size_type size_type;
>> -  typedef ActionList::iterator iterator;
>> -  typedef ActionList::const_iterator const_iterator;
>> +  typedef ActionList::iterator input_iterator;
>> +  typedef ActionList::const_iterator input_const_iterator;
>> +  typedef llvm::iterator_range input_range;
>> +  typedef llvm::iterator_range input_const_range;
>>
>>enum ActionClass {
>>  InputClass = 0,
>> @@ -98,10 +100,14 @@ public:
>>
>>size_type size() const { return Inputs.size(); }
>>
>> -  iterator begin() { return Inputs.begin(); }
>> -  iterator end() { return Inputs.end(); }
>> -  const_iterator begin() const { return Inputs.begin(); }
>> -  const_iterator end() const { return Inputs.end(); }
>> +  input_iterator input_begin() { return Inputs.begin(); }
>> +  input_iterator input_end() { return Inputs.end(); }
>> +  input_range inputs() { return input_range(input_begin(), input_end());
>> }
>> +  input_const_iterator input_begin() const { return Inputs.begin(); }
>> +  input_const_iterator input_end() const { return Inputs.end(); }
>> +  input_const_range inputs() const {
>> +return input_const_range(input_begin(), input_end());
>> +  }
>>  };
>>
>>  class InputAction : public Action {
>>
>> Modified: cfe/trunk/lib/Driver/Compilation.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=261674&r1=261673&r2=261674&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Driver/Compilation.cpp (original)
>> +++ cfe/trunk/lib/Driver/Compilation.cpp Tue Feb 23 13:30:43 2016
>> @@ -176,8 +176,8 @@ static bool ActionFailed(const Action *A
>>  if (A == &(CI->second->getSource()))
>>return true;
>>
>> -  for (Action::const_iterator AI = A->begin(), AE = A->end(); AI != AE;
>> ++AI)
>> -if (ActionFailed(*AI, FailingCommands))
>> +  for (const Action *AI : A->inputs())
>> +if (ActionFailed(AI, FailingCommands))
>>return true;
>>
>>return false;
>>
>> Modified: cfe/trunk/lib/Driver/Driver.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=261674&r1=261673&r2=261674&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Driver/Driver.cpp (original)
>> +++ cfe/trunk/lib/Driver/Driver.cpp Tue Feb 23 13:30:43 2016
>> @@ -948,15 +948,15 @@ static unsigned PrintActions1(const Comp
>>  os << "\"" << IA->getInputArg().getValue() << "\"";
>>} else if (BindArchAction *BIA = dyn_cast(A)) {
>>  os << '"' << BIA->getArchName() << '"' << ", {"
>> -   << PrintActions1(C, *BIA->begin(), Ids) << "}";
>> +   << PrintActions1(C, *BIA->input_begin(), Ids) << "}";
>>} else if (CudaDeviceAction *CDA = dyn_cast(A)) {
>>  os << '"'
>> << (CDA->getGpuArchName() ? CDA->getGpuArchName

[PATCH] D17550: Adding doxygen comments to the LLVM intrinsics (part 6, popcntintrin.h)

2016-02-23 Thread Katya Romanova via cfe-commits
kromanova created this revision.
kromanova added a subscriber: cfe-commits.
kromanova set the repository for this revision to rL LLVM.

Here is the patch with the doxygen comments for the intrinsincs in the header 
file popcntintrin.h.
The doxygen comments are automatically generated based on SCE internal 
intrinsics document using DCG tool that I wrote.

I will submit more doxygen comments for the other intrinsic header files as 
soon as this patch is approved.

Here is the link to the general discussion about adding comments to x86 
intrinsics headers.
http://permalink.gmane.org/gmane.comp.compilers.clang.devel/42032

Here are the links to the similar code reviews for the doxygen comments in some 
other header files.

http://reviews.llvm.org/D8762 (closed)
http://reviews.llvm.org/D15999 (closed)
http://reviews.llvm.org/D16562 (closed)
http://reviews.llvm.org/D16913 (closed)
http://reviews.llvm.org/D17021 (closed)


Repository:
  rL LLVM

http://reviews.llvm.org/D17550

Files:
  popcntintrin.h

Index: popcntintrin.h
===
--- popcntintrin.h
+++ popcntintrin.h
@@ -27,25 +27,65 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, 
__target__("popcnt")))
 
+/// \brief Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c POPCNT instruction.
+///
+/// \param __A
+///An unsigned 32-bit integer operand.
+/// \returns A 32-bit integer containing the number of bits with value 1 in the
+///source operand.
 static __inline__ int __DEFAULT_FN_ATTRS
 _mm_popcnt_u32(unsigned int __A)
 {
   return __builtin_popcount(__A);
 }
 
+/// \brief Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c POPCNT instruction.
+///
+/// \param __A
+///A signed 32-bit integer operand.
+/// \returns A 32-bit integer containing the number of bits with value 1 in the
+///source operand.
 static __inline__ int __DEFAULT_FN_ATTRS
 _popcnt32(int __A)
 {
   return __builtin_popcount(__A);
 }
 
 #ifdef __x86_64__
+/// \brief Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c POPCNT instruction.
+///
+/// \param __A
+///An unsigned 64-bit integer operand.
+/// \returns A 64-bit integer containing the number of bits with value 1 in the
+///source operand.
 static __inline__ long long __DEFAULT_FN_ATTRS
 _mm_popcnt_u64(unsigned long long __A)
 {
   return __builtin_popcountll(__A);
 }
 
+/// \brief Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c POPCNT instruction.
+///
+/// \param __A
+///A signed 64-bit integer operand.
+/// \returns A 64-bit integer containing the number of bits with value 1 in the
+///source operand.
 static __inline__ long long __DEFAULT_FN_ATTRS
 _popcnt64(long long __A)
 {


Index: popcntintrin.h
===
--- popcntintrin.h
+++ popcntintrin.h
@@ -27,25 +27,65 @@
 /* Define the default attributes for the functions in this file. */
 #define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__, __target__("popcnt")))
 
+/// \brief Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c POPCNT instruction.
+///
+/// \param __A
+///An unsigned 32-bit integer operand.
+/// \returns A 32-bit integer containing the number of bits with value 1 in the
+///source operand.
 static __inline__ int __DEFAULT_FN_ATTRS
 _mm_popcnt_u32(unsigned int __A)
 {
   return __builtin_popcount(__A);
 }
 
+/// \brief Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c POPCNT instruction.
+///
+/// \param __A
+///A signed 32-bit integer operand.
+/// \returns A 32-bit integer containing the number of bits with value 1 in the
+///source operand.
 static __inline__ int __DEFAULT_FN_ATTRS
 _popcnt32(int __A)
 {
   return __builtin_popcount(__A);
 }
 
 #ifdef __x86_64__
+/// \brief Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to the \c POPCNT instruction.
+///
+/// \param __A
+///An unsigned 64-bit integer operand.
+/// \returns A 64-bit integer containing the number of bits with value 1 in the
+///source operand.
 static __inline__ long long __DEFAULT_FN_ATTRS
 _mm_popcnt_u64(unsigned long long __A)
 {
   return __builtin_popcountll(__A);
 }
 
+/// \brief Counts the number of bits in the source operand having a value of 1.
+///
+/// \headerfile 
+///
+/// This intrinsic corresponds to 

Re: r261674 - Rename Action::begin() to Action::input_begin().

2016-02-23 Thread David Blaikie via cfe-commits
On Tue, Feb 23, 2016 at 12:46 PM, Nico Weber  wrote:

> On Tue, Feb 23, 2016 at 2:44 PM, David Blaikie via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>>
>>
>> On Tue, Feb 23, 2016 at 11:30 AM, Nico Weber via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: nico
>>> Date: Tue Feb 23 13:30:43 2016
>>> New Revision: 261674
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=261674&view=rev
>>> Log:
>>> Rename Action::begin() to Action::input_begin().
>>>
>>> Also introduce inputs() that reutnrs an llvm::iterator_range.
>>> Iterating over A->inputs() is much less mysterious than
>>> iterating over *A.  No intended behavior change.
>>>
>>
>> Seems like a strange change - is there ambiguity of what an Action is a
>> collection of?
>>
>
> Action isn't primarily a collection, but an action (a list of inputs, but
> also a kind, an output type, etc) :-)
>

The analogy to llvm::Function, llvm::BasicBlock, etc, still seem somewhat
apt (a Function isn't, in some sense, primarily a collection of basic
blocks - it's a global value with a name and parameters, etc).


> I found this code pretty confusing, hence I renamed it.
>
> (I do have a local change currently that gives it a second iterable thing,
> but this seemed like a good change independent of my local change.)
>

Fair enough - just figured I'd point out there's a fair bit of precedent
for thing-is-a-collection across LLVM, in case that provides a diferent
perspective.

- Dave


>
>
>> (does it expose other collections (perhaps its outputs?) - or only its
>> inputs? )
>>
>> Lots of things in LLVM/Clang are containers (functions are containers of
>> basic blocks, basic blocks are containers of instructions, etc) so this
>> doesn't seem too strange to me... perhaps there's something different about
>> this situation/API?
>>
>>
>>>
>>> Modified:
>>> cfe/trunk/include/clang/Driver/Action.h
>>> cfe/trunk/lib/Driver/Compilation.cpp
>>> cfe/trunk/lib/Driver/Driver.cpp
>>> cfe/trunk/lib/Driver/Tools.cpp
>>> cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp
>>> cfe/trunk/lib/Tooling/CompilationDatabase.cpp
>>>
>>> Modified: cfe/trunk/include/clang/Driver/Action.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=261674&r1=261673&r2=261674&view=diff
>>>
>>> ==
>>> --- cfe/trunk/include/clang/Driver/Action.h (original)
>>> +++ cfe/trunk/include/clang/Driver/Action.h Tue Feb 23 13:30:43 2016
>>> @@ -41,8 +41,10 @@ namespace driver {
>>>  class Action {
>>>  public:
>>>typedef ActionList::size_type size_type;
>>> -  typedef ActionList::iterator iterator;
>>> -  typedef ActionList::const_iterator const_iterator;
>>> +  typedef ActionList::iterator input_iterator;
>>> +  typedef ActionList::const_iterator input_const_iterator;
>>> +  typedef llvm::iterator_range input_range;
>>> +  typedef llvm::iterator_range input_const_range;
>>>
>>>enum ActionClass {
>>>  InputClass = 0,
>>> @@ -98,10 +100,14 @@ public:
>>>
>>>size_type size() const { return Inputs.size(); }
>>>
>>> -  iterator begin() { return Inputs.begin(); }
>>> -  iterator end() { return Inputs.end(); }
>>> -  const_iterator begin() const { return Inputs.begin(); }
>>> -  const_iterator end() const { return Inputs.end(); }
>>> +  input_iterator input_begin() { return Inputs.begin(); }
>>> +  input_iterator input_end() { return Inputs.end(); }
>>> +  input_range inputs() { return input_range(input_begin(),
>>> input_end()); }
>>> +  input_const_iterator input_begin() const { return Inputs.begin(); }
>>> +  input_const_iterator input_end() const { return Inputs.end(); }
>>> +  input_const_range inputs() const {
>>> +return input_const_range(input_begin(), input_end());
>>> +  }
>>>  };
>>>
>>>  class InputAction : public Action {
>>>
>>> Modified: cfe/trunk/lib/Driver/Compilation.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=261674&r1=261673&r2=261674&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Driver/Compilation.cpp (original)
>>> +++ cfe/trunk/lib/Driver/Compilation.cpp Tue Feb 23 13:30:43 2016
>>> @@ -176,8 +176,8 @@ static bool ActionFailed(const Action *A
>>>  if (A == &(CI->second->getSource()))
>>>return true;
>>>
>>> -  for (Action::const_iterator AI = A->begin(), AE = A->end(); AI != AE;
>>> ++AI)
>>> -if (ActionFailed(*AI, FailingCommands))
>>> +  for (const Action *AI : A->inputs())
>>> +if (ActionFailed(AI, FailingCommands))
>>>return true;
>>>
>>>return false;
>>>
>>> Modified: cfe/trunk/lib/Driver/Driver.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=261674&r1=261673&r2=261674&view=diff
>>>
>>> ==
>>> --- cfe/trunk/lib/Driver/Driver.cpp (orig

Re: r261674 - Rename Action::begin() to Action::input_begin().

2016-02-23 Thread Nico Weber via cfe-commits
On Tue, Feb 23, 2016 at 3:55 PM, David Blaikie  wrote:

>
>
> On Tue, Feb 23, 2016 at 12:46 PM, Nico Weber  wrote:
>
>> On Tue, Feb 23, 2016 at 2:44 PM, David Blaikie via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>>
>>>
>>> On Tue, Feb 23, 2016 at 11:30 AM, Nico Weber via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>
 Author: nico
 Date: Tue Feb 23 13:30:43 2016
 New Revision: 261674

 URL: http://llvm.org/viewvc/llvm-project?rev=261674&view=rev
 Log:
 Rename Action::begin() to Action::input_begin().

 Also introduce inputs() that reutnrs an llvm::iterator_range.
 Iterating over A->inputs() is much less mysterious than
 iterating over *A.  No intended behavior change.

>>>
>>> Seems like a strange change - is there ambiguity of what an Action is a
>>> collection of?
>>>
>>
>> Action isn't primarily a collection, but an action (a list of inputs, but
>> also a kind, an output type, etc) :-)
>>
>
> The analogy to llvm::Function, llvm::BasicBlock, etc, still seem somewhat
> apt (a Function isn't, in some sense, primarily a collection of basic
> blocks - it's a global value with a name and parameters, etc).
>
>
>> I found this code pretty confusing, hence I renamed it.
>>
>> (I do have a local change currently that gives it a second iterable
>> thing, but this seemed like a good change independent of my local change.)
>>
>
> Fair enough - just figured I'd point out there's a fair bit of precedent
> for thing-is-a-collection across LLVM, in case that provides a different
> perspective.
>

It's not very common in clang though, is it?
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D15829: [PGO] Clang Option that enables IR level PGO instrumentation

2016-02-23 Thread Rong Xu via cfe-commits
xur updated this revision to Diff 48846.
xur marked an inline comment as done.
xur added a comment.

Here is the new patch that removes the auto detection of profile kind.

In this patch, I replace the CC1 option of -fprofile-instr-use=<> with 
-fprofile-instrument={llvm-use|clang-use}. For the use compilation, the profile 
reuses the -fprofile-instrument-path= option.

Again, all changes are of CC1 options. Driver options are intact.

Some test are modified due to the -fprofile-instr-use= option change.

A new test is added to test IR profile compilation. 
test/CodeGen/pgo-instrumentation.c


http://reviews.llvm.org/D15829

Files:
  include/clang/Driver/CC1Options.td
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  include/clang/Frontend/CodeGenOptions.h
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CodeGenModule.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGen/Inputs/pgotestclang.profraw
  test/CodeGen/Inputs/pgotestir.profraw
  test/CodeGen/pgo-instrumentation.c
  test/Driver/clang_f_opts.c
  test/Profile/c-captured.c
  test/Profile/c-counter-overflows.c
  test/Profile/c-general.c
  test/Profile/c-outdated-data.c
  test/Profile/c-unprofiled-blocks.c
  test/Profile/c-unprofiled.c
  test/Profile/cxx-lambda.cpp
  test/Profile/cxx-rangefor.cpp
  test/Profile/cxx-templates.cpp
  test/Profile/objc-general.m
  test/Profile/profile-does-not-exist.c

Index: test/Profile/profile-does-not-exist.c
===
--- test/Profile/profile-does-not-exist.c
+++ test/Profile/profile-does-not-exist.c
@@ -1,4 +1,4 @@
-// RUN: not %clang_cc1 -emit-llvm %s -o - -fprofile-instr-use=%t.nonexistent.profdata 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -emit-llvm %s -o - -fprofile-instrument-path=%t.nonexistent.profdata -fprofile-instrument=clang-use 2>&1 | FileCheck %s
 
 // CHECK: error: Could not read profile {{.*}}.nonexistent.profdata:
 // CHECK-NOT: Assertion failed
Index: test/Profile/objc-general.m
===
--- test/Profile/objc-general.m
+++ test/Profile/objc-general.m
@@ -3,7 +3,7 @@
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name objc-general.m %s -o - -emit-llvm -fblocks -fprofile-instrument=clang | FileCheck -check-prefix=PGOGEN %s
 
 // RUN: llvm-profdata merge %S/Inputs/objc-general.proftext -o %t.profdata
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name objc-general.m %s -o - -emit-llvm -fblocks -fprofile-instr-use=%t.profdata | FileCheck -check-prefix=PGOUSE %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name objc-general.m %s -o - -emit-llvm -fblocks -fprofile-instrument-path=%t.profdata -fprofile-instrument=clang-use | FileCheck -check-prefix=PGOUSE %s
 
 #ifdef HAVE_FOUNDATION
 
Index: test/Profile/cxx-templates.cpp
===
--- test/Profile/cxx-templates.cpp
+++ test/Profile/cxx-templates.cpp
@@ -6,7 +6,7 @@
 // RUN: FileCheck --input-file=%tgen -check-prefix=T100GEN -check-prefix=ALL %s
 
 // RUN: llvm-profdata merge %S/Inputs/cxx-templates.proftext -o %t.profdata
-// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-templates.cpp -std=c++11 -o - -emit-llvm -fprofile-instr-use=%t.profdata > %tuse
+// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-templates.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument-path=%t.profdata -fprofile-instrument=clang-use > %tuse
 // RUN: FileCheck --input-file=%tuse -check-prefix=T0USE -check-prefix=ALL %s
 // RUN: FileCheck --input-file=%tuse -check-prefix=T100USE -check-prefix=ALL %s
 
Index: test/Profile/cxx-rangefor.cpp
===
--- test/Profile/cxx-rangefor.cpp
+++ test/Profile/cxx-rangefor.cpp
@@ -4,7 +4,7 @@
 // RUN: FileCheck --input-file=%tgen -check-prefix=CHECK -check-prefix=PGOGEN %s
 
 // RUN: llvm-profdata merge %S/Inputs/cxx-rangefor.proftext -o %t.profdata
-// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instr-use=%t.profdata > %tuse
+// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-rangefor.cpp -std=c++11 -o - -emit-llvm -fprofile-instrument-path=%t.profdata -fprofile-instrument=clang-use > %tuse
 // RUN: FileCheck --input-file=%tuse -check-prefix=CHECK -check-prefix=PGOUSE %s
 
 // PGOGEN: @[[RFC:__profc__Z9range_forv]] = private global [5 x i64] zeroinitializer
Index: test/Profile/cxx-lambda.cpp
===
--- test/Profile/cxx-lambda.cpp
+++ test/Profile/cxx-lambda.cpp
@@ -5,7 +5,7 @@
 // RUN: FileCheck --input-file=%tgen -check-prefix=LMBGEN %s
 
 // RUN: llvm-profdata merge %S/Inputs/cxx-lambda.proftext -o %t.profdata
-// RUN: %clang_cc1 -x c++ %s -triple %itanium_abi_triple -main-file-name cxx-lambda

Re: r261674 - Rename Action::begin() to Action::input_begin().

2016-02-23 Thread David Blaikie via cfe-commits
On Tue, Feb 23, 2016 at 1:02 PM, Nico Weber  wrote:

> On Tue, Feb 23, 2016 at 3:55 PM, David Blaikie  wrote:
>
>>
>>
>> On Tue, Feb 23, 2016 at 12:46 PM, Nico Weber  wrote:
>>
>>> On Tue, Feb 23, 2016 at 2:44 PM, David Blaikie via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>>


 On Tue, Feb 23, 2016 at 11:30 AM, Nico Weber via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:

> Author: nico
> Date: Tue Feb 23 13:30:43 2016
> New Revision: 261674
>
> URL: http://llvm.org/viewvc/llvm-project?rev=261674&view=rev
> Log:
> Rename Action::begin() to Action::input_begin().
>
> Also introduce inputs() that reutnrs an llvm::iterator_range.
> Iterating over A->inputs() is much less mysterious than
> iterating over *A.  No intended behavior change.
>

 Seems like a strange change - is there ambiguity of what an Action is a
 collection of?

>>>
>>> Action isn't primarily a collection, but an action (a list of inputs,
>>> but also a kind, an output type, etc) :-)
>>>
>>
>> The analogy to llvm::Function, llvm::BasicBlock, etc, still seem somewhat
>> apt (a Function isn't, in some sense, primarily a collection of basic
>> blocks - it's a global value with a name and parameters, etc).
>>
>>
>>> I found this code pretty confusing, hence I renamed it.
>>>
>>> (I do have a local change currently that gives it a second iterable
>>> thing, but this seemed like a good change independent of my local change.)
>>>
>>
>> Fair enough - just figured I'd point out there's a fair bit of precedent
>> for thing-is-a-collection across LLVM, in case that provides a different
>> perspective.
>>
>
> It's not very common in clang though, is it?
>

Seems pretty common, judging by a quick 'grep -r "  begin()'
tools/clang/include' - lots of things that look like they're far more than
a container, have begin functions.

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


Re: r261669 - Amends r252104 to evaluate the controlling expression in an unevaluated context. This eliminates false-positive diagnostics about null pointer dereferences (etc) in the controlling expre

2016-02-23 Thread Hans Wennborg via cfe-commits
On Tue, Feb 23, 2016 at 11:12 AM, Aaron Ballman  wrote:
> On Tue, Feb 23, 2016 at 2:03 PM, Hans Wennborg  wrote:
>> Hi Aaron,
>>
>> I'll let it sit in the tree for a bit, and will then merge it later today.
>
> Sounds great, thank you!

r261684.


>> Many thanks,
>> Hans
>>
>> On Tue, Feb 23, 2016 at 11:01 AM, Aaron Ballman  
>> wrote:
>>> Hans, this should be safe to merge into 3.8 (as Richard had mentioned
>>> in the review thread). Can you do the merge magic on my behalf?
>>>
>>> Thanks!
>>>
>>> ~Aaron
>>>
>>> On Tue, Feb 23, 2016 at 1:55 PM, Aaron Ballman via cfe-commits
>>>  wrote:
 Author: aaronballman
 Date: Tue Feb 23 12:55:15 2016
 New Revision: 261669

 URL: http://llvm.org/viewvc/llvm-project?rev=261669&view=rev
 Log:
 Amends r252104 to evaluate the controlling expression in an unevaluated 
 context. This eliminates false-positive diagnostics about null pointer 
 dereferences (etc) in the controlling expression.

 Modified:
 cfe/trunk/lib/Sema/SemaExpr.cpp
 cfe/trunk/test/Sema/generic-selection.c

 Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
 URL: 
 http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=261669&r1=261668&r2=261669&view=diff
 ==
 --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
 +++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Feb 23 12:55:15 2016
 @@ -1373,10 +1373,13 @@ Sema::CreateGenericSelectionExpr(SourceL

// Decay and strip qualifiers for the controlling expression type, and 
 handle
// placeholder type replacement. See committee discussion from WG14 
 DR423.
 -  ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
 -  if (R.isInvalid())
 -return ExprError();
 -  ControllingExpr = R.get();
 +  {
 +EnterExpressionEvaluationContext Unevaluated(*this, 
 Sema::Unevaluated);
 +ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
 +if (R.isInvalid())
 +  return ExprError();
 +ControllingExpr = R.get();
 +  }

// The controlling expression is an unevaluated operand, so side 
 effects are
// likely unintended.

 Modified: cfe/trunk/test/Sema/generic-selection.c
 URL: 
 http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/generic-selection.c?rev=261669&r1=261668&r2=261669&view=diff
 ==
 --- cfe/trunk/test/Sema/generic-selection.c (original)
 +++ cfe/trunk/test/Sema/generic-selection.c Tue Feb 23 12:55:15 2016
 @@ -31,4 +31,8 @@ void foo(int n) {

const int i = 12;
int a9[_Generic(i, int: 1, default: 2) == 1 ? 1 : -1];
 +
 +  // This is expected to not trigger any diagnostics because the 
 controlling
 +  // expression is not evaluated.
 +  (void)_Generic(*(int *)0, int: 1);
  }


 ___
 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


[libcxxabi] r261691 - Creating release candidate rc3 from release_380 branch

2016-02-23 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Feb 23 15:40:04 2016
New Revision: 261691

URL: http://llvm.org/viewvc/llvm-project?rev=261691&view=rev
Log:
Creating release candidate rc3 from release_380 branch

Added:
libcxxabi/tags/RELEASE_380/rc3/   (props changed)
  - copied from r261690, libcxxabi/branches/release_38/

Propchange: libcxxabi/tags/RELEASE_380/rc3/
--
svn:mergeinfo = /libcxxabi/trunk:257896


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


[libcxx] r261690 - Creating release candidate rc3 from release_380 branch

2016-02-23 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Feb 23 15:40:01 2016
New Revision: 261690

URL: http://llvm.org/viewvc/llvm-project?rev=261690&view=rev
Log:
Creating release candidate rc3 from release_380 branch

Added:
libcxx/tags/RELEASE_380/rc3/   (props changed)
  - copied from r261689, libcxx/branches/release_38/

Propchange: libcxx/tags/RELEASE_380/rc3/
--
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Feb 23 15:40:01 2016
@@ -0,0 +1,2 @@
+/libcxx/branches/apple:136569-137939
+/libcxx/trunk:257682,257696,257702,258107,258403,259682


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


[libunwind] r261697 - Creating release candidate rc3 from release_380 branch

2016-02-23 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Tue Feb 23 15:40:24 2016
New Revision: 261697

URL: http://llvm.org/viewvc/llvm-project?rev=261697&view=rev
Log:
Creating release candidate rc3 from release_380 branch

Added:
libunwind/tags/RELEASE_380/rc3/
  - copied from r261696, libunwind/branches/release_38/

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


r261703 - [analyzer] Find ObjC 'self' decl even when block captures local named 'self'.

2016-02-23 Thread Devin Coughlin via cfe-commits
Author: dcoughlin
Date: Tue Feb 23 16:26:04 2016
New Revision: 261703

URL: http://llvm.org/viewvc/llvm-project?rev=261703&view=rev
Log:
[analyzer] Find ObjC 'self' decl even when block captures local named 'self'.

When looking up the 'self' decl in block captures, make sure to find the actual
self declaration even when the block captures a local variable named 'self'.

rdar://problem/24751280

Modified:
cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp
cfe/trunk/test/Analysis/blocks.m
cfe/trunk/test/Analysis/lambdas.mm

Modified: cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp?rev=261703&r1=261702&r2=261703&view=diff
==
--- cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp (original)
+++ cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp Tue Feb 23 16:26:04 2016
@@ -135,6 +135,10 @@ bool AnalysisDeclContext::isBodyAutosynt
   return Tmp && Body->getLocStart().isValid();
 }
 
+/// Returns true if \param VD is an Objective-C implicit 'self' parameter.
+static bool isSelfDecl(const VarDecl *VD) {
+  return isa(VD) && VD->getName() == "self";
+}
 
 const ImplicitParamDecl *AnalysisDeclContext::getSelfDecl() const {
   if (const ObjCMethodDecl *MD = dyn_cast(D))
@@ -143,7 +147,7 @@ const ImplicitParamDecl *AnalysisDeclCon
 // See if 'self' was captured by the block.
 for (const auto &I : BD->captures()) {
   const VarDecl *VD = I.getVariable();
-  if (VD->getName() == "self")
+  if (isSelfDecl(VD))
 return dyn_cast(VD);
 }
   }
@@ -161,7 +165,7 @@ const ImplicitParamDecl *AnalysisDeclCon
   continue;
 
 VarDecl *VD = LC.getCapturedVar();
-if (VD->getName() == "self")
+if (isSelfDecl(VD))
   return dyn_cast(VD);
   }
 

Modified: cfe/trunk/test/Analysis/blocks.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/blocks.m?rev=261703&r1=261702&r2=261703&view=diff
==
--- cfe/trunk/test/Analysis/blocks.m (original)
+++ cfe/trunk/test/Analysis/blocks.m Tue Feb 23 16:26:04 2016
@@ -210,3 +210,25 @@ void testCallContainingWithSignature5()
   });
 }
 
+__attribute__((objc_root_class))
+@interface SuperClass
+- (void)someMethod;
+@end
+
+@interface SomeClass : SuperClass
+@end
+
+// Make sure to properly handle super-calls when a block captures
+// a local variable named 'self'.
+@implementation SomeClass
+-(void)foo; {
+  /*__weak*/ SomeClass *weakSelf = self;
+  (void)(^(void) {
+SomeClass *self = weakSelf;
+(void)(^(void) {
+  (void)self;
+  [super someMethod]; // no-warning
+});
+  });
+}
+@end

Modified: cfe/trunk/test/Analysis/lambdas.mm
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/lambdas.mm?rev=261703&r1=261702&r2=261703&view=diff
==
--- cfe/trunk/test/Analysis/lambdas.mm (original)
+++ cfe/trunk/test/Analysis/lambdas.mm Tue Feb 23 16:26:04 2016
@@ -12,7 +12,6 @@ int clang_analyzer_eval(int);
 }
 @end
 
-
 @implementation Sub
 - (void)callMethodOnSuperInCXXLambda; {
   // Explicit capture.
@@ -26,6 +25,20 @@ int clang_analyzer_eval(int);
   }();
 }
 
+// Make sure to properly handle super-calls when a block captures
+// a local variable named 'self'.
+- (void)callMethodOnSuperInCXXLambdaWithRedefinedSelf; {
+  /*__weak*/ Sub *weakSelf = self;
+  // Implicit capture. (Sema outlaws explicit capture of a redefined self
+  // and a call to super [which uses the original self]).
+  [=]() {
+Sub *self = weakSelf;
+[=]() {
+  [super superMethod];
+}();
+  }();
+}
+
 - (void)swapIvars {
   int tmp = _ivar1;
   _ivar1 = _ivar2;


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


Re: [PATCH] D15829: [PGO] Clang Option that enables IR level PGO instrumentation

2016-02-23 Thread David Li via cfe-commits
davidxl added inline comments.


Comment at: include/clang/Frontend/CodeGenOptions.h:83
@@ -82,2 +82,3 @@
   enum ProfileInstrKind {
 ProfileNoInstr,// No instrumentation.
+ProfileClangInstr, // Clang instrumentation to generate execution counts

Maybe ProfileNone, // Profile instrumentation and use is turned off.


Comment at: lib/CodeGen/CodeGenModule.cpp:151
@@ -151,1 +150,3 @@
+  if (CodeGenOpts.hasProfileClangUse() &&
+  !CodeGenOpts.InstrProfileInput.empty()) {
 auto ReaderOrErr =

Is the second condition still needed? Should it be asserted ?


Comment at: test/CodeGen/pgo-instrumentation.c:4
@@ +3,3 @@
+// Ensure Pass PGOInstrumentationGenPass is invoked.
+// RUN: %clang-cc1 -O2 -fprofile-instrument=llvm %s -mllvm 
-debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s 
-check-prefix=CHECK-PGOGENPASS-INVOKED-INSTR-GEN
+// CHECK-PGOGENPASS-INVOKED-INSTR-GEN: PGOInstrumentationGenPass

should be %clang_cc1


Comment at: test/CodeGen/pgo-instrumentation.c:8
@@ +7,3 @@
+// Ensure Pass PGOInstrumentationGenPass is not invoked.
+// RUN: %clang-cc1 -O2 -fprofile-instrument=clang %s -mllvm 
-debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s 
-check-prefix=CHECK-PGOGENPASS-INVOKED-INSTR-GEN-CLANG
+// CHECK-PGOGENPASS-INVOKED-INSTR-GEN-CLANG-NOT: PGOInstrumentationGenPass

%clang_cc1


http://reviews.llvm.org/D15829



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


r261705 - PR24667: fix quadratic runtime if textually-included modular headers define large numbers of macros.

2016-02-23 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Feb 23 17:20:51 2016
New Revision: 261705

URL: http://llvm.org/viewvc/llvm-project?rev=261705&view=rev
Log:
PR24667: fix quadratic runtime if textually-included modular headers define 
large numbers of macros.

Modified:
cfe/trunk/include/clang/Lex/Preprocessor.h
cfe/trunk/lib/Lex/PPLexerChange.cpp
cfe/trunk/lib/Lex/PPMacroExpansion.cpp

Modified: cfe/trunk/include/clang/Lex/Preprocessor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Preprocessor.h?rev=261705&r1=261704&r2=261705&view=diff
==
--- cfe/trunk/include/clang/Lex/Preprocessor.h (original)
+++ cfe/trunk/include/clang/Lex/Preprocessor.h Tue Feb 23 17:20:51 2016
@@ -507,9 +507,10 @@ class Preprocessor : public RefCountedBa
   /// \brief Information about a submodule that we're currently building.
   struct BuildingSubmoduleInfo {
 BuildingSubmoduleInfo(Module *M, SourceLocation ImportLoc,
-  SubmoduleState *OuterSubmoduleState)
-: M(M), ImportLoc(ImportLoc), OuterSubmoduleState(OuterSubmoduleState) 
{
-}
+  SubmoduleState *OuterSubmoduleState,
+  unsigned OuterPendingModuleMacroNames)
+: M(M), ImportLoc(ImportLoc), OuterSubmoduleState(OuterSubmoduleState),
+  OuterPendingModuleMacroNames(OuterPendingModuleMacroNames) {}
 
 /// The module that we are building.
 Module *M;
@@ -517,6 +518,8 @@ class Preprocessor : public RefCountedBa
 SourceLocation ImportLoc;
 /// The previous SubmoduleState.
 SubmoduleState *OuterSubmoduleState;
+/// The number of pending module macro names when we started building this.
+unsigned OuterPendingModuleMacroNames;
   };
   SmallVector BuildingSubmoduleStack;
 
@@ -541,6 +544,9 @@ class Preprocessor : public RefCountedBa
   /// The set of known macros exported from modules.
   llvm::FoldingSet ModuleMacros;
 
+  /// The names of potential module macros that we've not yet processed.
+  llvm::SmallVector PendingModuleMacroNames;
+
   /// The list of module macros, for each identifier, that are not overridden 
by
   /// any other module macro.
   llvm::DenseMap>
@@ -1704,6 +1710,10 @@ private:
   void EnterSubmodule(Module *M, SourceLocation ImportLoc);
   void LeaveSubmodule();
 
+  /// Determine whether we need to create module macros for #defines in the
+  /// current context.
+  bool needModuleMacros() const;
+
   /// Update the set of active module macros and ambiguity flag for a module
   /// macro name.
   void updateModuleMacroInfo(const IdentifierInfo *II, ModuleMacroInfo &Info);

Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=261705&r1=261704&r2=261705&view=diff
==
--- cfe/trunk/lib/Lex/PPLexerChange.cpp (original)
+++ cfe/trunk/lib/Lex/PPLexerChange.cpp Tue Feb 23 17:20:51 2016
@@ -622,8 +622,8 @@ void Preprocessor::HandleMicrosoftCommen
 void Preprocessor::EnterSubmodule(Module *M, SourceLocation ImportLoc) {
   if (!getLangOpts().ModulesLocalVisibility) {
 // Just track that we entered this submodule.
-BuildingSubmoduleStack.push_back(
-BuildingSubmoduleInfo(M, ImportLoc, CurSubmoduleState));
+BuildingSubmoduleStack.push_back(BuildingSubmoduleInfo(
+M, ImportLoc, CurSubmoduleState, PendingModuleMacroNames.size()));
 return;
   }
 
@@ -664,8 +664,8 @@ void Preprocessor::EnterSubmodule(Module
   }
 
   // Track that we entered this module.
-  BuildingSubmoduleStack.push_back(
-  BuildingSubmoduleInfo(M, ImportLoc, CurSubmoduleState));
+  BuildingSubmoduleStack.push_back(BuildingSubmoduleInfo(
+  M, ImportLoc, CurSubmoduleState, PendingModuleMacroNames.size()));
 
   // Switch to this submodule as the current submodule.
   CurSubmoduleState = &State;
@@ -675,27 +675,48 @@ void Preprocessor::EnterSubmodule(Module
 makeModuleVisible(M, ImportLoc);
 }
 
+bool Preprocessor::needModuleMacros() const {
+  // If we're not within a submodule, we never need to create ModuleMacros.
+  if (BuildingSubmoduleStack.empty())
+return false;
+  // If we are tracking module macro visibility even for textually-included
+  // headers, we need ModuleMacros.
+  if (getLangOpts().ModulesLocalVisibility)
+return true;
+  // Otherwise, we only need module macros if we're actually compiling a module
+  // interface.
+  return getLangOpts().CompilingModule;
+}
+
 void Preprocessor::LeaveSubmodule() {
   auto &Info = BuildingSubmoduleStack.back();
 
   Module *LeavingMod = Info.M;
   SourceLocation ImportLoc = Info.ImportLoc;
 
-  if ((!getLangOpts().CompilingModule ||
-   LeavingMod->getTopLevelModuleName() != getLangOpts().CurrentModule) &&
-  !getLangOpts().ModulesLocalVisibility) {
-// Fast path: if we're leaving a modular header that we included textually

Re: [PATCH] SemaCXX: Support templates in availability attributes

2016-02-23 Thread Duncan P. N. Exon Smith via cfe-commits

> On 2016-Feb-23, at 11:18, Aaron Ballman  wrote:
> 
> On Tue, Feb 23, 2016 at 1:52 PM, Manman Ren  wrote:
>> This patch looks good to me. But I am not sure if Aaron has any comment.
>> 
>> On Feb 22, 2016, at 6:19 PM, Duncan P. N. Exon Smith 
>> wrote:
>> 
>> 
>> On 2016-Feb-22, at 17:24, Manman Ren  wrote:
>> 
>> 
>> 
>> On Feb 8, 2016, at 8:17 PM, Duncan P. N. Exon Smith 
>> wrote:
>> 
>> This patch adds support for templates in availability attributes.
>> - If the context for an availability diagnostic is a
>> `FunctionTemplateDecl`, look through it to the `FunctionDecl`.
>> 
>> 
>> AvailabilityResult Decl::getAvailability(std::string *Message) const {
>> +  if (auto *FTD = dyn_cast(this))
>> +return FTD->getTemplatedDecl()->getAvailability(Message);
>> +
>> AvailabilityResult Result = AR_Available;
>> 
>> 
>> This looks generally correct to me.
>> The UnavailableAttr is attached to the FunctionDecl, not the
>> FunctionTemplateDecl, so looking through sounds right.
>> 
>> - Add `__has_feature(attribute_availability_in_templates)`.
>> 
>> 
>> @Aaron, any comment on this?
>> This patch adds extra support for Availability attribute (similar to
>> attribute_availability_with_strict in r261548).
>> Not sure if has_attribute can be used for this purpose.
> 
> Given that we're already using __has_feature for the rest of the
> availability attribute stuff, I think it's better to keep it all
> grouped together instead of checking for some features with
> __has_feature and others with __has_attribute.

Besides that argument, this isn't adding any attributes, just checking
how they behave.

> If I understand
> properly, this is taking code that would have previously been
> ill-formed and making it well-formed, and that's why the feature
> testing macro is required?

Exactly.  Previously this was ill-formed:
```
class Unavail __attribute__((unavailable));

template 
void foo(Unavail&) __attribute__((unavailable));
```

Same for `__attribute((availability(macosx,unavailable)))`, and other
triggers of "unavailable".

> 
> Thanks!
> 
> ~Aaron
> 
>> 
>> Manman
>> 
>> 
>> Is there anything else I should be testing to be sure availability
>> works correctly in templates?
>> 
>> 
>> Maybe
>> test()
>> calling unavailable function from an unavailable template function
>> calling an unavailable template function
>> 
>> I think these all work with the current compiler. But I am not sure if we
>> have existing test coverage.
>> 
>> 
>> Thanks for the ideas; let me know if you have any others.
>> 
>> Can you have a look at the new patch?
>> 
>> Cheers,
>> Manman
>> 
>> I'm working on a patch to add
>> availability markup to the libc++ headers, and this is the only
>> problem I've hit so far.  Anyone have thoughts on other things I
>> should test?
>> 
>> 
>> <0001-SemaCXX-Support-templates-in-availability-attributes.patch>

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


Re: [PATCH] D15636: Reduce false positives in printf/scanf format checker

2016-02-23 Thread Richard Trieu via cfe-commits
rtrieu added a comment.

A few more comments.

In http://reviews.llvm.org/D15636#358588, @AndyG wrote:

> Patch additionally re-based off r261522.


It's usually a bad idea to rebase in the middle of a string of patches.  
Phabricator isn't aware of revisions, so while a base to latest patch will show 
up fine, attempting to diff the original patch to the latest will show all the 
upstream changes as well.



Comment at: lib/Sema/SemaChecking.cpp:3279
@@ +3278,3 @@
+  void Update(signed NewFirstUncoveredArg, const Expr *StrExpr) {
+// Don't update if a previous string covers all arguments.
+if (FirstUncoveredArg == AllCovered)

Add an assert that NewFirstUncoveredArg >= 0


Comment at: lib/Sema/SemaChecking.cpp:3284-3288
@@ +3283,7 @@
+if (NewFirstUncoveredArg < 0) {
+  // A string has been found with all arguments covered, so clear out
+  // the diagnostics.
+  FirstUncoveredArg = AllCovered;
+  DiagnosticExprs.clear();
+  return;
+}

Move this to a new function "setAllCovered()"


Comment at: lib/Sema/SemaChecking.cpp:3823-3833
@@ -3822,13 +3904,1 @@
 CoveredArgs.flip();
-signed notCoveredArg = CoveredArgs.find_first();
-if (notCoveredArg >= 0) {
-  assert((unsigned)notCoveredArg < NumDataArgs);
-  if (const Expr *E = getDataArg((unsigned) notCoveredArg)) {
-SourceLocation Loc = E->getLocStart();
-if (!S.getSourceManager().isInSystemMacro(Loc)) {
-  EmitFormatDiagnostic(S.PDiag(diag::warn_printf_data_arg_not_used),
-   Loc, /*IsStringLocation*/false,
-   getFormatStringRange());
-}
-  }
-}

Use two different function calls depending on the result of the find_first().  
This also preserves the existing assert.
```
signed notCoveredArg = CoveredArgs.find_first();
if (notCoveredArg >= 0) {
  assert((unsigned)notCoveredArg < NumDataArgs);
  UncoveredArg.Update(notCoveredArg, OrigFormatExpr);
} else {
  UncoveredArg.setAllCovered();
}
```




Comment at: lib/Sema/SemaChecking.cpp:3905
@@ -3822,14 +3904,3 @@
 CoveredArgs.flip();
-signed notCoveredArg = CoveredArgs.find_first();
-if (notCoveredArg >= 0) {
-  assert((unsigned)notCoveredArg < NumDataArgs);
-  if (const Expr *E = getDataArg((unsigned) notCoveredArg)) {
-SourceLocation Loc = E->getLocStart();
-if (!S.getSourceManager().isInSystemMacro(Loc)) {
-  EmitFormatDiagnostic(S.PDiag(diag::warn_printf_data_arg_not_used),
-   Loc, /*IsStringLocation*/false,
-   getFormatStringRange());
-}
-  }
-}
+UncoveredArg.Update(CoveredArgs.find_first(), FExpr);
   }

AndyG wrote:
> Rather than `FExpr`, I think this should be `OrigFormatExpr`?
OrigFormatExpr is probably better.


Comment at: lib/Sema/SemaChecking.cpp:3923-3924
@@ +3922,4 @@
+  PartialDiagnostic PDiag = S.PDiag(diag::warn_printf_data_arg_not_used);
+  for (unsigned i = 1; i < DiagnosticExprs.size(); ++i)
+PDiag << DiagnosticExprs[i]->getSourceRange();
+

That raises the question why the first element is different from the rest.


Comment at: lib/Sema/SemaChecking.cpp:5081
@@ -4981,3 +5080,3 @@
 Type == Sema::FST_FreeBSDKPrintf))
   H.DoneProcessing();
   } else if (Type == Sema::FST_Scanf) {

Not exactly what I said, but this works too.


http://reviews.llvm.org/D15636



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


Re: [PATCH] D17183: Make TargetInfo store an actual DataLayout instead of a string.

2016-02-23 Thread James Y Knight via cfe-commits
jyknight added a comment.

Ping. I'm pretty sure you said you were going to look at this. :)


http://reviews.llvm.org/D17183



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


Re: [PATCH] D17348: Add -Wcast-calling-convention to warn when casting away calling conventions

2016-02-23 Thread Richard Trieu via cfe-commits
rtrieu added inline comments.


Comment at: lib/Sema/SemaCast.cpp:1729
@@ +1728,3 @@
+/// defined in the current TU.
+static void diagnoseCallingConvCast(Sema &Self, const ExprResult &SrcExpr,
+QualType DstType, SourceRange OpRange) {

Capitalize Diagnose like the other Diagnose functions in the file.


Comment at: lib/Sema/SemaCast.cpp:1752-1753
@@ +1751,4 @@
+  Expr *Src = SrcExpr.get()->IgnoreParenImpCasts();
+  if (auto *AddrOf = dyn_cast(Src))
+Src = AddrOf->getSubExpr()->IgnoreParenImpCasts();
+  auto *DRE = dyn_cast(Src);

Which UnaryOperator are you attempting to strip off here?  This one will strip 
off every UnaryOperator.


Comment at: lib/Sema/SemaCast.cpp:1769-1773
@@ +1768,7 @@
+  SourceLocation NameLoc = Definition->getNameInfo().getLoc();
+  SmallString<64> CCAttrText;
+  if (Self.getLangOpts().MicrosoftExt)
+(Twine("__") + DstCCName + " ").toVector(CCAttrText);
+  else
+(Twine("__attribute__((") + DstCCName + ")) ").toVector(CCAttrText);
+  Self.Diag(NameLoc, diag::note_change_calling_conv_fixit)

Usually in Sema, we uses a SmallVector backed ostream for making custom strings.
```
SmallString<64> CCAttrText;
llvm::raw_svector_ostream OS(CCAttrText);
OS << "some string";
```


http://reviews.llvm.org/D17348



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


  1   2   >