r270962 - [OPENMP] Fixed processing of '-fopenmp-version=' option and test.
Author: abataev Date: Thu May 26 23:13:39 2016 New Revision: 270962 URL: http://llvm.org/viewvc/llvm-project?rev=270962=rev Log: [OPENMP] Fixed processing of '-fopenmp-version=' option and test. Modified: cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/InitPreprocessor.cpp cfe/trunk/test/OpenMP/driver.c Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270962=270961=270962=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Thu May 26 23:13:39 2016 @@ -4864,7 +4864,6 @@ void Clang::ConstructJob(Compilation , // Forward flags for OpenMP if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ, options::OPT_fno_openmp, false)) { -Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ); switch (getOpenMPRuntime(getToolChain(), Args)) { case OMPRT_OMP: case OMPRT_IOMP5: @@ -4877,6 +4876,7 @@ void Clang::ConstructJob(Compilation , if (!Args.hasFlag(options::OPT_fopenmp_use_tls, options::OPT_fnoopenmp_use_tls, /*Default=*/true)) CmdArgs.push_back("-fnoopenmp-use-tls"); + Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ); break; default: // By default, if Clang doesn't know how to generate useful OpenMP code Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=270962=270961=270962=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 26 23:13:39 2016 @@ -1954,15 +1954,16 @@ static void ParseLangArgs(LangOptions } // Check if -fopenmp is specified. - Opts.OpenMP = Args.hasArg(options::OPT_fopenmp); + Opts.OpenMP = Args.hasArg(options::OPT_fopenmp) ? 1 : 0; Opts.OpenMPUseTLS = Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls); Opts.OpenMPIsDevice = Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device); if (Opts.OpenMP) { -if (int Version = getLastArgIntValue(Args, OPT_fopenmp_version_EQ, - Opts.OpenMP, Diags)) +int Version = +getLastArgIntValue(Args, OPT_fopenmp_version_EQ, Opts.OpenMP, Diags); +if (Version != 0) Opts.OpenMP = Version; // Provide diagnostic when a given target is not expected to be an OpenMP // device or host. Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=270962=270961=270962=diff == --- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original) +++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Thu May 26 23:13:39 2016 @@ -922,24 +922,24 @@ static void InitializePredefinedMacros(c } // OpenMP definition - if (LangOpts.OpenMP) { -// OpenMP 2.2: -// In implementations that support a preprocessor, the _OPENMP -// macro name is defined to have the decimal value mm where -// and mm are the year and the month designations of the -// version of the OpenMP API that the implementation support. -switch (LangOpts.OpenMP) { -case 40: - Builder.defineMacro("_OPENMP", "201307"); - break; -case 45: - Builder.defineMacro("_OPENMP", "201511"); - break; -default: - // Default version is OpenMP 3.1 - Builder.defineMacro("_OPENMP", "201107"); - break; -} + // OpenMP 2.2: + // In implementations that support a preprocessor, the _OPENMP + // macro name is defined to have the decimal value mm where + // and mm are the year and the month designations of the + // version of the OpenMP API that the implementation support. + switch (LangOpts.OpenMP) { + case 0: +break; + case 40: +Builder.defineMacro("_OPENMP", "201307"); +break; + case 45: +Builder.defineMacro("_OPENMP", "201511"); +break; + default: +// Default version is OpenMP 3.1 +Builder.defineMacro("_OPENMP", "201107"); +break; } // CUDA device path compilaton Modified: cfe/trunk/test/OpenMP/driver.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/driver.c?rev=270962=270961=270962=diff == --- cfe/trunk/test/OpenMP/driver.c (original) +++ cfe/trunk/test/OpenMP/driver.c Thu May 26 23:13:39 2016 @@ -8,17 +8,17 @@ // CHECK-NO-TLS: -cc1 // CHECK-NO-TLS-SAME: -fnoopenmp-use-tls // -// RUN: %clang %s -c -E -dM -fopenmp | FileCheck --check-prefix=CHECK-DEFAULT-VERSION %s -// RUN: %clang %s -c -E -dM -fopenmp
Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow
mclow.lists added a comment. Let's file a bug on this too - http://llvm.org/bugs (make it easier to find in the future) http://reviews.llvm.org/D20334 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18110: [OpenMP] Fix SEMA bug in the capture of global variables in template functions.
ABataev added a comment. Hi Daniel, Will fix it ASAP Best regards, Alexey Bataev = Software Engineer Intel Compiler Team 27.05.2016 1:33, Samuel Antao пишет: > sfantao updated the summary for this revision. > > http://reviews.llvm.org/D18110 http://reviews.llvm.org/D18110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20090: [OPENCL] Fix wrongly vla error for OpenCL array.
pxli168 added inline comments. Comment at: lib/Sema/SemaType.cpp:2055 @@ -2054,3 +2054,3 @@ - return S.VerifyIntegerConstantExpression(ArraySize, , Diagnoser, - S.LangOpts.GNUMode).isInvalid(); + return S + .VerifyIntegerConstantExpression(ArraySize, , Diagnoser, Anastasia wrote: > pxli168 wrote: > > Anastasia wrote: > > > Formatting looks weird though... may be better to leave the first line > > > unmodified? > > I felt very strange, too. But this is what clang-format gives me. > I see. clang-format doesn't take readability into account unfortunately. :) > > Let's just leave the first line of this change unmodified at least to make it > more readable. OK, I also found the clang-format can do some strange thing. Comment at: test/CodeGenOpenCL/vla.cl:1 @@ +1,2 @@ +// RUN: %clang_cc1 -emit-llvm -O0 -o - %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -DCL20 -o - %s | FileCheck %s --check-prefix=CL20 Anastasia wrote: > pxli168 wrote: > > Anastasia wrote: > > > Could we have a Sema test instead where we accept the VLA if constant AS > > > object is used and give an error otherwise? > > > > > > Also do we need to test CL2.0? We don't seem to be doing anything > > > different for that version. > > In earier than OpenCL1.2 program scope variable must reside in constant > > address space and no > > ``` > > const global int > > ``` > > can be here. > > But const global value should also not be seen as VLA either. > Why not? Could you write a complete example perhaps? I am not sure I > understand your point. > > Thanks! Oh, I mean that in OpenCL 1.2 there will be some error message with ``` const global int ``` But I want to have a test with something that not only with the constant address space. Or what you suggest is that I make all the test in OpenCL 2.0? http://reviews.llvm.org/D20090 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes
alexfh added a comment. Full context diffs, please. See http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface for instructions. Repository: rL LLVM http://reviews.llvm.org/D20714 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270952 - [Intrin.h] Sort the __read[fg]s intrinsics
Author: majnemer Date: Thu May 26 21:06:14 2016 New Revision: 270952 URL: http://llvm.org/viewvc/llvm-project?rev=270952=rev Log: [Intrin.h] Sort the __read[fg]s intrinsics No functional change is intended. Modified: cfe/trunk/lib/Headers/Intrin.h Modified: cfe/trunk/lib/Headers/Intrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=270952=270951=270952=diff == --- cfe/trunk/lib/Headers/Intrin.h (original) +++ cfe/trunk/lib/Headers/Intrin.h Thu May 26 21:06:14 2016 @@ -806,20 +806,24 @@ static __inline__ unsigned char __DEFAUL __readfsbyte(unsigned long __offset) { return *__ptr_to_addr_space(257, unsigned char, __offset); } -static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS -__readfsqword(unsigned long __offset) { - return *__ptr_to_addr_space(257, unsigned __int64, __offset); -} static __inline__ unsigned short __DEFAULT_FN_ATTRS __readfsword(unsigned long __offset) { return *__ptr_to_addr_space(257, unsigned short, __offset); } +static __inline__ unsigned __int64 __DEFAULT_FN_ATTRS +__readfsqword(unsigned long __offset) { + return *__ptr_to_addr_space(257, unsigned __int64, __offset); +} #endif #ifdef __x86_64__ static __inline__ unsigned char __DEFAULT_FN_ATTRS __readgsbyte(unsigned long __offset) { return *__ptr_to_addr_space(256, unsigned char, __offset); } +static __inline__ unsigned short __DEFAULT_FN_ATTRS +__readgsword(unsigned long __offset) { + return *__ptr_to_addr_space(256, unsigned short, __offset); +} static __inline__ unsigned long __DEFAULT_FN_ATTRS __readgsdword(unsigned long __offset) { return *__ptr_to_addr_space(256, unsigned long, __offset); @@ -828,10 +832,6 @@ static __inline__ unsigned __int64 __DEF __readgsqword(unsigned long __offset) { return *__ptr_to_addr_space(256, unsigned __int64, __offset); } -static __inline__ unsigned short __DEFAULT_FN_ATTRS -__readgsword(unsigned long __offset) { - return *__ptr_to_addr_space(256, unsigned short, __offset); -} #endif #undef __ptr_to_addr_space /**\ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270953 - [CodeGen] Don't crash when sizeof(long) != 4 for some intrins
Author: majnemer Date: Thu May 26 21:06:19 2016 New Revision: 270953 URL: http://llvm.org/viewvc/llvm-project?rev=270953=rev Log: [CodeGen] Don't crash when sizeof(long) != 4 for some intrins _InterlockedIncrement and _InterlockedDecrement have 'long' in their prototypes. We assumed 'long' was the same size as an i32 which is incorrect for other targets. This fixes PR27892. Added: cfe/trunk/test/CodeGen/pr27892.c Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=270953=270952=270953=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Thu May 26 21:06:19 2016 @@ -1884,22 +1884,24 @@ RValue CodeGenFunction::EmitBuiltinExpr( return RValue::get(Builder.CreateExtractValue(CXI, 0)); } case Builtin::BI_InterlockedIncrement: { +llvm::Type *IntTy = ConvertType(E->getType()); AtomicRMWInst *RMWI = Builder.CreateAtomicRMW( AtomicRMWInst::Add, EmitScalarExpr(E->getArg(0)), - ConstantInt::get(Int32Ty, 1), + ConstantInt::get(IntTy, 1), llvm::AtomicOrdering::SequentiallyConsistent); RMWI->setVolatile(true); -return RValue::get(Builder.CreateAdd(RMWI, ConstantInt::get(Int32Ty, 1))); +return RValue::get(Builder.CreateAdd(RMWI, ConstantInt::get(IntTy, 1))); } case Builtin::BI_InterlockedDecrement: { +llvm::Type *IntTy = ConvertType(E->getType()); AtomicRMWInst *RMWI = Builder.CreateAtomicRMW( AtomicRMWInst::Sub, EmitScalarExpr(E->getArg(0)), - ConstantInt::get(Int32Ty, 1), + ConstantInt::get(IntTy, 1), llvm::AtomicOrdering::SequentiallyConsistent); RMWI->setVolatile(true); -return RValue::get(Builder.CreateSub(RMWI, ConstantInt::get(Int32Ty, 1))); +return RValue::get(Builder.CreateSub(RMWI, ConstantInt::get(IntTy, 1))); } case Builtin::BI_InterlockedExchangeAdd: { AtomicRMWInst *RMWI = Builder.CreateAtomicRMW( @@ -1911,11 +1913,12 @@ RValue CodeGenFunction::EmitBuiltinExpr( return RValue::get(RMWI); } case Builtin::BI__readfsdword: { +llvm::Type *IntTy = ConvertType(E->getType()); Value *IntToPtr = Builder.CreateIntToPtr(EmitScalarExpr(E->getArg(0)), - llvm::PointerType::get(CGM.Int32Ty, 257)); + llvm::PointerType::get(IntTy, 257)); LoadInst *Load = -Builder.CreateAlignedLoad(IntToPtr, /*Align=*/4, /*isVolatile=*/true); +Builder.CreateDefaultAlignedLoad(IntToPtr, /*isVolatile=*/true); return RValue::get(Load); } Added: cfe/trunk/test/CodeGen/pr27892.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pr27892.c?rev=270953=auto == --- cfe/trunk/test/CodeGen/pr27892.c (added) +++ cfe/trunk/test/CodeGen/pr27892.c Thu May 26 21:06:19 2016 @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -triple x86_64-linux-gnu -fms-extensions %s -emit-llvm -o - | FileCheck %s + +long test1(long *p) { + return _InterlockedIncrement(p); +} +// CHECK-DAG: define i64 @test1( +// CHECK: %[[p_addr:.*]] = alloca i64*, align 8 +// CHECK: store i64* %p, i64** %[[p_addr]], align 8 +// CHECK: %[[p_load:.*]] = load i64*, i64** %[[p_addr]], align 8 +// CHECK: %[[atomic_add:.*]] = atomicrmw volatile add i64* %[[p_load]], i64 1 seq_cst +// CHECK: %[[res:.*]] = add i64 %[[atomic_add]], 1 +// CHECK: ret i64 %[[res]] + +long test2(long *p) { + return _InterlockedDecrement(p); +} +// CHECK-DAG: define i64 @test2( +// CHECK: %[[p_addr:.*]] = alloca i64*, align 8 +// CHECK: store i64* %p, i64** %[[p_addr]], align 8 +// CHECK: %[[p_load:.*]] = load i64*, i64** %[[p_addr]], align 8 +// CHECK: %[[atomic_sub:.*]] = atomicrmw volatile sub i64* %[[p_load]], i64 1 seq_cst +// CHECK: %[[res:.*]] = sub i64 %[[atomic_sub]], 1 +// CHECK: ret i64 %[[res]] ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow
ahatanak marked an inline comment as done. ahatanak added a comment. I spent some time debugging the code and here is what I found. The initial buffer size is 0 when strstreambuf is constructed and all six pointers are null initially. When the first character is pushed, strstreambuf::overflow allocates 4096B (which is the value of __default_alsize) and initializes the six pointers to the address of "buf". Then it bumps the current put character pointer (pptr). The other five pointers don't change. strstreambuf::overflow gets called 4095 more times and pptr is incremented every time. No new memory blocks are allocated while this happens because pptr() != epptr() after the first character is pushed. It seems that std::ends does get written to the right location (meaning buf+4096). I'm thinking ASAN doesn't catch this as an out-of-bound write because I'm using libc++ that is not instrumented. It catches the out-of-bound read because the call to strlen is intercepted (wrap_strlen) is called. http://reviews.llvm.org/D20334 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20334: [libcxx] Fix a bug in strstreambuf::overflow
ahatanak updated this revision to Diff 58740. ahatanak added a comment. Remove unused variable and add test case. http://reviews.llvm.org/D20334 Files: src/strstream.cpp test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp Index: test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp === --- /dev/null +++ test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp @@ -0,0 +1,32 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// + +// class strstreambuf + +// int overflow(int c); + +#include +#include +#include + +int main(int, char const **argv) { + std::ostrstream oss; + std::string s; + + for (int i = 0; i < 4096; ++i) +s.push_back((i % 16) + 'a'); + + oss << s << std::ends; + std::cout << oss.str(); + oss.freeze(false); + + return 0; +} Index: src/strstream.cpp === --- src/strstream.cpp +++ src/strstream.cpp @@ -171,16 +171,15 @@ ptrdiff_t ninp = gptr() - eback(); ptrdiff_t einp = egptr() - eback(); ptrdiff_t nout = pptr() - pbase(); -ptrdiff_t eout = epptr() - pbase(); if (__strmode_ & __allocated) { if (__pfree_) __pfree_(eback()); else delete [] eback(); } setg(buf, buf + ninp, buf + einp); -setp(buf + einp, buf + einp + eout); +setp(buf + einp, buf + new_size); pbump(static_cast(nout)); __strmode_ |= __allocated; } Index: test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp === --- /dev/null +++ test/std/depr/depr.str.strstreams/depr.strstreambuf/depr.strstreambuf.members/overflow.pass.cpp @@ -0,0 +1,32 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// + +// class strstreambuf + +// int overflow(int c); + +#include +#include +#include + +int main(int, char const **argv) { + std::ostrstream oss; + std::string s; + + for (int i = 0; i < 4096; ++i) +s.push_back((i % 16) + 'a'); + + oss << s << std::ends; + std::cout << oss.str(); + oss.freeze(false); + + return 0; +} Index: src/strstream.cpp === --- src/strstream.cpp +++ src/strstream.cpp @@ -171,16 +171,15 @@ ptrdiff_t ninp = gptr() - eback(); ptrdiff_t einp = egptr() - eback(); ptrdiff_t nout = pptr() - pbase(); -ptrdiff_t eout = epptr() - pbase(); if (__strmode_ & __allocated) { if (__pfree_) __pfree_(eback()); else delete [] eback(); } setg(buf, buf + ninp, buf + einp); -setp(buf + einp, buf + einp + eout); +setp(buf + einp, buf + new_size); pbump(static_cast(nout)); __strmode_ |= __allocated; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20715: [docs] Document the source-based code coverage feature
vsk created this revision. vsk added a reviewer: bogner. vsk added subscribers: kcc, cfe-commits, silvas. It would be helpful to have a user-friendly guide for code coverage. There is some overlap with [1], but this document visits issues which may affect users in more depth. Prompted by: https://llvm.org/bugs/show_bug.cgi?id=27781 [1] http://llvm.org/docs/CoverageMappingFormat.html http://reviews.llvm.org/D20715 Files: docs/SourceBasedCodeCoverage.rst Index: docs/SourceBasedCodeCoverage.rst === --- /dev/null +++ docs/SourceBasedCodeCoverage.rst @@ -0,0 +1,174 @@ +== +Source-based Code Coverage +== + +.. contents:: + :local: + +Introduction + + +This document explains how to use clang's source-based code coverage feature. +It's called "source-based" because it operates on AST and preprocessor +information directly. This allows it to generate very precise coverage data. + +Clang ships two other code coverage implementations: + +* :doc:`SanitizerCoverage` - A low-overhead tool meant for use alongside the + various sanitizers. It can provide up to edge-level coverage. + +* gcov - A GCC-compatible coverage implementation which operates on DebugInfo. + +From this point onwards "code coverage" will refer to the source-based kind. + +The code coverage workflow +== + +The code coverage workflow consists of three main steps: + +1. Compile with coverage enabled. + +2. Run the program. + +3. Create a report out of the generated profile. + +The next few sections work through a complete, copy-'n-paste friendly example +based on this program: + +.. code-block:: console + +% cat < foo.cc +#define BAR(x) ((x) || (x)) +template void foo(T x) { + for (unsigned I = 0; I < 10; ++I) { BAR(I); } +} +int main() { + foo(0); + foo(0); + return 0; +} +EOF + +Compiling with coverage enabled +=== + +To compile code with coverage enabled pass ``-fprofile-instr-generate +-fcoverage-mapping`` to the compiler: + +.. code-block:: console + +# Step 1: Compile with coverage enabled. +% cc -fprofile-instr-generate -fcoverage-mapping foo.cc -o foo + +Note that linking together code with and without coverage instrumentation is +supported: any uninstrumented code simply won't be accounted for. + +Running the instrumented program + + +The next step is to run the instrumented program. When the program exits it +will write a **raw profile** to the path specified by the ``LLVM_PROFILE_FILE`` +environment variable. If that variable does not exist the profile is written to +``./default.profraw``. + +If ``LLVM_PROFILE_FILE`` contains a path to a non-existent directory the +missing directory structure will be created. Additionally, the following +special **pattern strings** are replaced: + +* "%p" expands out to the PID. + +* "%h" expands out to the hostname of the machine running the program. + +.. code-block:: console + +# Step 2: Run the program. +% LLVM_PROFILE_FILE="foo.profraw" ./foo + +Creating coverage reports += + +Raw profiles have to be **indexed** before they can be used to generated +coverage reports: + +.. code-block:: console + +# Step 3(a): Index the raw profile. +% llvm-profdata merge -sparse foo.profraw -o foo.profdata + +There are multiple different ways to render coverage reports. One option is to +generate a line-oriented report: + +.. code-block:: console + +# Step 3(b): Create a line-oriented coverage report. +% llvm-cov show ./foo -instr-profile=foo.profdata + +This report includes a summary view as well as dedicated sub-views for +templated functions and their instantiations. For our example program, we get +distinct views for ``foo(...)`` and ``foo(...)``. If +``-show-line-counts-or-regions`` is enabled, ``llvm-cov`` displays nested +region counts (even in macro expansions): + +.. code-block:: console + + 20|1|#define BAR(x) ((x) || (x)) + ^20 ^2 +2|2|template void foo(T x) { + 22|3| for (unsigned I = 0; I < 10; ++I) { BAR(I); } + ^22 ^20 ^20^20 +1|4|} +-- +| _Z3fooIiEvT_: +| 1|2|template void foo(T x) { +| 11|3| for (unsigned I = 0; I < 10; ++I) { BAR(I); } +| ^11 ^10 ^10^10 +| 1|4|} +-- +| _Z3fooIfEvT_: +| 1|2|template void foo(T x) { +| 11|3| for (unsigned I = 0; I < 10; ++I) { BAR(I); } +| ^11 ^10 ^10^10 +| 1|4|} +-- + +It's possible to generate a file-level summary of coverage statistics (instead +of a line-oriented report) with: + +..
Re: [PATCH] D20499: [Temporary, Lifetime] Add lifetime marks for temporaries
timshen marked an inline comment as done. timshen added a comment. http://reviews.llvm.org/D20499 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20499: [Temporary, Lifetime] Add lifetime marks for temporaries
timshen updated this revision to Diff 58734. timshen added a comment. Herald added a subscriber: klimek. Used pushFullExprCleanup. microsoft-abi-eh-cleanups.cpp fails because each pushFullExprCleanup introduces a new cleanup.cond variable, even if that pushFullExprCleanup is just for lifetime marks. With LLVM optimizations turned on (e.g. -O1), these cleanup.conds get eliminated; -O0 doesn't generate lifetime marks. So there is no practical affect unless "-disable-llvm-optzns -O3" -- as the test does -- are passed together. http://reviews.llvm.org/D20499 Files: include/clang/AST/ExprCXX.h include/clang/AST/Stmt.h include/clang/Sema/CleanupInfo.h include/clang/Sema/ScopeInfo.h include/clang/Sema/Sema.h lib/AST/Expr.cpp lib/AST/ExprCXX.cpp lib/Analysis/Consumed.cpp lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprConstant.cpp lib/CodeGen/CodeGenFunction.h lib/CodeGen/EHScopeStack.h lib/Sema/Sema.cpp lib/Sema/SemaCast.cpp lib/Sema/SemaCoroutine.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaExprObjC.cpp lib/Sema/SemaInit.cpp lib/Sema/SemaLambda.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/SemaStmt.cpp lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp test/CodeGen/temporary-lifetime.cpp test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp unittests/ASTMatchers/ASTMatchersNodeTest.cpp Index: unittests/ASTMatchers/ASTMatchersNodeTest.cpp === --- unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -999,8 +999,8 @@ EXPECT_TRUE(matches("struct Foo { ~Foo(); };" "const Foo f = Foo();", varDecl(hasInitializer(exprWithCleanups(); - EXPECT_FALSE(matches("struct Foo { };" - "const Foo f = Foo();", + EXPECT_FALSE(matches("struct Foo { }; Foo a;" + "const Foo f = a;", varDecl(hasInitializer(exprWithCleanups(); } Index: test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp === --- test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp +++ test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 %s -// RUN: %clang_cc1 -std=c++11 -emit-llvm -O3 -disable-llvm-optzns %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 -check-prefix WIN32-LIFETIME %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 -check-prefix WIN32-O0 %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm -O3 -disable-llvm-optzns %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 -check-prefix WIN32-O3 -check-prefix WIN32-LIFETIME %s struct A { A(); @@ -95,40 +95,78 @@ return (cond ? TakesTwo((TakeRef(A()), A()), (TakeRef(A()), A())) : CouldThrow()); } -// WIN32-LABEL: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} { -// WIN32: alloca i1 -// WIN32: %[[arg1_cond:.*]] = alloca i1 +// WIN32-O0-LABEL: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} { +// WIN32-O0: alloca i1 +// WIN32-O0: %[[arg1_cond:.*]] = alloca i1 //Start all four cleanups as deactivated. -// WIN32: store i1 false -// WIN32: store i1 false -// WIN32: store i1 false -// WIN32: store i1 false -// WIN32: br i1 +// WIN32-O0: store i1 false +// WIN32-O0: store i1 false +// WIN32-O0: store i1 false +// WIN32-O0: store i1 false +// WIN32-O0: br i1 //True condition. -// WIN32: call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" -// WIN32: store i1 true -// WIN32: invoke void @"\01?TakeRef@@YAXABUA@@@Z" -// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" -// WIN32: store i1 true, i1* %[[arg1_cond]] -// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" -// WIN32: store i1 true -// WIN32: invoke void @"\01?TakeRef@@YAXABUA@@@Z" -// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" -// WIN32: store i1 true -// WIN32: store i1 false, i1* %[[arg1_cond]] -// WIN32: invoke i32 @"\01?TakesTwo@@YAHUA@@0@Z" +// WIN32-O0: call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" +// WIN32-O0: store i1 true +// WIN32-O0: invoke void @"\01?TakeRef@@YAXABUA@@@Z" +// WIN32-O0: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" +// WIN32-O0: store i1 true, i1* %[[arg1_cond]] +// WIN32-O0: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" +// WIN32-O0: store i1 true +// WIN32-O0: invoke void
Re: [PATCH] D20499: [Temporary, Lifetime] Add lifetime marks for temporaries
timshen updated this revision to Diff 58738. timshen added a comment. Upload the rebased patch. http://reviews.llvm.org/D20499 Files: lib/CodeGen/CGCleanup.cpp lib/CodeGen/CGDecl.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CodeGenFunction.h lib/CodeGen/EHScopeStack.h test/CodeGen/temporary-lifetime.cpp test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp Index: test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp === --- test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp +++ test/CodeGenCXX/microsoft-abi-eh-cleanups.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 %s -// RUN: %clang_cc1 -std=c++11 -emit-llvm -O3 -disable-llvm-optzns %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 -check-prefix WIN32-LIFETIME %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 -check-prefix WIN32-O0 %s +// RUN: %clang_cc1 -std=c++11 -emit-llvm -O3 -disable-llvm-optzns %s -o - -triple=i386-pc-win32 -mconstructor-aliases -fexceptions -fcxx-exceptions -fno-rtti | FileCheck -check-prefix WIN32 -check-prefix WIN32-O3 -check-prefix WIN32-LIFETIME %s struct A { A(); @@ -95,40 +95,78 @@ return (cond ? TakesTwo((TakeRef(A()), A()), (TakeRef(A()), A())) : CouldThrow()); } -// WIN32-LABEL: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} { -// WIN32: alloca i1 -// WIN32: %[[arg1_cond:.*]] = alloca i1 +// WIN32-O0-LABEL: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} { +// WIN32-O0: alloca i1 +// WIN32-O0: %[[arg1_cond:.*]] = alloca i1 //Start all four cleanups as deactivated. -// WIN32: store i1 false -// WIN32: store i1 false -// WIN32: store i1 false -// WIN32: store i1 false -// WIN32: br i1 +// WIN32-O0: store i1 false +// WIN32-O0: store i1 false +// WIN32-O0: store i1 false +// WIN32-O0: store i1 false +// WIN32-O0: br i1 //True condition. -// WIN32: call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" -// WIN32: store i1 true -// WIN32: invoke void @"\01?TakeRef@@YAXABUA@@@Z" -// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" -// WIN32: store i1 true, i1* %[[arg1_cond]] -// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" -// WIN32: store i1 true -// WIN32: invoke void @"\01?TakeRef@@YAXABUA@@@Z" -// WIN32: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" -// WIN32: store i1 true -// WIN32: store i1 false, i1* %[[arg1_cond]] -// WIN32: invoke i32 @"\01?TakesTwo@@YAHUA@@0@Z" +// WIN32-O0: call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" +// WIN32-O0: store i1 true +// WIN32-O0: invoke void @"\01?TakeRef@@YAXABUA@@@Z" +// WIN32-O0: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" +// WIN32-O0: store i1 true, i1* %[[arg1_cond]] +// WIN32-O0: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" +// WIN32-O0: store i1 true +// WIN32-O0: invoke void @"\01?TakeRef@@YAXABUA@@@Z" +// WIN32-O0: invoke x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" +// WIN32-O0: store i1 true +// WIN32-O0: store i1 false, i1* %[[arg1_cond]] +// WIN32-O0: invoke i32 @"\01?TakesTwo@@YAHUA@@0@Z" //False condition. -// WIN32: invoke i32 @"\01?CouldThrow@@YAHXZ"() +// WIN32-O0: invoke i32 @"\01?CouldThrow@@YAHXZ"() //Two normal cleanups for TakeRef args. -// WIN32: call x86_thiscallcc void @"\01??1A@@QAE@XZ"({{.*}}) -// WIN32-NOT: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ" -// WIN32: ret i32 +// WIN32-O0: call x86_thiscallcc void @"\01??1A@@QAE@XZ"({{.*}}) +// WIN32-O0-NOT: invoke x86_thiscallcc void @"\01??1A@@QAE@XZ" +// WIN32-O0: ret i32 // //Somewhere in the landing pad soup, we conditionally destroy arg1. -// WIN32: %[[isactive:.*]] = load i1, i1* %[[arg1_cond]] -// WIN32: br i1 %[[isactive]] -// WIN32: call x86_thiscallcc void @"\01??1A@@QAE@XZ"({{.*}}) -// WIN32: } +// WIN32-O0: %[[isactive:.*]] = load i1, i1* %[[arg1_cond]] +// WIN32-O0: br i1 %[[isactive]] +// WIN32-O0: call x86_thiscallcc void @"\01??1A@@QAE@XZ"({{.*}}) +// WIN32-O0: } + +// WIN32-O3-LABEL: define i32 @"\01?HasConditionalDeactivatedCleanups@@YAH_N@Z"{{.*}} { +// WIN32-O3: alloca i1 +// WIN32-O3: alloca i1 +// WIN32-O3: %[[arg1_cond:.*]] = alloca i1 +//Start all four cleanups as deactivated. +// WIN32-O3: store i1 false +// WIN32-O3: store i1 false +// WIN32-O3: store i1 false +// WIN32-O3: store i1 false +// WIN32-O3: store i1 false +// WIN32-O3: store i1 false +// WIN32-O3: br i1 +//True condition. +// WIN32-O3: call x86_thiscallcc %struct.A* @"\01??0A@@QAE@XZ" +// WIN32-O3: store i1 true +// WIN32-O3: invoke void
Re: [PATCH] D20499: [Temporary, Lifetime] Add lifetime marks for temporaries
timshen updated this revision to Diff 58737. timshen added a comment. Upload the rebased patch. http://reviews.llvm.org/D20499 Files: include/clang/AST/ExprCXX.h include/clang/AST/Stmt.h include/clang/Sema/CleanupInfo.h include/clang/Sema/ScopeInfo.h include/clang/Sema/Sema.h lib/AST/Expr.cpp lib/AST/ExprCXX.cpp lib/Analysis/Consumed.cpp lib/CodeGen/CGExprConstant.cpp lib/Sema/Sema.cpp lib/Sema/SemaCast.cpp lib/Sema/SemaCoroutine.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaExprObjC.cpp lib/Sema/SemaInit.cpp lib/Sema/SemaLambda.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/SemaStmt.cpp lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp unittests/ASTMatchers/ASTMatchersNodeTest.cpp Index: unittests/ASTMatchers/ASTMatchersNodeTest.cpp === --- unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -999,8 +999,8 @@ EXPECT_TRUE(matches("struct Foo { ~Foo(); };" "const Foo f = Foo();", varDecl(hasInitializer(exprWithCleanups(); - EXPECT_FALSE(matches("struct Foo { };" - "const Foo f = Foo();", + EXPECT_FALSE(matches("struct Foo { }; Foo a;" + "const Foo f = a;", varDecl(hasInitializer(exprWithCleanups(); } Index: lib/Serialization/ASTWriterStmt.cpp === --- lib/Serialization/ASTWriterStmt.cpp +++ lib/Serialization/ASTWriterStmt.cpp @@ -1430,7 +1430,8 @@ Record.push_back(E->getNumObjects()); for (unsigned i = 0, e = E->getNumObjects(); i != e; ++i) Record.AddDeclRef(E->getObject(i)); - + + Record.push_back(E->cleanupsHaveSideEffects()); Record.AddStmt(E->getSubExpr()); Code = serialization::EXPR_EXPR_WITH_CLEANUPS; } Index: lib/Serialization/ASTReaderStmt.cpp === --- lib/Serialization/ASTReaderStmt.cpp +++ lib/Serialization/ASTReaderStmt.cpp @@ -1448,6 +1448,7 @@ E->getTrailingObjects()[i] = ReadDeclAs(Record, Idx); + E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record[Idx++]; E->SubExpr = Reader.ReadSubExpr(); } Index: lib/Sema/SemaStmt.cpp === --- lib/Sema/SemaStmt.cpp +++ lib/Sema/SemaStmt.cpp @@ -1518,6 +1518,10 @@ // variables Increment and DRE. bool ProcessIterationStmt(Sema , Stmt* Statement, bool , DeclRefExpr *) { +if (auto Cleanups = dyn_cast(Statement)) + if (!Cleanups->cleanupsHaveSideEffects()) +Statement = Cleanups->getSubExpr(); + if (UnaryOperator *UO = dyn_cast(Statement)) { switch (UO->getOpcode()) { default: return false; @@ -2472,6 +2476,10 @@ QualType VariableType = VD->getType(); + if (auto Cleanups = dyn_cast(InitExpr)) +if (!Cleanups->cleanupsHaveSideEffects()) + InitExpr = Cleanups->getSubExpr(); + const MaterializeTemporaryExpr *MTE = dyn_cast(InitExpr); Index: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -3792,6 +3792,10 @@ } return true; } + if (auto *ExprTemp = dyn_cast(S)) +if (!ExprTemp->cleanupsHaveSideEffects()) + S = ExprTemp->getSubExpr(); + InitSrcRange = S->getSourceRange(); if (Expr *E = dyn_cast(S)) S = E->IgnoreParens(); @@ -3979,6 +3983,10 @@ SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_incr) << LCDecl; return true; } + if (auto *ExprTemp = dyn_cast(S)) +if (!ExprTemp->cleanupsHaveSideEffects()) + S = ExprTemp->getSubExpr(); + IncrementSrcRange = S->getSourceRange(); S = S->IgnoreParens(); if (auto UO = dyn_cast(S)) { Index: lib/Sema/SemaLambda.cpp === --- lib/Sema/SemaLambda.cpp +++ lib/Sema/SemaLambda.cpp @@ -1500,7 +1500,7 @@ SourceRange IntroducerRange; bool ExplicitParams; bool ExplicitResultType; - bool LambdaExprNeedsCleanups; + CleanupInfo LambdaCleanup; bool ContainsUnexpandedParameterPack; SmallVector ArrayIndexVars; SmallVectorArrayIndexStarts; @@ -1510,7 +1510,7 @@ IntroducerRange = LSI->IntroducerRange; ExplicitParams = LSI->ExplicitParams; ExplicitResultType = !LSI->HasImplicitReturnType; -LambdaExprNeedsCleanups = LSI->ExprNeedsCleanups; +LambdaCleanup = LSI->Cleanup; ContainsUnexpandedParameterPack = LSI->ContainsUnexpandedParameterPack; CallOperator->setLexicalDeclContext(Class); @@ -1591,9 +1591,8 @@ CheckCompletedCXXClass(Class); } - if (LambdaExprNeedsCleanups) -ExprNeedsCleanups = true; - + Cleanup.mergeFrom(LambdaCleanup); + LambdaExpr
[PATCH] D20714: [Clang-tidy] Fix some Include What You Use warnings; other minor fixes
Eugene.Zelenko created this revision. Eugene.Zelenko added reviewers: alexfh, hokein, etienneb. Eugene.Zelenko added a subscriber: cfe-commits. Eugene.Zelenko set the repository for this revision to rL LLVM. I checked this patch on my own build on RHEL 6. Regressions were OK. Repository: rL LLVM http://reviews.llvm.org/D20714 Files: clang-tidy/ClangTidy.cpp clang-tidy/ClangTidy.h clang-tidy/ClangTidyDiagnosticConsumer.cpp clang-tidy/ClangTidyDiagnosticConsumer.h clang-tidy/ClangTidyModule.cpp clang-tidy/ClangTidyModule.h clang-tidy/ClangTidyOptions.cpp clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.h clang-tidy/llvm/HeaderGuardCheck.cpp clang-tidy/llvm/HeaderGuardCheck.h clang-tidy/tool/ClangTidyMain.cpp clang-tidy/utils/OptionsUtils.cpp clang-tidy/utils/OptionsUtils.h Index: clang-tidy/tool/ClangTidyMain.cpp === --- clang-tidy/tool/ClangTidyMain.cpp +++ clang-tidy/tool/ClangTidyMain.cpp @@ -16,11 +16,26 @@ //===--===// #include "../ClangTidy.h" +#include "../ClangTidyDiagnosticConsumer.h" +#include "../ClangTidyOptions.h" #include "clang/Tooling/CommonOptionsParser.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/ErrorOr.h" +#include "llvm/Support/FileSystem.h" #include "llvm/Support/Process.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/Support/Timer.h" +#include +#include +#include +#include +#include +#include using namespace clang::ast_matchers; -using namespace clang::driver; using namespace clang::tooling; using namespace llvm; Index: clang-tidy/ClangTidyOptions.cpp === --- clang-tidy/ClangTidyOptions.cpp +++ clang-tidy/ClangTidyOptions.cpp @@ -10,13 +10,18 @@ #include "ClangTidyOptions.h" #include "ClangTidyModuleRegistry.h" #include "clang/Basic/LLVM.h" +#include "llvm/ADT/None.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/Twine.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/Errc.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #include "llvm/Support/YAMLTraits.h" #include "llvm/Support/raw_ostream.h" +#include +#include +#include #include #define DEBUG_TYPE "clang-tidy-options" @@ -50,6 +55,7 @@ IO.mapRequired("name", File.Name); IO.mapOptional("lines", File.LineRanges); } + static StringRef validate(IO , FileFilter ) { if (File.Name.empty()) return "No file name specified"; @@ -72,12 +78,14 @@ NOptionMap(IO &) {} NOptionMap(IO &, const ClangTidyOptions::OptionMap ) : Options(OptionMap.begin(), OptionMap.end()) {} + ClangTidyOptions::OptionMap denormalize(IO &) { ClangTidyOptions::OptionMap Map; for (const auto : Options) Map[KeyValue.first] = KeyValue.second; return Map; } + std::vector Options; }; Index: clang-tidy/ClangTidyModule.h === --- clang-tidy/ClangTidyModule.h +++ clang-tidy/ClangTidyModule.h @@ -14,8 +14,10 @@ #include "llvm/ADT/StringRef.h" #include #include +#include #include -#include +#include +#include "ClangTidyOptions.h" namespace clang { namespace tidy { Index: clang-tidy/llvm/HeaderGuardCheck.cpp === --- clang-tidy/llvm/HeaderGuardCheck.cpp +++ clang-tidy/llvm/HeaderGuardCheck.cpp @@ -8,6 +8,10 @@ //===--===// #include "HeaderGuardCheck.h" +#include "clang/Tooling/Tooling.h" +#include +#include +#include namespace clang { namespace tidy { Index: clang-tidy/llvm/HeaderGuardCheck.h === --- clang-tidy/llvm/HeaderGuardCheck.h +++ clang-tidy/llvm/HeaderGuardCheck.h @@ -11,6 +11,8 @@ #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_HEADER_GUARD_CHECK_H #include "../utils/HeaderGuard.h" +#include "llvm/ADT/StringRef.h" +#include namespace clang { namespace tidy { Index: clang-tidy/ClangTidyModule.cpp === --- clang-tidy/ClangTidyModule.cpp +++ clang-tidy/ClangTidyModule.cpp @@ -12,6 +12,8 @@ //===--===// #include "ClangTidyModule.h" +#include "ClangTidy.h" +#include "ClangTidyDiagnosticConsumer.h" namespace clang { namespace tidy { Index: clang-tidy/ClangTidy.h === --- clang-tidy/ClangTidy.h +++ clang-tidy/ClangTidy.h @@ -14,12 +14,18 @@ #include "ClangTidyOptions.h" #include
Re: [PATCH] D20428: Tracking exception specification source locations
rsmith added inline comments. Comment at: include/clang/AST/TypeLoc.h:1251 @@ -1250,2 +1250,3 @@ SourceLocation RParenLoc; + SourceRange ExceptionSpecRange; SourceLocation LocalRangeEnd; Can you arrange things so we only store this if there is an exception specification? Or, failing that, at least only store it for a `FunctionProtoTypeLoc`. http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20428: Tracking exception specification source locations
rsmith added a comment. Seems reasonable to me. Comment at: lib/Parse/ParseDeclCXX.cpp:3403-3427 @@ -3402,5 +3402,6 @@ // recovery, but emit a diagnostic and don't store the results. - SourceRange NoexceptRange; + SourceRange NoexceptRange(Tok.getLocation(), +Tok.getEndLoc().getLocWithOffset(-1)); ExceptionSpecificationType NoexceptType = EST_None; SourceLocation KeywordLoc = ConsumeToken(); @@ -3423,6 +3424,5 @@ } else { // There is no argument. NoexceptType = EST_BasicNoexcept; -NoexceptRange = SourceRange(KeywordLoc, KeywordLoc); } This change seems strange: 1) We should be using normal token-based ranges here; the `getEndLoc().getLocWithOffset(-1)` doesn't make sense. 2) This specifies a range for the error case, where we produce an exception specification of `EST_None`. We should not have a `NoexceptRange` if we're recovering as if there were no `noexcept`. Can you revert the changes to this file? http://reviews.llvm.org/D20428 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations
bryanpkc updated this revision to Diff 58723. bryanpkc added a comment. Re-added test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/crtbegin.o. http://reviews.llvm.org/D14727 Files: lib/Driver/ToolChains.cpp test/Driver/Inputs/gcc_version_parsing5/ test/Driver/Inputs/gcc_version_parsing5/bin/ test/Driver/Inputs/gcc_version_parsing5/bin/.keep test/Driver/Inputs/gcc_version_parsing5/lib/ test/Driver/Inputs/gcc_version_parsing5/lib/gcc/ test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/ test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/ test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/crtbegin.o test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/5/ test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/5/crtbegin.o test/Driver/linux-ld.c Index: test/Driver/linux-ld.c === --- test/Driver/linux-ld.c +++ test/Driver/linux-ld.c @@ -388,6 +388,15 @@ // CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" // CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99{{/|}}crtbegin.o" // CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=i386-unknown-linux -m32 \ +// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing5/bin \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION5 %s +// CHECK-GCC-VERSION5: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-GCC-VERSION5: "{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5{{/|}}crtbegin.o" +// CHECK-GCC-VERSION5: "-L{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5" // // Test a simulated installation of libc++ on Linux, both through sysroot and // the installation path of Clang. Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -1298,13 +1298,16 @@ if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0) return BadVersion; GoodVersion.MajorStr = First.first.str(); + if (First.second.empty()) +return GoodVersion; if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 0) return BadVersion; GoodVersion.MinorStr = Second.first.str(); // First look for a number prefix and parse that if present. Otherwise just // stash the entire patch string in the suffix, and leave the number // unspecified. This covers versions strings such as: + // 5(handled above) // 4.4 // 4.4.0 // 4.4.x Index: test/Driver/linux-ld.c === --- test/Driver/linux-ld.c +++ test/Driver/linux-ld.c @@ -388,6 +388,15 @@ // CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" // CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99{{/|}}crtbegin.o" // CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=i386-unknown-linux -m32 \ +// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing5/bin \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION5 %s +// CHECK-GCC-VERSION5: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-GCC-VERSION5: "{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5{{/|}}crtbegin.o" +// CHECK-GCC-VERSION5: "-L{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5" // // Test a simulated installation of libc++ on Linux, both through sysroot and // the installation path of Clang. Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -1298,13 +1298,16 @@ if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0) return BadVersion; GoodVersion.MajorStr = First.first.str(); + if (First.second.empty()) +return GoodVersion; if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 0) return BadVersion; GoodVersion.MinorStr = Second.first.str(); // First look for a number prefix and parse that if present. Otherwise just // stash the entire patch string in the suffix, and leave the number // unspecified. This covers versions strings such as: + // 5(handled above) // 4.4 // 4.4.0 // 4.4.x
r270940 - OpenMPClause.h: Fix r270882. [-Wdocumentation]
Author: chapuni Date: Thu May 26 19:15:11 2016 New Revision: 270940 URL: http://llvm.org/viewvc/llvm-project?rev=270940=rev Log: OpenMPClause.h: Fix r270882. [-Wdocumentation] Modified: cfe/trunk/include/clang/AST/OpenMPClause.h Modified: cfe/trunk/include/clang/AST/OpenMPClause.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=270940=270939=270940=diff == --- cfe/trunk/include/clang/AST/OpenMPClause.h (original) +++ cfe/trunk/include/clang/AST/OpenMPClause.h Thu May 26 19:15:11 2016 @@ -4077,8 +4077,8 @@ public: /// \brief Creates clause with a list of variables \a Vars. /// /// \param C AST context. - /// \brief StartLoc Starting location of the clause. - /// \brief EndLoc Ending location of the clause. + /// \param StartLoc Starting location of the clause. + /// \param EndLoc Ending location of the clause. /// \param Vars The original expression used in the clause. /// \param Declarations Declarations used in the clause. /// \param ComponentLists Component lists used in the clause. @@ -4181,8 +4181,8 @@ public: /// \brief Creates clause with a list of variables \a Vars. /// /// \param C AST context. - /// \brief StartLoc Starting location of the clause. - /// \brief EndLoc Ending location of the clause. + /// \param StartLoc Starting location of the clause. + /// \param EndLoc Ending location of the clause. /// \param Vars The original expression used in the clause. /// \param Declarations Declarations used in the clause. /// \param ComponentLists Component lists used in the clause. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations
jroelofs added a comment. In http://reviews.llvm.org/D14727#441758, @bryanpkc wrote: > Fixed the code to set GoodVersion.MajorStr before returning, and removed an > unnecessary file > (test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/crtbegin.o). That file is not unnecessary... The test is to make sure that if there are multiple versions installed in the same spot, that the latest one is picked up. http://reviews.llvm.org/D14727 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14727: [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations
bryanpkc updated this revision to Diff 58722. bryanpkc added a comment. Fixed the code to set GoodVersion.MajorStr before returning, and removed an unnecessary file (test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/4.9.2/crtbegin.o). http://reviews.llvm.org/D14727 Files: lib/Driver/ToolChains.cpp test/Driver/Inputs/gcc_version_parsing5/ test/Driver/Inputs/gcc_version_parsing5/bin/ test/Driver/Inputs/gcc_version_parsing5/bin/.keep test/Driver/Inputs/gcc_version_parsing5/lib/ test/Driver/Inputs/gcc_version_parsing5/lib/gcc/ test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/ test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/5/ test/Driver/Inputs/gcc_version_parsing5/lib/gcc/i386-unknown-linux/5/crtbegin.o test/Driver/linux-ld.c Index: test/Driver/linux-ld.c === --- test/Driver/linux-ld.c +++ test/Driver/linux-ld.c @@ -388,6 +388,15 @@ // CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" // CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99{{/|}}crtbegin.o" // CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=i386-unknown-linux -m32 \ +// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing5/bin \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION5 %s +// CHECK-GCC-VERSION5: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-GCC-VERSION5: "{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5{{/|}}crtbegin.o" +// CHECK-GCC-VERSION5: "-L{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5" // // Test a simulated installation of libc++ on Linux, both through sysroot and // the installation path of Clang. Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -1298,13 +1298,16 @@ if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0) return BadVersion; GoodVersion.MajorStr = First.first.str(); + if (First.second.empty()) +return GoodVersion; if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 0) return BadVersion; GoodVersion.MinorStr = Second.first.str(); // First look for a number prefix and parse that if present. Otherwise just // stash the entire patch string in the suffix, and leave the number // unspecified. This covers versions strings such as: + // 5(handled above) // 4.4 // 4.4.0 // 4.4.x Index: test/Driver/linux-ld.c === --- test/Driver/linux-ld.c +++ test/Driver/linux-ld.c @@ -388,6 +388,15 @@ // CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" // CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99{{/|}}crtbegin.o" // CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=i386-unknown-linux -m32 \ +// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing5/bin \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION5 %s +// CHECK-GCC-VERSION5: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-GCC-VERSION5: "{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5{{/|}}crtbegin.o" +// CHECK-GCC-VERSION5: "-L{{.*}}/Inputs/gcc_version_parsing5/bin/../lib/gcc/i386-unknown-linux/5" // // Test a simulated installation of libc++ on Linux, both through sysroot and // the installation path of Clang. Index: lib/Driver/ToolChains.cpp === --- lib/Driver/ToolChains.cpp +++ lib/Driver/ToolChains.cpp @@ -1298,13 +1298,16 @@ if (First.first.getAsInteger(10, GoodVersion.Major) || GoodVersion.Major < 0) return BadVersion; GoodVersion.MajorStr = First.first.str(); + if (First.second.empty()) +return GoodVersion; if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 0) return BadVersion; GoodVersion.MinorStr = Second.first.str(); // First look for a number prefix and parse that if present. Otherwise just // stash the entire patch string in the suffix, and leave the number // unspecified. This covers versions strings such as: + // 5(handled above) // 4.4 // 4.4.0 // 4.4.x ___ cfe-commits mailing list cfe-commits@lists.llvm.org
[PATCH] D20710: Lit C++11 Compatibility Patch #9
tigerleapgorge created this revision. tigerleapgorge added a reviewer: rsmith. tigerleapgorge added a subscriber: cfe-commits. Hi everyone, I am back again with Lit test C++11 compatibility patch #9. 30 tests are updated this time. They are follows. CXX/basic/basic.stc/basic.stc.dynamic/p2-noexceptions.cpp Operator delete’s throwing prototype has changed. (C++ standard 18.6 [support.dynamic]) C++98 prototype: void operator delete (void* ptr) throw(); C++11 prototype: void operator delete (void* ptr) noexcept; This test redeclares operator delete without “noexcept” Added the following expected Warning for C++11 (2 instances) C++11: warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch] CXX/basic/basic.stc/basic.stc.dynamic/p2.cpp Operator new’s throwing prototype has changed: C++98 prototype: void* operator new (std::size_t size) throw (std::bad_alloc); C++11 prototype: void* operator new (std::size_t size); This test declares operator new with “throw(std::bad_alloc)” then redeclares operator new again without a throw. In C++11 the redeclaration is the same as the prototype. Restricted the following to warning C++98. C++98: warning: 'operator new' is missing exception specification 'throw(std::bad_alloc)' [-Wmissing-exception-spec] note: previous declaration is here Operator delete’s throwing prototype has also changed (see previous test p2-noexceptions.cpp for prototypes): This test declares operator delete with “throw()”, then redeclares operator delete without a throw. Expect the following change in diagnostics. C++98: warning: 'operator delete' is missing exception specification 'throw()' [-Wmissing-exception-spec] note: previous declaration is here C++11: warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch] note: previous declaration is here CXX/class.access/class.friend/p1.cpp This test verifies when a class befriends another class. C++11’s “constexpr” feature interferes with Clang’s “befriend implicitly-declared members” feature. This test contains 2 parts: test6 and test7. Test6: (r101122 – “Allow classes to befriend implicitly-declared members.”) Struct A is declared as POD. Struct B befriends A’s implicitly-declared constructor. This amounts to a re-declaration of struct A with a different const-ness. Therefore, add the following diagnostics to the expected diagnostics. C++11: error: non-constexpr declaration of 'A' follows constexpr declaration note: previous declaration is here For test7: (r101173 – “Support befriending members of class template specializations.”) This test is intended to verify A’s private constructor inside struct template X’s specialization. However, struct X’s constructor and destructor are explicitly declared, struct X’s copy-constructor is implicitly declared. When class A befriends X’s implicitly declared copy-constructor, Clang issues a similar error to that of test 6. But, this error stops the generation of subsequent errors. Since the intended target of this test are the subsequent errors, I added a struct X copy constructor declaration to stop the first error. CXX/class.access/p4.cpp When constructing a class that contains a member that cannot be initialized, C++98 and C++11 issues similar diagnostics but in opposite order. C++98 messages begin with the innermost member that failed to initialize. C++11 messages begin with the outermost constructor that was implicitly deleted. The diff here is quite large. It has 3 parts. Test2: Change in diagnostics. (2 sets) C++98: error: base class 'test2::A' has private default constructor note: declared private here note: implicit default constructor for 'test2::B' first required here C++11: error: call to implicitly-deleted default constructor of 'test2::B' note: default constructor of 'B' is implicitly deleted because base class 'test2::A' has an inaccessible default constructor C++98: error: inherited virtual base class 'test2::A' has private default constructor note: declared private here note: implicit default constructor for 'test2::D' first required here C++11: error: call to implicitly-deleted default constructor of 'test2::D' note: default constructor of 'D' is implicitly deleted because base class 'test2::A' has an inaccessible default constructor Test3: Massive reduction in diagnostics issued. Class template “Base” has a
[PATCH] D20709: Support ARM subtarget feature +long64
pirama created this revision. pirama added a reviewer: kristof.beyls. pirama added subscribers: srhines, cfe-commits. Herald added subscribers: rengolin, aemerson. Set alignment and width of long datatype to be 64-bits if the ARM subtarget feature +long64 is set. http://reviews.llvm.org/D20709 Files: lib/Basic/Targets.cpp test/CodeGen/arm-types.c Index: test/CodeGen/arm-types.c === --- /dev/null +++ test/CodeGen/arm-types.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -triple arm -DLONG_SIZE_AND_ALIGN=4 +// RUN: %clang_cc1 -triple arm -target-feature +long64 -DLONG_SIZE_AND_ALIGN=8 + +_Static_assert(sizeof(long) == LONG_SIZE_AND_ALIGN, "sizeof long is wrong"); +_Static_assert(_Alignof(long) == LONG_SIZE_AND_ALIGN, "alignof long is wrong"); Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -4955,6 +4955,8 @@ Unaligned = 0; } else if (Feature == "+fp16") { HW_FP |= HW_FP_HP; + } else if (Feature == "+long64") { +LongWidth = LongAlign = 64; } } HW_FP &= ~HW_FP_remove; Index: test/CodeGen/arm-types.c === --- /dev/null +++ test/CodeGen/arm-types.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -triple arm -DLONG_SIZE_AND_ALIGN=4 +// RUN: %clang_cc1 -triple arm -target-feature +long64 -DLONG_SIZE_AND_ALIGN=8 + +_Static_assert(sizeof(long) == LONG_SIZE_AND_ALIGN, "sizeof long is wrong"); +_Static_assert(_Alignof(long) == LONG_SIZE_AND_ALIGN, "alignof long is wrong"); Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -4955,6 +4955,8 @@ Unaligned = 0; } else if (Feature == "+fp16") { HW_FP |= HW_FP_HP; + } else if (Feature == "+long64") { +LongWidth = LongAlign = 64; } } HW_FP &= ~HW_FP_remove; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20626: [Clang][AVX512][intrinsics] Adding missing intrinsics div_pd and div_ps
craig.topper added a subscriber: craig.topper. Comment at: test/CodeGen/avx512f-builtins.c:1927 @@ +1926,3 @@ + // check-label: @test_mm512_div_pd + // check: @llvm.x86.avx512.mask.div.pd.512 + return _mm512_div_pd(__a,__b); delena wrote: > I don't understand how do you receive intrinsic if you issue IR. The word "check" being in lowercase causes filecheck to ignore it so it isn't being checked. http://reviews.llvm.org/D20626 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18110: [OpenMP] Fix SEMA bug in the capture of global variables in template functions.
sfantao updated this revision to Diff 58704. sfantao updated the summary for this revision. sfantao added a comment. Remove most of the logic in the first diff. It is no longer necessary given that all firstprivate captures are now passed by value no matter the directive they are captured in. Still, there is a small fix related with template function and capture of globals. http://reviews.llvm.org/D18110 Files: lib/Sema/SemaOpenMP.cpp test/OpenMP/target_codegen_global_capture.cpp Index: test/OpenMP/target_codegen_global_capture.cpp === --- test/OpenMP/target_codegen_global_capture.cpp +++ test/OpenMP/target_codegen_global_capture.cpp @@ -21,6 +21,11 @@ // CHECK-DAG: [[BB:@.+]] = internal global float 1.00e+01 // CHECK-DAG: [[BC:@.+]] = internal global float 1.10e+01 // CHECK-DAG: [[BD:@.+]] = internal global float 1.20e+01 +// CHECK-DAG: [[TBA:@.+]] = {{.*}}global float 1.70e+01 +// CHECK-DAG: [[TBB:@.+]] = {{.*}}global float 1.80e+01 +// CHECK-DAG: [[TBC:@.+]] = {{.*}}global float 1.90e+01 +// CHECK-DAG: [[TBD:@.+]] = {{.*}}global float 2.00e+01 + double Ga = 1.0; double Gb = 2.0; double Gc = 3.0; @@ -42,14 +47,14 @@ static float Sd = 8.0; // CHECK-DAG:[[VALLB:%.+]] = load i16, i16* [[LB]], - // CHECK-64-DAG: [[VALGB:%.+]] = load double, double* @Gb, - // CHECK-DAG:[[VALFB:%.+]] = load float, float* @_ZZ3fooE2Sb, - // CHECK-64-DAG: [[VALGC:%.+]] = load double, double* @Gc, + // CHECK-64-DAG: [[VALGB:%.+]] = load double, double* [[GB]], + // CHECK-DAG:[[VALFB:%.+]] = load float, float* [[FB]], + // CHECK-64-DAG: [[VALGC:%.+]] = load double, double* [[GC]], // CHECK-DAG:[[VALLC:%.+]] = load i16, i16* [[LC]], - // CHECK-DAG:[[VALFC:%.+]] = load float, float* @_ZZ3fooE2Sc, + // CHECK-DAG:[[VALFC:%.+]] = load float, float* [[FC]], // CHECK-DAG:[[VALLD:%.+]] = load i16, i16* [[LD]], - // CHECK-64-DAG: [[VALGD:%.+]] = load double, double* @Gd, - // CHECK-DAG:[[VALFD:%.+]] = load float, float* @_ZZ3fooE2Sd, + // CHECK-64-DAG: [[VALGD:%.+]] = load double, double* [[GD]], + // CHECK-DAG:[[VALFD:%.+]] = load float, float* [[FD]], // 3 local vars being captured. @@ -178,14 +183,156 @@ #pragma omp parallel { // CHECK-DAG:[[VALLB:%.+]] = load i16, i16* [[LLB]], -// CHECK-64-DAG: [[VALGB:%.+]] = load double, double* @Gb, -// CHECK-DAG:[[VALFB:%.+]] = load float, float* @_ZZ3barE2Sb, -// CHECK-64-DAG: [[VALGC:%.+]] = load double, double* @Gc, +// CHECK-64-DAG: [[VALGB:%.+]] = load double, double* [[GB]], +// CHECK-DAG:[[VALFB:%.+]] = load float, float* [[BB]], +// CHECK-64-DAG: [[VALGC:%.+]] = load double, double* [[GC]], +// CHECK-DAG:[[VALLC:%.+]] = load i16, i16* [[LLC]], +// CHECK-DAG:[[VALFC:%.+]] = load float, float* [[BC]], +// CHECK-DAG:[[VALLD:%.+]] = load i16, i16* [[LLD]], +// CHECK-64-DAG: [[VALGD:%.+]] = load double, double* [[GD]], +// CHECK-DAG:[[VALFD:%.+]] = load float, float* [[BD]], + +// 3 local vars being captured. + +// CHECK-DAG: store i16 [[VALLB]], i16* [[CONVLB:%.+]], +// CHECK-DAG: [[CONVLB]] = bitcast i[[sz:64|32]]* [[CADDRLB:%.+]] to i16* +// CHECK-DAG: [[CVALLB:%.+]] = load i[[sz]], i[[sz]]* [[CADDRLB]], +// CHECK-DAG: [[CPTRLB:%.+]] = inttoptr i[[sz]] [[CVALLB]] to i8* +// CHECK-DAG: store i8* [[CPTRLB]], i8** [[GEPLB:%.+]], +// CHECK-DAG: [[GEPLB]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{[0-8]}} + +// CHECK-DAG: store i16 [[VALLC]], i16* [[CONVLC:%.+]], +// CHECK-DAG: [[CONVLC]] = bitcast i[[sz]]* [[CADDRLC:%.+]] to i16* +// CHECK-DAG: [[CVALLC:%.+]] = load i[[sz]], i[[sz]]* [[CADDRLC]], +// CHECK-DAG: [[CPTRLC:%.+]] = inttoptr i[[sz]] [[CVALLC]] to i8* +// CHECK-DAG: store i8* [[CPTRLC]], i8** [[GEPLC:%.+]], +// CHECK-DAG: [[GEPLC]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{[0-8]}} + +// CHECK-DAG: store i16 [[VALLD]], i16* [[CONVLD:%.+]], +// CHECK-DAG: [[CONVLD]] = bitcast i[[sz]]* [[CADDRLD:%.+]] to i16* +// CHECK-DAG: [[CVALLD:%.+]] = load i[[sz]], i[[sz]]* [[CADDRLD]], +// CHECK-DAG: [[CPTRLD:%.+]] = inttoptr i[[sz]] [[CVALLD]] to i8* +// CHECK-DAG: store i8* [[CPTRLD]], i8** [[GEPLD:%.+]], +// CHECK-DAG: [[GEPLD]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{[0-8]}} + +// 3 static vars being captured. + +// CHECK-DAG: store float [[VALFB]], float* [[CONVFB:%.+]], +// CHECK-DAG: [[CONVFB]] = bitcast i[[sz]]* [[CADDRFB:%.+]] to float* +// CHECK-DAG: [[CVALFB:%.+]] = load i[[sz]], i[[sz]]* [[CADDRFB]], +// CHECK-DAG: [[CPTRFB:%.+]] = inttoptr i[[sz]] [[CVALFB]] to i8* +// CHECK-DAG: store i8* [[CPTRFB]], i8** [[GEPFB:%.+]], +// CHECK-DAG: [[GEPFB]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{[0-8]}} + +
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
rmaprath added a comment. In http://reviews.llvm.org/D20677#441598, @EricWF wrote: > I want to take a look at this as well. I'll review it tomorrow. Thanks! will wait until we have ironed out all the details, no hurry. / Asiri http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
rmaprath added a comment. In http://reviews.llvm.org/D20677#441407, @bcraig wrote: > https://mentorembedded.github.io/cxx-abi/abi-eh.html mentions the functions, > but it doesn't really say what they are for. The C++ standard mentions when > an exception of std::bad_cast and std::bad_typeid are thrown. Put those two > documents together, and you get my earlier statements. Granted, it's just a > well informed guess, but a guess I'm pretty confident in. > > Leaving those functions in should be harmless, other than the size of the > dead code. There are also all the private type_info classes that are dead > weight if RTTI is turned off. > > While it may make sense to remove those functions, that's probably best left > for a different code review. Thanks, added that to my arsenal of references :) http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
EricWF added a reviewer: mclow.lists. EricWF added a subscriber: mclow.lists. EricWF added a comment. Adding @mclow.lists to this as well. http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r270927 - Use size_t to store the results of sizeof calculations.
Author: asiri Date: Thu May 26 16:56:04 2016 New Revision: 270927 URL: http://llvm.org/viewvc/llvm-project?rev=270927=rev Log: Use size_t to store the results of sizeof calculations. NFC. Modified: libunwind/trunk/src/config.h Modified: libunwind/trunk/src/config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=270927=270926=270927=diff == --- libunwind/trunk/src/config.h (original) +++ libunwind/trunk/src/config.h Thu May 26 16:56:04 2016 @@ -131,7 +131,7 @@ template struct check_fit { template struct blk_count { -static const uint64_t count = +static const size_t count = (sizeof(T) + sizeof(uint64_t) - 1) / sizeof(uint64_t); }; static const bool does_fit = ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
EricWF added a comment. I want to take a look at this as well. I'll review it tomorrow. http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libunwind] r270925 - Fix gcc libunwind build.
On 5/26/16 3:45 PM, Asiri Rathnayake via cfe-commits wrote: struct blk_count { -static const uint32_t count = +static const uint64_t count = (sizeof(T) + sizeof(uint64_t) - Should that be 'size_t' instead? Jon -- Jon Roelofs jonat...@codesourcery.com CodeSourcery / Mentor Embedded ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r270925 - Fix gcc libunwind build.
Author: asiri Date: Thu May 26 16:45:54 2016 New Revision: 270925 URL: http://llvm.org/viewvc/llvm-project?rev=270925=rev Log: Fix gcc libunwind build. r270692 seems to have broken gcc builds of libunwind. This is because statements like: static_assert(check_fit::does_fit, "or1k registers do not fit into unw_context_t"); Do not work when static_assert is a macro taking two parameters, the extra comma separating the template parameters confuses the pre-processor. The fix is to change those statements to: static_assert((check_fit ::does_fit), "or1k registers do not fit into unw_context_t"); Also fixed a gcc warning about a trivial un-intended narrowing. Differential revision: http://reviews.llvm.org/D20119 Modified: libunwind/trunk/src/Registers.hpp libunwind/trunk/src/UnwindCursor.hpp libunwind/trunk/src/config.h Modified: libunwind/trunk/src/Registers.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Registers.hpp?rev=270925=270924=270925=diff == --- libunwind/trunk/src/Registers.hpp (original) +++ libunwind/trunk/src/Registers.hpp Thu May 26 16:45:54 2016 @@ -87,7 +87,7 @@ private: }; inline Registers_x86::Registers_x86(const void *registers) { - static_assert(check_fit ::does_fit, + static_assert((check_fit ::does_fit), "x86 registers do not fit into unw_context_t"); memcpy(&_registers, registers, sizeof(_registers)); } @@ -281,7 +281,7 @@ private: }; inline Registers_x86_64::Registers_x86_64(const void *registers) { - static_assert(check_fit ::does_fit, + static_assert((check_fit ::does_fit), "x86_64 registers do not fit into unw_context_t"); memcpy(&_registers, registers, sizeof(_registers)); } @@ -548,7 +548,7 @@ private: }; inline Registers_ppc::Registers_ppc(const void *registers) { - static_assert(check_fit ::does_fit, + static_assert((check_fit ::does_fit), "ppc registers do not fit into unw_context_t"); memcpy(&_registers, static_cast(registers), sizeof(_registers)); @@ -1078,7 +1078,7 @@ private: }; inline Registers_arm64::Registers_arm64(const void *registers) { - static_assert(check_fit ::does_fit, + static_assert((check_fit ::does_fit), "arm64 registers do not fit into unw_context_t"); memcpy(&_registers, registers, sizeof(_registers)); static_assert(sizeof(GPRs) == 0x110, @@ -1404,7 +1404,7 @@ inline Registers_arm::Registers_arm(cons _saved_vfp_d16_d31(false), _saved_iwmmx(false), _saved_iwmmx_control(false) { - static_assert(check_fit ::does_fit, + static_assert((check_fit ::does_fit), "arm registers do not fit into unw_context_t"); // See unw_getcontext() note about data. memcpy(&_registers, registers, sizeof(_registers)); @@ -1758,7 +1758,7 @@ private: }; inline Registers_or1k::Registers_or1k(const void *registers) { - static_assert(check_fit ::does_fit, + static_assert((check_fit ::does_fit), "or1k registers do not fit into unw_context_t"); memcpy(&_registers, static_cast(registers), sizeof(_registers)); Modified: libunwind/trunk/src/UnwindCursor.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=270925=270924=270925=diff == --- libunwind/trunk/src/UnwindCursor.hpp (original) +++ libunwind/trunk/src/UnwindCursor.hpp Thu May 26 16:45:54 2016 @@ -603,7 +603,7 @@ template UnwindCursor::UnwindCursor(unw_context_t *context, A ) : _addressSpace(as), _registers(context), _unwindInfoMissing(false), _isSignalFrame(false) { - static_assert(check_fit , unw_cursor_t>::does_fit, + static_assert((check_fit , unw_cursor_t>::does_fit), "UnwindCursor<> does not fit in unw_cursor_t"); memset(&_info, 0, sizeof(_info)); } Modified: libunwind/trunk/src/config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=270925=270924=270925=diff == --- libunwind/trunk/src/config.h (original) +++ libunwind/trunk/src/config.h Thu May 26 16:45:54 2016 @@ -131,7 +131,7 @@ template struct check_fit { template struct blk_count { -static const uint32_t count = +static const uint64_t count = (sizeof(T) + sizeof(uint64_t) - 1) / sizeof(uint64_t); }; static
Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage
rmaprath added a comment. In http://reviews.llvm.org/D20119#441548, @jroelofs wrote: > In http://reviews.llvm.org/D20119#441516, @rmaprath wrote: > > > Please shout! > > > Just add some parens: > > static_assert((check_fit::does_fit), > "or1k registers do not fit into unw_context_t"); > Don't know why I didn't try that, works like a charm. Thanks! / Asiri http://reviews.llvm.org/D20119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20404: [Driver] Fix driver support for color diagnostics
LGTM. > On 2016-May-26, at 11:34, Bruno Cardoso Lopeswrote: > > bruno added a comment. > > Ping! > > > http://reviews.llvm.org/D20404 > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20404: [Driver] Fix driver support for color diagnostics
dexonsmith added a subscriber: dexonsmith. dexonsmith added a comment. LGTM. http://reviews.llvm.org/D20404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage
jroelofs added a comment. In http://reviews.llvm.org/D20119#441516, @rmaprath wrote: > Please shout! Just add some parens: static_assert((check_fit::does_fit), "or1k registers do not fit into unw_context_t"); http://reviews.llvm.org/D20119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20498: [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr
timshen updated this revision to Diff 58694. timshen marked 2 inline comments as done. timshen added a comment. Removed C++ constrain and added back the missing comment line. http://reviews.llvm.org/D20498 Files: include/clang/AST/ExprCXX.h include/clang/AST/Stmt.h include/clang/Sema/CleanupInfo.h include/clang/Sema/ScopeInfo.h include/clang/Sema/Sema.h lib/AST/Expr.cpp lib/AST/ExprCXX.cpp lib/Analysis/Consumed.cpp lib/CodeGen/CGExprConstant.cpp lib/Sema/Sema.cpp lib/Sema/SemaCast.cpp lib/Sema/SemaCoroutine.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaExprObjC.cpp lib/Sema/SemaInit.cpp lib/Sema/SemaLambda.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/SemaStmt.cpp lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp unittests/ASTMatchers/ASTMatchersNodeTest.cpp Index: unittests/ASTMatchers/ASTMatchersNodeTest.cpp === --- unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -999,8 +999,8 @@ EXPECT_TRUE(matches("struct Foo { ~Foo(); };" "const Foo f = Foo();", varDecl(hasInitializer(exprWithCleanups(); - EXPECT_FALSE(matches("struct Foo { };" - "const Foo f = Foo();", + EXPECT_FALSE(matches("struct Foo { }; Foo a;" + "const Foo f = a;", varDecl(hasInitializer(exprWithCleanups(); } Index: lib/Serialization/ASTWriterStmt.cpp === --- lib/Serialization/ASTWriterStmt.cpp +++ lib/Serialization/ASTWriterStmt.cpp @@ -1430,7 +1430,8 @@ Record.push_back(E->getNumObjects()); for (unsigned i = 0, e = E->getNumObjects(); i != e; ++i) Record.AddDeclRef(E->getObject(i)); - + + Record.push_back(E->cleanupsHaveSideEffects()); Record.AddStmt(E->getSubExpr()); Code = serialization::EXPR_EXPR_WITH_CLEANUPS; } Index: lib/Serialization/ASTReaderStmt.cpp === --- lib/Serialization/ASTReaderStmt.cpp +++ lib/Serialization/ASTReaderStmt.cpp @@ -1448,6 +1448,7 @@ E->getTrailingObjects()[i] = ReadDeclAs(Record, Idx); + E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record[Idx++]; E->SubExpr = Reader.ReadSubExpr(); } Index: lib/Sema/SemaStmt.cpp === --- lib/Sema/SemaStmt.cpp +++ lib/Sema/SemaStmt.cpp @@ -1518,6 +1518,10 @@ // variables Increment and DRE. bool ProcessIterationStmt(Sema , Stmt* Statement, bool , DeclRefExpr *) { +if (auto Cleanups = dyn_cast(Statement)) + if (!Cleanups->cleanupsHaveSideEffects()) +Statement = Cleanups->getSubExpr(); + if (UnaryOperator *UO = dyn_cast(Statement)) { switch (UO->getOpcode()) { default: return false; @@ -2472,6 +2476,10 @@ QualType VariableType = VD->getType(); + if (auto Cleanups = dyn_cast(InitExpr)) +if (!Cleanups->cleanupsHaveSideEffects()) + InitExpr = Cleanups->getSubExpr(); + const MaterializeTemporaryExpr *MTE = dyn_cast(InitExpr); Index: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -3792,6 +3792,10 @@ } return true; } + if (auto *ExprTemp = dyn_cast(S)) +if (!ExprTemp->cleanupsHaveSideEffects()) + S = ExprTemp->getSubExpr(); + InitSrcRange = S->getSourceRange(); if (Expr *E = dyn_cast(S)) S = E->IgnoreParens(); @@ -3979,6 +3983,10 @@ SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_incr) << LCDecl; return true; } + if (auto *ExprTemp = dyn_cast(S)) +if (!ExprTemp->cleanupsHaveSideEffects()) + S = ExprTemp->getSubExpr(); + IncrementSrcRange = S->getSourceRange(); S = S->IgnoreParens(); if (auto UO = dyn_cast(S)) { Index: lib/Sema/SemaLambda.cpp === --- lib/Sema/SemaLambda.cpp +++ lib/Sema/SemaLambda.cpp @@ -1500,7 +1500,7 @@ SourceRange IntroducerRange; bool ExplicitParams; bool ExplicitResultType; - bool LambdaExprNeedsCleanups; + CleanupInfo LambdaCleanup; bool ContainsUnexpandedParameterPack; SmallVector ArrayIndexVars; SmallVectorArrayIndexStarts; @@ -1510,7 +1510,7 @@ IntroducerRange = LSI->IntroducerRange; ExplicitParams = LSI->ExplicitParams; ExplicitResultType = !LSI->HasImplicitReturnType; -LambdaExprNeedsCleanups = LSI->ExprNeedsCleanups; +LambdaCleanup = LSI->Cleanup; ContainsUnexpandedParameterPack = LSI->ContainsUnexpandedParameterPack; CallOperator->setLexicalDeclContext(Class); @@ -1591,9 +1591,8 @@ CheckCompletedCXXClass(Class); } - if (LambdaExprNeedsCleanups) -
Re: [PATCH] D20119: [libunwind] Improve unwinder stack usage
rmaprath added a comment. Looks like this patch breakes gcc builds of libunwind (none of the bots seem to test it though). The problem is two-fold, in `src/config.h` we have: // Define static_assert() unless already defined by compiler. #ifndef __has_feature #define __has_feature(__x) 0 #endif #if !(__has_feature(cxx_static_assert)) && !defined(static_assert) #define static_assert(__b, __m) \ extern int compile_time_assert_failed[ ( __b ) ? 1 : -1 ] \ __attribute__( ( unused ) ); #endif This is not optimal for gcc when targeting `-std=c++11`, `!defined(static_assert)` will be false even though the `static_assert` keyword is present. We can easily fix this by checking for the `__cplusplus` version instead. But there is still a problem for compilers that does not support the `static_assert` keyword, which has to resort to using this macro version of `static_assert(x,y)`. The problem here is that statements like: static_assert(check_fit::does_fit, "or1k registers do not fit into unw_context_t"); Do not fit into that macro (it thinks we're passing three arguments to a macro that accepts only two - because of the additional comma in the template argument list). I don't see an easy way to address this other than reverting some of the work done in the previous patch. Do many people care about building libunwind with a compiler that does not support `static_assert` keyword? If not, I'd prefer to let this slip and get rid of the `static_assert` macro definition. Please shout! http://reviews.llvm.org/D20119 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20498: [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr
rsmith added inline comments. Comment at: lib/Sema/SemaInit.cpp:6197 @@ +6196,3 @@ + // but there may be a chance to merge them. + if (getLangOpts().CPlusPlus) +Cleanup.setExprNeedsCleanups(false); Why is this C++-only? We presumably would want to clean up after materialized temporaries in other languages if they ever get created. Comment at: lib/Sema/SemaInit.cpp:6461 @@ -6460,3 +6477,2 @@ - // If we're binding to an Objective-C object that has lifetime, we // need cleanups. Likewise if we're extending this temporary to automatic Accidentally-deleted? http://reviews.llvm.org/D20498 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270904 - Produce better pretty stack traces from crashes in template instantiation: add
Author: rsmith Date: Thu May 26 15:23:13 2016 New Revision: 270904 URL: http://llvm.org/viewvc/llvm-project?rev=270904=rev Log: Produce better pretty stack traces from crashes in template instantiation: add pretty stack trace entries for all cases where we instantiate the definition of something, and include the fully-qualified name with template arguments in the name of the instantiated entity. Modified: cfe/trunk/lib/Sema/Sema.cpp cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Modified: cfe/trunk/lib/Sema/Sema.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=270904=270903=270904=diff == --- cfe/trunk/lib/Sema/Sema.cpp (original) +++ cfe/trunk/lib/Sema/Sema.cpp Thu May 26 15:23:13 2016 @@ -1265,10 +1265,10 @@ void PrettyDeclStackTraceEntry::print(ra } OS << Message; - if (TheDecl && isa(TheDecl)) { -std::string Name = cast(TheDecl)->getNameAsString(); -if (!Name.empty()) - OS << " '" << Name << '\''; + if (auto *ND = dyn_cast_or_null(TheDecl)) { +OS << " '"; +ND->getNameForDiagnostic(OS, ND->getASTContext().getPrintingPolicy(), true); +OS << "'"; } OS << '\n'; Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=270904=270903=270904=diff == --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu May 26 15:23:13 2016 @@ -21,6 +21,7 @@ #include "clang/Sema/DeclSpec.h" #include "clang/Sema/Initialization.h" #include "clang/Sema/Lookup.h" +#include "clang/Sema/PrettyDeclStackTrace.h" #include "clang/Sema/Template.h" #include "clang/Sema/TemplateDeduction.h" @@ -1955,6 +1956,8 @@ Sema::InstantiateClass(SourceLocation Po InstantiatingTemplate Inst(*this, PointOfInstantiation, Instantiation); if (Inst.isInvalid()) return true; + PrettyDeclStackTraceEntry CrashInfo(*this, Instantiation, SourceLocation(), + "instantiating class definition"); // Enter the scope of this instantiation. We don't use // PushDeclContext because we don't have a scope. @@ -2178,6 +2181,8 @@ bool Sema::InstantiateEnum(SourceLocatio InstantiatingTemplate Inst(*this, PointOfInstantiation, Instantiation); if (Inst.isInvalid()) return true; + PrettyDeclStackTraceEntry CrashInfo(*this, Instantiation, SourceLocation(), + "instantiating enum definition"); // The instantiation is visible here, even if it was first declared in an // unimported module. @@ -2250,6 +2255,8 @@ bool Sema::InstantiateInClassInitializer InstantiatingTemplate Inst(*this, PointOfInstantiation, Instantiation); if (Inst.isInvalid()) return true; + PrettyDeclStackTraceEntry CrashInfo(*this, Instantiation, SourceLocation(), + "instantiating default member init"); // Enter the scope of this instantiation. We don't use PushDeclContext because // we don't have a scope. Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=270904=270903=270904=diff == --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu May 26 15:23:13 2016 @@ -3649,6 +3649,8 @@ void Sema::InstantiateFunctionDefinition InstantiatingTemplate Inst(*this, PointOfInstantiation, Function); if (Inst.isInvalid()) return; + PrettyDeclStackTraceEntry CrashInfo(*this, Function, SourceLocation(), + "instantiating function definition"); // Copy the inner loc start from the pattern. Function->setInnerLocStart(PatternDecl->getInnerLocStart()); @@ -4033,6 +4035,8 @@ void Sema::InstantiateVariableDefinition InstantiatingTemplate Inst(*this, PointOfInstantiation, Var); if (Inst.isInvalid()) return; + PrettyDeclStackTraceEntry CrashInfo(*this, Var, SourceLocation(), + "instantiating variable initializer"); // If we're performing recursive template instantiation, create our own // queue of pending implicit instantiations that we will instantiate @@ -4160,6 +4164,8 @@ void Sema::InstantiateVariableDefinition InstantiatingTemplate Inst(*this, PointOfInstantiation, Var); if (Inst.isInvalid()) return; + PrettyDeclStackTraceEntry CrashInfo(*this, Var, SourceLocation(), + "instantiating variable definition"); // If we're performing recursive template instantiation, create our own
Re: [PATCH] D20498: [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr
timshen marked 7 inline comments as done. Comment at: lib/Sema/SemaInit.cpp:6190-6191 @@ +6189,4 @@ + MaterializeTemporaryExpr(T, Temporary, BoundToLvalueReference); + + // Order an ExprWithCleanups for lifetime marks. + // > Please also sink the calls to mark the destructor referenced and check its > access into here too. We should keep the checks for a usable destructor and > the triggering of an ExprWithCleanups for the destructor together. As discussed, MaybeBindToTemporary more or less overlaps with this in the access checking perspective. Added a TODO for a potential merge of MaterializeTemporaryExpr and BindToCXXTemporary in the future. > I think this may set ExprNeedsCleanups even when unnecessary, if the MTE is > lifetime-extended (I think you only actually want an ExprWithCleanups if the > storage duration is SD_Automatic). We can't really deal with that here, > because we don't know the storage duration of the MTE yet, but please add a > FIXME here to not set ExprNeedsCleanups if the temporary is lifetime-extended. Due to the use of pushCleanupAfterFullExpr in CodeGen::EmitMaterializeTemporaryExpr, there has to have a RunCleanupsScope at FullExpr level to delay and forward the cleanups to its upper level. So even for lifetime-extended variables, the cleanup scope is necessary. http://reviews.llvm.org/D20498 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20498: [Temporary] Add an ExprWithCleanups for each C++ MaterializeTemporaryExpr
timshen updated this revision to Diff 58676. timshen added a comment. Update to reflect the comments. http://reviews.llvm.org/D20498 Files: include/clang/AST/ExprCXX.h include/clang/AST/Stmt.h include/clang/Sema/CleanupInfo.h include/clang/Sema/ScopeInfo.h include/clang/Sema/Sema.h lib/AST/Expr.cpp lib/AST/ExprCXX.cpp lib/Analysis/Consumed.cpp lib/CodeGen/CGExprConstant.cpp lib/Sema/Sema.cpp lib/Sema/SemaCast.cpp lib/Sema/SemaCoroutine.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaExprCXX.cpp lib/Sema/SemaExprObjC.cpp lib/Sema/SemaInit.cpp lib/Sema/SemaLambda.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/SemaStmt.cpp lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp unittests/ASTMatchers/ASTMatchersNodeTest.cpp Index: unittests/ASTMatchers/ASTMatchersNodeTest.cpp === --- unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -999,8 +999,8 @@ EXPECT_TRUE(matches("struct Foo { ~Foo(); };" "const Foo f = Foo();", varDecl(hasInitializer(exprWithCleanups(); - EXPECT_FALSE(matches("struct Foo { };" - "const Foo f = Foo();", + EXPECT_FALSE(matches("struct Foo { }; Foo a;" + "const Foo f = a;", varDecl(hasInitializer(exprWithCleanups(); } Index: lib/Serialization/ASTWriterStmt.cpp === --- lib/Serialization/ASTWriterStmt.cpp +++ lib/Serialization/ASTWriterStmt.cpp @@ -1430,7 +1430,8 @@ Record.push_back(E->getNumObjects()); for (unsigned i = 0, e = E->getNumObjects(); i != e; ++i) Record.AddDeclRef(E->getObject(i)); - + + Record.push_back(E->cleanupsHaveSideEffects()); Record.AddStmt(E->getSubExpr()); Code = serialization::EXPR_EXPR_WITH_CLEANUPS; } Index: lib/Serialization/ASTReaderStmt.cpp === --- lib/Serialization/ASTReaderStmt.cpp +++ lib/Serialization/ASTReaderStmt.cpp @@ -1448,6 +1448,7 @@ E->getTrailingObjects()[i] = ReadDeclAs(Record, Idx); + E->ExprWithCleanupsBits.CleanupsHaveSideEffects = Record[Idx++]; E->SubExpr = Reader.ReadSubExpr(); } Index: lib/Sema/SemaStmt.cpp === --- lib/Sema/SemaStmt.cpp +++ lib/Sema/SemaStmt.cpp @@ -1518,6 +1518,10 @@ // variables Increment and DRE. bool ProcessIterationStmt(Sema , Stmt* Statement, bool , DeclRefExpr *) { +if (auto Cleanups = dyn_cast(Statement)) + if (!Cleanups->cleanupsHaveSideEffects()) +Statement = Cleanups->getSubExpr(); + if (UnaryOperator *UO = dyn_cast(Statement)) { switch (UO->getOpcode()) { default: return false; @@ -2472,6 +2476,10 @@ QualType VariableType = VD->getType(); + if (auto Cleanups = dyn_cast(InitExpr)) +if (!Cleanups->cleanupsHaveSideEffects()) + InitExpr = Cleanups->getSubExpr(); + const MaterializeTemporaryExpr *MTE = dyn_cast(InitExpr); Index: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -3792,6 +3792,10 @@ } return true; } + if (auto *ExprTemp = dyn_cast(S)) +if (!ExprTemp->cleanupsHaveSideEffects()) + S = ExprTemp->getSubExpr(); + InitSrcRange = S->getSourceRange(); if (Expr *E = dyn_cast(S)) S = E->IgnoreParens(); @@ -3979,6 +3983,10 @@ SemaRef.Diag(DefaultLoc, diag::err_omp_loop_not_canonical_incr) << LCDecl; return true; } + if (auto *ExprTemp = dyn_cast(S)) +if (!ExprTemp->cleanupsHaveSideEffects()) + S = ExprTemp->getSubExpr(); + IncrementSrcRange = S->getSourceRange(); S = S->IgnoreParens(); if (auto UO = dyn_cast(S)) { Index: lib/Sema/SemaLambda.cpp === --- lib/Sema/SemaLambda.cpp +++ lib/Sema/SemaLambda.cpp @@ -1500,7 +1500,7 @@ SourceRange IntroducerRange; bool ExplicitParams; bool ExplicitResultType; - bool LambdaExprNeedsCleanups; + CleanupInfo LambdaCleanup; bool ContainsUnexpandedParameterPack; SmallVector ArrayIndexVars; SmallVectorArrayIndexStarts; @@ -1510,7 +1510,7 @@ IntroducerRange = LSI->IntroducerRange; ExplicitParams = LSI->ExplicitParams; ExplicitResultType = !LSI->HasImplicitReturnType; -LambdaExprNeedsCleanups = LSI->ExprNeedsCleanups; +LambdaCleanup = LSI->Cleanup; ContainsUnexpandedParameterPack = LSI->ContainsUnexpandedParameterPack; CallOperator->setLexicalDeclContext(Class); @@ -1591,9 +1591,8 @@ CheckCompletedCXXClass(Class); } - if (LambdaExprNeedsCleanups) -ExprNeedsCleanups = true; - + Cleanup.mergeFrom(LambdaCleanup); +
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
bcraig added a comment. LGTM. Probably want a "LGTM" from at least one other person though. In http://reviews.llvm.org/D20677#441085, @rmaprath wrote: > In http://reviews.llvm.org/D20677#441061, @jroelofs wrote: > > > This is the canonical reference for the Itanium ABI: > > https://mentorembedded.github.io/cxx-abi/abi.html > > > I was indeed looking at this, but couldn't find those exact function > signatures (or something that looks like it). Perhaps it's covered there as a > more general concept. I'll have a read. https://mentorembedded.github.io/cxx-abi/abi-eh.html mentions the functions, but it doesn't really say what they are for. The C++ standard mentions when an exception of std::bad_cast and std::bad_typeid are thrown. Put those two documents together, and you get my earlier statements. Granted, it's just a well informed guess, but a guess I'm pretty confident in. Leaving those functions in should be harmless, other than the size of the dead code. There are also all the private type_info classes that are dead weight if RTTI is turned off. While it may make sense to remove those functions, that's probably best left for a different code review. http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20626: [Clang][AVX512][intrinsics] Adding missing intrinsics div_pd and div_ps
delena added inline comments. Comment at: test/CodeGen/avx512f-builtins.c:1927 @@ +1926,3 @@ + // check-label: @test_mm512_div_pd + // check: @llvm.x86.avx512.mask.div.pd.512 + return _mm512_div_pd(__a,__b); I don't understand how do you receive intrinsic if you issue IR. http://reviews.llvm.org/D20626 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270897 - Re-commit r270748 "clang-cl: Treat dllimport explicit template instantiation definitions as declarations (PR27810, PR27811)"
Author: hans Date: Thu May 26 14:42:56 2016 New Revision: 270897 URL: http://llvm.org/viewvc/llvm-project?rev=270897=rev Log: Re-commit r270748 "clang-cl: Treat dllimport explicit template instantiation definitions as declarations (PR27810, PR27811)" Also make explicit instantiation decls not apply to nested classes when targeting MSVC. That dll attributes are not inherited by inner classes might be the explanation for MSVC's behaviour here. Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp cfe/trunk/test/CodeGenCXX/dllexport.cpp cfe/trunk/test/CodeGenCXX/dllimport.cpp cfe/trunk/test/CodeGenCXX/explicit-instantiation.cpp cfe/trunk/test/SemaTemplate/extern-templates.cpp Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=270897=270896=270897=diff == --- cfe/trunk/lib/Sema/SemaTemplate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu May 26 14:42:56 2016 @@ -7367,6 +7367,29 @@ Sema::ActOnExplicitInstantiation(Scope * } } + // In MSVC mode, dllimported explicit instantiation definitions are treated as + // instantiation declarations for most purposes. + bool DLLImportExplicitInstantiationDef = false; + if (TSK == TSK_ExplicitInstantiationDefinition && + Context.getTargetInfo().getCXXABI().isMicrosoft()) { +// Check for dllimport class template instantiation definitions. +bool DLLImport = +ClassTemplate->getTemplatedDecl()->getAttr(); +for (AttributeList *A = Attr; A; A = A->getNext()) { + if (A->getKind() == AttributeList::AT_DLLImport) +DLLImport = true; + if (A->getKind() == AttributeList::AT_DLLExport) { +// dllexport trumps dllimport here. +DLLImport = false; +break; + } +} +if (DLLImport) { + TSK = TSK_ExplicitInstantiationDeclaration; + DLLImportExplicitInstantiationDef = true; +} + } + // Translate the parser's template argument list in our AST format. TemplateArgumentListInfo TemplateArgs(LAngleLoc, RAngleLoc); translateTemplateArguments(TemplateArgsIn, TemplateArgs); @@ -7420,6 +7443,12 @@ Sema::ActOnExplicitInstantiation(Scope * Specialization->setLocation(TemplateNameLoc); PrevDecl = nullptr; } + +if (PrevDecl_TSK == TSK_ExplicitInstantiationDeclaration && +DLLImportExplicitInstantiationDef) { + // The new specialization might add a dllimport attribute. + HasNoEffect = false; +} } if (!Specialization) { @@ -7497,11 +7526,11 @@ Sema::ActOnExplicitInstantiation(Scope * Specialization->getDefinition()); if (Def) { TemplateSpecializationKind Old_TSK = Def->getTemplateSpecializationKind(); - // Fix a TSK_ExplicitInstantiationDeclaration followed by a // TSK_ExplicitInstantiationDefinition if (Old_TSK == TSK_ExplicitInstantiationDeclaration && -TSK == TSK_ExplicitInstantiationDefinition) { +(TSK == TSK_ExplicitInstantiationDefinition || + DLLImportExplicitInstantiationDef)) { // FIXME: Need to notify the ASTMutationListener that we did this. Def->setTemplateSpecializationKind(TSK); Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=270897=270896=270897=diff == --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu May 26 14:42:56 2016 @@ -2542,6 +2542,13 @@ Sema::InstantiateClassMembers(SourceLoca == TSK_ExplicitSpecialization) continue; + if (Context.getTargetInfo().getCXXABI().isMicrosoft() && + TSK == TSK_ExplicitInstantiationDeclaration) { +// In MSVC mode, explicit instantiation decl of the outer class doesn't +// affect the inner class. +continue; + } + if (CheckSpecializationInstantiationRedecl(PointOfInstantiation, TSK, Record, MSInfo->getTemplateSpecializationKind(), Modified: cfe/trunk/test/CodeGenCXX/dllexport.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllexport.cpp?rev=270897=270896=270897=diff == --- cfe/trunk/test/CodeGenCXX/dllexport.cpp (original) +++ cfe/trunk/test/CodeGenCXX/dllexport.cpp Thu May 26 14:42:56 2016 @@ -844,6 +844,11 @@ struct __declspec(dllexport) B { // M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FB@pr26490@@QAEXXZ" } +// dllexport trumps dllexport on an explicit instantiation. +template struct
Re: [PATCH] D20336: [AMDGPU] Remove individual debugger options + update features
kzhuravl added a comment. http://reviews.llvm.org/rL270895 Repository: rL LLVM http://reviews.llvm.org/D20336 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20336: [AMDGPU] Remove individual debugger options + update features
This revision was automatically updated to reflect the committed changes. Closed by commit rL270895: [AMDGPU] Remove individual debugger options + update features (authored by kzhuravl). Changed prior to commit: http://reviews.llvm.org/D20336?vs=57518=58668#toc Repository: rL LLVM http://reviews.llvm.org/D20336 Files: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/amdgpu-features.c Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -1475,10 +1475,6 @@ Group, HelpText<"Generate additional code for specified of debugger ABI (AMDGPU only)">, MetaVarName<"">; -def mamdgpu_debugger_insert_nops : Flag<["-"], "mamdgpu-debugger-insert-nops">, - Group; -def mamdgpu_debugger_reserve_trap_regs : Flag<["-"], "mamdgpu-debugger-reserve-trap-regs">, - Group; def mvsx : Flag<["-"], "mvsx">, Group; def mno_vsx : Flag<["-"], "mno-vsx">, Group; Index: cfe/trunk/test/Driver/amdgpu-features.c === --- cfe/trunk/test/Driver/amdgpu-features.c +++ cfe/trunk/test/Driver/amdgpu-features.c @@ -1,21 +1,7 @@ -// Check handling of AMDGPU target features. -// -// -mamdgpu-debugger-abi=0.0 // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=0.0 %s -o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-0-0 %s // CHECK-MAMDGPU-DEBUGGER-ABI-0-0: the clang compiler does not support '-mamdgpu-debugger-abi=0.0' -// -// -mamdgpu-debugger-abi=1.0 + // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=1.0 %s -o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s -// CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-reserve-trap-regs" -// -// -mamdgpu-debugger-insert-nops -// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-insert-nops %s -o 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-INSERT-NOPS %s -// CHECK-MAMDGPU-DEBUGGER-INSERT-NOPS: "-target-feature" "+amdgpu-debugger-insert-nops" -// -// -mamdgpu-debugger-reserve-trap-regs -// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-reserve-trap-regs %s -o 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-RESERVE-TRAP-REGS %s -// CHECK-MAMDGPU-DEBUGGER-RESERVE-TRAP-REGS: "-target-feature" "+amdgpu-debugger-reserve-trap-regs" +// CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-reserve-regs" "-target-feature" "+amdgpu-debugger-emit-prologue" Index: cfe/trunk/lib/Driver/Tools.cpp === --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -2463,7 +2463,8 @@ StringRef value = dAbi->getValue(); if (value == "1.0") { Features.push_back("+amdgpu-debugger-insert-nops"); - Features.push_back("+amdgpu-debugger-reserve-trap-regs"); + Features.push_back("+amdgpu-debugger-reserve-regs"); + Features.push_back("+amdgpu-debugger-emit-prologue"); } else { D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args); } Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -1475,10 +1475,6 @@ Group, HelpText<"Generate additional code for specified of debugger ABI (AMDGPU only)">, MetaVarName<"">; -def mamdgpu_debugger_insert_nops : Flag<["-"], "mamdgpu-debugger-insert-nops">, - Group; -def mamdgpu_debugger_reserve_trap_regs : Flag<["-"], "mamdgpu-debugger-reserve-trap-regs">, - Group; def mvsx : Flag<["-"], "mvsx">, Group; def mno_vsx : Flag<["-"], "mno-vsx">, Group; Index: cfe/trunk/test/Driver/amdgpu-features.c === --- cfe/trunk/test/Driver/amdgpu-features.c +++ cfe/trunk/test/Driver/amdgpu-features.c @@ -1,21 +1,7 @@ -// Check handling of AMDGPU target features. -// -// -mamdgpu-debugger-abi=0.0 // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=0.0 %s -o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-0-0 %s // CHECK-MAMDGPU-DEBUGGER-ABI-0-0: the clang compiler does not support '-mamdgpu-debugger-abi=0.0' -// -// -mamdgpu-debugger-abi=1.0 + // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=1.0 %s -o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s -// CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops"
r270895 - [AMDGPU] Remove individual debugger options + update features
Author: kzhuravl Date: Thu May 26 14:36:39 2016 New Revision: 270895 URL: http://llvm.org/viewvc/llvm-project?rev=270895=rev Log: [AMDGPU] Remove individual debugger options + update features Differential Revision: http://reviews.llvm.org/D20336 Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/amdgpu-features.c Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=270895=270894=270895=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Thu May 26 14:36:39 2016 @@ -1475,10 +1475,6 @@ def mamdgpu_debugger_abi : Joined<["-"], Group, HelpText<"Generate additional code for specified of debugger ABI (AMDGPU only)">, MetaVarName<"">; -def mamdgpu_debugger_insert_nops : Flag<["-"], "mamdgpu-debugger-insert-nops">, - Group; -def mamdgpu_debugger_reserve_trap_regs : Flag<["-"], "mamdgpu-debugger-reserve-trap-regs">, - Group; def mvsx : Flag<["-"], "mvsx">, Group; def mno_vsx : Flag<["-"], "mno-vsx">, Group; Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=270895=270894=270895=diff == --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Thu May 26 14:36:39 2016 @@ -2463,7 +2463,8 @@ static void getAMDGPUTargetFeatures(cons StringRef value = dAbi->getValue(); if (value == "1.0") { Features.push_back("+amdgpu-debugger-insert-nops"); - Features.push_back("+amdgpu-debugger-reserve-trap-regs"); + Features.push_back("+amdgpu-debugger-reserve-regs"); + Features.push_back("+amdgpu-debugger-emit-prologue"); } else { D.Diag(diag::err_drv_clang_unsupported) << dAbi->getAsString(Args); } Modified: cfe/trunk/test/Driver/amdgpu-features.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/amdgpu-features.c?rev=270895=270894=270895=diff == --- cfe/trunk/test/Driver/amdgpu-features.c (original) +++ cfe/trunk/test/Driver/amdgpu-features.c Thu May 26 14:36:39 2016 @@ -1,21 +1,7 @@ -// Check handling of AMDGPU target features. -// -// -mamdgpu-debugger-abi=0.0 // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=0.0 %s -o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-0-0 %s // CHECK-MAMDGPU-DEBUGGER-ABI-0-0: the clang compiler does not support '-mamdgpu-debugger-abi=0.0' -// -// -mamdgpu-debugger-abi=1.0 + // RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-abi=1.0 %s -o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-ABI-1-0 %s -// CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-reserve-trap-regs" -// -// -mamdgpu-debugger-insert-nops -// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-insert-nops %s -o 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-INSERT-NOPS %s -// CHECK-MAMDGPU-DEBUGGER-INSERT-NOPS: "-target-feature" "+amdgpu-debugger-insert-nops" -// -// -mamdgpu-debugger-reserve-trap-regs -// RUN: %clang -### -target amdgcn -x cl -S -emit-llvm -mcpu=kaveri -mamdgpu-debugger-reserve-trap-regs %s -o 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-MAMDGPU-DEBUGGER-RESERVE-TRAP-REGS %s -// CHECK-MAMDGPU-DEBUGGER-RESERVE-TRAP-REGS: "-target-feature" "+amdgpu-debugger-reserve-trap-regs" +// CHECK-MAMDGPU-DEBUGGER-ABI-1-0: "-target-feature" "+amdgpu-debugger-insert-nops" "-target-feature" "+amdgpu-debugger-reserve-regs" "-target-feature" "+amdgpu-debugger-emit-prologue" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20499: [Temporary, Lifetime] Add lifetime marks for temporaries
rsmith added inline comments. Comment at: lib/CodeGen/CGExpr.cpp:446 @@ +445,3 @@ + case SD_FullExpression: +EHStack.pushCleanup(NormalEHLifetimeMarker, Object, + Size); This should use pushFullExprCleanup. http://reviews.llvm.org/D20499 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19274: Compilation for Intel MCU (Part 2/3)
aturetsk added inline comments. Comment at: lib/Driver/Tools.cpp:3657 @@ +3656,3 @@ + if (IsIAMCU && types::isCXX(Input.getType())) +D.Diag(diag::err_drv_cxx_not_supported) << getToolChain().getTriple().str(); + bruno wrote: > aturetsk wrote: > > bruno wrote: > > > Taking a look at this again I don't think there's a real need for a new > > > diagnostic here; instead of adding diag::err_drv_cxx_not_supported, you > > > can do something similar to: > > > > > > D.Diag(diag::err_drv_clang_unsupported) << "C++ is not supported with > > > -miamcu" > > > > > > Otherwise, LGTM! > > The best thing I could come up with is this: > > ``` > > D.Diag(diag::err_drv_clang_unsupported) << "C++ for IAMCU"; > > ``` > > This code makes the error message look like this: > > ``` > > error: the clang compiler does not support 'C++ for IAMCU' > > ``` > > As you can see the message is a bit crooked. Do you thinks it's better to > > keep it this way? > Sorry, but I didn't mean you should change the message. My only point here is > that I don't see the need for adding a new diagnostic, you can still keep > something more similar with your old intent, example: > > D.Diag(diag::err_drv_clang_unsupported) << "C++ for target" << > getToolChain().getTriple().str(); My concern is not the change in the message :) My concern is redundant quotation marks which look a bit ugly and out of place. But if you're OK with them, so would I. http://reviews.llvm.org/D19274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270886 - [OpenMP] Codegen for target update directive.
Author: sfantao Date: Thu May 26 13:30:22 2016 New Revision: 270886 URL: http://llvm.org/viewvc/llvm-project?rev=270886=rev Log: [OpenMP] Codegen for target update directive. Summary: This patch implements the code generation for the `target update` directive. The implemntation relies on the logic already in place for target data standalone directives, i.e. target enter/exit data. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D20650 Added: cfe/trunk/test/OpenMP/target_update_codegen.cpp Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntime.h cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=270886=270885=270886=diff == --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original) +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu May 26 13:30:22 2016 @@ -660,6 +660,9 @@ enum OpenMPRTLFunction { // Call to void __tgt_target_data_end(int32_t device_id, int32_t arg_num, // void** args_base, void **args, size_t *arg_sizes, int32_t *arg_types); OMPRTL__tgt_target_data_end, + // Call to void __tgt_target_data_update(int32_t device_id, int32_t arg_num, + // void** args_base, void **args, size_t *arg_sizes, int32_t *arg_types); + OMPRTL__tgt_target_data_update, }; /// A basic class for pre|post-action for advanced codegen sequence for OpenMP @@ -1609,6 +1612,20 @@ CGOpenMPRuntime::createRuntimeFunction(u RTLFn = CGM.CreateRuntimeFunction(FnTy, "__tgt_target_data_end"); break; } + case OMPRTL__tgt_target_data_update: { +// Build void __tgt_target_data_update(int32_t device_id, int32_t arg_num, +// void** args_base, void **args, size_t *arg_sizes, int32_t *arg_types); +llvm::Type *TypeParams[] = {CGM.Int32Ty, +CGM.Int32Ty, +CGM.VoidPtrPtrTy, +CGM.VoidPtrPtrTy, +CGM.SizeTy->getPointerTo(), +CGM.Int32Ty->getPointerTo()}; +llvm::FunctionType *FnTy = +llvm::FunctionType::get(CGM.VoidTy, TypeParams, /*isVarArg*/ false); +RTLFn = CGM.CreateRuntimeFunction(FnTy, "__tgt_target_data_update"); +break; + } } assert(RTLFn && "Unable to find OpenMP runtime function"); return RTLFn; @@ -5347,13 +5364,27 @@ public: // declaration in a single chunk so that we can generate the map flags // correctly. Therefore, we organize all lists in a map. llvm::DenseMap> Info; + +// Helper function to fill the information map for the different supported +// clauses. +auto & = +[](const ValueDecl *D, +OMPClauseMappableExprCommon::MappableExprComponentListRef L, +OpenMPMapClauseKind MapType, OpenMPMapClauseKind MapModifier) { + const ValueDecl *VD = + D ? cast(D->getCanonicalDecl()) : nullptr; + Info[VD].push_back({L, MapType, MapModifier}); +}; + for (auto *C : Directive.getClausesOfKind()) - for (auto L : C->component_lists()) { -const ValueDecl *VD = -L.first ? cast(L.first->getCanonicalDecl()) : nullptr; -Info[VD].push_back( -{L.second, C->getMapType(), C->getMapTypeModifier()}); - } + for (auto L : C->component_lists()) +InfoGen(L.first, L.second, C->getMapType(), C->getMapTypeModifier()); +for (auto *C : Directive.getClausesOfKind()) + for (auto L : C->component_lists()) +InfoGen(L.first, L.second, OMPC_MAP_to, OMPC_MAP_unknown); +for (auto *C : Directive.getClausesOfKind()) + for (auto L : C->component_lists()) +InfoGen(L.first, L.second, OMPC_MAP_from, OMPC_MAP_unknown); for (auto : Info) { // We need to know when we generate information for the first component @@ -6128,15 +6159,16 @@ void CGOpenMPRuntime::emitTargetDataCall } } -void CGOpenMPRuntime::emitTargetEnterOrExitDataCall( +void CGOpenMPRuntime::emitTargetDataStandAloneCall( CodeGenFunction , const OMPExecutableDirective , const Expr *IfCond, const Expr *Device) { if (!CGF.HaveInsertPoint()) return; assert((isa(D) || - isa(D)) && - "Expecting either target enter or exit data directives."); + isa(D) || + isa(D)) && + "Expecting either target enter, exit data, or update directives."); // Generate the code for the opening of the data environment. auto & = [, , Device](CodeGenFunction , PrePostActionTy &) { @@ -6147,8 +6179,8 @@ void CGOpenMPRuntime::emitTargetEnterOrE MappableExprsHandler::MapFlagsArrayTy MapTypes; // Get map clause information. -MappableExprsHandler MCHandler(D, CGF); -
Re: [PATCH] D20650: [OpenMP] Codegen for target update directive.
sfantao updated this revision to Diff 58658. sfantao added a comment. - Adapt target update tests bits to reflect latest changes in the trunk. http://reviews.llvm.org/D20650 Files: lib/CodeGen/CGOpenMPRuntime.cpp lib/CodeGen/CGOpenMPRuntime.h lib/CodeGen/CGStmtOpenMP.cpp test/OpenMP/target_update_codegen.cpp Index: test/OpenMP/target_update_codegen.cpp === --- /dev/null +++ test/OpenMP/target_update_codegen.cpp @@ -0,0 +1,245 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +///==/// +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fomptargets=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 -fomptargets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fomptargets=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 -fomptargets=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 -fomptargets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fomptargets=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 34] + +// CK1: [[SIZE02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4] +// CK1: [[MTYPE02:@.+]] = {{.+}}constant [1 x i32] [i32 33] + +// CK1: [[MTYPE03:@.+]] = {{.+}}constant [1 x i32] [i32 34] + +// CK1: [[SIZE04:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] 24] +// CK1: [[MTYPE04:@.+]] = {{.+}}constant [2 x i32] [i32 33, i32 17] + +// CK1-LABEL: _Z3fooi +void foo(int arg) { + int la; + float lb[arg]; + + // Region 00 + // CK1-DAG: call void @__tgt_target_data_update(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 update if(1+3-5) device(arg) from(gc) + {++arg;} + + // Region 01 + // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1 + #pragma omp target update 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_update(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 update to(arg) if(arg) device(4) + {++arg;} + + // CK1: %{{.+}} = add nsw i32 %{{[^,]+}}, 1 + {++arg;} + + // Region 03 + // CK1-DAG: call void @__tgt_target_data_update(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 {{.+}}[[P:%[^,]+]] + // CK1-DAG: [[GEPS]] =
Re: [PATCH] D20451: [Parser] Fix look ahead after EOF while parsing objc message and lambdas
bruno added a comment. Ping! http://reviews.llvm.org/D20451 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20404: [Driver] Fix driver support for color diagnostics
bruno added a comment. Ping! http://reviews.llvm.org/D20404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20675: Compilation for Intel MCU (Part 3/3)
bruno accepted this revision. bruno added a comment. This revision is now accepted and ready to land. LGTM http://reviews.llvm.org/D20675 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19274: Compilation for Intel MCU (Part 2/3)
bruno added inline comments. Comment at: lib/Driver/Tools.cpp:3657 @@ +3656,3 @@ + if (IsIAMCU && types::isCXX(Input.getType())) +D.Diag(diag::err_drv_cxx_not_supported) << getToolChain().getTriple().str(); + aturetsk wrote: > bruno wrote: > > Taking a look at this again I don't think there's a real need for a new > > diagnostic here; instead of adding diag::err_drv_cxx_not_supported, you can > > do something similar to: > > > > D.Diag(diag::err_drv_clang_unsupported) << "C++ is not supported with > > -miamcu" > > > > Otherwise, LGTM! > The best thing I could come up with is this: > ``` > D.Diag(diag::err_drv_clang_unsupported) << "C++ for IAMCU"; > ``` > This code makes the error message look like this: > ``` > error: the clang compiler does not support 'C++ for IAMCU' > ``` > As you can see the message is a bit crooked. Do you thinks it's better to > keep it this way? Sorry, but I didn't mean you should change the message. My only point here is that I don't see the need for adding a new diagnostic, you can still keep something more similar with your old intent, example: D.Diag(diag::err_drv_clang_unsupported) << "C++ for target" << getToolChain().getTriple().str(); http://reviews.llvm.org/D19274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: [PATCH] D20681: Add target-specific pre-linking passes to Clang
+Jeff To cite some of the previous discussions (http://lists.llvm.org/pipermail/cfe-dev/2016-May/048822.html ) Brian: On our side, we use such pre-link passes to interface with the specifics of our built-in function library. For example, we transform printf calls into a form that interacts with our library. We also transform calls to pipe functions, kernel enqueue related functions, and transform calls to the atomic functions to corresponding LLVM atomic instructions (and keep track of the memory scope elsewhere currently). You may have noticed that we have a proposal out to enable the atomic instructions to directly carry a memory scope. Jeff: We have similar passes related to builtin functions but they are rather specific to our implementation and not too complex. Thanks. Sam -Original Message- From: Liu, Yaxun (Sam) Sent: Thursday, May 26, 2016 11:44 AM To: reviews+d20681+public+7364792746786...@reviews.llvm.org; rich...@metafoo.co.uk; anastasia.stul...@arm.com Cc: Stellard, Thomas; cfe-commits@lists.llvm.org; Sumner, Brian Subject: RE: [PATCH] D20681: Add target-specific pre-linking passes to Clang + Brian -Original Message- From: Tom Stellard [mailto:thomas.stell...@amd.com] Sent: Thursday, May 26, 2016 11:11 AM To: Liu, Yaxun (Sam) ; rich...@metafoo.co.uk; anastasia.stul...@arm.com Cc: Stellard, Thomas ; cfe-commits@lists.llvm.org Subject: Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang tstellarAMD added a comment. Can you give some examples of what pre-link passes may be required? http://reviews.llvm.org/D20681 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20683: [MSVC2015] Fix mangling for static variables initialization guards
rnk accepted this revision. rnk added a reviewer: rnk. rnk added a comment. This revision is now accepted and ready to land. lgtm, agreed, looks like an oversight. http://reviews.llvm.org/D20683 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18575: [clang-tidy] New checker to replace deprecated throw() specifications
hintonda added a comment. Please see http://reviews.llvm.org/D20693 for an alternative approach. http://reviews.llvm.org/D18575 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types
pirama added inline comments. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7900 @@ -7897,1 +7899,3 @@ +def ext_opencl_ext_vector_type_rgba_selector: ExtWarn< + "vector component name '%0' is an OpenCL 2.2 extension">; } // end of sema category Anastasia wrote: > Could it be an error instead for CL <2.2? It isn't a valid feature and we > have already rejected similar cases with an error. > > How about changing to something like: > "vector component name '%0' is not supported in earlier than OpenCL version > 2.2" > > See similar diagnostics above - err_opencl_invalid_read_write, > err_opencl_unknown_type_specifier. > > Using extension might be confusing because we have core spec and extension > spec in OpenCL. Since .rgba is just a syntactic feature in the frontend that requires no support from the runtime, should this be an error? Making this an ExtWarn, like Richard suggested, will reject these under -pedantic-errors. But I'll let you make this call. I'll update the diagnostic message to the following, if that's ok: > "vector component name '%0' cannot be used earlier than OpenCL version 2.2. http://reviews.llvm.org/D20602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20693: New checker to replace dynamic exception specifications
hintonda created this revision. hintonda added reviewers: alexfh, aaron.ballman. hintonda added subscribers: etienneb, Eugene.Zelenko, cfe-commits. [clang-tidy] New checker to replace dynamic exception specifications This is an alternative to D18575 which relied on reparsing the decl to find the location of dynamic exception specifications, but couldn't deal with preprocessor conditionals correctly without reparsing the entire file. This approach uses D20428 to find dynamic exception specifiaction locations and handles all cases correctly. http://reviews.llvm.org/D20693 Files: clang-tidy/modernize/CMakeLists.txt clang-tidy/modernize/ModernizeTidyModule.cpp clang-tidy/modernize/UseNoexceptCheck.cpp clang-tidy/modernize/UseNoexceptCheck.h docs/ReleaseNotes.rst docs/clang-tidy/checks/modernize-use-noexcept.rst test/clang-tidy/modernize-use-noexcept-macro.cpp test/clang-tidy/modernize-use-noexcept.cpp Index: test/clang-tidy/modernize-use-noexcept.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept.cpp @@ -0,0 +1,56 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -- -std=c++11 + +class A {}; +class B {}; + +void foo() throw(); +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void foo() noexcept; + +void bar() throw(...); +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw(...)' [modernize-use-noexcept] +// CHECK-FIXES: void bar() noexcept(false); + +void k() throw(int(int)); +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int))' [modernize-use-noexcept] +// CHECK-FIXES: void k() noexcept(false); + +void foobar() throw(A, B) +{} +// CHECK-MESSAGES: :[[@LINE-2]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void foobar() noexcept(false) + +void baz(int = (throw A(), 0)) throw(A, B) {} +// CHECK-MESSAGES: :[[@LINE-1]]:32: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] +// CHECK-FIXES: void baz(int = (throw A(), 0)) noexcept(false) {} + +void g(void (*fp)(void) throw()); +// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void g(void (*fp)(void) noexcept); + +void f(void (*fp)(void) throw()) throw(char); +// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-MESSAGES: :[[@LINE-2]]:34: warning: found dynamic exception specification 'throw(char)' [modernize-use-noexcept] +// CHECK-FIXES: void f(void (*fp)(void) noexcept) noexcept(false); + +void j() throw(int(int) throw(void(void) throw(int))); +// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: found dynamic exception specification 'throw(int(int) throw(void(void) throw(int)))' [modernize-use-noexcept] +// CHECK-FIXES: void j() noexcept(false); + +class Y { + Y() throw() = default; +}; +// CHECK-MESSAGES: :[[@LINE-2]]:7: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: Y() noexcept = default; + +// Should not trigger a replacement. +void titi() noexcept {} +void toto() noexcept(true) {} + +// Should not trigger a replacement. +void bad() +#if !__has_feature(cxx_noexcept) +throw() +#endif +; Index: test/clang-tidy/modernize-use-noexcept-macro.cpp === --- /dev/null +++ test/clang-tidy/modernize-use-noexcept-macro.cpp @@ -0,0 +1,24 @@ +// RUN: %check_clang_tidy %s modernize-use-noexcept %t -- \ +// RUN: -config="{CheckOptions: [{key: modernize-use-noexcept.ReplacementString, value: 'NOEXCEPT'}]}" \ +// RUN: -- -std=c++11 + +// Example definition of NOEXCEPT -- simplified test to see if noexcept is supported. +#if (__has_feature(cxx_noexcept)) +#define NOEXCEPT noexcept +#else +#define NOEXCEPT throw() +#endif + +void bar() throw() {} +// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: found dynamic exception specification 'throw()' [modernize-use-noexcept] +// CHECK-FIXES: void bar() NOEXCEPT {} + +// Should not trigger a FixItHint, since macros only support noexcept, and this +// case throws. +class A {}; +class B {}; +void foobar() throw(A, B); +// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: found dynamic exception specification 'throw(A, B)' [modernize-use-noexcept] + +// Should not trigger a replacement. +void foo() noexcept(true); Index: docs/clang-tidy/checks/modernize-use-noexcept.rst === --- /dev/null +++ docs/clang-tidy/checks/modernize-use-noexcept.rst @@ -0,0 +1,55 @@ +.. title:: clang-tidy - modernize-use-noexcept + +modernize-use-noexcept +== + +The check converts dynamic exception specifications, e.g.,
r270882 - [OpenMP] Parsing and sema support for the from clause
Author: sfantao Date: Thu May 26 12:49:04 2016 New Revision: 270882 URL: http://llvm.org/viewvc/llvm-project?rev=270882=rev Log: [OpenMP] Parsing and sema support for the from clause Summary: The patch contains the parsing and sema support for the `from` clause. Patch based on the original post by Kelvin Li. Reviewers: hfinkel, carlo.bertolli, kkwli0, arpith-jacob, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D18488 Added: cfe/trunk/test/OpenMP/target_update_from_messages.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/AST/OpenMPClause.cpp cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/Basic/OpenMPKinds.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp cfe/trunk/test/OpenMP/target_update_ast_print.cpp cfe/trunk/test/OpenMP/target_update_device_messages.cpp cfe/trunk/test/OpenMP/target_update_if_messages.cpp cfe/trunk/test/OpenMP/target_update_messages.cpp cfe/trunk/test/OpenMP/target_update_to_messages.cpp cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=270882=270881=270882=diff == --- cfe/trunk/include/clang/AST/OpenMPClause.h (original) +++ cfe/trunk/include/clang/AST/OpenMPClause.h Thu May 26 12:49:04 2016 @@ -4113,6 +4113,110 @@ public: reinterpret_cast(varlist_end())); } }; + +/// \brief This represents clause 'from' in the '#pragma omp ...' +/// directives. +/// +/// \code +/// #pragma omp target update from(a,b) +/// \endcode +/// In this example directive '#pragma omp target update' has clause 'from' +/// with the variables 'a' and 'b'. +/// +class OMPFromClause final +: public OMPMappableExprListClause, + private llvm::TrailingObjects< + OMPFromClause, Expr *, ValueDecl *, unsigned, + OMPClauseMappableExprCommon::MappableComponent> { + friend TrailingObjects; + friend OMPVarListClause; + friend OMPMappableExprListClause; + friend class OMPClauseReader; + + /// Define the sizes of each trailing object array except the last one. This + /// is required for TrailingObjects to work properly. + size_t numTrailingObjects(OverloadToken) const { +return varlist_size(); + } + size_t numTrailingObjects(OverloadToken) const { +return getUniqueDeclarationsNum(); + } + size_t numTrailingObjects(OverloadToken) const { +return getUniqueDeclarationsNum() + getTotalComponentListNum(); + } + + /// \brief Build clause with number of variables \a NumVars. + /// + /// \param StartLoc Starting location of the clause. + /// \param EndLoc Ending location of the clause. + /// \param NumVars Number of expressions listed in this clause. + /// \param NumUniqueDeclarations Number of unique base declarations in this + /// clause. + /// \param NumComponentLists Number of component lists in this clause. + /// \param NumComponents Total number of expression components in the clause. + /// + explicit OMPFromClause(SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc, unsigned NumVars, + unsigned NumUniqueDeclarations, + unsigned NumComponentLists, unsigned NumComponents) + : OMPMappableExprListClause(OMPC_from, StartLoc, LParenLoc, EndLoc, + NumVars, NumUniqueDeclarations, + NumComponentLists, NumComponents) {} + + /// \brief Build an empty clause. + /// + /// \param NumVars Number of expressions listed in this clause. + /// \param NumUniqueDeclarations Number of unique base declarations in this + /// clause. + /// \param NumComponentLists Number of component lists in this clause. + /// \param NumComponents Total number of expression components in the clause. + /// + explicit OMPFromClause(unsigned NumVars, unsigned NumUniqueDeclarations, + unsigned NumComponentLists, unsigned NumComponents) + : OMPMappableExprListClause( +OMPC_from, SourceLocation(), SourceLocation(), SourceLocation(), +NumVars, NumUniqueDeclarations, NumComponentLists, NumComponents) {} + +public: + /// \brief Creates clause with a list of variables \a Vars. + /// + /// \param C AST context. + /// \brief StartLoc Starting location of the clause. + /// \brief EndLoc Ending location of the clause. + /// \param Vars The original
r270880 - [OpenMP] Parsing and sema support for the to clause
Author: sfantao Date: Thu May 26 12:39:58 2016 New Revision: 270880 URL: http://llvm.org/viewvc/llvm-project?rev=270880=rev Log: [OpenMP] Parsing and sema support for the to clause Summary: The patch contains the parsing and sema support for the `to` clause. Patch based on the original post by Kelvin Li. Reviewers: carlo.bertolli, hfinkel, kkwli0, arpith-jacob, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D18597 Added: cfe/trunk/test/OpenMP/target_update_ast_print.cpp cfe/trunk/test/OpenMP/target_update_to_messages.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/AST/OpenMPClause.cpp cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/Basic/OpenMPKinds.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp cfe/trunk/test/OpenMP/nesting_of_regions.cpp cfe/trunk/test/OpenMP/target_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp cfe/trunk/test/OpenMP/target_update_device_messages.cpp cfe/trunk/test/OpenMP/target_update_if_messages.cpp cfe/trunk/test/OpenMP/target_update_messages.cpp cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=270880=270879=270880=diff == --- cfe/trunk/include/clang/AST/OpenMPClause.h (original) +++ cfe/trunk/include/clang/AST/OpenMPClause.h Thu May 26 12:39:58 2016 @@ -4010,6 +4010,109 @@ public: return child_range(child_iterator(), child_iterator()); } }; + +/// \brief This represents clause 'to' in the '#pragma omp ...' +/// directives. +/// +/// \code +/// #pragma omp target update to(a,b) +/// \endcode +/// In this example directive '#pragma omp target update' has clause 'to' +/// with the variables 'a' and 'b'. +/// +class OMPToClause final : public OMPMappableExprListClause, + private llvm::TrailingObjects< + OMPToClause, Expr *, ValueDecl *, unsigned, + OMPClauseMappableExprCommon::MappableComponent> { + friend TrailingObjects; + friend OMPVarListClause; + friend OMPMappableExprListClause; + friend class OMPClauseReader; + + /// Define the sizes of each trailing object array except the last one. This + /// is required for TrailingObjects to work properly. + size_t numTrailingObjects(OverloadToken) const { +return varlist_size(); + } + size_t numTrailingObjects(OverloadToken) const { +return getUniqueDeclarationsNum(); + } + size_t numTrailingObjects(OverloadToken) const { +return getUniqueDeclarationsNum() + getTotalComponentListNum(); + } + + /// \brief Build clause with number of variables \a NumVars. + /// + /// \param StartLoc Starting location of the clause. + /// \param EndLoc Ending location of the clause. + /// \param NumVars Number of expressions listed in this clause. + /// \param NumUniqueDeclarations Number of unique base declarations in this + /// clause. + /// \param NumComponentLists Number of component lists in this clause. + /// \param NumComponents Total number of expression components in the clause. + /// + explicit OMPToClause(SourceLocation StartLoc, SourceLocation LParenLoc, + SourceLocation EndLoc, unsigned NumVars, + unsigned NumUniqueDeclarations, + unsigned NumComponentLists, unsigned NumComponents) + : OMPMappableExprListClause(OMPC_to, StartLoc, LParenLoc, EndLoc, NumVars, + NumUniqueDeclarations, NumComponentLists, + NumComponents) {} + + /// \brief Build an empty clause. + /// + /// \param NumVars Number of expressions listed in this clause. + /// \param NumUniqueDeclarations Number of unique base declarations in this + /// clause. + /// \param NumComponentLists Number of component lists in this clause. + /// \param NumComponents Total number of expression components in the clause. + /// + explicit OMPToClause(unsigned NumVars, unsigned NumUniqueDeclarations, + unsigned NumComponentLists, unsigned NumComponents) + : OMPMappableExprListClause( +OMPC_to, SourceLocation(), SourceLocation(), SourceLocation(), +NumVars, NumUniqueDeclarations, NumComponentLists, NumComponents) {} + +public:
[PATCH] D20689: [clang-tidy] Suspicious Call Argument checker
varjujan created this revision. varjujan added a reviewer: alexfh. varjujan added subscribers: xazax.hun, cfe-commits. This checker finds those function calls where the function arguments are provided in an incorrect order. It compares the name of the given variable to the argument name in the function definition. It issues a message if the given variable name is similar to an another function argument in a function call. It uses case insensitive comparison. http://reviews.llvm.org/D20689 Files: clang-tidy/misc/CMakeLists.txt clang-tidy/misc/MiscTidyModule.cpp clang-tidy/misc/SuspiciousCallArgumentCheck.cpp clang-tidy/misc/SuspiciousCallArgumentCheck.h docs/clang-tidy/checks/list.rst docs/clang-tidy/checks/misc-suspicious-call-argument.rst test/clang-tidy/misc-suspicious-call-argument.cpp Index: test/clang-tidy/misc-suspicious-call-argument.cpp === --- /dev/null +++ test/clang-tidy/misc-suspicious-call-argument.cpp @@ -0,0 +1,106 @@ +// RUN: %check_clang_tidy %s misc-suspicious-call-argument %t -- -- -std=c++11 + +// For equality test. +void set(int *buff, int value, int count) { + while (count > 0) { +*buff = value; +++buff; +--count; + } +} + +// For equality test. +void foo(int *array, int count) { + // Equality test. + set(array, count, 10); + // CHECK-MESSAGES: :[[@LINE-1]]:4: warning: count (value) is potentially swapped with literal (count). [misc-suspicious-call-argument] +} + +// For equality test. +void f(int b, int aaa) {} + +// For prefix/suffix test. +int uselessFoo(int valToRet, int uselessParam) { return valToRet; } + +// For variadic function test. +double average(int count, int fixParam1, int fixParam2, ...) { return 0.0; } + +void fooo(int asdasdasd, int bbb, int ccc = 1, int ddd = 0) {} + +class TestClass { +public: + void thisFunction(int integerParam, int thisIsPARAM) {} +}; + +int main() { + int asdasdasd, qweqweqweq, cc, ddd = 0; + + fooo(asdasdasd, cc); + // CHECK-MESSAGES: :[[@LINE-1]]:2: warning: cc (bbb) is potentially swapped with literal (ccc). [misc-suspicious-call-argument] + + const int MAX = 15; + int *array = new int[MAX]; + int count = 5; + + // Equality test 1. + foo(array, count); + + // Equality test 2. + double avg = average(1, 2, count, 3, 4, 5, 6, + 7); // "count" should be the first argument + // CHECK-MESSAGES: :[[@LINE-1]]:15: warning: literal (count) is potentially swapped with count (fixParam2). [misc-suspicious-call-argument] + + // Equality test 3. + int aa, aaa = 0; + f(aa, aaa); // should pass (0. arg is similar to 1. param, but 1. arg is equal to 1. param) + + // Equality test 4. + int fixParam1 = 5; + avg = average(count, 1, 2, 3, 4, fixParam1, 6, +7); // should pass, we only check params and args before "..." + + // Levenshtein test 1. + int cooundt = 4; + set(array, cooundt, 10); // "cooundt" is similar to "count" + // CHECK-MESSAGES: :[[@LINE-1]]:2: warning: cooundt (value) is potentially swapped with literal (count). [misc-suspicious-call-argument] + + // Levenshtein test 2. + int _value = 3; + set(array, 5, _value); // "_value" is similar to "value" + // CHECK-MESSAGES: :[[@LINE-1]]:2: warning: literal (value) is potentially swapped with _value (count). [misc-suspicious-call-argument] + + // Prefix test 1. + int val = 1; + int tmp = uselessFoo(5, val); // "val" is a prefix of "valToRet" + // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: literal (valToRet) is potentially swapped with val (uselessParam). [misc-suspicious-call-argument] + + // Prefix test 2. + int VALtoretAwesome = 1; + tmp = uselessFoo( + 5, VALtoretAwesome); // "valToRet" is a prefix of "VALtoretAwesome" + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: literal (valToRet) is potentially swapped with VALtoretAwesome (uselessParam). [misc-suspicious-call-argument] + + // Suffix test 1. + int param = 1; + int randomValue = 5; + tmp = uselessFoo(param, randomValue); // "param" is a suffix of "uselessParam" + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: param (valToRet) is swapped with randomValue (uselessParam). [misc-suspicious-call-argument] + + // Suffix test 2. + int reallyUselessParam = 1; + tmp = uselessFoo(reallyUselessParam, + 5); // "uselessParam" is a suffix of "reallyUselessParam" + // CHECK-MESSAGES: :[[@LINE-1]]:8: warning: reallyUselessParam (valToRet) is potentially swapped with literal (uselessParam). [misc-suspicious-call-argument] + + // Test lambda. + auto testMethod = [&](int method, int randomParam) { return 0; }; + int method = 0; + testMethod(method, 0); // Should pass. + + // Member function test + TestClass test; + int integ, thisIsAnArg = 0; + test.thisFunction(integ, thisIsAnArg); // Should pass. + + return 0; +} Index: docs/clang-tidy/checks/misc-suspicious-call-argument.rst === ---
Re: [PATCH] D18597: [OpenMP] Parsing and sema support for the to clause
sfantao updated this revision to Diff 58651. sfantao added a comment. - Mark MappableVarListInfo as final. http://reviews.llvm.org/D18597 Files: include/clang/AST/OpenMPClause.h include/clang/AST/RecursiveASTVisitor.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/OpenMPKinds.def include/clang/Sema/Sema.h lib/AST/OpenMPClause.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Basic/OpenMPKinds.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/Parse/ParseOpenMP.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp test/OpenMP/nesting_of_regions.cpp test/OpenMP/target_map_messages.cpp test/OpenMP/target_parallel_for_map_messages.cpp test/OpenMP/target_parallel_map_messages.cpp test/OpenMP/target_update_ast_print.cpp test/OpenMP/target_update_device_messages.cpp test/OpenMP/target_update_if_messages.cpp test/OpenMP/target_update_messages.cpp test/OpenMP/target_update_to_messages.cpp tools/libclang/CIndex.cpp Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -2246,6 +2246,9 @@ } void OMPClauseEnqueue::VisitOMPDefaultmapClause( const OMPDefaultmapClause * /*C*/) {} +void OMPClauseEnqueue::VisitOMPToClause(const OMPToClause *C) { + VisitOMPClauseList(C); +} } void EnqueueVisitor::EnqueueChildren(const OMPClause *S) { Index: test/OpenMP/target_update_to_messages.cpp === --- /dev/null +++ test/OpenMP/target_update_to_messages.cpp @@ -0,0 +1,175 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note 2 {{declared here}} +extern S1 a; +class S2 { + mutable int a; +public: + S2():a(0) { } + S2(S2 ):a(s2.a) { } + static float S2s; // expected-note 4 {{mappable type cannot contain static members}} + static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}} +}; +const float S2::S2sc = 0; +const S2 b; +const S2 ba[5]; +class S3 { + int a; +public: + S3():a(0) { } + S3(S3 ):a(s3.a) { } +}; +const S3 c; +const S3 ca[5]; +extern const int f; +class S4 { + int a; + S4(); + S4(const S4 ); +public: + S4(int v):a(v) { } +}; +class S5 { + int a; + S5():a(0) {} + S5(const S5 ):a(s5.a) { } +public: + S5(int v):a(v) { } +}; +struct S6 { + int ii; + int aa[30]; + float xx; + double *pp; +}; +struct S7 { + int i; + int a[50]; + float x; + S6 s6[5]; + double *p; + unsigned bfa : 4; +}; + +S3 h; +#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} + +typedef int from; + +template // expected-note {{declared here}} +T tmain(T argc) { + const T d = 5; + const T da[5] = { 0 }; + S4 e(4); + S5 g(5); + T *m; + T i, t[20]; + T = i; + T *k = + T x; + T y; + T to; + const T ()[5] = da; + S7 s7; + +#pragma omp target update to // expected-error {{expected '(' after 'to'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to() // expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update() // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(alloc) // expected-error {{use of undeclared identifier 'alloc'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(x) +#pragma omp target update to(t[:I]) +#pragma omp target update to(T) // expected-error {{'T' does not refer to a value}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(I) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} +#pragma omp target update to(S2::S2s) +#pragma omp target update to(S2::S2sc) +#pragma omp target update to(to) +#pragma omp target update to(y x) // expected-error {{expected ',' or ')' in 'to' clause}} +#pragma omp target update to(argc > 0 ? x : y) // expected-error 2 {{expected expression containing only member accesses and/or array sections based on named variables}} +#pragma omp target update to(S1) // expected-error {{'S1' does not refer to a value}}}
Re: [PATCH] D15944: [OpenMP] Parsing and sema support for target update directive
This revision was automatically updated to reflect the committed changes. Closed by commit rL270878: [OpenMP] Parsing and sema support for target update directive (authored by sfantao). Changed prior to commit: http://reviews.llvm.org/D15944?vs=58469=58647#toc Repository: rL LLVM http://reviews.llvm.org/D15944 Files: cfe/trunk/include/clang-c/Index.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/AST/StmtOpenMP.h cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/include/clang/Basic/StmtNodes.td cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/include/clang/Serialization/ASTBitCodes.h cfe/trunk/lib/AST/StmtOpenMP.cpp cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/Basic/OpenMPKinds.cpp cfe/trunk/lib/CodeGen/CGStmt.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp cfe/trunk/test/OpenMP/nesting_of_regions.cpp cfe/trunk/test/OpenMP/target_update_device_messages.cpp cfe/trunk/test/OpenMP/target_update_if_messages.cpp cfe/trunk/test/OpenMP/target_update_messages.cpp cfe/trunk/tools/libclang/CIndex.cpp cfe/trunk/tools/libclang/CXCursor.cpp Index: cfe/trunk/include/clang-c/Index.h === --- cfe/trunk/include/clang-c/Index.h +++ cfe/trunk/include/clang-c/Index.h @@ -2281,7 +2281,7 @@ */ CXCursor_OMPTaskLoopSimdDirective = 259, - /** \brief OpenMP distribute directive. + /** \brief OpenMP distribute directive. */ CXCursor_OMPDistributeDirective= 260, @@ -2301,7 +2301,11 @@ */ CXCursor_OMPTargetParallelForDirective = 264, - CXCursor_LastStmt = CXCursor_OMPTargetParallelForDirective, + /** \brief OpenMP target update directive. + */ + CXCursor_OMPTargetUpdateDirective = 265, + + CXCursor_LastStmt = CXCursor_OMPTargetUpdateDirective, /** * \brief Cursor that represents the translation unit itself. Index: cfe/trunk/include/clang/AST/StmtOpenMP.h === --- cfe/trunk/include/clang/AST/StmtOpenMP.h +++ cfe/trunk/include/clang/AST/StmtOpenMP.h @@ -2688,7 +2688,7 @@ /// \param Clauses List of clauses. /// \param AssociatedStmt Statement, associated with the directive. /// \param Exprs Helper expressions for CodeGen. -/// + /// static OMPDistributeDirective * Create(const ASTContext , SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef Clauses, @@ -2710,6 +2710,65 @@ } }; +/// \brief This represents '#pragma omp target update' directive. +/// +/// \code +/// #pragma omp target update to(a) from(b) device(1) +/// \endcode +/// In this example directive '#pragma omp target update' has clause 'to' with +/// argument 'a', clause 'from' with argument 'b' and clause 'device' with +/// argument '1'. +/// +class OMPTargetUpdateDirective : public OMPExecutableDirective { + friend class ASTStmtReader; + /// \brief Build directive with the given start and end location. + /// + /// \param StartLoc Starting location of the directive kind. + /// \param EndLoc Ending Location of the directive. + /// \param NumClauses The number of clauses. + /// + OMPTargetUpdateDirective(SourceLocation StartLoc, SourceLocation EndLoc, + unsigned NumClauses) + : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass, + OMPD_target_update, StartLoc, EndLoc, NumClauses, + 0) {} + + /// \brief Build an empty directive. + /// + /// \param NumClauses Number of clauses. + /// + explicit OMPTargetUpdateDirective(unsigned NumClauses) + : OMPExecutableDirective(this, OMPTargetUpdateDirectiveClass, + OMPD_target_update, SourceLocation(), + SourceLocation(), NumClauses, 0) {} + +public: + /// \brief Creates directive with a list of \a Clauses. + /// + /// \param C AST context. + /// \param StartLoc Starting location of the directive kind. + /// \param EndLoc Ending Location of the directive. + /// \param Clauses List of clauses. + /// + static OMPTargetUpdateDirective *Create(const ASTContext , + SourceLocation StartLoc, + SourceLocation EndLoc, + ArrayRef Clauses); + + /// \brief Creates an empty directive with the place for \a NumClauses + /// clauses. + /// + /// \param C AST context. + /// \param NumClauses The number of
r270878 - [OpenMP] Parsing and sema support for target update directive
Author: sfantao Date: Thu May 26 12:30:50 2016 New Revision: 270878 URL: http://llvm.org/viewvc/llvm-project?rev=270878=rev Log: [OpenMP] Parsing and sema support for target update directive Summary: This patch is to add parsing and sema support for `target update` directive. Support for the `to` and `from` clauses will be added by a different patch. This patch also adds support for other clauses that are already implemented upstream and apply to `target update`, e.g. `device` and `if`. This patch is based on the original post by Kelvin Li. Reviewers: hfinkel, carlo.bertolli, kkwli0, arpith-jacob, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D15944 Added: cfe/trunk/test/OpenMP/target_update_device_messages.cpp cfe/trunk/test/OpenMP/target_update_if_messages.cpp cfe/trunk/test/OpenMP/target_update_messages.cpp Modified: cfe/trunk/include/clang-c/Index.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/AST/StmtOpenMP.h cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/include/clang/Basic/StmtNodes.td cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/include/clang/Serialization/ASTBitCodes.h cfe/trunk/lib/AST/StmtOpenMP.cpp cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/Basic/OpenMPKinds.cpp cfe/trunk/lib/CodeGen/CGStmt.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp cfe/trunk/test/OpenMP/nesting_of_regions.cpp cfe/trunk/tools/libclang/CIndex.cpp cfe/trunk/tools/libclang/CXCursor.cpp Modified: cfe/trunk/include/clang-c/Index.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=270878=270877=270878=diff == --- cfe/trunk/include/clang-c/Index.h (original) +++ cfe/trunk/include/clang-c/Index.h Thu May 26 12:30:50 2016 @@ -2281,7 +2281,7 @@ enum CXCursorKind { */ CXCursor_OMPTaskLoopSimdDirective = 259, - /** \brief OpenMP distribute directive. + /** \brief OpenMP distribute directive. */ CXCursor_OMPDistributeDirective= 260, @@ -2301,7 +2301,11 @@ enum CXCursorKind { */ CXCursor_OMPTargetParallelForDirective = 264, - CXCursor_LastStmt = CXCursor_OMPTargetParallelForDirective, + /** \brief OpenMP target update directive. + */ + CXCursor_OMPTargetUpdateDirective = 265, + + CXCursor_LastStmt = CXCursor_OMPTargetUpdateDirective, /** * \brief Cursor that represents the translation unit itself. Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=270878=270877=270878=diff == --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Thu May 26 12:30:50 2016 @@ -2502,6 +2502,9 @@ DEF_TRAVERSE_STMT(OMPTargetParallelForDi DEF_TRAVERSE_STMT(OMPTeamsDirective, { TRY_TO(TraverseOMPExecutableDirective(S)); }) +DEF_TRAVERSE_STMT(OMPTargetUpdateDirective, + { TRY_TO(TraverseOMPExecutableDirective(S)); }) + DEF_TRAVERSE_STMT(OMPTaskLoopDirective, { TRY_TO(TraverseOMPExecutableDirective(S)); }) Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=270878=270877=270878=diff == --- cfe/trunk/include/clang/AST/StmtOpenMP.h (original) +++ cfe/trunk/include/clang/AST/StmtOpenMP.h Thu May 26 12:30:50 2016 @@ -2688,7 +2688,7 @@ public: /// \param Clauses List of clauses. /// \param AssociatedStmt Statement, associated with the directive. /// \param Exprs Helper expressions for CodeGen. -/// + /// static OMPDistributeDirective * Create(const ASTContext , SourceLocation StartLoc, SourceLocation EndLoc, unsigned CollapsedNum, ArrayRef Clauses, @@ -2710,6 +2710,65 @@ public: } }; +/// \brief This represents '#pragma omp target update' directive. +/// +/// \code +/// #pragma omp target update to(a) from(b) device(1) +/// \endcode +/// In this example directive '#pragma omp target update' has clause 'to' with +/// argument 'a', clause 'from' with argument 'b' and clause 'device' with +/// argument '1'. +/// +class OMPTargetUpdateDirective : public OMPExecutableDirective { + friend class
Re: [PATCH] D20660: Remove `auto_ptr` in C++17.
NO_REMOVE seems like a strange way of saying it - is there existing precedent for that naming/description? (rather than something like _LIBCPP_PROVIDE_AUTOPTR ? As for tests - XFAILing seems a bit general when there's really not much value in running any of the tests anyway. REQUIRES, perhaps? (that does bring the issue I assume Eric is alluding to forward a bit (I assume what he's alluding to is that when we have c++2x then we'd have to say XFAIL c++1z c++2x and so on - switching it around we /already/ have the problem that we'd want the auto_ptr tests to REQUIRE c++11, c++14 or whatever)) & maybe having an explicit test or two for the negative case (I would worry that XFAIL would be too vague "this should fail somehow... "). But maybe that's all unnecessary paranoia. - Dave On Wed, May 25, 2016 at 9:28 PM, Marshall Clow via cfe-commits < cfe-commits@lists.llvm.org> wrote: > mclow.lists created this revision. > mclow.lists added a reviewer: EricWF. > mclow.lists added a subscriber: cfe-commits. > > [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4190 | N4190 > ]] removed `auto_ptr` from C++1z. (and other stuff) > > Wrap all the auto_ptr bits in an #ifdef so they disappear when compiling > with `-std=c++1z` or later. > > Introduce a new configuration option, `_LIBCPP_NO_REMOVE_AUTOPTR` which > allows user code to continue using `auto_ptr` in C++1z mode if desired. > > Add a test for `_LIBCPP_NO_REMOVE_AUTOPTR`, and mark all the rest of the > `auto_ptr` tests to XFAIL for c++1z > > http://reviews.llvm.org/D20660 > > Files: > include/memory > test/libcxx/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/assignment.pass.cpp > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert.pass.cpp > > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/convert_assignment.pass.cpp > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/copy.pass.cpp > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.cons/pointer.pass.cpp > > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/assign_from_auto_ptr_ref.pass.cpp > > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_from_auto_ptr_ref.pass.cpp > > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr.pass.cpp > > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.conv/convert_to_auto_ptr_ref.pass.cpp > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/arrow.pass.cpp > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/deref.pass.cpp > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/release.pass.cpp > test/std/depr/depr.auto.ptr/auto.ptr/auto.ptr.members/reset.pass.cpp > test/std/depr/depr.auto.ptr/auto.ptr/element_type.pass.cpp > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270870 - [OpenMP] Add support for the 'private pointer' flag to signal variables captured in target regions and used in first-private clauses.
Author: sfantao Date: Thu May 26 11:53:38 2016 New Revision: 270870 URL: http://llvm.org/viewvc/llvm-project?rev=270870=rev Log: [OpenMP] Add support for the 'private pointer' flag to signal variables captured in target regions and used in first-private clauses. Summary: If a variable is implicitly mapped (doesn't show in a map clause), the runtime library has to be informed if the corresponding capture shows up in first-private clause, so that the storage previously allocated in the device is used. This patch adds the support for that. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D20112 Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/test/OpenMP/target_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/target_map_codegen.cpp Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=270870=270869=270870=diff == --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original) +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu May 26 11:53:38 2016 @@ -4927,6 +4927,9 @@ public: /// map/privatization results in multiple arguments passed to the runtime /// library. OMP_MAP_FIRST_REF = 0x20, +/// \brief This flag signals that the reference being passed is a pointer to +/// private data. +OMP_MAP_PRIVATE_PTR = 0x80, /// \brief Pass the element to the device by value. OMP_MAP_PRIVATE_VAL = 0x100, }; @@ -4941,6 +4944,9 @@ private: /// \brief Function the directive is being generated for. CodeGenFunction + /// \brief Set of all first private variables in the current directive. + llvm::SmallPtrSet FirstPrivateDecls; + llvm::Value *getExprTypeSize(const Expr *E) const { auto ExprTy = E->getType().getCanonicalType(); @@ -5293,9 +5299,33 @@ private: } } + /// \brief Return the adjusted map modifiers if the declaration a capture + /// refers to appears in a first-private clause. This is expected to be used + /// only with directives that start with 'target'. + unsigned adjustMapModifiersForPrivateClauses(const CapturedStmt::Capture , + unsigned CurrentModifiers) { +assert(Cap.capturesVariable() && "Expected capture by reference only!"); + +// A first private variable captured by reference will use only the +// 'private ptr' and 'map to' flag. Return the right flags if the captured +// declaration is known as first-private in this handler. +if (FirstPrivateDecls.count(Cap.getCapturedVar())) + return MappableExprsHandler::OMP_MAP_PRIVATE_PTR | + MappableExprsHandler::OMP_MAP_TO; + +// We didn't modify anything. +return CurrentModifiers; + } + public: MappableExprsHandler(const OMPExecutableDirective , CodeGenFunction ) - : Directive(Dir), CGF(CGF) {} + : Directive(Dir), CGF(CGF) { +// Extract firstprivate clause information. +for (const auto *C : Dir.getClausesOfKind()) + for (const auto *D : C->varlists()) +FirstPrivateDecls.insert( + cast(cast(D)->getDecl())->getCanonicalDecl()); + } /// \brief Generate all the base pointers, section pointers, sizes and map /// types for the extracted mappable expressions. @@ -5377,6 +5407,86 @@ public: return; } + + /// \brief Generate the default map information for a given capture \a CI, + /// record field declaration \a RI and captured value \a CV. + void generateDefaultMapInfo( + const CapturedStmt::Capture , const FieldDecl , llvm::Value *CV, + MappableExprsHandler::MapValuesArrayTy , + MappableExprsHandler::MapValuesArrayTy , + MappableExprsHandler::MapValuesArrayTy , + MappableExprsHandler::MapFlagsArrayTy ) { +auto = CGF.getContext(); + +// Do the default mapping. +if (CI.capturesThis()) { + CurBasePointers.push_back(CV); + CurPointers.push_back(CV); + const PointerType *PtrTy = cast(RI.getType().getTypePtr()); + CurSizes.push_back(CGF.getTypeSize(PtrTy->getPointeeType())); + // Default map type. + CurMapTypes.push_back(MappableExprsHandler::OMP_MAP_TO | +MappableExprsHandler::OMP_MAP_FROM); +} else if (CI.capturesVariableByCopy()) { + if (!RI.getType()->isAnyPointerType()) { +// If the field is not a pointer, we need to save the actual value +// and load it as a void pointer. +CurMapTypes.push_back(MappableExprsHandler::OMP_MAP_PRIVATE_VAL); +auto DstAddr = CGF.CreateMemTemp(Ctx.getUIntPtrType(), + Twine(CI.getCapturedVar()->getName()) + + ".casted"); +LValue DstLV = CGF.MakeAddrLValue(DstAddr, Ctx.getUIntPtrType()); + +auto
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
rmaprath added a comment. In http://reviews.llvm.org/D20677#441061, @jroelofs wrote: > This is the canonical reference for the Itanium ABI: > https://mentorembedded.github.io/cxx-abi/abi.html I was indeed looking at this, but couldn't find those exact function signatures (or something that looks like it). Perhaps it's covered there as a more general concept. I'll have a read. Thanks! / Asiri http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270868 - [OpenMP] Adjust map type bits according to latest spec and use zero size array sections for pointers.
Author: sfantao Date: Thu May 26 11:48:10 2016 New Revision: 270868 URL: http://llvm.org/viewvc/llvm-project?rev=270868=rev Log: [OpenMP] Adjust map type bits according to latest spec and use zero size array sections for pointers. Summary: This patch changes the bits used to specify the map types according to the latest version of the libomptarget document and add the support for zero size array section when pointers are being implicitly mapped. This completes the missing new 4.5 map semantics. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: http://reviews.llvm.org/D20111 Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/test/OpenMP/target_codegen.cpp cfe/trunk/test/OpenMP/target_codegen_registration.cpp cfe/trunk/test/OpenMP/target_data_codegen.cpp cfe/trunk/test/OpenMP/target_enter_data_codegen.cpp cfe/trunk/test/OpenMP/target_exit_data_codegen.cpp cfe/trunk/test/OpenMP/target_firstprivate_codegen.cpp cfe/trunk/test/OpenMP/target_map_codegen.cpp Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=270868=270867=270868=diff == --- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original) +++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu May 26 11:48:10 2016 @@ -4909,8 +4909,6 @@ public: /// \brief Values for bit flags used to specify the mapping type for /// offloading. enum OpenMPOffloadMappingFlags { -/// \brief Only allocate memory on the device, -OMP_MAP_ALLOC = 0x00, /// \brief Allocate memory on the device and move data from host to device. OMP_MAP_TO = 0x01, /// \brief Allocate memory on the device and move data from device to host. @@ -4918,19 +4916,19 @@ public: /// \brief Always perform the requested mapping action on the element, even /// if it was already mapped before. OMP_MAP_ALWAYS = 0x04, -/// \brief Decrement the reference count associated with the element without -/// executing any other action. -OMP_MAP_RELEASE = 0x08, /// \brief Delete the element from the device environment, ignoring the /// current reference count associated with the element. -OMP_MAP_DELETE = 0x10, -/// \brief The element passed to the device is a pointer. -OMP_MAP_PTR = 0x20, -/// \brief Signal the element as extra, i.e. is not argument to the target -/// region kernel. -OMP_MAP_EXTRA = 0x40, +OMP_MAP_DELETE = 0x08, +/// \brief The element being mapped is a pointer, therefore the pointee +/// should be mapped as well. +OMP_MAP_IS_PTR = 0x10, +/// \brief This flags signals that an argument is the first one relating to +/// a map/private clause expression. For some cases a single +/// map/privatization results in multiple arguments passed to the runtime +/// library. +OMP_MAP_FIRST_REF = 0x20, /// \brief Pass the element to the device by value. -OMP_MAP_BYCOPY = 0x80, +OMP_MAP_PRIVATE_VAL = 0x100, }; typedef SmallVector MapValuesArrayTy; @@ -4987,14 +4985,19 @@ private: /// \brief Return the corresponding bits for a given map clause modifier. Add /// a flag marking the map as a pointer if requested. Add a flag marking the - /// map as extra, meaning is not an argument of the kernel. + /// map as the first one of a series of maps that relate to the same map + /// expression. unsigned getMapTypeBits(OpenMPMapClauseKind MapType, OpenMPMapClauseKind MapTypeModifier, bool AddPtrFlag, - bool AddExtraFlag) const { + bool AddIsFirstFlag) const { unsigned Bits = 0u; switch (MapType) { case OMPC_MAP_alloc: - Bits = OMP_MAP_ALLOC; +case OMPC_MAP_release: + // alloc and release is the default behavior in the runtime library, i.e. + // if we don't pass any bits alloc/release that is what the runtime is + // going to do. Therefore, we don't need to signal anything for these two + // type modifiers. break; case OMPC_MAP_to: Bits = OMP_MAP_TO; @@ -5008,17 +5011,14 @@ private: case OMPC_MAP_delete: Bits = OMP_MAP_DELETE; break; -case OMPC_MAP_release: - Bits = OMP_MAP_RELEASE; - break; default: llvm_unreachable("Unexpected map type!"); break; } if (AddPtrFlag) - Bits |= OMP_MAP_PTR; -if (AddExtraFlag) - Bits |= OMP_MAP_EXTRA; + Bits |= OMP_MAP_IS_PTR; +if (AddIsFirstFlag) + Bits |= OMP_MAP_FIRST_REF; if (MapTypeModifier == OMPC_MAP_always) Bits |= OMP_MAP_ALWAYS; return Bits; @@ -5270,13 +5270,13 @@ private: Pointers.push_back(LB); Sizes.push_back(Size); -// We need to add a pointer flag for each map that comes from
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
jroelofs added a comment. This is the canonical reference for the Itanium ABI: https://mentorembedded.github.io/cxx-abi/abi.html http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
rmaprath marked an inline comment as done. Comment at: src/cxa_aux_runtime.cpp:19-25 @@ -18,5 +18,9 @@ extern "C" { _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) { +#ifndef _LIBCXXABI_NO_EXCEPTIONS throw std::bad_cast(); +#else + std::terminate(); +#endif } rmaprath wrote: > I'm not very familiar with how RTTI works, I was simply getting rid of the > `throw` statements which get in the way of compiling with `-fno-exceptions`. > > So, I presume these `__cxa_bad_xxx` calls are inserted by the compiler? > > The tests `dynamic_cast_xxx` all seem to pass, which I found a bit weird > because I would've expected some of those to fail because of the > `std::terminate()`. Or are they not related to RTTI? Thanks. I will try to get clang to generate these (btw, do you have a reference for those RTTI functions? I couldn't find much on the interwebs. I suppose leaving these functions (which call `std::terminate()`) in the -fno-exceptions variant is not a problem? http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20687: Update hasDynamicExceptionSpec to use functionType instead of functionDecl.
hintonda created this revision. hintonda added a reviewer: aaron.ballman. hintonda added a subscriber: cfe-commits. Herald added a subscriber: klimek. Update hasDynamicExceptionSpec to use functionType instead of functionDecl. http://reviews.llvm.org/D20687 Files: docs/LibASTMatchersReference.html include/clang/ASTMatchers/ASTMatchers.h unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp === --- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -1383,19 +1383,19 @@ } TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) { - EXPECT_TRUE(notMatches("void f();", functionDecl(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void f();", functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void g() noexcept;", - functionDecl(hasDynamicExceptionSpec(; + functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void h() noexcept(true);", - functionDecl(hasDynamicExceptionSpec(; + functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void i() noexcept(false);", - functionDecl(hasDynamicExceptionSpec(; + functionType(hasDynamicExceptionSpec(; EXPECT_TRUE( - matches("void j() throw();", functionDecl(hasDynamicExceptionSpec(; + matches("void j() throw();", functionType(hasDynamicExceptionSpec(; EXPECT_TRUE( - matches("void k() throw(int);", functionDecl(hasDynamicExceptionSpec(; + matches("void k() throw(int);", functionType(hasDynamicExceptionSpec(; EXPECT_TRUE( - matches("void l() throw(...);", functionDecl(hasDynamicExceptionSpec(; + matches("void l() throw(...);", functionType(hasDynamicExceptionSpec(; } TEST(HasObjectExpression, DoesNotMatchMember) { Index: include/clang/ASTMatchers/ASTMatchers.h === --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -3245,10 +3245,10 @@ /// void k() throw(int); /// void l() throw(...); /// \endcode -/// functionDecl(hasDynamicExceptionSpec()) +/// functionType(hasDynamicExceptionSpec()) /// matches the declarations of j, k, and l, but not f, g, h, or i. -AST_MATCHER(FunctionDecl, hasDynamicExceptionSpec) { - if (const auto *FnTy = Node.getType()->getAs()) +AST_MATCHER(FunctionType, hasDynamicExceptionSpec) { + if (const auto *FnTy = dyn_cast()) return FnTy->hasDynamicExceptionSpec(); return false; } Index: docs/LibASTMatchersReference.html === --- docs/LibASTMatchersReference.html +++ docs/LibASTMatchersReference.html @@ -2403,22 +2403,6 @@ -Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclhasDynamicExceptionSpec -Matches functions that have a dynamic exception specification. - -Given: - void f(); - void g() noexcept; - void h() noexcept(true); - void i() noexcept(false); - void j() throw(); - void k() throw(int); - void l() throw(...); -functionDecl(hasDynamicExceptionSpec()) - matches the declarations of j, k, and l, but not f, g, h, or i. - - - Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html;>FunctionDeclhasOverloadedOperatorNameStringRef Name Matches overloaded operator names. @@ -2616,6 +2600,22 @@ +Matcherhttp://clang.llvm.org/doxygen/classclang_1_1FunctionType.html;>FunctionTypehasDynamicExceptionSpec +Matches functions that have a dynamic exception specification. + +Given: + void f(); + void g() noexcept; + void h() noexcept(true); + void i() noexcept(false); + void j() throw(); + void k() throw(int); + void l() throw(...); +functionType(hasDynamicExceptionSpec()) + matches the declarations of j, k, and l, but not f, g, h, or i. + + + Matcherhttp://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html;>IntegerLiteralequalsValueT Value Matches literals that are equal to the given value. Index: unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp === --- unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -1383,19 +1383,19 @@ } TEST(hasDynamicExceptionSpec, MatchesDynamicExceptionSpecifications) { - EXPECT_TRUE(notMatches("void f();", functionDecl(hasDynamicExceptionSpec(; + EXPECT_TRUE(notMatches("void f();", functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void g() noexcept;", - functionDecl(hasDynamicExceptionSpec(; + functionType(hasDynamicExceptionSpec(; EXPECT_TRUE(notMatches("void h()
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
bcraig added inline comments. Comment at: src/cxa_aux_runtime.cpp:19-24 @@ -18,4 +18,8 @@ extern "C" { _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) { +#ifndef _LIBCXXABI_NO_EXCEPTIONS throw std::bad_cast(); +#else + std::terminate(); +#endif } bcraig wrote: > So you're turning off exceptions, but leaving RTTI? You might want to keep > some of the RTTI tests around too if that's the case. _cxa_bad_cast should be inserted by the compiler. It is called when a dynamic_cast to a reference type fails. _cxa_bad_typeid should be inserted by the compiler. It is called when typeid is used on a null pointer. _cxa_throw_bad_array_new_length should probably stay put. The most common reason for that to get hit is if sizeof(obj) * number_of_elts > SIZE_T_MAX. http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20684: [X86][SSE] Replace VPMOVSX and (V)PMOVZX integer extension intrinsics with generic IR (clang)
RKSimon created this revision. RKSimon added reviewers: mkuper, craig.topper, spatel, andreadb. RKSimon added a subscriber: cfe-commits. RKSimon set the repository for this revision to rL LLVM. The VPMOVSX and (V)PMOVZX sign/zero extension intrinsics can be safely represented as generic __builtin_convertvector calls instead of x86 intrinsics. This patch removes the clang builtins and their use in the sse2/avx headers - a companion patch will remove/auto-upgrade the llvm intrinsics. Note: We already did this for SSE41 PMOVSX sometime ago. Repository: rL LLVM http://reviews.llvm.org/D20684 Files: include/clang/Basic/BuiltinsX86.def lib/Headers/avx2intrin.h lib/Headers/smmintrin.h test/CodeGen/avx2-builtins.c test/CodeGen/builtins-x86.c test/CodeGen/sse41-builtins.c Index: test/CodeGen/sse41-builtins.c === --- test/CodeGen/sse41-builtins.c +++ test/CodeGen/sse41-builtins.c @@ -119,37 +119,43 @@ __m128i test_mm_cvtepu8_epi16(__m128i a) { // CHECK-LABEL: test_mm_cvtepu8_epi16 - // CHECK: call <8 x i16> @llvm.x86.sse41.pmovzxbw(<16 x i8> {{.*}}) + // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <8 x i32> + // CHECK: zext <8 x i8> {{.*}} to <8 x i16> return _mm_cvtepu8_epi16(a); } __m128i test_mm_cvtepu8_epi32(__m128i a) { // CHECK-LABEL: test_mm_cvtepu8_epi32 - // CHECK: call <4 x i32> @llvm.x86.sse41.pmovzxbd(<16 x i8> {{.*}}) + // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <4 x i32> + // CHECK: zext <4 x i8> {{.*}} to <4 x i32> return _mm_cvtepu8_epi32(a); } __m128i test_mm_cvtepu8_epi64(__m128i a) { // CHECK-LABEL: test_mm_cvtepu8_epi64 - // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxbq(<16 x i8> {{.*}}) + // CHECK: shufflevector <16 x i8> {{.*}}, <16 x i8> {{.*}}, <2 x i32> + // CHECK: zext <2 x i8> {{.*}} to <2 x i64> return _mm_cvtepu8_epi64(a); } __m128i test_mm_cvtepu16_epi32(__m128i a) { // CHECK-LABEL: test_mm_cvtepu16_epi32 - // CHECK: call <4 x i32> @llvm.x86.sse41.pmovzxwd(<8 x i16> {{.*}}) + // CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <4 x i32> + // CHECK: zext <4 x i16> {{.*}} to <4 x i32> return _mm_cvtepu16_epi32(a); } __m128i test_mm_cvtepu16_epi64(__m128i a) { // CHECK-LABEL: test_mm_cvtepu16_epi64 - // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxwq(<8 x i16> {{.*}}) + // CHECK: shufflevector <8 x i16> {{.*}}, <8 x i16> {{.*}}, <2 x i32> + // CHECK: zext <2 x i16> {{.*}} to <2 x i64> return _mm_cvtepu16_epi64(a); } __m128i test_mm_cvtepu32_epi64(__m128i a) { // CHECK-LABEL: test_mm_cvtepu32_epi64 - // CHECK: call <2 x i64> @llvm.x86.sse41.pmovzxdq(<4 x i32> {{.*}}) + // CHECK: shufflevector <4 x i32> {{.*}}, <4 x i32> {{.*}}, <2 x i32> + // CHECK: zext <2 x i32> {{.*}} to <2 x i64> return _mm_cvtepu32_epi64(a); } Index: test/CodeGen/builtins-x86.c === --- test/CodeGen/builtins-x86.c +++ test/CodeGen/builtins-x86.c @@ -387,12 +387,6 @@ tmp_V4i = __builtin_ia32_pminsd128(tmp_V4i, tmp_V4i); tmp_V4i = __builtin_ia32_pminud128(tmp_V4i, tmp_V4i); tmp_V8s = __builtin_ia32_pminuw128(tmp_V8s, tmp_V8s); - tmp_V4i = __builtin_ia32_pmovzxbd128(tmp_V16c); - tmp_V2LLi = __builtin_ia32_pmovzxbq128(tmp_V16c); - tmp_V8s = __builtin_ia32_pmovzxbw128(tmp_V16c); - tmp_V2LLi = __builtin_ia32_pmovzxdq128(tmp_V4i); - tmp_V4i = __builtin_ia32_pmovzxwd128(tmp_V8s); - tmp_V2LLi = __builtin_ia32_pmovzxwq128(tmp_V8s); tmp_V2LLi = __builtin_ia32_pmuldq128(tmp_V4i, tmp_V4i); tmp_V4i = __builtin_ia32_pmulld128(tmp_V4i, tmp_V4i); tmp_V4f = __builtin_ia32_roundps(tmp_V4f, imm_i_0_16); Index: test/CodeGen/avx2-builtins.c === --- test/CodeGen/avx2-builtins.c +++ test/CodeGen/avx2-builtins.c @@ -292,73 +292,79 @@ __m256i test_mm256_cvtepi8_epi16(__m128i a) { // CHECK-LABEL: test_mm256_cvtepi8_epi16 - // CHECK: call <16 x i16> @llvm.x86.avx2.pmovsxbw(<16 x i8> %{{.*}}) + // CHECK: sext <16 x i8> %{{.*}} to <16 x i16> return _mm256_cvtepi8_epi16(a); } __m256i test_mm256_cvtepi8_epi32(__m128i a) { // CHECK-LABEL: test_mm256_cvtepi8_epi32 - // CHECK: call <8 x i32> @llvm.x86.avx2.pmovsxbd(<16 x i8> %{{.*}}) + // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <8 x i32> + // CHECK: sext <8 x i8> %{{.*}} to <8 x i32> return _mm256_cvtepi8_epi32(a); } __m256i test_mm256_cvtepi8_epi64(__m128i a) { // CHECK-LABEL: test_mm256_cvtepi8_epi64 - // CHECK: call <4 x i64> @llvm.x86.avx2.pmovsxbq(<16 x i8> %{{.*}}) + // CHECK: shufflevector <16 x i8> %{{.*}}, <16 x i8> %{{.*}}, <4 x i32> + // CHECK: sext <4 x i8> %{{.*}} to <4 x i64> return _mm256_cvtepi8_epi64(a); } __m256i test_mm256_cvtepi16_epi32(__m128i a) { // CHECK-LABEL: test_mm256_cvtepi16_epi32 - // CHECK: call <8 x i32> @llvm.x86.avx2.pmovsxwd(<8 x i16> %{{.*}}) +
Re: [PATCH] D20672: Don't pass -fms-compatibility-version flag during build
This revision was automatically updated to reflect the committed changes. Closed by commit rL270860: Since some time clang itself figures out the default for ms-compatibility… (authored by ismail). Changed prior to commit: http://reviews.llvm.org/D20672?vs=58586=58623#toc Repository: rL LLVM http://reviews.llvm.org/D20672 Files: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Index: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake === --- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake +++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake @@ -353,19 +353,6 @@ append("/Zc:rvalueCast" CMAKE_CXX_FLAGS) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") -# Find and run MSVC (not clang-cl) and get its version. This will tell -# clang-cl what version of MSVC to pretend to be so that the STL works. -execute_process(COMMAND "$ENV{VSINSTALLDIR}/VC/bin/cl.exe" - OUTPUT_QUIET - ERROR_VARIABLE MSVC_COMPAT_VERSION - ) -string(REGEX REPLACE "^.*Compiler Version ([0-9.]+) for .*$" "\\1" - MSVC_COMPAT_VERSION "${MSVC_COMPAT_VERSION}") -append("-fms-compatibility-version=${MSVC_COMPAT_VERSION}" - CMAKE_C_FLAGS CMAKE_CXX_FLAGS) - endif() - - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # clang-cl and cl by default produce non-deterministic binaries because # link.exe /incremental requires a timestamp in the .obj file. clang-cl # has the flag /Brepro to force deterministic binaries. We want to pass that Index: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake === --- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake +++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake @@ -353,19 +353,6 @@ append("/Zc:rvalueCast" CMAKE_CXX_FLAGS) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") -# Find and run MSVC (not clang-cl) and get its version. This will tell -# clang-cl what version of MSVC to pretend to be so that the STL works. -execute_process(COMMAND "$ENV{VSINSTALLDIR}/VC/bin/cl.exe" - OUTPUT_QUIET - ERROR_VARIABLE MSVC_COMPAT_VERSION - ) -string(REGEX REPLACE "^.*Compiler Version ([0-9.]+) for .*$" "\\1" - MSVC_COMPAT_VERSION "${MSVC_COMPAT_VERSION}") -append("-fms-compatibility-version=${MSVC_COMPAT_VERSION}" - CMAKE_C_FLAGS CMAKE_CXX_FLAGS) - endif() - - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # clang-cl and cl by default produce non-deterministic binaries because # link.exe /incremental requires a timestamp in the .obj file. clang-cl # has the flag /Brepro to force deterministic binaries. We want to pass that ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
rmaprath marked 2 inline comments as done. Comment at: src/cxa_aux_runtime.cpp:19-20 @@ -18,3 +18,4 @@ extern "C" { _LIBCXXABI_FUNC_VIS LIBCXXABI_NORETURN void __cxa_bad_cast(void) { +#ifndef _LIBCXXABI_NO_EXCEPTIONS throw std::bad_cast(); I'm not very familiar with how RTTI works, I was simply getting rid of the `throw` statements which get in the way of compiling with `-fno-exceptions`. So, I presume these `__cxa_bad_xxx` calls are inserted by the compiler? The tests `dynamic_cast_xxx` all seem to pass, which I found a bit weird because I would've expected some of those to fail because of the `std::terminate()`. Or are they not related to RTTI? Comment at: src/cxa_new_delete.cpp:85-86 @@ -79,2 +84,4 @@ +#endif p = ::operator new(size); +#ifndef _LIBCXXABI_NO_EXCEPTIONS } I agree. I've update it to be inline with `new.cpp` from libcxx. At least the users will have some method of recovery if we return null, calling `std::terminate()` would be a bit rude. http://reviews.llvm.org/D20677 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: [PATCH] D20681: Add target-specific pre-linking passes to Clang
+ Brian -Original Message- From: Tom Stellard [mailto:thomas.stell...@amd.com] Sent: Thursday, May 26, 2016 11:11 AM To: Liu, Yaxun (Sam); rich...@metafoo.co.uk; anastasia.stul...@arm.com Cc: Stellard, Thomas ; cfe-commits@lists.llvm.org Subject: Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang tstellarAMD added a comment. Can you give some examples of what pre-link passes may be required? http://reviews.llvm.org/D20681 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20677: Make it possible to build a -fno-exceptions libc++abi variant.
rmaprath updated this revision to Diff 58620. http://reviews.llvm.org/D20677 Files: CMakeLists.txt src/cxa_aux_runtime.cpp src/cxa_handlers.cpp src/cxa_new_delete.cpp src/cxa_personality.cpp test/CMakeLists.txt test/backtrace_test.pass.cpp test/catch_array_01.pass.cpp test/catch_array_02.pass.cpp test/catch_class_01.pass.cpp test/catch_class_02.pass.cpp test/catch_class_03.pass.cpp test/catch_class_04.pass.cpp test/catch_const_pointer_nullptr.pass.cpp test/catch_function_01.pass.cpp test/catch_function_02.pass.cpp test/catch_in_noexcept.pass.cpp test/catch_member_data_pointer_01.pass.cpp test/catch_member_function_pointer_01.pass.cpp test/catch_member_pointer_nullptr.pass.cpp test/catch_multi_level_pointer.pass.cpp test/catch_pointer_nullptr.pass.cpp test/catch_pointer_reference.pass.cpp test/catch_ptr.pass.cpp test/catch_ptr_02.pass.cpp test/incomplete_type.sh.cpp test/inherited_exception.pass.cpp test/libcxxabi/test/config.py test/lit.site.cfg.in test/test_aux_runtime.pass.cpp test/test_aux_runtime_op_array_new.pass.cpp test/test_guard.pass.cpp test/test_vector1.pass.cpp test/test_vector2.pass.cpp test/test_vector3.pass.cpp test/uncaught_exceptions.pass.cpp test/unwind_01.pass.cpp test/unwind_02.pass.cpp test/unwind_03.pass.cpp test/unwind_04.pass.cpp test/unwind_05.pass.cpp test/unwind_06.pass.cpp Index: test/unwind_06.pass.cpp === --- test/unwind_06.pass.cpp +++ test/unwind_06.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include #include #include Index: test/unwind_05.pass.cpp === --- test/unwind_05.pass.cpp +++ test/unwind_05.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include #include #include Index: test/unwind_04.pass.cpp === --- test/unwind_04.pass.cpp +++ test/unwind_04.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include #include #include Index: test/unwind_03.pass.cpp === --- test/unwind_03.pass.cpp +++ test/unwind_03.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include #include #include Index: test/unwind_02.pass.cpp === --- test/unwind_02.pass.cpp +++ test/unwind_02.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include struct A Index: test/unwind_01.pass.cpp === --- test/unwind_01.pass.cpp +++ test/unwind_01.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include struct A Index: test/uncaught_exceptions.pass.cpp === --- test/uncaught_exceptions.pass.cpp +++ test/uncaught_exceptions.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include #include #include Index: test/test_vector3.pass.cpp === --- test/test_vector3.pass.cpp +++ test/test_vector3.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include "cxxabi.h" #include Index: test/test_vector2.pass.cpp === --- test/test_vector2.pass.cpp +++ test/test_vector2.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include "cxxabi.h" #include Index: test/test_vector1.pass.cpp === --- test/test_vector1.pass.cpp +++ test/test_vector1.pass.cpp @@ -7,6 +7,8 @@ // //===--===// +// UNSUPPORTED: libcxxabi-no-exceptions + #include "cxxabi.h" #include Index: test/test_guard.pass.cpp === --- test/test_guard.pass.cpp +++ test/test_guard.pass.cpp @@ -41,6 +41,7 @@ // When initialization
Re: [PATCH] D15421: [Feature] Add a builtin for indexing into parameter packs
ldionne updated this revision to Diff 58619. ldionne added a comment. Rebase the patch on top of the current `master`. The patch passes all of Clang's tests (`make check-clang`). I also removed the TODO comment about diagnostics, since that was answered by Richard Smith. http://reviews.llvm.org/D15421 Files: include/clang/AST/ASTContext.h include/clang/AST/DeclTemplate.h include/clang/Basic/Builtins.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Serialization/ASTBitCodes.h lib/AST/ASTContext.cpp lib/AST/DeclTemplate.cpp lib/Lex/PPMacroExpansion.cpp lib/Sema/SemaLookup.cpp lib/Sema/SemaTemplate.cpp lib/Serialization/ASTReader.cpp lib/Serialization/ASTWriter.cpp test/PCH/type_pack_element.cpp test/SemaCXX/type_pack_element.cpp Index: test/SemaCXX/type_pack_element.cpp === --- /dev/null +++ test/SemaCXX/type_pack_element.cpp @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +static_assert(__has_builtin(__type_pack_element), ""); + +using SizeT = decltype(sizeof(int)); + +template +using TypePackElement = __type_pack_element; + +template +struct X; + +static_assert(__is_same(TypePackElement<0, X<0>>, X<0>), ""); + +static_assert(__is_same(TypePackElement<0, X<0>, X<1>>, X<0>), ""); +static_assert(__is_same(TypePackElement<1, X<0>, X<1>>, X<1>), ""); + +static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>>, X<0>), ""); +static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>>, X<1>), ""); +static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>>, X<2>), ""); + +static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>, X<3>>, X<0>), ""); +static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>, X<3>>, X<1>), ""); +static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>, X<3>>, X<2>), ""); +static_assert(__is_same(TypePackElement<3, X<0>, X<1>, X<2>, X<3>>, X<3>), ""); + +static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>, X<3>, X<4>>, X<0>), ""); +static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>, X<3>, X<4>>, X<1>), ""); +static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>, X<3>, X<4>>, X<2>), ""); +static_assert(__is_same(TypePackElement<3, X<0>, X<1>, X<2>, X<3>, X<4>>, X<3>), ""); +static_assert(__is_same(TypePackElement<4, X<0>, X<1>, X<2>, X<3>, X<4>>, X<4>), ""); + +static_assert(__is_same(TypePackElement<0, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<0>), ""); +static_assert(__is_same(TypePackElement<1, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<1>), ""); +static_assert(__is_same(TypePackElement<2, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<2>), ""); +static_assert(__is_same(TypePackElement<3, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<3>), ""); +static_assert(__is_same(TypePackElement<4, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<4>), ""); +static_assert(__is_same(TypePackElement<5, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<5>), ""); + +// Test __type_pack_element with more than 2 top-level template arguments. +static_assert(__is_same(__type_pack_element<5, X<0>, X<1>, X<2>, X<3>, X<4>, X<5>>, X<5>), ""); + +template +using ErrorTypePackElement1 = __type_pack_element; // expected-error{{may not be accessed at an out of bounds index}} +using illformed1 = ErrorTypePackElement1<3, X<0>, X<1>>; // expected-note{{in instantiation}} Index: test/PCH/type_pack_element.cpp === --- /dev/null +++ test/PCH/type_pack_element.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -std=c++14 -x c++-header %s -emit-pch -o %t.pch +// RUN: %clang_cc1 -std=c++14 -x c++ /dev/null -include-pch %t.pch + +template +struct X { }; + +using SizeT = decltype(sizeof(int)); + +template +using TypePackElement = __type_pack_element; + +void fn1() { + X<0> x0 = TypePackElement<0, X<0>, X<1>, X<2>>{}; + X<1> x1 = TypePackElement<1, X<0>, X<1>, X<2>>{}; + X<2> x2 = TypePackElement<2, X<0>, X<1>, X<2>>{}; +} Index: lib/Serialization/ASTWriter.cpp === --- lib/Serialization/ASTWriter.cpp +++ lib/Serialization/ASTWriter.cpp @@ -4191,6 +4191,8 @@ PREDEF_DECL_CF_CONSTANT_STRING_ID); RegisterPredefDecl(Context.CFConstantStringTagDecl, PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID); + RegisterPredefDecl(Context.TypePackElementDecl, + PREDEF_DECL_TYPE_PACK_ELEMENT_ID); // Build a record containing all of the tentative definitions in this file, in // TentativeDefinitions order. Generally, this record will be empty for Index: lib/Serialization/ASTReader.cpp === --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -6428,6 +6428,9 @@ case PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID: return Context.getCFConstantStringTagDecl(); + + case PREDEF_DECL_TYPE_PACK_ELEMENT_ID: +
Re: [PATCH] D20561: Warn when taking address of packed member
rogfer01 added a comment. Firefox build has ended and exposes 62 diagnostics, 44 unique ocurrences and 10 different diagnostics (shown below) in networking code. taking address of packed member 'address' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value taking address of packed member 'addr' of class or structure 'sctp_ipv4addr_param' may result in an unaligned pointer value taking address of packed member 'addr' of class or structure 'sctp_ipv6addr_param' may result in an unaligned pointer value taking address of packed member 'aph' of class or structure 'sctp_asconf_addr_param' may result in an unaligned pointer value taking address of packed member 'cookie' of class or structure 'sctp_cookie_echo_chunk' may result in an unaligned pointer value taking address of packed member 'init' of class or structure 'sctp_init_chunk' may result in an unaligned pointer value taking address of packed member 'laddress' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value taking address of packed member 'ph' of class or structure 'sctp_ipv4addr_param' may result in an unaligned pointer value taking address of packed member 'ph' of class or structure 'sctp_ipv6addr_param' may result in an unaligned pointer value taking address of packed member 'time_entered' of class or structure 'sctp_state_cookie' may result in an unaligned pointer value which leads me to think that there might be cases where the field of a packed struct happens to be aligned for the type of the field itself. I'll add a check for this. I'll give it a spin. http://reviews.llvm.org/D20561 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains
It does, thanks! On Thu, May 26, 2016 at 3:35 PM, Simon Atanasyanwrote: > I hope r270842 fixes the problem. > > Thanks a lot for your help. > > On Thu, May 26, 2016 at 11:28 AM, Ismail Donmez wrote: >> Indeed the problematic option is -DCLANG_DEFAULT_CXX_STDLIB=libc++ , >> thanks Jonas! >> >> On Thu, May 26, 2016 at 11:19 AM, Hahnfeld, Jonas >> wrote: >>> Hi, >>> >>> Have you also set CLANG_DEFAULT_CXX_STDLIB? Then you may need to add an >>> '-stdlib=platform' to the test... (see r260662 and r263434) >>> >>> Cheers, >>> Jonas >>> -Original Message- From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of Ismail Donmez via cfe-commits Sent: Thursday, May 26, 2016 10:03 AM To: Simon Atanasyan Cc: cfe-commits Subject: Re: r270373 - [driver][mips] Support new versions of MIPS CodeScape toolchains Hi, I think this is because I enable libc++ by default with - DLLVM_ENABLE_LIBCXX=ON , so this tests need an explicit -stdlib=libstdc++ > > -- > Simon Atanasyan ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20672: Don't pass -fms-compatibility-version flag during build
hans accepted this revision. hans added a comment. This revision is now accepted and ready to land. lgtm if it works :-) Repository: rL LLVM http://reviews.llvm.org/D20672 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
RE: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing
Hi, I think this commit may have caused the failure in http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/13743. Could you check? Buildbot will have supressed the usual email because the previous build failed (for a different reason). > -Original Message- > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf > Of Alexey Bataev via cfe-commits > Sent: 26 May 2016 12:10 > To: cfe-commits@lists.llvm.org > Subject: r270838 - [OPENMP] Add option '-fopenmp-version=[31|40|45]' > allowing choosing > > Author: abataev > Date: Thu May 26 06:10:11 2016 > New Revision: 270838 > > URL: http://llvm.org/viewvc/llvm-project?rev=270838=rev > Log: > [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosing > OpenMP version. > > If '-fopenmp' option is provided '-fopenmp-version=' allows to control, > which version of OpenMP must be supported. Currently it affects only the > value of _OPENMP define. > > Modified: > cfe/trunk/include/clang/Basic/LangOptions.def > cfe/trunk/include/clang/Driver/Options.td > cfe/trunk/lib/Driver/Tools.cpp > cfe/trunk/lib/Frontend/CompilerInvocation.cpp > cfe/trunk/lib/Frontend/InitPreprocessor.cpp > cfe/trunk/test/OpenMP/driver.c > cfe/trunk/test/OpenMP/predefined_macro.c > > Modified: cfe/trunk/include/clang/Basic/LangOptions.def > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=270838=270 > 837=270838=diff > == > > --- cfe/trunk/include/clang/Basic/LangOptions.def (original) > +++ cfe/trunk/include/clang/Basic/LangOptions.def Thu May 26 06:10:11 > 2016 > @@ -182,7 +182,7 @@ LANGOPT(NativeHalfType, 1, 0, "Nativ > LANGOPT(NativeHalfArgsAndReturns, 1, 0, "Native half args and returns") > LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns") > LANGOPT(CUDA , 1, 0, "CUDA") > -LANGOPT(OpenMP, 1, 0, "OpenMP support") > +LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP > (31, 40 or 45)") > LANGOPT(OpenMPUseTLS , 1, 0, "Use TLS for threadprivates or runtime > calls") > LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP target > device") > > > Modified: cfe/trunk/include/clang/Driver/Options.td > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/include/clang/Driver/Options.td?rev=270838=270837& > r2=270838=diff > == > > --- cfe/trunk/include/clang/Driver/Options.td (original) > +++ cfe/trunk/include/clang/Driver/Options.td Thu May 26 06:10:11 2016 > @@ -1004,6 +1004,7 @@ def fobjc_sender_dependent_dispatch : Fl > def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">, > Group; > def fopenmp : Flag<["-"], "fopenmp">, Group, Flags<[CC1Option, > NoArgumentUnused]>; > def fno_openmp : Flag<["-"], "fno-openmp">, Group, > Flags<[NoArgumentUnused]>; > +def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">, > Group, Flags<[CC1Option, NoArgumentUnused]>; > def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group; > def fopenmp_use_tls : Flag<["-"], "fopenmp-use-tls">, Group, > Flags<[NoArgumentUnused]>; > def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">, > Group, Flags<[CC1Option, NoArgumentUnused]>; > > Modified: cfe/trunk/lib/Driver/Tools.cpp > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/lib/Driver/Tools.cpp?rev=270838=270837=270838& > view=diff > == > > --- cfe/trunk/lib/Driver/Tools.cpp (original) > +++ cfe/trunk/lib/Driver/Tools.cpp Thu May 26 06:10:11 2016 > @@ -4862,7 +4862,8 @@ void Clang::ConstructJob(Compilation , > >// Forward flags for OpenMP >if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ, > - options::OPT_fno_openmp, false)) > + options::OPT_fno_openmp, false)) { > +Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ); > switch (getOpenMPRuntime(getToolChain(), Args)) { > case OMPRT_OMP: > case OMPRT_IOMP5: > @@ -4885,6 +4886,7 @@ void Clang::ConstructJob(Compilation , >// semantic analysis, etc. >break; > } > + } > >const SanitizerArgs = getToolChain().getSanitizerArgs(); >Sanitize.addArgs(getToolChain(), Args, CmdArgs, InputType); > > Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp > URL: http://llvm.org/viewvc/llvm- > project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=270838=270 > 837=270838=diff > == > > --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) > +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu May 26 06:10:11 > 2016 > @@ -1960,18 +1960,23 @@ static void ParseLangArgs(LangOptions >Opts.OpenMPIsDevice = >Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device); > > - // Provide
Re: [PATCH] D20561: Warn when taking address of packed member
rogfer01 marked 4 inline comments as done. Comment at: lib/Sema/SemaExpr.cpp:10527 @@ +10526,3 @@ +ME->getMemberDecl()->hasAttr()) { + Diag(OpLoc, diag::warn_taking_address_of_packed_member) + << ME->getMemberDecl() << RD; aaron.ballman wrote: > I wonder if we should diagnose only when the resulting pointer is actually > misaligned. For instance, the following code should be just fine: > ``` > struct __attribute__((packed)) S { > int i; > }; > > void f(S s) { > int *ip = // Why should this warn? > } > ``` > Have you run this patch over any large code bases to see how high the > false-positive rate is? How do you envision users silencing this diagnostic > if they have a false-positive? Something like `&(s.x)` (since I you're not > ignoring paren imp casts)? I think it should warn because in this case == and the alignment of the whole struct is 1 (due to the packed attribute) so s.i is also aligned to 1 which would not be the suitable alignment for an int. I'm currently building Firefox, I'll add a comment once it ends. Regarding silencing the diagnostic: -Wno-address-of-packed-member should do but I understand it might be too coarse in some cases. http://reviews.llvm.org/D20561 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20681: Add target-specific pre-linking passes to Clang
tstellarAMD added a comment. Can you give some examples of what pre-link passes may be required? http://reviews.llvm.org/D20681 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20602: Add .rgba syntax extension to ext_vector_type types
Anastasia added a subscriber: Anastasia. Comment at: include/clang/Basic/DiagnosticSemaKinds.td:7900 @@ -7897,1 +7899,3 @@ +def ext_opencl_ext_vector_type_rgba_selector: ExtWarn< + "vector component name '%0' is an OpenCL 2.2 extension">; } // end of sema category Could it be an error instead for CL <2.2? It isn't a valid feature and we have already rejected similar cases with an error. How about changing to something like: "vector component name '%0' is not supported in earlier than OpenCL version 2.2" See similar diagnostics above - err_opencl_invalid_read_write, err_opencl_unknown_type_specifier. Using extension might be confusing because we have core spec and extension spec in OpenCL. http://reviews.llvm.org/D20602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18641: [PP] Handle #include_next after include found relative to current one same as GCC
DmitryPolukhin abandoned this revision. DmitryPolukhin added a comment. It seems that there is no interest in this patch, abandon. http://reviews.llvm.org/D18641 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20010: [clang-tidy] UnnecessaryCopyInitialization - Extend to trigger on non-const "this" object argument if it is not modified
flx added a comment. Friendly ping. http://reviews.llvm.org/D20010 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC
atanasyan accepted this revision. atanasyan added a reviewer: atanasyan. atanasyan added a comment. This revision is now accepted and ready to land. LGTM Comment at: lib/Basic/Targets.cpp:6986 @@ +6985,3 @@ + : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips || + getTriple().getArch() == llvm::Triple::mipsel) +? "mips32r2" dsanders wrote: > atanasyan wrote: > > What do you think about creation a static function and using it to simplify > > this and similar conditions? > > > > ``` > > static bool is32BitTriple(const llvm::Triple ) { > > return Triple.getArch() == llvm::Triple::mips || Triple.getArch() == > > llvm::Triple::mipsel; > > } > > ``` > I'm happy to add one if you want it but I'm currently finishing a patch that > removes most of them in favour of ABI checks. The only one I think should > remain as an Arch check is the one for MipsTargetInfo::ABI. Even that one is > incorrect on our buildbots which detect as mips64-linux-gnu but should > default to O32. Agreed. In that case the separate function is redundant. http://reviews.llvm.org/D20678 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.
mprobst updated this revision to Diff 58612. mprobst marked an inline comment as done. mprobst added a comment. revert FormatTokenLexer, restrict to first token http://reviews.llvm.org/D20632 Files: lib/Format/FormatToken.h lib/Format/TokenAnnotator.cpp unittests/Format/FormatTestJS.cpp Index: unittests/Format/FormatTestJS.cpp === --- unittests/Format/FormatTestJS.cpp +++ unittests/Format/FormatTestJS.cpp @@ -1272,5 +1272,12 @@ verifyFormat("var x = 'foo';", LeaveQuotes); } +TEST_F(FormatTestJS, SupportShebangLines) { + verifyFormat("#!/usr/bin/env node\n" + "var x = hello();", + "#!/usr/bin/env node\n" + "var x = hello();"); +} + } // end namespace tooling } // end namespace clang Index: lib/Format/TokenAnnotator.cpp === --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -690,10 +690,24 @@ } LineType parsePreprocessorDirective() { +bool IsFirstToken = CurrentToken->IsFirst; LineType Type = LT_PreprocessorDirective; next(); if (!CurrentToken) return Type; + +if (Style.Language == FormatStyle::LK_JavaScript && IsFirstToken) { + // JavaScript files can contain shebang lines of the form: + // #!/usr/bin/env node + // Treat these like C++ #include directives. + while (CurrentToken) { +// Tokens cannot be comments here. +CurrentToken->Type = TT_ImplicitStringLiteral; +next(); + } + return LT_ImportStatement; +} + if (CurrentToken->Tok.is(tok::numeric_constant)) { CurrentToken->SpacesRequiredBefore = 1; return Type; Index: lib/Format/FormatToken.h === --- lib/Format/FormatToken.h +++ lib/Format/FormatToken.h @@ -145,7 +145,7 @@ /// \brief Whether the token text contains newlines (escaped or not). bool IsMultiline = false; - /// \brief Indicates that this is the first token. + /// \brief Indicates that this is the first token of the file. bool IsFirst = false; /// \brief Whether there must be a line break before this token. Index: unittests/Format/FormatTestJS.cpp === --- unittests/Format/FormatTestJS.cpp +++ unittests/Format/FormatTestJS.cpp @@ -1272,5 +1272,12 @@ verifyFormat("var x = 'foo';", LeaveQuotes); } +TEST_F(FormatTestJS, SupportShebangLines) { + verifyFormat("#!/usr/bin/env node\n" + "var x = hello();", + "#!/usr/bin/env node\n" + "var x = hello();"); +} + } // end namespace tooling } // end namespace clang Index: lib/Format/TokenAnnotator.cpp === --- lib/Format/TokenAnnotator.cpp +++ lib/Format/TokenAnnotator.cpp @@ -690,10 +690,24 @@ } LineType parsePreprocessorDirective() { +bool IsFirstToken = CurrentToken->IsFirst; LineType Type = LT_PreprocessorDirective; next(); if (!CurrentToken) return Type; + +if (Style.Language == FormatStyle::LK_JavaScript && IsFirstToken) { + // JavaScript files can contain shebang lines of the form: + // #!/usr/bin/env node + // Treat these like C++ #include directives. + while (CurrentToken) { +// Tokens cannot be comments here. +CurrentToken->Type = TT_ImplicitStringLiteral; +next(); + } + return LT_ImportStatement; +} + if (CurrentToken->Tok.is(tok::numeric_constant)) { CurrentToken->SpacesRequiredBefore = 1; return Type; Index: lib/Format/FormatToken.h === --- lib/Format/FormatToken.h +++ lib/Format/FormatToken.h @@ -145,7 +145,7 @@ /// \brief Whether the token text contains newlines (escaped or not). bool IsMultiline = false; - /// \brief Indicates that this is the first token. + /// \brief Indicates that this is the first token of the file. bool IsFirst = false; /// \brief Whether there must be a line break before this token. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20678: [mips] Fold MipsTargetInfoBase subclasses into MipsTargetInfoBase and rename to MipsTargetInfo. NFC
dsanders added inline comments. Comment at: lib/Basic/Targets.cpp:6986 @@ +6985,3 @@ + : TargetInfo(Triple), CPU((getTriple().getArch() == llvm::Triple::mips || + getTriple().getArch() == llvm::Triple::mipsel) +? "mips32r2" atanasyan wrote: > What do you think about creation a static function and using it to simplify > this and similar conditions? > > ``` > static bool is32BitTriple(const llvm::Triple ) { > return Triple.getArch() == llvm::Triple::mips || Triple.getArch() == > llvm::Triple::mipsel; > } > ``` I'm happy to add one if you want it but I'm currently finishing a patch that removes most of them in favour of ABI checks. The only one I think should remain as an Arch check is the one for MipsTargetInfo::ABI. Even that one is incorrect on our buildbots which detect as mips64-linux-gnu but should default to O32. Comment at: lib/Basic/Targets.cpp:7006 @@ +7005,3 @@ + MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32; +} else if (getTriple().getArch() == llvm::Triple::mips64 || + getTriple().getArch() == llvm::Triple::mips64el) { atanasyan wrote: > Can we use just `else` here? Sure http://reviews.llvm.org/D20678 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20632: clang-format: [JS] Support shebang lines on the very first line.
mprobst marked 2 inline comments as done. Comment at: lib/Format/TokenAnnotator.cpp:698 @@ +697,3 @@ + +if (Style.Language == FormatStyle::LK_JavaScript) { + // JavaScript files can contain shebang lines of the form: alexeagle wrote: > should we still restrict it to be on the first line? > > I suppose if you start some other line with #, that's not valid JS or TS so > it doesn't matter what clang-format does to it? Maybe it's fine like this. Done. Doesn't make a big difference I guess, but it's better to be conservative. http://reviews.llvm.org/D20632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20277: [clang-tidy] UnnecessaryValueParamCheck - suggest std::move() if non-const value parameter can be moved.
flx added a comment. This is ready for review again. http://reviews.llvm.org/D20277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r270851 - Adding missing _mm512_castsi512_si256 intrinsic.
Author: mzuckerm Date: Thu May 26 09:32:11 2016 New Revision: 270851 URL: http://llvm.org/viewvc/llvm-project?rev=270851=rev Log: Adding missing _mm512_castsi512_si256 intrinsic. Modified: cfe/trunk/lib/Headers/avx512fintrin.h cfe/trunk/test/CodeGen/avx512f-builtins.c Modified: cfe/trunk/lib/Headers/avx512fintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=270851=270850=270851=diff == --- cfe/trunk/lib/Headers/avx512fintrin.h (original) +++ cfe/trunk/lib/Headers/avx512fintrin.h Thu May 26 09:32:11 2016 @@ -445,6 +445,12 @@ _mm512_castsi512_si128 (__m512i __A) return (__m128i)__builtin_shufflevector(__A, __A , 0, 1); } +static __inline __m256i __DEFAULT_FN_ATTRS +_mm512_castsi512_si256 (__m512i __A) +{ + return (__m256i)__builtin_shufflevector(__A, __A , 0, 1, 2, 3); +} + /* Bitwise operators */ static __inline__ __m512i __DEFAULT_FN_ATTRS _mm512_and_epi32(__m512i __a, __m512i __b) Modified: cfe/trunk/test/CodeGen/avx512f-builtins.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/avx512f-builtins.c?rev=270851=270850=270851=diff == --- cfe/trunk/test/CodeGen/avx512f-builtins.c (original) +++ cfe/trunk/test/CodeGen/avx512f-builtins.c Thu May 26 09:32:11 2016 @@ -6041,6 +6041,13 @@ __m128i test_mm512_castsi512_si128 (__m5 return _mm512_castsi512_si128 (__A); } +__m256i test_mm512_castsi512_si256 (__m512i __A) +{ + // CHECK-LABEL: @test_mm512_castsi512_si256 + // CHECK: shufflevector <8 x i64> %{{.}}, <8 x i64> %{{.}}, <4 x i32> + return _mm512_castsi512_si256 (__A); +} + __m128 test_mm_cvt_roundsd_ss(__m128 __A, __m128d __B) { // CHECK-LABEL: @test_mm_cvt_roundsd_ss // CHECK: @llvm.x86.avx512.mask.cvtsd2ss.round ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20681: Add target-specific pre-linking passes to Clang
yaxunl created this revision. yaxunl added reviewers: rsmith, Anastasia. yaxunl added subscribers: cfe-commits, tstellarAMD. Sometimes a backend needs to apply certain target-specific passes before linking. This patch attempts to add that. It depends on a new virtual member function addPreLinkPasses to be added to TargetMachine, which will be implemented by a separate patch for llvm. http://reviews.llvm.org/D20681 Files: include/clang/CodeGen/BackendUtil.h lib/CodeGen/BackendUtil.cpp lib/CodeGen/CodeGenAction.cpp Index: lib/CodeGen/CodeGenAction.cpp === --- lib/CodeGen/CodeGenAction.cpp +++ lib/CodeGen/CodeGenAction.cpp @@ -165,19 +165,20 @@ void *OldDiagnosticContext = Ctx.getDiagnosticContext(); Ctx.setDiagnosticHandler(DiagnosticHandler, this); - // Link LinkModule into this module if present, preserving its validity. - for (auto : LinkModules) { -unsigned LinkFlags = I.first; -CurLinkModule = I.second.get(); -if (Linker::linkModules(*getModule(), std::move(I.second), LinkFlags)) - return; - } - - EmbedBitcode(getModule(), CodeGenOpts, llvm::MemoryBufferRef()); - + std::function+LinkCallBack = [=](llvm::Module *M)->bool { +// Link LinkModule into this module if present, preserving its validity. +for (auto : LinkModules) { + unsigned LinkFlags = I.first; + CurLinkModule = I.second.get(); + if (Linker::linkModules(*getModule(), std::move(I.second), LinkFlags)) +return true; +} +return false; + }; EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts, C.getTargetInfo().getDataLayout(), -getModule(), Action, AsmOutStream); +getModule(), Action, AsmOutStream, ); Ctx.setInlineAsmDiagnosticHandler(OldHandler, OldContext); Index: lib/CodeGen/BackendUtil.cpp === --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -59,8 +59,10 @@ const LangOptions Module *TheModule; + Timer PreLinkTime; Timer CodeGenerationTime; + mutable legacy::PassManager *PreLinkPasses; mutable legacy::PassManager *CodeGenPasses; mutable legacy::PassManager *PerModulePasses; mutable legacy::FunctionPassManager *PerFunctionPasses; @@ -100,8 +102,14 @@ return PerFunctionPasses; } - /// Set LLVM command line options passed through -backend-option. - void setCommandLineOpts(); + legacy::PassManager *getPreLinkPasses() const { +if (!PreLinkPasses) { + PreLinkPasses = new legacy::PassManager(); + PreLinkPasses->add( + createTargetTransformInfoWrapperPass(getTargetIRAnalysis())); +} +return PreLinkPasses; + } void CreatePasses(ModuleSummaryIndex *ModuleSummary); @@ -120,16 +128,21 @@ /// \return True on success. bool AddEmitPasses(BackendAction Action, raw_pwrite_stream ); + /// Add target specific pre-linking passes. + void AddPreLinkPasses(raw_pwrite_stream ); + public: EmitAssemblyHelper(DiagnosticsEngine &_Diags, const CodeGenOptions , const clang::TargetOptions , const LangOptions , Module *M) : Diags(_Diags), CodeGenOpts(CGOpts), TargetOpts(TOpts), LangOpts(LOpts), -TheModule(M), CodeGenerationTime("Code Generation Time"), +TheModule(M), PreLinkTime("Pre-Linking Passes Time"), +CodeGenerationTime("Code Generation Time"), PreLinkPasses(nullptr), CodeGenPasses(nullptr), PerModulePasses(nullptr), PerFunctionPasses(nullptr) {} ~EmitAssemblyHelper() { +delete PreLinkPasses; delete CodeGenPasses; delete PerModulePasses; delete PerFunctionPasses; @@ -140,6 +153,14 @@ std::unique_ptr TM; void EmitAssembly(BackendAction Action, raw_pwrite_stream *OS); + void DoPreLinkPasses(raw_pwrite_stream *OS); + + /// Set LLVM command line options passed through -backend-option. + void setCommandLineOpts(); + + /// Set up target for target specific pre-linking passes and LLVM code + /// generation. + void setTarget(BackendAction Action); }; // We need this wrapper to access LangOpts and CGOpts from extension functions @@ -504,6 +525,14 @@ BackendArgs.data()); } +void EmitAssemblyHelper::setTarget(BackendAction Action) { + bool UsesCodeGen = (Action != Backend_EmitNothing && + Action != Backend_EmitBC && + Action != Backend_EmitLL); + if (!TM) +TM.reset(CreateTargetMachine(UsesCodeGen)); +} + TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) { // Create the TargetMachine for generating code. std::string Error; @@ -625,6 +654,7 @@ return TM; } + bool
Re: [PATCH] D20680: [mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.
atanasyan accepted this revision. atanasyan added a reviewer: atanasyan. atanasyan added a comment. This revision is now accepted and ready to land. LGTM http://reviews.llvm.org/D20680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D20338: [PCH] Fixed overridden files always invalidating preamble even when unchanged
cameron314 added a comment. Thanks @bruno, I'll have a look at using a VFS for the test. Comment at: lib/Basic/FileManager.cpp:389 @@ -383,2 +388,3 @@ UFE->File.reset(); + UFE->IsVirtual = true; return UFE; rsmith wrote: > Rather than adding this `IsVirtual` flag, could you just set `UFE->IsValid` > to `true` here? It looks like a simple oversight that this code fails to set > the `IsValid` flag properly. I could, but I didn't want to accidentally break something else that depends on virtual files not being valid. That's the type of change that can easily introduce a subtle bug not caught by the tests. Semantically, is a virtual file always valid? Repository: rL LLVM http://reviews.llvm.org/D20338 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D20680: [mips] Slightly simplify MipsTargetInfo::setDataLayout(). NFC.
dsanders created this revision. dsanders added subscribers: cfe-commits, atanasyan. dsanders added a dependency: D20679: [mips] Kill 'support' for untested EABI.. Depends on D20679 http://reviews.llvm.org/D20680 Files: lib/Basic/Targets.cpp Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -6940,25 +6940,21 @@ class MipsTargetInfo : public TargetInfo { void setDataLayout() { -if (BigEndian) { - if (ABI == "o32") -resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); - else if (ABI == "n32") -resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); - else if (ABI == "n64") -resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); - else -llvm_unreachable("Invalid ABI"); -} else { - if (ABI == "o32") -resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); - else if (ABI == "n32") -resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); - else if (ABI == "n64") -resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); - else -llvm_unreachable("Invalid ABI"); -} +StringRef Layout; + +if (ABI == "o32") + Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"; +else if (ABI == "n32") + Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"; +else if (ABI == "n64") + Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"; +else + llvm_unreachable("Invalid ABI"); + +if (BigEndian) + resetDataLayout(("E-" + Layout).str()); +else + resetDataLayout(("e-" + Layout).str()); } Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -6940,25 +6940,21 @@ class MipsTargetInfo : public TargetInfo { void setDataLayout() { -if (BigEndian) { - if (ABI == "o32") -resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); - else if (ABI == "n32") -resetDataLayout("E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); - else if (ABI == "n64") -resetDataLayout("E-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); - else -llvm_unreachable("Invalid ABI"); -} else { - if (ABI == "o32") -resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"); - else if (ABI == "n32") -resetDataLayout("e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"); - else if (ABI == "n64") -resetDataLayout("e-m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"); - else -llvm_unreachable("Invalid ABI"); -} +StringRef Layout; + +if (ABI == "o32") + Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"; +else if (ABI == "n32") + Layout = "m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32:64-S128"; +else if (ABI == "n64") + Layout = "m:m-i8:8:32-i16:16:32-i64:64-n32:64-S128"; +else + llvm_unreachable("Invalid ABI"); + +if (BigEndian) + resetDataLayout(("E-" + Layout).str()); +else + resetDataLayout(("e-" + Layout).str()); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits