r252400 - Make a couple methods static.
Author: ctopper Date: Sat Nov 7 02:08:34 2015 New Revision: 252400 URL: http://llvm.org/viewvc/llvm-project?rev=252400&view=rev Log: Make a couple methods static. Modified: cfe/trunk/include/clang/Sema/Sema.h Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=252400&r1=252399&r2=252400&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Sat Nov 7 02:08:34 2015 @@ -8846,8 +8846,8 @@ private: bool HasVAListArg; }; - bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember, - FormatStringInfo *FSI); + static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember, + FormatStringInfo *FSI); bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall, const FunctionProtoType *Proto); bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc, @@ -8935,7 +8935,7 @@ public: bool FormatStringHasSArg(const StringLiteral *FExpr); - bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx); + static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx); private: bool CheckFormatArguments(const FormatAttr *Format, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r252399 - Make SemaBuiltinCpuSupports a static function. NFC.
Author: ctopper Date: Sat Nov 7 02:08:31 2015 New Revision: 252399 URL: http://llvm.org/viewvc/llvm-project?rev=252399&view=rev Log: Make SemaBuiltinCpuSupports a static function. NFC. Modified: cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/SemaChecking.cpp Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=252399&r1=252398&r2=252399&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Sat Nov 7 02:08:31 2015 @@ -8912,7 +8912,6 @@ private: bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall, int ArgNum, unsigned ExpectedFieldNum, bool AllowName); - bool SemaBuiltinCpuSupports(CallExpr *TheCall); public: enum FormatStringType { FST_Scanf, Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=252399&r1=252398&r2=252399&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Sat Nov 7 02:08:31 2015 @@ -1070,12 +1070,32 @@ bool Sema::CheckSystemZBuiltinFunctionCa return SemaBuiltinConstantArgRange(TheCall, i, l, u); } +/// SemaBuiltinCpuSupports - Handle __builtin_cpu_supports(char *). +/// This checks that the target supports __builtin_cpu_supports and +/// that the string argument is constant and valid. +static bool SemaBuiltinCpuSupports(Sema &S, CallExpr *TheCall) { + Expr *Arg = TheCall->getArg(0); + + // Check if the argument is a string literal. + if (!isa(Arg->IgnoreParenImpCasts())) +return S.Diag(TheCall->getLocStart(), diag::err_expr_not_string_literal) + << Arg->getSourceRange(); + + // Check the contents of the string. + StringRef Feature = + cast(Arg->IgnoreParenImpCasts())->getString(); + if (!S.Context.getTargetInfo().validateCpuSupports(Feature)) +return S.Diag(TheCall->getLocStart(), diag::err_invalid_cpu_supports) + << Arg->getSourceRange(); + return false; +} + bool Sema::CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { unsigned i = 0, l = 0, u = 0; switch (BuiltinID) { default: return false; case X86::BI__builtin_cpu_supports: -return SemaBuiltinCpuSupports(TheCall); +return SemaBuiltinCpuSupports(*this, TheCall); case X86::BI__builtin_ms_va_start: return SemaBuiltinMSVAStart(TheCall); case X86::BI_mm_prefetch: i = 1; l = 0; u = 3; break; @@ -2952,26 +2972,6 @@ bool Sema::SemaBuiltinARMSpecialReg(unsi return false; } -/// SemaBuiltinCpuSupports - Handle __builtin_cpu_supports(char *). -/// This checks that the target supports __builtin_cpu_supports and -/// that the string argument is constant and valid. -bool Sema::SemaBuiltinCpuSupports(CallExpr *TheCall) { - Expr *Arg = TheCall->getArg(0); - - // Check if the argument is a string literal. - if (!isa(Arg->IgnoreParenImpCasts())) -return Diag(TheCall->getLocStart(), diag::err_expr_not_string_literal) - << Arg->getSourceRange(); - - // Check the contents of the string. - StringRef Feature = - cast(Arg->IgnoreParenImpCasts())->getString(); - if (!Context.getTargetInfo().validateCpuSupports(Feature)) -return Diag(TheCall->getLocStart(), diag::err_invalid_cpu_supports) - << Arg->getSourceRange(); - return false; -} - /// SemaBuiltinLongjmp - Handle __builtin_longjmp(void *env[5], int val). /// This checks that the target supports __builtin_longjmp and /// that val is a constant 1. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12407: [clang-format-vs] Add an option to reformat source code when file is saved to disk
kimgr added a subscriber: kimgr. kimgr added a comment. Add debugging ideas. Comment at: tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs:86 @@ -69,1 +85,3 @@ +IComponentModel componentModel = GetService(typeof(SComponentModel)) as IComponentModel; +editorAdaptersFactoryService = componentModel.GetService(); aaron.ballman wrote: > hans wrote: > > aaron.ballman wrote: > > > berenm wrote: > > > > I did more tests on my side, and apparently this line does not work on > > > > VS2012, componentModel is null. I don't know at all why and how to fix > > > > it, and it works fine starting with VS2013. > > > Our minimum supported MSVC version for development is 2013. Do we > > > document supported versions for clang-format? Do we want to support > > > versions older than the development version we're on? > > The manifest claims support for 2010 and later. I usually test with 2012 > > when I build the weekly snapshot. > > > > Our clang-cl VS integration also tries to support 2010 and later, so I > > think it would be nice if the clang-format plugin does too. > Thank you for the information! That sounds good to me. Then I think berenm's > issue should be resolved if possible. I haven't had time to dig into this too much, but here's an idea: You're only getting the IComponentModel to get the IVsEditorAdaptersFactoryService, which in turn is only used to get at the document's text buffer in OnBeforeSave. It seems to me there *should* be a more straightforward way to do that without involving COM interop. Unfortunately, I don't know what it is :-) Google around, and this article describes something similar: http://schmalls.com/2015/01/19/adventures-in-visual-studio-extension-development-part-2 I don't know if maybe you have the wrong RunningDocumentTable service, it seems very COM-styled, compared to the one used in the article. http://reviews.llvm.org/D12407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r252404 - Remove spaces at start of line, NFC.
Author: yrnkrn Date: Sat Nov 7 10:24:52 2015 New Revision: 252404 URL: http://llvm.org/viewvc/llvm-project?rev=252404&view=rev Log: Remove spaces at start of line, NFC. Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=252404&r1=252403&r2=252404&view=diff == --- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original) +++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Sat Nov 7 10:24:52 2015 @@ -72,7 +72,7 @@ public: ~CompilerInvocationBase(); CompilerInvocationBase(const CompilerInvocationBase &X); - + LangOptions *getLangOpts() { return LangOpts.get(); } const LangOptions *getLangOpts() const { return LangOpts.get(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r252405 - Remove spaces in empty line, NFC.
Author: yrnkrn Date: Sat Nov 7 10:35:07 2015 New Revision: 252405 URL: http://llvm.org/viewvc/llvm-project?rev=252405&view=rev Log: Remove spaces in empty line, NFC. Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=252405&r1=252404&r2=252405&view=diff == --- cfe/trunk/lib/Lex/PPLexerChange.cpp (original) +++ cfe/trunk/lib/Lex/PPLexerChange.cpp Sat Nov 7 10:35:07 2015 @@ -121,7 +121,7 @@ void Preprocessor::EnterSourceFileWithLe CurSubmodule = nullptr; if (CurLexerKind != CLK_LexAfterModuleImport) CurLexerKind = CLK_Lexer; - + // Notify the client, if desired, that we are in a new source file. if (Callbacks && !CurLexer->Is_PragmaLexer) { SrcMgr::CharacteristicKind FileType = ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r252406 - More of P0006R0: type traits variable aliases for C++17.
Author: marshall Date: Sat Nov 7 11:44:36 2015 New Revision: 252406 URL: http://llvm.org/viewvc/llvm-project?rev=252406&view=rev Log: More of P0006R0: type traits variable aliases for C++17. Modified: libcxx/trunk/include/type_traits libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/has_virtual_destructor.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_assignable.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_assignable.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_copy_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_default_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_destructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_assignable.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_move_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_assignable.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_assignable.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_copy_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_default_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_destructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_assignable.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_nothrow_move_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_assignable.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_assignable.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_copy_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_default_constructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_destructible.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_assignable.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.unary/meta.unary.prop/is_trivially_move_constructible.pass.cpp Modified: libcxx/trunk/include/type_traits URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=252406&r1=252405&r2=252406&view=diff == --- libcxx/trunk/include/type_traits (original) +++ libcxx/trunk/include/type_traits Sat Nov 7 11:44:36 2015 @@ -1378,6 +1378,11 @@ template struct _LIBCPP_TYPE #endif +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool has_virtual_destructor_v += has_virtual_destructor<_Tp>::value; +#endif + // alignment_of template struct _LIBCPP_TYPE_VIS_ONLY alignment_of @@ -1905,12 +1910,22 @@ template struct is_assignable : public __is_assignable_imp<_Tp, _Arg> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_assignable_v += is_assignable<_Tp, _Arg>::value; +#endif + // is_copy_assignable template struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable : public is_assignable::type, typename add_lvalue_reference::type>::type> {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_copy_assignable_v += is_copy_assignable<_Tp>::value; +#endif + // is_move_assignable template struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable @@ -1921,6 +1936,11 @@ template struct _LIBCPP_TYPE : public is_copy_assignable<_Tp> {}; #endif +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_move_assignable_v += is_move_assignable<_Tp>::value; +#endif + // is_destructible // if it's a reference, return true @@ -1979,6 +1999,11 @@ template <> struct is_destructible : public _VSTD::false_type {}; +#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) +template _LIBCPP_CONSTEXPR bool is_destructible_v += is_destructible<_Tp>::value; +#endif + // move #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -3013,6 +3038,11 @@
[libcxx] r252407 - Implement LWG#2353: std::next is over-constrained
Author: marshall Date: Sat Nov 7 11:48:49 2015 New Revision: 252407 URL: http://llvm.org/viewvc/llvm-project?rev=252407&view=rev Log: Implement LWG#2353: std::next is over-constrained Modified: libcxx/trunk/include/iterator libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/include/iterator URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/iterator?rev=252407&r1=252406&r2=252407&view=diff == --- libcxx/trunk/include/iterator (original) +++ libcxx/trunk/include/iterator Sat Nov 7 11:48:49 2015 @@ -513,12 +513,12 @@ distance(_InputIter __first, _InputIter return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category()); } -template +template inline _LIBCPP_INLINE_VISIBILITY -_ForwardIter -next(_ForwardIter __x, - typename iterator_traits<_ForwardIter>::difference_type __n = 1, - typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0) +_InputIter +next(_InputIter __x, + typename iterator_traits<_InputIter>::difference_type __n = 1, + typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0) { _VSTD::advance(__x, __n); return __x; Modified: libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp?rev=252407&r1=252406&r2=252407&view=diff == --- libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp (original) +++ libcxx/trunk/test/std/iterators/iterator.primitives/iterator.operations/next.pass.cpp Sat Nov 7 11:48:49 2015 @@ -12,6 +12,8 @@ // template // Iter next(Iter x, Iter::difference_type n = 1); +// LWG #2353 relaxed the requirement on next from ForwardIterator to InputIterator + #include #include @@ -34,11 +36,13 @@ test(It i, It x) int main() { const char* s = "1234567890"; +test(input_iterator(s), 10, input_iterator(s+10)); test(forward_iterator(s), 10, forward_iterator(s+10)); test(bidirectional_iterator(s), 10, bidirectional_iterator(s+10)); test(random_access_iterator(s), 10, random_access_iterator(s+10)); test(s, 10, s+10); +test(input_iterator(s), input_iterator(s+1)); test(forward_iterator(s), forward_iterator(s+1)); test(bidirectional_iterator(s), bidirectional_iterator(s+1)); test(random_access_iterator(s), random_access_iterator(s+1)); Modified: libcxx/trunk/www/cxx1z_status.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=252407&r1=252406&r2=252407&view=diff == --- libcxx/trunk/www/cxx1z_status.html (original) +++ libcxx/trunk/www/cxx1z_status.html Sat Nov 7 11:48:49 2015 @@ -164,7 +164,7 @@ http://cplusplus.github.io/LWG/lwg-defects.html#2259";>2259Issues in 17.6.5.5 rules for member functionsKonaComplete http://cplusplus.github.io/LWG/lwg-defects.html#2273";>2273regex_match ambiguityKona http://cplusplus.github.io/LWG/lwg-defects.html#2336";>2336is_trivially_constructible/is_trivially_assignable traits are always falseKona - http://cplusplus.github.io/LWG/lwg-defects.html#2353";>2353std::next is over-constrainedKona + http://cplusplus.github.io/LWG/lwg-defects.html#2353";>2353std::next is over-constrainedKonaComplete http://cplusplus.github.io/LWG/lwg-defects.html#2367";>2367pair and tuple are not correctly implemented for is_constructible with no argsKonaPatch Ready http://cplusplus.github.io/LWG/lwg-defects.html#2380";>2380Mayprovide long ::abs(long) and long long ::abs(long long)?KonaComplete http://cplusplus.github.io/LWG/lwg-defects.html#2384";>2384Allocator's deallocate function needs better specificationKonaComplete ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r252408 - Mark LWG#2224 as complete. Wording change only, no code changes required
Author: marshall Date: Sat Nov 7 11:56:51 2015 New Revision: 252408 URL: http://llvm.org/viewvc/llvm-project?rev=252408&view=rev Log: Mark LWG#2224 as complete. Wording change only, no code changes required Modified: libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/www/cxx1z_status.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=252408&r1=252407&r2=252408&view=diff == --- libcxx/trunk/www/cxx1z_status.html (original) +++ libcxx/trunk/www/cxx1z_status.html Sat Nov 7 11:56:51 2015 @@ -157,7 +157,7 @@ http://cplusplus.github.io/LWG/lwg-defects.html#2156";>2156Unordered containers' reserve(n) reserves for n-1 elementsKona http://cplusplus.github.io/LWG/lwg-defects.html#2218";>2218Unclear how containers use allocator_traits::construct()Kona http://cplusplus.github.io/LWG/lwg-defects.html#2219";>2219INVOKE-ing a pointer to member with a reference_wrapper as the object expressionKona - http://cplusplus.github.io/LWG/lwg-defects.html#2224";>2224Ambiguous status of access to non-live objectsKona + http://cplusplus.github.io/LWG/lwg-defects.html#2224";>2224Ambiguous status of access to non-live objectsKonaComplete http://cplusplus.github.io/LWG/lwg-defects.html#2234";>2234assert() should allow usage in constant expressionsKonaComplete http://cplusplus.github.io/LWG/lwg-defects.html#2244";>2244Issue on basic_istream::seekgKonaComplete http://cplusplus.github.io/LWG/lwg-defects.html#2250";>2250Follow-up On Library Issue 2207Kona ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r252410 - [analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects.
Author: dcoughlin Date: Sat Nov 7 12:27:35 2015 New Revision: 252410 URL: http://llvm.org/viewvc/llvm-project?rev=252410&view=rev Log: [analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects. Currently the SATestBuild.py and SATestAdd.py buildbot scripts expect project sources to be checked into the project repository. This commit changes these scripts to additionally support a model where project sources are downloaded rather than checked into the repository. Sometimes projects may need to be modified (for example, to support a newer versions of clang), so the updated scripts also allow for an optional patch file that will be applied to the downloaded project source before analysis. To support this workflow, this commit changes the expected layout of a project in the repository. The project-specific helper scripts will stay in the root of each project directory, but the benchmark source itself (if checked into the repo) should now be stored in a subdirectory named 'CachedSource': project_name/ cleanup_run_static_analyzer.sh [optional] run_static_analyzer.cmd [required] download_project.sh [optional] CachedSource/ [optional] changes_for_analyzer.patch [optional] If the 'CachedSource' source directory is not present, the download script will be executed. This script should download the project source into 'CachedSource'. Then, if 'changes_for_analyzer.patch' is present its changes will be applied to a copy of 'CachedSource' before analysis. Differential Revision: http://reviews.llvm.org/D14345 Modified: cfe/trunk/utils/analyzer/SATestAdd.py cfe/trunk/utils/analyzer/SATestBuild.py Modified: cfe/trunk/utils/analyzer/SATestAdd.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestAdd.py?rev=252410&r1=252409&r2=252410&view=diff == --- cfe/trunk/utils/analyzer/SATestAdd.py (original) +++ cfe/trunk/utils/analyzer/SATestAdd.py Sat Nov 7 12:27:35 2015 @@ -10,11 +10,35 @@ the Repository Directory. have the same name as the project ID The project should use the following files for set up: - - pre_run_static_analyzer.sh - prepare the build environment. + - cleanup_run_static_analyzer.sh - prepare the build environment. Ex: make clean can be a part of it. - run_static_analyzer.cmd - a list of commands to run through scan-build. Each command should be on a separate line. Choose from: configure, make, xcodebuild + - download_project.sh - download the project into the CachedSource/ + directory. For example, download a zip of + the project source from GitHub, unzip it, + and rename the unzipped directory to + 'CachedSource'. This script is not called + when 'CachedSource' is already present, + so an alternative is to check the + 'CachedSource' directory into the + repository directly. + - CachedSource/ - An optional directory containing the source of the + project being analyzed. If present, + download_project.sh will not be called. + - changes_for_analyzer.patch - An optional patch file for any local changes + (e.g., to adapt to newer version of clang) + that should be applied to CachedSource + before analysis. To construct this patch, + run the the download script to download + the project to CachedSource, copy the + CachedSource to another directory (for + example, PatchedSource) and make any needed + modifications to the the copied source. + Then run: + diff -ur CachedSource PatchedSource \ + > changes_for_analyzer.patch """ import SATestBuild Modified: cfe/trunk/utils/analyzer/SATestBuild.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/SATestBuild.py?rev=252410&r1=252409&r2=252410&view=diff == --- cfe/trunk/utils/analyzer/SATestBuild.py (original) +++ cfe/trunk/utils/analyzer/SATestBuild.py Sat Nov 7 12:27:35 2015 @@ -154,6 +154,8 @@ Jobs = int(math.ceil(detectCPUs() * 0.75 ProjectMapFile = "projectMap.csv" # Names of the project specific
Re: [PATCH] D14345: [analyzer] Update SATestBuild.py to enable a 'download and patch' model for projects.
This revision was automatically updated to reflect the committed changes. Closed by commit rL252410: [analyzer] Update SATestBuild.py to enable a 'download and patch' model for… (authored by dcoughlin). Changed prior to commit: http://reviews.llvm.org/D14345?vs=39229&id=39641#toc Repository: rL LLVM http://reviews.llvm.org/D14345 Files: cfe/trunk/utils/analyzer/SATestAdd.py cfe/trunk/utils/analyzer/SATestBuild.py Index: cfe/trunk/utils/analyzer/SATestBuild.py === --- cfe/trunk/utils/analyzer/SATestBuild.py +++ cfe/trunk/utils/analyzer/SATestBuild.py @@ -154,6 +154,8 @@ ProjectMapFile = "projectMap.csv" # Names of the project specific scripts. +# The script that downloads the project. +DownloadScript = "download_project.sh" # The script that needs to be executed before the build can start. CleanupScript = "cleanup_run_static_analyzer.sh" # This is a file containing commands for scan-build. @@ -173,6 +175,21 @@ SBOutputDirName = "ScanBuildResults" SBOutputDirReferencePrefix = "Ref" +# The name of the directory storing the cached project source. If this directory +# does not exist, the download script will be executed. That script should +# create the "CachedSource" directory and download the project source into it. +CachedSourceDirName = "CachedSource" + +# The name of the directory containing the source code that will be analyzed. +# Each time a project is analyzed, a fresh copy of its CachedSource directory +# will be copied to the PatchedSource directory and then the local patches +# in PatchfileName will be applied (if PatchfileName exists). +PatchedSourceDirName = "PatchedSource" + +# The name of the patchfile specifying any changes that should be applied +# to the CachedSource before analyzing. +PatchfileName = "changes_for_analyzer.patch" + # The list of checkers used during analyzes. # Currently, consists of all the non-experimental checkers, plus a few alpha # checkers we don't want to regress on. @@ -186,23 +203,73 @@ # Run pre-processing script if any. def runCleanupScript(Dir, PBuildLogFile): +Cwd = os.path.join(Dir, PatchedSourceDirName) ScriptPath = os.path.join(Dir, CleanupScript) +runScript(ScriptPath, PBuildLogFile, Cwd) + +# Run the script to download the project, if it exists. +def runDownloadScript(Dir, PBuildLogFile): +ScriptPath = os.path.join(Dir, DownloadScript) +runScript(ScriptPath, PBuildLogFile, Dir) + +# Run the provided script if it exists. +def runScript(ScriptPath, PBuildLogFile, Cwd): if os.path.exists(ScriptPath): try: if Verbose == 1: print " Executing: %s" % (ScriptPath,) -check_call("chmod +x %s" % ScriptPath, cwd = Dir, +check_call("chmod +x %s" % ScriptPath, cwd = Cwd, stderr=PBuildLogFile, stdout=PBuildLogFile, shell=True) -check_call(ScriptPath, cwd = Dir, stderr=PBuildLogFile, +check_call(ScriptPath, cwd = Cwd, stderr=PBuildLogFile, stdout=PBuildLogFile, shell=True) except: -print "Error: The pre-processing step failed. See ", \ - PBuildLogFile.name, " for details." +print "Error: Running %s failed. See %s for details." % (ScriptPath, +PBuildLogFile.name) sys.exit(-1) +# Download the project and apply the local patchfile if it exists. +def downloadAndPatch(Dir, PBuildLogFile): +CachedSourceDirPath = os.path.join(Dir, CachedSourceDirName) + +# If the we don't already have the cached source, run the project's +# download script to download it. +if not os.path.exists(CachedSourceDirPath): + runDownloadScript(Dir, PBuildLogFile) + if not os.path.exists(CachedSourceDirPath): +print "Error: '%s' not found after download." % (CachedSourceDirPath) +exit(-1) + +PatchedSourceDirPath = os.path.join(Dir, PatchedSourceDirName) + +# Remove potentially stale patched source. +if os.path.exists(PatchedSourceDirPath): +shutil.rmtree(PatchedSourceDirPath) + +# Copy the cached source and apply any patches to the copy. +shutil.copytree(CachedSourceDirPath, PatchedSourceDirPath, symlinks=True) +applyPatch(Dir, PBuildLogFile) + +def applyPatch(Dir, PBuildLogFile): +PatchfilePath = os.path.join(Dir, PatchfileName) +PatchedSourceDirPath = os.path.join(Dir, PatchedSourceDirName) +if not os.path.exists(PatchfilePath): +print " No local patches." +return + +print " Applying patch." +try: +check_call("patch -p1 < %s" % (PatchfilePath), +cwd = PatchedSourceDirPath, +stderr=PBuildLogFile, +stdout=PBuildLo
Re: [PATCH] D14385: Correct atomic libcall support for __atomic_*_fetch builtins.
jyknight updated this revision to Diff 39644. jyknight marked 2 inline comments as done. jyknight added a comment. Respond to comments. http://reviews.llvm.org/D14385 Files: lib/CodeGen/CGAtomic.cpp test/CodeGen/atomic-ops-libcall.c Index: test/CodeGen/atomic-ops-libcall.c === --- test/CodeGen/atomic-ops-libcall.c +++ test/CodeGen/atomic-ops-libcall.c @@ -74,36 +74,43 @@ int test_atomic_add_fetch(int *p) { // CHECK: test_atomic_add_fetch - // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_add_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_add_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: {{%[^ ]*}} = add i32 [[CALL]], 55 return __atomic_add_fetch(p, 55, memory_order_seq_cst); } int test_atomic_sub_fetch(int *p) { // CHECK: test_atomic_sub_fetch - // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_sub_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_sub_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: {{%[^ ]*}} = add i32 [[CALL]], -55 return __atomic_sub_fetch(p, 55, memory_order_seq_cst); } int test_atomic_and_fetch(int *p) { // CHECK: test_atomic_and_fetch - // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_and_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_and_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: {{%[^ ]*}} = and i32 [[CALL]], 55 return __atomic_and_fetch(p, 55, memory_order_seq_cst); } int test_atomic_or_fetch(int *p) { // CHECK: test_atomic_or_fetch - // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_or_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_or_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: {{%[^ ]*}} = or i32 [[CALL]], 55 return __atomic_or_fetch(p, 55, memory_order_seq_cst); } int test_atomic_xor_fetch(int *p) { // CHECK: test_atomic_xor_fetch - // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_xor_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_xor_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: {{%[^ ]*}} = xor i32 [[CALL]], 55 return __atomic_xor_fetch(p, 55, memory_order_seq_cst); } int test_atomic_nand_fetch(int *p) { // CHECK: test_atomic_nand_fetch - // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_nand_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: [[CALL:%[^ ]*]] = tail call i32 @__atomic_fetch_nand_4(i8* {{%[0-9]+}}, i32 55, i32 5) + // CHECK: [[OR:%[^ ]*]] = or i32 [[CALL]], -56 + // CHECK: {{%[^ ]*}} = xor i32 [[OR]], 55 return __atomic_nand_fetch(p, 55, memory_order_seq_cst); } Index: lib/CodeGen/CGAtomic.cpp === --- lib/CodeGen/CGAtomic.cpp +++ lib/CodeGen/CGAtomic.cpp @@ -609,8 +609,8 @@ break; case AtomicExpr::AO__atomic_nand_fetch: -PostOp = llvm::Instruction::And; -// Fall through. +PostOp = llvm::Instruction::And; // the NOT is special cased below + // Fall through. case AtomicExpr::AO__atomic_fetch_nand: Op = llvm::AtomicRMWInst::Nand; break; @@ -840,6 +840,7 @@ MemTy->isPointerType() ? getContext().getIntPtrType() : MemTy; QualType RetTy; bool HaveRetTy = false; +llvm::Instruction::BinaryOps PostOp = (llvm::Instruction::BinaryOps)0; switch (E->getOp()) { case AtomicExpr::AO__c11_atomic_init: llvm_unreachable("Already handled!"); @@ -893,84 +894,71 @@ case AtomicExpr::AO__atomic_load_n: LibCallName = "__atomic_load"; break; +// T __atomic_add_fetch_N(T *mem, T val, int order) // T __atomic_fetch_add_N(T *mem, T val, int order) +case AtomicExpr::AO__atomic_add_fetch: + PostOp = llvm::Instruction::Add; +// Fall through. case AtomicExpr::AO__c11_atomic_fetch_add: case AtomicExpr::AO__atomic_fetch_add: LibCallName = "__atomic_fetch_add"; AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(), LoweredMemTy, E->getExprLoc(), sizeChars); break; +// T __atomic_and_fetch_N(T *mem, T val, int order) // T __atomic_fetch_and_N(T *mem, T val, int order) +case AtomicExpr::AO__atomic_and_fetch: + PostOp = llvm::Instruction::And; +// Fall through. case AtomicExpr::AO__c11_atomic_fetch_and: case AtomicExpr::AO__atomic_fetch_and: LibCallName = "__atomic_fetch_and"; AddDirectArgument(*this, Args, UseOptimizedLibcall, Val1.getPointer(), MemTy, E->getExprLoc(), sizeChars); break; +// T __atomic_or_fetch_N(T *mem, T val, int order) // T __atomic_fetch_or_N(T *mem, T val, int order) +case AtomicExpr::AO__atomic_or_fetch: + PostOp = llvm::Instruction::Or; +// Fall through. case AtomicExpr::AO__c11_atomic_fetch_or: case AtomicExpr::AO__atomic_fetc
Re: [PATCH] D14385: Correct atomic libcall support for __atomic_*_fetch builtins.
jyknight added inline comments. Comment at: lib/CodeGen/CGAtomic.cpp:901 @@ -897,1 +900,3 @@ + PostOp = llvm::Instruction::Add; +// Fall through. case AtomicExpr::AO__c11_atomic_fetch_add: compnerd wrote: > I think we should use `[[clang::fallthrough]]` instead. It annotates as well > as the comment, aids the static analyzer, and should be ignored by compilers > that don't support it. I don't know why, but it appears that this would be the first use of that feature in clang/llvm. Everywhere else uses a comment, so I'd not want to be the first here. http://reviews.llvm.org/D14385 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits