r321574 - [NFC] Modernize enum 'UnqualifiedId::IdKind' into a scoped enum UnqualifiedIdKind.
Author: faisalv Date: Fri Dec 29 20:15:27 2017 New Revision: 321574 URL: http://llvm.org/viewvc/llvm-project?rev=321574&view=rev Log: [NFC] Modernize enum 'UnqualifiedId::IdKind' into a scoped enum UnqualifiedIdKind. Modified: cfe/trunk/include/clang/Sema/DeclSpec.h cfe/trunk/lib/Parse/ParseDecl.cpp cfe/trunk/lib/Parse/ParseDeclCXX.cpp cfe/trunk/lib/Parse/ParseExprCXX.cpp cfe/trunk/lib/Parse/ParseTemplate.cpp cfe/trunk/lib/Sema/DeclSpec.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/lib/Sema/SemaExprMember.cpp cfe/trunk/lib/Sema/SemaTemplate.cpp cfe/trunk/lib/Sema/SemaType.cpp Modified: cfe/trunk/include/clang/Sema/DeclSpec.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=321574&r1=321573&r2=321574&view=diff == --- cfe/trunk/include/clang/Sema/DeclSpec.h (original) +++ cfe/trunk/include/clang/Sema/DeclSpec.h Fri Dec 29 20:15:27 2017 @@ -882,6 +882,30 @@ private: }; +/// \brief Describes the kind of unqualified-id parsed. +enum class UnqualifiedIdKind { + /// \brief An identifier. + IK_Identifier, + /// \brief An overloaded operator name, e.g., operator+. + IK_OperatorFunctionId, + /// \brief A conversion function name, e.g., operator int. + IK_ConversionFunctionId, + /// \brief A user-defined literal name, e.g., operator "" _i. + IK_LiteralOperatorId, + /// \brief A constructor name. + IK_ConstructorName, + /// \brief A constructor named via a template-id. + IK_ConstructorTemplateId, + /// \brief A destructor name. + IK_DestructorName, + /// \brief A template-id, e.g., f. + IK_TemplateId, + /// \brief An implicit 'self' parameter + IK_ImplicitSelfParam, + /// \brief A deduction-guide name (a template-name) + IK_DeductionGuideName +}; + /// \brief Represents a C++ unqualified-id that has been parsed. class UnqualifiedId { private: @@ -890,28 +914,7 @@ private: public: /// \brief Describes the kind of unqualified-id parsed. - enum IdKind { -/// \brief An identifier. -IK_Identifier, -/// \brief An overloaded operator name, e.g., operator+. -IK_OperatorFunctionId, -/// \brief A conversion function name, e.g., operator int. -IK_ConversionFunctionId, -/// \brief A user-defined literal name, e.g., operator "" _i. -IK_LiteralOperatorId, -/// \brief A constructor name. -IK_ConstructorName, -/// \brief A constructor named via a template-id. -IK_ConstructorTemplateId, -/// \brief A destructor name. -IK_DestructorName, -/// \brief A template-id, e.g., f. -IK_TemplateId, -/// \brief An implicit 'self' parameter -IK_ImplicitSelfParam, -/// \brief A deduction-guide name (a template-name) -IK_DeductionGuideName - } Kind; + UnqualifiedIdKind Kind; struct OFI { /// \brief The kind of overloaded operator. @@ -966,13 +969,14 @@ public: /// \brief The location of the last token that describes this unqualified-id. SourceLocation EndLocation; - - UnqualifiedId() : Kind(IK_Identifier), Identifier(nullptr) { } + + UnqualifiedId() + : Kind(UnqualifiedIdKind::IK_Identifier), Identifier(nullptr) {} /// \brief Clear out this unqualified-id, setting it to default (invalid) /// state. void clear() { -Kind = IK_Identifier; +Kind = UnqualifiedIdKind::IK_Identifier; Identifier = nullptr; StartLocation = SourceLocation(); EndLocation = SourceLocation(); @@ -985,15 +989,15 @@ public: bool isInvalid() const { return !isValid(); } /// \brief Determine what kind of name we have. - IdKind getKind() const { return Kind; } - void setKind(IdKind kind) { Kind = kind; } + UnqualifiedIdKind getKind() const { return Kind; } + void setKind(UnqualifiedIdKind kind) { Kind = kind; } /// \brief Specify that this unqualified-id was parsed as an identifier. /// /// \param Id the parsed identifier. /// \param IdLoc the location of the parsed identifier. void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc) { -Kind = IK_Identifier; +Kind = UnqualifiedIdKind::IK_Identifier; Identifier = const_cast(Id); StartLocation = EndLocation = IdLoc; } @@ -1022,7 +1026,7 @@ public: void setConversionFunctionId(SourceLocation OperatorLoc, ParsedType Ty, SourceLocation EndLoc) { -Kind = IK_ConversionFunctionId; +Kind = UnqualifiedIdKind::IK_ConversionFunctionId; StartLocation = OperatorLoc; EndLocation = EndLoc; ConversionFunctionId = Ty; @@ -1038,7 +1042,7 @@ public: /// \param IdLoc the location of the identifier. void setLiteralOperatorId(const IdentifierInfo *Id, SourceLocation OpLoc, SourceLocation IdLoc) { -Kind = IK_LiteralOp
[PATCH] D41622: [cmake] [libcxx] Fix path and flag problems when cross compiling.
hintonda added a comment. Btw, here's the WIP toolchain file I"m using, which might help clear up why these changes is necessary: https://github.com/donhinton/misc/blob/master/cmake/linux-toolchain.cmake Repository: rCXX libc++ https://reviews.llvm.org/D41622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41622: [cmake] [libcxx] Fix path and flag problems when cross compiling.
hintonda added a comment. In https://reviews.llvm.org/D41622#965280, @phosek wrote: > Would it be possible to split the `CMAKE_REQUIRED_FLAGS` fix into a separate > change since it's unrelated to the `CMAKE_FIND_ROOT_PATH` bit? Sure, but both are needed to actually work. This fixes cross compiling across systems, e.g., from Darwin to Linux. Without both, configuration will fail. Please note, cross system compiling also requires a pending patch to cmake: https://gitlab.kitware.com/cmake/cmake/merge_requests/1620 Repository: rCXX libc++ https://reviews.llvm.org/D41622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41623: [cmake] [libcxxabi] Fix path problems when cross compiling.
hintonda added a comment. In https://reviews.llvm.org/D41623#965271, @compnerd wrote: > I think that it might be better to handle this as a single global change: > > if(CMAKE_FIND_ROOT_PATH) > set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) > endif() When I cross compile on Darwin and target Linux, I set sysroot and only want look for headers and libs in the new sysroot, not the host system. However, in this case, I want to look for the just built headers. This change helps support this. As for global settings, this is what I'm setting in my toolchain file: SET(CMAKE_FIND_ROOT_PATH "${sysroot}" CACHE STRING "" FORCE) # adjust the default behavior of the FIND_XXX() commands: # search headers and libraries in the target environment, search # programs in the host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER CACHE STRING "" FORCE) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE STRING "" FORCE) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE STRING "" FORCE) Repository: rCXXA libc++abi https://reviews.llvm.org/D41623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41622: [cmake] [libcxx] Fix path and flag problems when cross compiling.
phosek added a comment. Would it be possible to split the `CMAKE_REQUIRED_FLAGS` fix into a separate change since it's unrelated to the `CMAKE_FIND_ROOT_PATH` bit? Repository: rCXX libc++ https://reviews.llvm.org/D41622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41621: [cmake] [libunwind] Fix path problems when cross compiling.
compnerd requested changes to this revision. compnerd added a comment. This revision now requires changes to proceed. Similar to the libc++abi and libc++ changes. https://reviews.llvm.org/D41621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41622: [cmake] [libcxx] Fix path and flag problems when cross compiling.
compnerd added a comment. Similar to the libc++abi wrt `find_path`. The `CMAKE_REQUIRED_FLAGS` handling LGTM. Repository: rCXX libc++ https://reviews.llvm.org/D41622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41623: [cmake] [libcxxabi] Fix path problems when cross compiling.
compnerd added a comment. I think that it might be better to handle this as a single global change: if(CMAKE_FIND_ROOT_PATH) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) endif() Repository: rCXXA libc++abi https://reviews.llvm.org/D41623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r321570 - Try again, this time with the correct address
Author: jroelofs Date: Fri Dec 29 11:26:53 2017 New Revision: 321570 URL: http://llvm.org/viewvc/llvm-project?rev=321570&view=rev Log: Try again, this time with the correct address Modified: libcxx/trunk/CREDITS.TXT Modified: libcxx/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CREDITS.TXT?rev=321570&r1=321569&r2=321570&view=diff == --- libcxx/trunk/CREDITS.TXT (original) +++ libcxx/trunk/CREDITS.TXT Fri Dec 29 11:26:53 2017 @@ -101,7 +101,7 @@ E: nico.ri...@gmail.com D: Windows fixes N: Jon Roelofs -E: jonat...@jroelofs.com +E: jroel...@jroelofs.com D: Remote testing, Newlib port, baremetal/single-threaded support. N: Jonathan Sauer ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r321569 - Try again, this time with the correct address
Author: jroelofs Date: Fri Dec 29 11:26:28 2017 New Revision: 321569 URL: http://llvm.org/viewvc/llvm-project?rev=321569&view=rev Log: Try again, this time with the correct address Modified: libcxxabi/trunk/CREDITS.TXT Modified: libcxxabi/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CREDITS.TXT?rev=321569&r1=321568&r2=321569&view=diff == --- libcxxabi/trunk/CREDITS.TXT (original) +++ libcxxabi/trunk/CREDITS.TXT Fri Dec 29 11:26:28 2017 @@ -58,7 +58,7 @@ E: e...@olofsson.info D: Minor patches and fixes N: Jon Roelofs -E: jonat...@jroelofs.com +E: jroel...@jroelofs.com D: ARM EHABI Unwind & Exception Handling, Bare-metal N: Nico Weber ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r321564 - Update CREDITS.txt with personal email address
Author: jroelofs Date: Fri Dec 29 11:16:12 2017 New Revision: 321564 URL: http://llvm.org/viewvc/llvm-project?rev=321564&view=rev Log: Update CREDITS.txt with personal email address Modified: libcxxabi/trunk/CREDITS.TXT Modified: libcxxabi/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CREDITS.TXT?rev=321564&r1=321563&r2=321564&view=diff == --- libcxxabi/trunk/CREDITS.TXT (original) +++ libcxxabi/trunk/CREDITS.TXT Fri Dec 29 11:16:12 2017 @@ -58,7 +58,7 @@ E: e...@olofsson.info D: Minor patches and fixes N: Jon Roelofs -E: jonat...@codesourcery.com +E: jonat...@jroelofs.com D: ARM EHABI Unwind & Exception Handling, Bare-metal N: Nico Weber ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r321563 - Update CREDITS.txt with personal email
Author: jroelofs Date: Fri Dec 29 11:15:20 2017 New Revision: 321563 URL: http://llvm.org/viewvc/llvm-project?rev=321563&view=rev Log: Update CREDITS.txt with personal email Modified: libcxx/trunk/CREDITS.TXT Modified: libcxx/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CREDITS.TXT?rev=321563&r1=321562&r2=321563&view=diff == --- libcxx/trunk/CREDITS.TXT (original) +++ libcxx/trunk/CREDITS.TXT Fri Dec 29 11:15:20 2017 @@ -101,7 +101,7 @@ E: nico.ri...@gmail.com D: Windows fixes N: Jon Roelofs -E: jonat...@codesourcery.com +E: jonat...@jroelofs.com D: Remote testing, Newlib port, baremetal/single-threaded support. N: Jonathan Sauer ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D40737: [clang-tidy] WIP Resubmit hicpp-multiway-paths-covered without breaking test
JonasToth added a comment. @sbenza and/or @klimek did you have time to address the stackoverflow caused from the ASTMatchers? Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D40737 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41545: Replace cp -a in various Clang tests
hubert.reinterpretcast added a comment. Maybe `cp -R` is sufficient? `cp -RPp` was the just-to-be-safe "minimal change". Repository: rC Clang https://reviews.llvm.org/D41545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41544: Use backslash escape, replacing xargs -0 in test macro-multiline.c
hubert.reinterpretcast added a comment. Ping Repository: rC Clang https://reviews.llvm.org/D41544 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41500: ananas: Add shared library support
zhmu added a comment. @ed I tried to keep things as much in line as the other ::linker::Construct() functions do. Do you wish to stray from that path? I actually prefer to keep it like this as it's quite readable already, but YMMV of course :-) Repository: rC Clang https://reviews.llvm.org/D41500 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r321562 - [docs] Added description of `-f[no]-openmp-simd` option to UsersManual.
Author: abataev Date: Fri Dec 29 10:27:00 2017 New Revision: 321562 URL: http://llvm.org/viewvc/llvm-project?rev=321562&view=rev Log: [docs] Added description of `-f[no]-openmp-simd` option to UsersManual. Modified: cfe/trunk/docs/UsersManual.rst Modified: cfe/trunk/docs/UsersManual.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=321562&r1=321561&r2=321562&view=diff == --- cfe/trunk/docs/UsersManual.rst (original) +++ cfe/trunk/docs/UsersManual.rst Fri Dec 29 10:27:00 2017 @@ -2042,6 +2042,11 @@ directives, and ``#pragma omp taskgroup` Use `-fopenmp` to enable OpenMP. Support for OpenMP can be disabled with `-fno-openmp`. +Use `-fopenmp-simd` to enable OpenMP simd features only, without linking +the runtime library; for combined constructs +(e.g. ``#pragma omp parallel for simd``) the non-simd directives and clauses +will be ignored. This can be disabled with `-fno-openmp-simd`. + Controlling implementation limits - ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r321561 - [docs] Updated ReleaseNotes for OpenMP part.
Author: abataev Date: Fri Dec 29 10:23:12 2017 New Revision: 321561 URL: http://llvm.org/viewvc/llvm-project?rev=321561&view=rev Log: [docs] Updated ReleaseNotes for OpenMP part. Modified: cfe/trunk/docs/ReleaseNotes.rst Modified: cfe/trunk/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=321561&r1=321560&r2=321561&view=diff == --- cfe/trunk/docs/ReleaseNotes.rst (original) +++ cfe/trunk/docs/ReleaseNotes.rst Fri Dec 29 10:23:12 2017 @@ -209,7 +209,18 @@ OpenCL C Language Changes in Clang OpenMP Support in Clang -- -... +- Added options `-f[no]-openmp-simd` that support code emission only foe OpenMP + SIMD-based directives, like `#pragma omp simd`, `#pragma omp parallel for simd` + etc. The code is emitted only for simd-based part of the combined directives + and clauses. + +- Added support for almost all target-based directives except for + `#pragma omp target teams distribute parallel for [simd]`. Although, please + note that `depend` clauses on target-based directives are not supported yet. + Clang supports offloading to X86_64, AArch64 and PPC64[LE] devices. + +- Added support for `reduction`-based clauses on `task`-based directives from + upcoming OpenMP 5.0. Internal API Changes ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r321099 - [driver][darwin] Take the OS version specified in "-target" as the target
I committed the patch that allows -m-version-min to specify the OS version when -target doesn't specify in r321559. Let me know if it works for you! Thanks, Alex On 21 December 2017 at 12:34, James Y Knight wrote: > I totally agree with moving towards eliminating the -m-version-min > flags, it's much better to put it in the target, and will clean up a lot of > cruft in the driver, eventually. > > Now -- we (or anyone else who runs into this) can simply start specifying > the version in both locations ("-target x86_64-apple-ios10 > -mios-simulator-version-min=10"), so as to work with both new and old > clang, and be closer to the ultimate goal of having only -target. That's an > overall nicer workaround to suggest than switching to -darwin. But, yea, > there's no need for *temporary* patch to fix things just for us. > > However, I do not understand why you're against committing the patch you > mention as option #2 -- that seems like it'd be best for all users, by > preserving compatibility with existing command-lines. So, I'd still like > that change to be committed, permanently, not temporarily. I'm sure we > can't be the only ones running clang like "-target x86_64-apple-ios > -mios-simulator-version-min=10", and it seems unfortunate and unnecessary > to break that, even if it can be worked around. > > In the future, I'd hope the -m-version-min arguments can be deprecated > more and more -- warning whenever you use them to modify the platform or > version at all, rather just on specification conflict; then, warn anytime > you use them at all; then, remove them. But in the meantime, it seems > strictly better to preserve compatibility, don't you think? > > > > On Dec 21, 2017 2:11 PM, "Alex L" wrote: > > Thanks for raising your concerns. > > We decided to avoid -m-version-min flag in favor of -target to > simplify the driver logic and to encourage the adoption of -target. Now > after r321145 we only warn about -m-version-min flag when the OS > version specified in it is different to the OS version specified in target, > or when target has no OS version. > > There are two possible solutions here: > 1) You can still use -target with -mios-simulator-version-min as before > but you'd have to use '-target=x86_64-apple-darwin' to ensure that the iOS > version specified by '-mios-simulator-version-min' is used. > 2) I also do have a patch that implements the logic that you propose (use > the OS version in -m-version-min flag if target has none). If you > believe that the first solution is not suitable for your code then I can > commit it. At the same time I believe that we would rather not use this > patch, but if it's urgent for your projects then maybe I can land it now > and then we can establish some sort of timeline for when it can be reverted? > > Thanks, > Alex > > > On 21 December 2017 at 08:00, James Y Knight wrote: > >> I think if a version number isn't explicitly specified in the -target >> value, the value from -m-version-min ought to still be used, as >> it was before. >> >> Currently, clang will ignore the -m-version-min version number >> if the target has a particular OS specified, even if it has no version >> number as part of it. >> >> (We should be able to workaround this change backwards-compatibly by >> specifying in both the -target argument and in the -m-version-min >> arguments, but I do think the behavior should be fixed.) >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r321559 - [driver][darwin] Take the OS version from -m-version-min argument when
Author: arphaman Date: Fri Dec 29 09:42:40 2017 New Revision: 321559 URL: http://llvm.org/viewvc/llvm-project?rev=321559&view=rev Log: [driver][darwin] Take the OS version from -m-version-min argument when -target has no OS version This ensures that Clang won't warn about redundant -m-version-min argument for an invocation like `-target x86_64-apple-macos -mmacos-version-min=10.11` Modified: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp cfe/trunk/test/Driver/darwin-version.c Modified: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Darwin.cpp?rev=321559&r1=321558&r2=321559&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Darwin.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Darwin.cpp Fri Dec 29 09:42:40 2017 @@ -1192,6 +1192,13 @@ struct DarwinPlatform { return OSVersion; } + void setOSVersion(StringRef S) { +assert(Kind == TargetArg && "Unexpected kind!"); +OSVersion = S; + } + + bool hasOSVersion() const { return HasOSVersion; } + /// Returns true if the target OS was explicitly specified. bool isExplicitlySpecified() const { return Kind <= DeploymentTargetEnv; } @@ -1235,17 +1242,21 @@ struct DarwinPlatform { llvm_unreachable("Unsupported Darwin Source Kind"); } - static DarwinPlatform createFromTarget(llvm::Triple::OSType OS, - StringRef OSVersion, Arg *A, - llvm::Triple::EnvironmentType Env) { -DarwinPlatform Result(TargetArg, getPlatformFromOS(OS), OSVersion, A); -switch (Env) { + static DarwinPlatform createFromTarget(const llvm::Triple &TT, + StringRef OSVersion, Arg *A) { +DarwinPlatform Result(TargetArg, getPlatformFromOS(TT.getOS()), OSVersion, + A); +switch (TT.getEnvironment()) { case llvm::Triple::Simulator: Result.Environment = DarwinEnvironmentKind::Simulator; break; default: break; } +unsigned Major, Minor, Micro; +TT.getOSVersion(Major, Minor, Micro); +if (Major == 0) + Result.HasOSVersion = false; return Result; } static DarwinPlatform createOSVersionArg(DarwinPlatformKind Platform, @@ -1295,6 +1306,7 @@ private: DarwinPlatformKind Platform; DarwinEnvironmentKind Environment = DarwinEnvironmentKind::NativeEnvironment; std::string OSVersion; + bool HasOSVersion = true; Arg *Argument; StringRef EnvVarName; }; @@ -1489,9 +1501,8 @@ Optional getDeploymentTa Triple.getOS() == llvm::Triple::UnknownOS) return None; std::string OSVersion = getOSVersion(Triple.getOS(), Triple, TheDriver); - return DarwinPlatform::createFromTarget(Triple.getOS(), OSVersion, - Args.getLastArg(options::OPT_target), - Triple.getEnvironment()); + return DarwinPlatform::createFromTarget(Triple, OSVersion, + Args.getLastArg(options::OPT_target)); } } // namespace @@ -1537,12 +1548,20 @@ void Darwin::AddDeploymentTarget(Derived (VersionTuple(TargetMajor, TargetMinor, TargetMicro) != VersionTuple(ArgMajor, ArgMinor, ArgMicro) || TargetExtra != ArgExtra))) { -// Warn about -m-version-min that doesn't match the OS version -// that's specified in the target. -std::string OSVersionArg = OSVersionArgTarget->getAsString(Args, Opts); -std::string TargetArg = OSTarget->getAsString(Args, Opts); -getDriver().Diag(clang::diag::warn_drv_overriding_flag_option) -<< OSVersionArg << TargetArg; +// Select the OS version from the -m-version-min argument when +// the -target does not include an OS version. +if (OSTarget->getPlatform() == OSVersionArgTarget->getPlatform() && +!OSTarget->hasOSVersion()) { + OSTarget->setOSVersion(OSVersionArgTarget->getOSVersion()); +} else { + // Warn about -m-version-min that doesn't match the OS version + // that's specified in the target. + std::string OSVersionArg = + OSVersionArgTarget->getAsString(Args, Opts); + std::string TargetArg = OSTarget->getAsString(Args, Opts); + getDriver().Diag(clang::diag::warn_drv_overriding_flag_option) + << OSVersionArg << TargetArg; +} } } } else { Modified: cfe/trunk/test/Driver/darwin-version.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-version.c?rev=321559&r1=321558&r2=321559&view=diff == --- cfe/trunk/test/Driver/darwin-version.c (original) +++ cfe/trunk/test/Driver/darwin-version.c Fri Dec 29 09:42:40 2017 @@ -205,7 +205,8 @@ // RUN: %clang -targ
r321558 - [OPENMP] Initial support for `-fopenmp-simd` option.
Author: abataev Date: Fri Dec 29 09:36:15 2017 New Revision: 321558 URL: http://llvm.org/viewvc/llvm-project?rev=321558&view=rev Log: [OPENMP] Initial support for `-fopenmp-simd` option. Added basic support for `-fopenmp-simd` options. Modified: cfe/trunk/include/clang/Basic/LangOptions.def cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/InitPreprocessor.cpp cfe/trunk/test/OpenMP/driver.c cfe/trunk/test/OpenMP/linking.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=321558&r1=321557&r2=321558&view=diff == --- cfe/trunk/include/clang/Basic/LangOptions.def (original) +++ cfe/trunk/include/clang/Basic/LangOptions.def Fri Dec 29 09:36:15 2017 @@ -194,6 +194,7 @@ LANGOPT(NativeHalfArgsAndReturns, 1, 0, LANGOPT(HalfArgsAndReturns, 1, 0, "half args and returns") LANGOPT(CUDA , 1, 0, "CUDA") LANGOPT(OpenMP, 32, 0, "OpenMP support and version of OpenMP (31, 40 or 45)") +LANGOPT(OpenMPSimd, 1, 0, "Use SIMD only OpenMP support.") LANGOPT(OpenMPUseTLS , 1, 0, "Use TLS for threadprivates or runtime calls") LANGOPT(OpenMPIsDevice, 1, 0, "Generate code only for OpenMP target device") LANGOPT(RenderScript , 1, 0, "RenderScript") Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=321558&r1=321557&r2=321558&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Fri Dec 29 09:36:15 2017 @@ -1369,12 +1369,16 @@ def fopenmp_use_tls : Flag<["-"], "fopen def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">, Group, Flags<[CC1Option, NoArgumentUnused]>; def fopenmp_targets_EQ : CommaJoined<["-"], "fopenmp-targets=">, Flags<[DriverOption, CC1Option]>, HelpText<"Specify comma-separated list of triples OpenMP offloading targets to be supported">; -def fopenmp_dump_offload_linker_script : Flag<["-"], "fopenmp-dump-offload-linker-script">, Group, +def fopenmp_dump_offload_linker_script : Flag<["-"], "fopenmp-dump-offload-linker-script">, Group, Flags<[NoArgumentUnused]>; def fopenmp_relocatable_target : Flag<["-"], "fopenmp-relocatable-target">, Group, Flags<[CC1Option, NoArgumentUnused]>, HelpText<"OpenMP target code is compiled as relocatable using the -c flag. For OpenMP targets the code is relocatable by default.">; def fnoopenmp_relocatable_target : Flag<["-"], "fnoopenmp-relocatable-target">, Group, Flags<[CC1Option, NoArgumentUnused]>, HelpText<"Do not compile OpenMP target code as relocatable.">; +def fopenmp_simd : Flag<["-"], "fopenmp-simd">, Group, Flags<[CC1Option, NoArgumentUnused]>, + HelpText<"Emit OpenMP code only for SIMD-based constructs.">; +def fno_openmp_simd : Flag<["-"], "fno-openmp-simd">, Group, Flags<[CC1Option, NoArgumentUnused]>, + HelpText<"Disable OpenMP code for SIMD-based constructs.">; def fno_optimize_sibling_calls : Flag<["-"], "fno-optimize-sibling-calls">, Group; def foptimize_sibling_calls : Flag<["-"], "foptimize-sibling-calls">, Group; def force__cpusubtype__ALL : Flag<["-"], "force_cpusubtype_ALL">; Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=321558&r1=321557&r2=321558&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Fri Dec 29 09:36:15 2017 @@ -3901,6 +3901,10 @@ void Clang::ConstructJob(Compilation &C, // semantic analysis, etc. break; } + } else { +Args.AddLastArg(CmdArgs, options::OPT_fopenmp_simd, +options::OPT_fno_openmp_simd); +Args.AddAllArgs(CmdArgs, options::OPT_fopenmp_version_EQ); } const SanitizerArgs &Sanitize = getToolChain().getSanitizerArgs(); Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=321558&r1=321557&r2=321558&view=diff == --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Dec 29 09:36:15 2017 @@ -2407,16 +2407,22 @@ static void ParseLangArgs(LangOptions &O // Check if -fopenmp is specified. Opts.OpenMP = Args.hasArg(options::OPT_fopenmp) ? 1 : 0; + // Check if -fopenmp-simd is specified. + Opts.OpenMPSimd = !Opts.OpenMP && Args.hasFlag(options::OPT_fopenmp_simd, +
[PATCH] D41538: [analyzer] Fix some checker's output plist not containing the checker name #2
a.sidorin added inline comments. Comment at: lib/StaticAnalyzer/Checkers/ValistChecker.cpp:277 + BT_leakedvalist.reset(new BugType( + CheckNames[ReportUninit ? CK_Uninitialized : CK_Unterminated], + "Leaked va_list", categories::MemoryError)); xazax.hun wrote: > a.sidorin wrote: > > If I understand correctly, if we report uninitialized and then > > unterminated, the second report will have wrong CheckName because it is > > never reset. > That is right. Unfortunately, If unterminated check is not turned on but > uninitialized is, we can end up with empty check names. I replaced this > workaround with a slightly more robust one. Maybe we should use different BugTypes for Uninitialized and Unterminated? Comment at: test/Analysis/malloc.c:1723 -char *dupstrWarn(const char *s) { - const int len = strlen(s); xazax.hun wrote: > a.sidorin wrote: > > Should we enable the checker instead of removing test? > I tried that once, but this caused more new warnings (and sinks) so more > changes would be required to make the tests pass. And this case is already > tested in `string.c`. Thank you, I got it. https://reviews.llvm.org/D41538 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] r321554 - [clangd] Properly set filterText for index-based completion items
Author: ibiryukov Date: Fri Dec 29 06:59:22 2017 New Revision: 321554 URL: http://llvm.org/viewvc/llvm-project?rev=321554&view=rev Log: [clangd] Properly set filterText for index-based completion items It was previously set to an identifier that the user typed, leading to surprising behavior in VSCode (probably in other editors too). Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=321554&r1=321553&r2=321554&view=diff == --- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original) +++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Fri Dec 29 06:59:22 2017 @@ -558,7 +558,7 @@ CompletionItem indexCompletionItem(const Item.insertText = Sym.Name; // FIXME(ioeric): support snippets. Item.insertTextFormat = InsertTextFormat::PlainText; - Item.filterText = Filter; + Item.filterText = Sym.Name; // FIXME(ioeric): sort symbols appropriately. Item.sortText = ""; Modified: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp?rev=321554&r1=321553&r2=321554&view=diff == --- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Fri Dec 29 06:59:22 2017 @@ -54,6 +54,7 @@ namespace { using namespace llvm; using ::testing::AllOf; using ::testing::Contains; +using ::testing::Each; using ::testing::ElementsAre; using ::testing::Not; @@ -75,6 +76,11 @@ MATCHER_P(Snippet, Text, "") { return arg.insertTextFormat == clangd::InsertTextFormat::Snippet && arg.insertText == Text; } +MATCHER(FilterContainsName, "") { + if (arg.filterText.empty()) +return true; + return llvm::StringRef(arg.insertText).contains(arg.filterText); +} // Shorthand for Contains(Named(Name)). Matcher &> Has(std::string Name) { return Contains(Named(std::move(Name))); @@ -95,9 +101,13 @@ CompletionList completions(StringRef Tex auto File = getVirtualTestFilePath("foo.cpp"); Annotations Test(Text); Server.addDocument(Context::empty(), File, Test.code()); - return Server.codeComplete(Context::empty(), File, Test.point(), Opts) - .get() - .second.Value; + auto CompletionList = + Server.codeComplete(Context::empty(), File, Test.point(), Opts) + .get() + .second.Value; + // Sanity-check that filterText is valid. + EXPECT_THAT(CompletionList.items, Each(FilterContainsName())); + return CompletionList; } TEST(CompletionTest, Limit) { @@ -513,7 +523,7 @@ TEST(CompletionTest, IndexBasedWithFilte void f() { ns::x^ } )cpp", Opts); - EXPECT_THAT(Results.items, Contains(AllOf(Named("XYZ"), Filter("x"; + EXPECT_THAT(Results.items, Contains(AllOf(Named("XYZ"), Filter("XYZ"; EXPECT_THAT(Results.items, Not(Has("foo"))); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41629: [libcxx] Improve accuracy of complex asinh and acosh
miyuki created this revision. miyuki added reviewers: EricWF, mclow.lists. Currently std::asinh and std::acosh use std::pow to compute x^2. This results in a significant error when computing e.g. asinh(i) or acosh(-1). This patch expresses x^2 directly via x.real() and x.imag(), like it is done in libstdc++/glibc, and adds tests that checks the accuracy. https://reviews.llvm.org/D41629 Files: include/complex test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp Index: test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp === --- test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp +++ test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp @@ -44,6 +44,15 @@ assert(std::signbit(r.real()) == std::signbit(testcases[i].real())); assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag())); } +else if (testcases[i].real() == 0 && std::abs(testcases[i].imag()) == 1) +{ +assert(r.real() == 0); +assert(std::signbit(testcases[i].imag()) == std::signbit(r.imag())); +if (std::signbit(testcases[i].imag())) +is_about(r.imag(), -pi/2); +else +is_about(r.imag(), pi/2); +} else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag())) { assert(std::isinf(r.real())); Index: test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp === --- test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp +++ test/std/numerics/complex.number/complex.transcendentals/acosh.pass.cpp @@ -54,6 +54,15 @@ assert(r.imag() == 0); assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag())); } +else if (testcases[i].real() == -1 && testcases[i].imag() == 0) +{ +assert(r.real() == 0); +assert(!std::signbit(r.real())); +if (std::signbit(testcases[i].imag())) +is_about(r.imag(), -pi); +else +is_about(r.imag(), pi); +} else if (std::isfinite(testcases[i].real()) && std::isinf(testcases[i].imag())) { assert(std::isinf(r.real())); Index: include/complex === --- include/complex +++ include/complex @@ -1125,6 +1125,17 @@ return _VSTD::pow(result_type(__x), result_type(__y)); } +// __sqr, computes pow(x, 2) + +template +inline _LIBCPP_INLINE_VISIBILITY +complex<_Tp> +__sqr(const complex<_Tp>& __x) +{ +return complex<_Tp>((__x.real() - __x.imag()) * (__x.real() + __x.imag()), +_Tp(2) * __x.real() * __x.imag()); +} + // asinh template @@ -1150,7 +1161,7 @@ } if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag())); -complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) + _Tp(1))); +complex<_Tp> __z = log(__x + sqrt(__sqr(__x) + _Tp(1))); return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag())); } @@ -1184,7 +1195,7 @@ } if (__libcpp_isinf_or_builtin(__x.imag())) return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag())); -complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1))); +complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag())); } @@ -1318,7 +1329,7 @@ return complex<_Tp>(__pi/_Tp(2), -__x.imag()); if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag( return complex<_Tp>(__pi/_Tp(2), -__x.imag()); -complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1))); +complex<_Tp> __z = log(__x + sqrt(__sqr(__x) - _Tp(1))); if (signbit(__x.imag())) return complex<_Tp>(abs(__z.imag()), abs(__z.real())); return complex<_Tp>(abs(__z.imag()), -abs(__z.real())); Index: test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp === --- test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp +++ test/std/numerics/complex.number/complex.transcendentals/asinh.pass.cpp @@ -44,6 +44,15 @@ assert(std::signbit(r.real()) == std::signbit(testcases[i].real())); assert(std::signbit(r.imag()) == std::signbit(testcases[i].imag())); } +else if (testcases[i].real() == 0 && std::abs(testcases[i].imag()) == 1) +{ +assert(r.real() == 0); +assert(std::signbit(testcases[i].imag()) == std::signbit(r
[PATCH] D41627: [Modules TS] Fix namespace visibility
hamzasood created this revision. hamzasood added reviewers: rsmith, bruno, boris. Namespaces without an explicit `export` were being mistakenly marked as module private. This patch fixes the visibility as per `[basic.namespace]p1` and adds a test case with previously rejected (yet valid) code. https://reviews.llvm.org/D41627 Files: include/clang/AST/DeclBase.h lib/AST/DeclBase.cpp lib/Sema/SemaDeclCXX.cpp test/CXX/modules-ts/basic/basic.namespace/p1.cpp Index: test/CXX/modules-ts/basic/basic.namespace/p1.cpp === --- test/CXX/modules-ts/basic/basic.namespace/p1.cpp +++ test/CXX/modules-ts/basic/basic.namespace/p1.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fmodules-ts -DMODULE -emit-module-interface %s -o %t +// RUN: %clang_cc1 -fmodules-ts -DUSER -fmodule-file=%t %s -verify +// expected-no-diagnostics + +#ifdef MODULE +export module A; +namespace ns { + export class A { }; +} +#endif + +#ifdef USER +import A; +ns::A a; +#endif Index: lib/Sema/SemaDeclCXX.cpp === --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -8623,6 +8623,19 @@ // for the namespace has the declarations that showed up in that particular // namespace definition. PushDeclContext(NamespcScope, Namespc); + + // A namespace with external linkage should always be visible when imported, + // regardless of whether or not it's explicitly exported. + if (getLangOpts().ModulesTS && + !Namespc->isAnonymousNamespace() && !Namespc->isInAnonymousNamespace()) { +const Module *CurrentModule = getCurrentModule(); +assert(CurrentModule); +Namespc->setModuleOwnershipKind( +CurrentModule->Kind == Module::ModuleKind::GlobalModuleFragment +? Decl::ModuleOwnershipKind::Visible +: Decl::ModuleOwnershipKind::VisibleWhenImported); + } + return Namespc; } Index: lib/AST/DeclBase.cpp === --- lib/AST/DeclBase.cpp +++ lib/AST/DeclBase.cpp @@ -281,6 +281,23 @@ // Out-of-line virtual method providing a home for Decl. Decl::~Decl() = default; +Decl::ModuleOwnershipKind Decl::getModuleOwnershipKindForChildOf(DeclContext *DC) { + // Ignore namespaces because they're visible by default. + while (DC && DC->isNamespace()) +DC = DC->getParent(); + + if (auto *D = cast_or_null(DC)) { +auto MOK = D->getModuleOwnershipKind(); +if (MOK != ModuleOwnershipKind::Unowned && +(!D->isFromASTFile() || D->hasLocalOwningModuleStorage())) + return MOK; +// If D is not local and we have no local module storage, then we don't +// need to track module ownership at all. + } + + return ModuleOwnershipKind::Unowned; +} + void Decl::setDeclContext(DeclContext *DC) { DeclCtx = DC; } Index: include/clang/AST/DeclBase.h === --- include/clang/AST/DeclBase.h +++ include/clang/AST/DeclBase.h @@ -349,18 +349,7 @@ /// Get the module ownership kind to use for a local lexical child of \p DC, /// which may be either a local or (rarely) an imported declaration. - static ModuleOwnershipKind getModuleOwnershipKindForChildOf(DeclContext *DC) { -if (DC) { - auto *D = cast(DC); - auto MOK = D->getModuleOwnershipKind(); - if (MOK != ModuleOwnershipKind::Unowned && - (!D->isFromASTFile() || D->hasLocalOwningModuleStorage())) -return MOK; - // If D is not local and we have no local module storage, then we don't - // need to track module ownership at all. -} -return ModuleOwnershipKind::Unowned; - } + static ModuleOwnershipKind getModuleOwnershipKindForChildOf(DeclContext *DC); protected: Decl(Kind DK, DeclContext *DC, SourceLocation L) Index: test/CXX/modules-ts/basic/basic.namespace/p1.cpp === --- test/CXX/modules-ts/basic/basic.namespace/p1.cpp +++ test/CXX/modules-ts/basic/basic.namespace/p1.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fmodules-ts -DMODULE -emit-module-interface %s -o %t +// RUN: %clang_cc1 -fmodules-ts -DUSER -fmodule-file=%t %s -verify +// expected-no-diagnostics + +#ifdef MODULE +export module A; +namespace ns { + export class A { }; +} +#endif + +#ifdef USER +import A; +ns::A a; +#endif Index: lib/Sema/SemaDeclCXX.cpp === --- lib/Sema/SemaDeclCXX.cpp +++ lib/Sema/SemaDeclCXX.cpp @@ -8623,6 +8623,19 @@ // for the namespace has the declarations that showed up in that particular // namespace definition. PushDeclContext(NamespcScope, Namespc); + + // A namespace with external linkage should always be visible when imported, + // regardless of whether or not it's explicitly exported. + if (getLangOpts().ModulesTS && + !Namespc->isAnonymousNamespace() && !Namespc->isInAnonymousNamespace()) { +